Skip to content

Commit 0fe7482

Browse files
committed
feat: add harvest command for cleaning stale documentation and archiving artifacts
1 parent df529b9 commit 0fe7482

5 files changed

Lines changed: 824 additions & 11 deletions

File tree

AGENTS.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,28 @@ The `/speckit.release` command manages documentation lifecycle at release bounda
6060
/speckit.release --dry-run # Preview only
6161
```
6262

63+
### Harvest Command
64+
65+
The `/speckit.harvest` command cleans up stale documentation and completed delivery artifacts while preserving useful knowledge in living docs:
66+
67+
**Key Features:**
68+
69+
1. **Knowledge-Preserving Cleanup**: Captures durable guidance in CHANGELOG, instructions, and living docs before archival
70+
2. **Documentation Triage**: Scores and classifies stale drafts, reviews, audits, backups, and legacy-root docs
71+
3. **Comment Rewriting**: Finds spec-linked code comments and rewrites them into self-contained explanations
72+
4. **Archive Safety**: Moves obsolete artifacts to `/.archive/` instead of deleting them
73+
5. **Approval Gate**: Requires an explicit user confirmation step before any edits or archival moves
74+
6. **Scan Mode**: Supports dry-run style inventory via `--scope=scan`
75+
76+
**Usage:**
77+
78+
```bash
79+
/speckit.harvest
80+
/speckit.harvest --scope=docs
81+
/speckit.harvest --scope=comments
82+
/speckit.harvest --scope=scan
83+
```
84+
6385
### Constitution Evolution Command
6486

6587
The `/speckit.evolve-constitution` command facilitates constitution amendments:

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
| **Greenfield Bias** | Works well for new projects | `/speckit.discover-constitution` generates constitutions from existing code |
5050
| **Task Overhead** | Full spec workflow for everything | `/speckit.quickfix` provides lightweight workflow for bug fixes |
5151
| **Documentation Drift** | Specs accumulate and become stale | `/speckit.release` archives artifacts and maintains living docs |
52+
| **Repo Clutter** | AI-generated docs and stale drafts accumulate | `/speckit.harvest` consolidates knowledge and archives obsolete artifacts |
5253
| **Constitution Staleness** | No formal update process | `/speckit.evolve-constitution` proposes amendments from findings |
5354
| **Context Management** | Same context for all tasks | Right-sized workflows optimize AI agent effectiveness |
5455

@@ -404,6 +405,44 @@ Use the **`/speckit.release`** command to archive development artifacts and prep
404405
- `/.documentation/decisions/ADR-{NNN}.md` - Architectural Decision Records
405406
- Updated `CHANGELOG.md`
406407

408+
### Harvest Documentation Cleanup
409+
410+
Use the **`/speckit.harvest`** command to clean stale docs, rewrite spec-linked code comments, and archive obsolete artifacts after preserving useful knowledge in living documentation:
411+
412+
```bash
413+
# Full harvest
414+
/speckit.harvest
415+
416+
# Documentation-only review and cleanup plan
417+
/speckit.harvest --scope=docs
418+
419+
# Rewrite stale spec/task references in code comments only
420+
/speckit.harvest --scope=comments
421+
422+
# Dry-run inventory and report only
423+
/speckit.harvest --scope=scan
424+
```
425+
426+
**Key Features**:
427+
428+
- **Knowledge Preservation First** - Updates living docs before archival
429+
- **Documentation Scoring** - Assigns taxonomy, usefulness score, and disposition to scanned artifacts
430+
- **Comment Hygiene** - Rewrites spec-linked comments into self-contained code documentation
431+
- **Safe Archival** - Moves stale content to `/.archive/` with preserved structure
432+
- **Approval Gate** - Presents a harvest plan and requires explicit confirmation before changes
433+
434+
**Output**:
435+
436+
- Updated `CHANGELOG.md` or living docs where knowledge is harvested
437+
- Harvest report at `/.documentation/copilot/harvest-YYYY-MM-DD.md`
438+
- Archived stale docs and completed artifacts under `/.archive/`
439+
440+
**When to Use**:
441+
442+
- After several specs or quickfixes have accumulated supporting docs
443+
- When AI-generated reviews, drafts, or session notes are cluttering the repo
444+
- Before a release or documentation cleanup pass
445+
407446
### Constitution Evolution
408447

409448
Use the **`/speckit.evolve-constitution`** command to analyze PR reviews and propose constitution amendments:
@@ -579,6 +618,7 @@ These commands only require a constitution and work independently of the spec wo
579618
| `/speckit.site-audit` | Comprehensive codebase audit for security, quality, and compliance |
580619
| `/speckit.quickfix` | Rapid bug fixes and small features without full spec overhead |
581620
| `/speckit.release` | Archive dev artifacts at release and generate release documentation |
621+
| `/speckit.harvest` | Harvest living knowledge from stale docs and archive obsolete artifacts |
582622
| `/speckit.evolve-constitution` | Propose constitution amendments based on PR review patterns |
583623

584624
#### Spec Workflow Commands
@@ -657,6 +697,7 @@ Spec Kit Spark is actively developed with a clear vision for the future:
657697
- ✅ Adversarial risk analysis (`/speckit.critic`)
658698
- ✅ Lightweight quickfix workflow (`/speckit.quickfix`)
659699
- ✅ Release documentation management (`/speckit.release`)
700+
- ✅ Documentation harvest and cleanup workflow (`/speckit.harvest`)
660701
- ✅ Constitution evolution (`/speckit.evolve-constitution`)
661702
- ✅ 17+ AI agent integrations
662703

0 commit comments

Comments
 (0)