Documentation rots. This document defines the mechanical process for keeping docs fresh, accurate, and consistent with the codebase.
From Harness Engineering: "A monolithic manual turns into a graveyard of stale rules. Agents can't tell what's still true, humans stop maintaining it, and the file quietly becomes an attractive nuisance."
Technical debt in documentation is like a high-interest loan. Pay it down continuously in small increments rather than letting it compound.
- Update
feat/<name>/<version>/prd/erd.mdverification status - Update
quality/README.mddomain grade if affected - Verify cross-links from
context/README.mdare still correct - Check if any ADR was implicitly created or invalidated
- Update
architecture/README.mddomain map - Update
architecture/layers.mdif dependency rules changed - Update
architecture/data-flow.mdif data contracts changed - Record new ADR if a significant decision was made
- Update
conventions/README.mdand relevant style doc - Verify linter rules reflect the convention (if it matters, encode it)
- Run a doc freshness pass across affected files and indexes
- Update
plans/if active or completed plans are affected - Check
guides/for outdated step-by-step instructions
- Skim
context/README.mdindex, mark missing docs, prune empty sections - Verify
context/README.mdstill declares canonical sources for execution constraints, architectural rationale, and contracts - Verify all "Last Verified" dates in
quality/README.mdare current for the latest monthly review - Scan for broken cross-links between documents
| Check | Method | Frequency |
|---|---|---|
| File existence | All files referenced in indexes exist | Every PR |
| Cross-link validity | All [relative links] resolve |
Every PR |
| Canonical routing | context/README.md includes ## Canonical Sources and domain indexes include ## When to Read This |
Every PR |
| Quality date freshness | Last Verified is current for the latest monthly review |
Monthly |
| Feature status accuracy | Active features have corresponding code |
Monthly |
| ADR status | No Proposed ADRs older than 30 days |
Monthly |
| Spec-code alignment | Spec contracts match actual TypeScript interfaces | On refactor |
A document is stale if ANY of these are true:
- References deleted files or modules — paths that no longer exist
- Describes removed behavior — e.g., a setting that was replaced
- Contradicts the code — e.g., spec says "required" but code treats as optional
- Last verified is older than the latest monthly review — quality grades are uncertain
- Empty sections — placeholders that were never filled
- Broken links — references to files that moved or were deleted
- During code review, flag doc updates needed in the PR
- On feature merge, verify spec status is updated
- On Friday: 15-minute skim of
context/README.mdfor obvious staleness
Agents performing doc gardening should:
- Scan: Read each document in
context/and check references - Verify: Confirm referenced files exist and content matches
- Report: Prepare fix-up changes for:
- Broken links
- Stale quality dates
- Incorrect file paths
- Empty sections that should have content
- Do NOT: Rewrite content, change conventions, or add new sections without human approval
Scan context/ directory for stale documentation:
1. Read every .md file in context/ and its subdirectories
2. For each file, check that all [relative links] point to existing files
3. For quality/README.md, check that "Last Verified" dates are current for the latest monthly review
4. For feat/README.md, verify that "Active" features have corresponding code
5. For plans/README.md, verify active and completed indexes match the actual directory state
6. For guides/README.md, verify that all listed files exist
7. Report findings and prepare fix-up changes for any issues found
These rules are mechanically enforceable:
- Every top-level docs domain has an index —
context/*/README.mdexists for each semantic domain directory - Each domain index links to its canonical children — indexes cover the files or sub-indexes humans are expected to enter through
- Domain indexes declare entry scope — top-level indexes include a short
When to Read Thissection so readers know what the directory does and does not answer - Root routing stays explicit —
context/README.mddeclares canonical sources for execution constraints, architectural rationale, and contracts - No orphan domain documents — every long-lived
.mdfile undercontext/is linked from at least one index or redirect document - No duplicate content — each piece of knowledge lives in exactly one place (canonical source)
- Progressive disclosure — index files are maps (pointers), while deep content lives in leaf documents
- Container directories are exempt — version folders like
feat/<name>/<version>/prd/and storage folders likeplans/active/do not need standalone indexes unless they become human entry points
When updating quality/README.md:
| Grade Change | Action Required |
|---|---|
| Any → A | Must have automated test evidence |
| A → B | Document what regressed |
| B → C | Create plan to restore to B |
| Any → D | Create plan immediately, mark as priority |
| Date only | Update "Last Verified" with today's date |