|
| 1 | +--- |
| 2 | +status: planned |
| 3 | +created: '2025-11-13' |
| 4 | +tags: |
| 5 | + - process |
| 6 | + - maintenance |
| 7 | + - workflow |
| 8 | + - best-practices |
| 9 | +priority: high |
| 10 | +created_at: '2025-11-13T13:08:46.014Z' |
| 11 | +updated_at: '2025-11-13T13:10:19.510Z' |
| 12 | +--- |
| 13 | + |
| 14 | +# archiving-strategy |
| 15 | + |
| 16 | +> **Status**: 🗓️ Planned · **Priority**: High · **Created**: 2025-11-13 · **Tags**: process, maintenance, workflow, best-practices |
| 17 | +
|
| 18 | +**Project**: lean-spec |
| 19 | +**Team**: Core Development |
| 20 | + |
| 21 | +## Overview |
| 22 | + |
| 23 | +**Problem**: No clear strategy for when to archive completed specs, leading to: |
| 24 | +- Bulk archiving attempts that catch incomplete work (e.g., spec 073 Phase 2 not done) |
| 25 | +- Uncertainty about which completed specs should stay active vs archived |
| 26 | +- Risk of archiving specs that are still referenced or contain living documentation |
| 27 | +- Cluttered active workspace with many completed specs (29 completed specs currently) |
| 28 | + |
| 29 | +**Current State**: |
| 30 | +- We have `lean-spec archive` command that moves specs to `archived/` directory |
| 31 | +- Specs marked "complete" but unclear when they should be archived |
| 32 | +- No documented criteria or workflow for archiving decisions |
| 33 | +- Dependencies (`depends_on`, `related`) might reference archived specs |
| 34 | + |
| 35 | +**Goal**: Define clear archiving strategy with: |
| 36 | +1. **Criteria**: When a completed spec should be archived |
| 37 | +2. **Process**: How to safely archive specs |
| 38 | +3. **Exceptions**: When to keep completed specs active |
| 39 | +4. **Tooling**: Commands/checks to help with archiving decisions |
| 40 | + |
| 41 | +## Design |
| 42 | + |
| 43 | +### Archiving Criteria |
| 44 | + |
| 45 | +**Archive a completed spec when ALL of:** |
| 46 | +1. ✅ Status is "complete" |
| 47 | +2. ✅ Work is fully implemented (no pending phases/tasks) |
| 48 | +3. ✅ No longer needs frequent reference |
| 49 | +4. ✅ Not "living documentation" (e.g., philosophy/foundation docs) |
| 50 | +5. ✅ Age > 30 days since completion (optional cooling-off period) |
| 51 | + |
| 52 | +**Keep completed specs active if ANY of:** |
| 53 | +- 🔁 Referenced frequently for context |
| 54 | +- 📚 Contains living documentation (philosophy, core concepts) |
| 55 | +- 🔥 Completed within last 30 days (recent work) |
| 56 | +- 🔗 Multiple active specs depend on it |
| 57 | +- 🎯 Part of current release cycle |
| 58 | + |
| 59 | +### Spec Categories |
| 60 | + |
| 61 | +**Safe to Archive (Historical):** |
| 62 | +- Old launch milestones (v0.1, v0.2 launches) |
| 63 | +- One-time refactors/migrations (fully complete) |
| 64 | +- Completed documentation improvements (not living docs) |
| 65 | +- Infrastructure changes (fully implemented) |
| 66 | + |
| 67 | +**Keep Active (Reference):** |
| 68 | +- Foundation specs (048, 049, 066 - first principles) |
| 69 | +- Core feature documentation (if frequently referenced) |
| 70 | +- Current release work (v0.3.0 related) |
| 71 | +- Recent completions (< 30 days) |
| 72 | + |
| 73 | +**Review Carefully:** |
| 74 | +- Multi-phase specs (ensure all phases done) |
| 75 | +- Specs with dependencies (check if dependents need them) |
| 76 | +- Template/tooling specs (might be referenced) |
| 77 | + |
| 78 | +### Archiving Workflow |
| 79 | + |
| 80 | +**Pre-Archive Checklist:** |
| 81 | +```bash |
| 82 | +# 1. Verify spec is truly complete |
| 83 | +lean-spec view <spec> # Check plan/tasks |
| 84 | + |
| 85 | +# 2. Check dependencies |
| 86 | +lean-spec deps <spec> # See what depends on it |
| 87 | + |
| 88 | +# 3. Check age |
| 89 | +lean-spec view <spec> --json | jq '.completed_at' |
| 90 | + |
| 91 | +# 4. Search for references in active specs |
| 92 | +lean-spec search "<spec-name>" |
| 93 | +``` |
| 94 | + |
| 95 | +**Archive Command:** |
| 96 | +```bash |
| 97 | +lean-spec archive <spec> |
| 98 | +``` |
| 99 | + |
| 100 | +**Batch Archiving (with verification):** |
| 101 | +```bash |
| 102 | +# List candidates (completed > 30 days) |
| 103 | +lean-spec list --status complete |
| 104 | + |
| 105 | +# Review each before archiving |
| 106 | +# Archive individually after verification |
| 107 | +``` |
| 108 | + |
| 109 | +### Tooling Enhancements |
| 110 | + |
| 111 | +**Potential CLI improvements:** |
| 112 | +1. `lean-spec archive --candidates` - List archiving candidates with reasons |
| 113 | +2. `lean-spec archive --check <spec>` - Dry-run with safety checks |
| 114 | +3. `lean-spec deps <spec> --check-archived` - Warn if dependencies archived |
| 115 | +4. Filter by completion age: `lean-spec list --completed-before 2025-10-01` |
| 116 | + |
| 117 | +**Safety Features:** |
| 118 | +- Warn if archiving spec with active dependents |
| 119 | +- Show references in active specs before archiving |
| 120 | +- Dry-run mode to preview archive decision |
| 121 | + |
| 122 | +## Plan |
| 123 | + |
| 124 | +### Phase 1: Document Strategy |
| 125 | +- [ ] Define archiving criteria (in this spec) |
| 126 | +- [ ] Document workflow in AGENTS.md |
| 127 | +- [ ] Create archiving best practices guide |
| 128 | +- [ ] Add to official documentation |
| 129 | + |
| 130 | +### Phase 2: Tooling Support |
| 131 | +- [ ] Add `--completed-before <date>` filter to `list` command |
| 132 | +- [ ] Implement `lean-spec archive --candidates` (suggests specs to archive) |
| 133 | +- [ ] Add safety checks to `archive` command: |
| 134 | + - Warn if active specs depend on it |
| 135 | + - Show completion age |
| 136 | + - Check for incomplete tasks |
| 137 | +- [ ] Add `--check` dry-run flag to `archive` command |
| 138 | + |
| 139 | +### Phase 3: Clean Up Current Workspace |
| 140 | +- [ ] Review 29 completed specs with new criteria |
| 141 | +- [ ] Archive truly complete, historical specs |
| 142 | +- [ ] Keep foundation/reference specs active |
| 143 | +- [ ] Document decisions for future reference |
| 144 | + |
| 145 | +### Phase 4: Ongoing Maintenance |
| 146 | +- [ ] Add archiving to monthly/quarterly maintenance checklist |
| 147 | +- [ ] Monitor completion rate and archive rate |
| 148 | +- [ ] Refine criteria based on usage patterns |
| 149 | + |
| 150 | +## Test |
| 151 | + |
| 152 | +### Validation Criteria |
| 153 | +- [ ] Archiving criteria clear and actionable |
| 154 | +- [ ] Workflow documented and easy to follow |
| 155 | +- [ ] Safety checks prevent accidental archiving of needed specs |
| 156 | +- [ ] CLI commands help identify candidates automatically |
| 157 | + |
| 158 | +### Test Scenarios |
| 159 | +- [ ] Archive old completed spec (> 30 days, no dependents) |
| 160 | +- [ ] Attempt to archive recently completed spec (< 30 days) - should warn |
| 161 | +- [ ] Archive spec with active dependents - should show warning |
| 162 | +- [ ] List archiving candidates - should match manual review |
| 163 | +- [ ] Archive spec with incomplete phases - should detect and warn |
| 164 | + |
| 165 | +### Success Metrics |
| 166 | +- [ ] Zero accidental archives of needed specs |
| 167 | +- [ ] < 5 minutes to decide if spec should be archived |
| 168 | +- [ ] Clear rationale documented for each archiving decision |
| 169 | +- [ ] Active workspace stays < 20 specs (excluding archived) |
| 170 | + |
| 171 | +## Notes |
| 172 | + |
| 173 | +### Real-World Example: Nov 13, 2025 Bulk Archive Attempt |
| 174 | + |
| 175 | +**What Happened:** |
| 176 | +- Attempted to archive all 29 completed specs at once |
| 177 | +- Reverted due to concerns (spec 073 Phase 2 incomplete) |
| 178 | +- Realized we needed clear archiving criteria |
| 179 | + |
| 180 | +**Lessons Learned:** |
| 181 | +1. Bulk archiving is risky without verification |
| 182 | +2. "Complete" status doesn't always mean "fully done" |
| 183 | +3. Some specs are reference documentation (shouldn't archive) |
| 184 | +4. Need to check dependencies before archiving |
| 185 | + |
| 186 | +**Specs We're Uncertain About:** |
| 187 | +- 073: Phase 1 done, Phase 2 not started (split into separate spec?) |
| 188 | +- 048, 049, 066: Foundation specs, referenced often (keep active?) |
| 189 | +- 067, 069, 075: Recent core features (keep for context?) |
| 190 | +- 043: Old launch milestone (safe to archive?) |
| 191 | + |
| 192 | +### Dependencies and Archived Specs |
| 193 | + |
| 194 | +**Question**: Is it OK for active specs to depend on archived specs? |
| 195 | + |
| 196 | +**Answer**: Generally yes, since `depends_on` means "required work before starting": |
| 197 | +- If dependency is complete and archived, that's expected |
| 198 | +- `related` links can also point to archived specs (for context) |
| 199 | +- The archive doesn't delete specs, just moves them |
| 200 | + |
| 201 | +**However**, we should warn if: |
| 202 | +- Archiving a spec that many active specs depend on (heavy reference usage) |
| 203 | +- The spec contains living documentation that's frequently consulted |
| 204 | + |
| 205 | +### Alternative Approaches Considered |
| 206 | + |
| 207 | +**Auto-Archive After N Days:** |
| 208 | +- ❌ Too aggressive, doesn't account for reference value |
| 209 | +- ❌ Philosophy/foundation specs should never auto-archive |
| 210 | +- ✅ Could use as suggestion/reminder, not automatic |
| 211 | + |
| 212 | +**Status: "archived" vs Directory Move:** |
| 213 | +- Current: Move to `archived/` directory |
| 214 | +- Alternative: Keep in place, set `status: archived` |
| 215 | +- ✅ Directory move is clearer, easier to browse |
| 216 | +- ✅ Status can be "complete" (in archived/) |
| 217 | + |
| 218 | +**Archive Levels (Hot/Cold):** |
| 219 | +- Hot: Specs completed in last 90 days (keep active) |
| 220 | +- Warm: Specs 90-180 days old (review for archiving) |
| 221 | +- Cold: Specs > 180 days old (archive unless exception) |
| 222 | +- 🤔 Adds complexity, may not be needed for current scale |
| 223 | + |
| 224 | +### Open Questions |
| 225 | + |
| 226 | +1. Should we split multi-phase specs when only Phase 1 is done? |
| 227 | +2. How to handle "living documentation" specs (philosophy, guides)? |
| 228 | +3. Should `lean-spec board` show archived specs in a separate column? |
| 229 | +4. Archive specs individually or in batches (monthly cleanup)? |
| 230 | +5. Should we add `archived_at` timestamp to metadata? |
| 231 | + |
| 232 | +### Related Specs |
| 233 | + |
| 234 | +- 059-programmatic-spec-management: Programmatic access to specs (could help with archiving automation) |
| 235 | +- 065-v03-planning: Current release planning (determines what's "current" vs historical) |
0 commit comments