Documentation Lifecycle Convention¶
When to use: Introducing or retrofitting a clear docs structure in repositories where agent-generated markdown can blur what is provisional versus current truth.
Instructions¶
Goal¶
Separate stable documentation from interim planning and delivery notes so humans and agents can quickly determine:
- whether a document is current truth or temporary
- where implementation and docs must stay in sync
- whether a doc has been recently reconciled
Repository layout baseline¶
Use this baseline under docs/:
Rules:
docs/core/is grounded truth: stable architecture, operations, standards, and other docs that describe the repository as it actually is now.docs/core/kb/is durable knowledge content, not a temporary wiki scratchpad.docs/planning/is future-state intent (proposals before implementation).docs/wip/is current execution material (in-flight implementation notes).docs/archive/is historical context for completed, superseded, or abandoned material.
Promotion flow:
planning->wipwhen implementation starts.wip->corewhen the outcome is implemented and verified as current truth.planningorwip->archiveif superseded or abandoned.
Document metadata header¶
Add YAML frontmatter to docs that describe implementation behaviour:
---
doc_classification: core
status: current
last_reviewed: 2026-05-28
owned_by: platform-team
code_paths:
- src/sync/heartbeat.ts
- src/sync/scheduler.ts
related_docs:
- docs/core/architecture/communication-flows.md
---
Field conventions¶
The two lifecycle fields describe different axes and are intentionally kept separate:
doc_classification: where the doc lives — its tier. One ofcore,planning,wip,archive. This mirrors the folder the file sits in.status: the doc's actual condition — one ofcurrent,proposed,superseded,abandoned. This is its truth-state, independent of location.
The two are correlated but not identical, which is the point: when they
disagree that is a signal, not an error. A file with
doc_classification: core but status: superseded is current-tier content
that has gone stale and needs re-filing. archive also splits into
superseded vs abandoned, which doc_classification alone cannot express.
Remaining fields:
last_reviewed: ISO date (YYYY-MM-DD) updated when doc content is checked against implementation reality. Bump it for content reconciliation, not for metadata-only churn (moves, frontmatter edits, typo fixes).owned_by: team or role responsible for doc accuracy.code_paths: repo-relative implementation files or folders described by this document.related_docs: repo-relative links to associated docs.
doc_classification should normally match where the file lives. If a file
moves lifecycle stage, update both the path and the frontmatter (and reconcile
status).
Code-to-doc linkage contract¶
For source files implementing documented behaviour, add a top-of-file @docs:
block (or equivalent docstring) with repo-relative doc paths. Use the
docs-implementation-tagging skill format for the block style.
Minimum contract:
- durable behaviour docs include
code_paths - implementation files with external behaviour claims include
@docs: - paths in
code_paths,related_docs, and@docs:all resolve
Review and completion checks¶
At end of any change that affects behaviour:
- verify code still matches linked docs
- update docs and bump
last_reviewedwhere needed - verify each changed doc is in the correct lifecycle folder:
planningfor proposalswipfor in-flight implementationcorefor current trutharchivefor historical state- verify moved/renamed doc paths are updated in:
- other docs (
related_docs) - source
@docs:entries - repository indexes or contributor docs
Retrofit rollout for existing repositories¶
- Create
docs/core/,docs/core/kb/,docs/planning/,docs/wip/,docs/archive/. - Classify and move existing docs by lifecycle state.
- Add metadata headers to high-signal docs first (architecture, API, runbooks, operations).
- Add
@docs:tags to implementation files those docs describe. - Add checks for link validity and metadata path correctness.
- Add a short policy section in
AGENTS.mdor contributor docs so review expectations are explicit.
CI and pre-commit automation options¶
Use complementary checks:
lychee(or similar) for markdown link validity (internal and external).remark-lint+remark-validate-linksfor markdown and link hygiene.- a custom metadata check script that verifies:
doc_classificationaligns with folder pathstatusis one of the allowed values- each
code_pathsentry exists - each
related_docsentry exists - each
@docs:file reference exists
gray-matter is useful inside that custom script to parse and validate
frontmatter reliably; it does not replace link checking.
Start CI in warning mode if legacy debt is high, then move to blocking mode once the baseline is clean.
References¶
Troubleshooting¶
| Symptom | Likely cause | Fix |
|---|---|---|
| Team cannot tell if a doc is final | Lifecycle folders and frontmatter are inconsistent | Move the doc to the correct folder and align doc_classification/status |
| Completed work still appears in active docs | wip docs were not promoted or archived |
Promote stable outcomes into core; move obsolete notes to archive |
| Code changes land without doc updates | code_paths and @docs: contract not checked in review |
Add PR checklist and automate path checks |
| Links break after file moves | Path updates were partial | Run link/path checks and update related_docs, @docs:, and indexes together |