
Separate current documentation from historical records
Living documentation records the behavior and constraints that future engineers and agents should trust. It might include:- a
PRODUCT.mdthat explains user-visible behavior and product boundaries; - a
TECH.mdthat explains system components, data flow, and operational constraints; - an API contract generated from, or checked against, the implementation;
- a searchable handbook under
docs/; - runbooks for deploying, observing, and recovering the system;
- repository instructions for coding agents.
If I need to change or operate this system today, what should I believe?A repository can accumulate detailed feature directories without identifying which one describes current behavior. Maintainers need to designate the current source. GitHub’s Spec Kit persistence guidance makes this choice explicit. A team can keep feature artifacts as immutable history, continuously reconcile them with implementation discoveries, or treat a living specification as the contract. Whichever model a team chooses, contributors need to know which documents are historical and which are authoritative.
Documentation roles
Two records, two questions
Current documentation
What is true now?
- PRODUCT.md
- TECH.md
- API contract
- Handbook and runbooks
Decision history
How did we get here?
- RFC and approved plan
- Review thread
- Progress log
- Superseded decisions
Link current truth to its rationale without forcing agents to reconstruct the present from old discussions.
Put documentation in the implementation loop
Spec-driven tools already create structured context before code. GitHub Spec Kit, for example, uses a Spec → Plan → Tasks → Implement workflow. Those artifacts help an agent avoid jumping directly from an issue to a patch. Once implementation begins, code exposes details the plan could not know: an old client depends on undocumented behavior, a database invariant differs from the architecture diagram, or a browser interaction fails in a state the acceptance criteria missed. Feed those discoveries back into the maintained documents without rewriting history:1
Begin from maintained context
Link the change request to the current product, technical, API, and operational documents. If those sources disagree before work starts, resolve the disagreement or name it as part of the requested change.
2
Review the intended change
Review the consequential product and engineering decisions before broad agent execution. Pin the exact version in Git or the project system when other people need a durable record. How to Approve AI Coding Plans Before Execution explains Plannotator’s local feedback, Plan Diff, and Approve loop.
3
Capture implementation discoveries near the work
When an agent finds a material contradiction or missing decision, record it in the pull request or live draft while the evidence is available. Do not bury a changed product rule inside a code comment or an agent chat.
4
Verify behavior before rewriting the explanation
Run the relevant unit, integration, contract, migration, and end-to-end checks. Review the implementation and its code review artifacts, such as screenshots, browser traces, or test output. A generated explanation is a claim until executable behavior supports it.
5
Update current documents in the same change
Edit only the maintained pages affected by the accepted behavior. Link to the historical RFC for rationale instead of copying its entire narrative into the handbook.
6
Preserve the decision trail
Keep the approved request, important deviations, implementation revision, validation evidence, and final decision connected. Mark superseded documents clearly rather than deleting the evidence or leaving two sources that both appear current.
A repository-based example
Consider a team replacing a single-request upload API with resumable uploads for large files. Its repository contains:uploads.md. The discovery changes the compatibility contract and the server state machine.
The team should not let the agent invent retry semantics or rewrite the documentation to match the easiest implementation. It should return the discovery for a decision and approve the new direction. The agent then implements the idempotency rule and provides a handoff naming the exact revision, tests, risks, and documentation impact. See What Should an AI Coding Agent Hand Back After It Changes Code?.
Before merge, reviewers check four things together:
- Contract and retry tests demonstrate the accepted upload and resume behavior.
- Expiration, cleanup, storage-failure, and rollback behavior match the reviewed plan.
docs/PRODUCT.md,docs/TECH.md, anddocs/uploads.mddescribe the shipped system.specs/017-resumable-uploads/RFC.mdremains an immutable decision record and links to the final implementation.
PRODUCT.md and TECH.md files. A team still needs a convention for carrying accepted behavior into whichever documentation future contributors read first.
Repository files make the maintenance rule enforceable
Keeping documentation near code enables several maintenance checks:- A pull request can show code and documentation changes together.
CODEOWNERSor required reviewers can route affected documents to the right owners.- CI can build the documentation, check links, validate schemas, and test code samples.
- Git history can show when an explanation changed and which implementation changed with it.
- Agent instructions can identify the maintained documents that must be read before a particular system is modified.
docs/ tree with contradictory pages gives an agent more material but no reliable source.
Verify generated documentation
An agent can inventory changed files, draft release notes, update examples, and identify stale documents. It can also confidently describe behavior the program does not have. Anthropic’s work on long-running coding-agent harnesses found that progress files and Git history helped later sessions recover context, but it also found agents could mark work complete without proper end-to-end testing. Explicit browser testing exposed failures that code inspection and narrower checks missed. Check generated documentation against:- the approved request for intended behavior;
- the code diff for the mechanism;
- tests and runtime evidence for observed behavior;
- domain owners for product and operational meaning.
Skip documentation updates when behavior does not change
Not every edit changes durable behavior. A typo fix, local refactor, dependency patch with no contract change, or test-only cleanup may require no handbook update. Use one short question in the pull request or agent handoff:Does this change alter a user-visible behavior, public or internal contract, system constraint, operating procedure, or fact that future contributors rely on?If the answer is no, record no durable documentation impact and continue. Do not make the agent perturb an unrelated page merely to satisfy a checklist. If the answer is yes, name the exact maintained files and update them with the implementation. A small documentation impact field is enough to identify the required work without adding a separate approval process.
Limitations
Living documentation cannot make every repository fact current automatically.- Some behavior exists only at runtime or in external infrastructure.
- Tests can be incomplete or encode the wrong expectation.
- Generated API references may be accurate but still fail to explain intent.
- A document owner can approve prose without noticing a contradictory implementation.
- Fast-moving teams may accept temporary drift during incidents or migrations.
- Historical records can expose sensitive design or security details and may need access controls.
Frequently asked questions
What is living documentation for AI coding agents?
It is maintained product, technical, API, and operational context that changes with the system and is available to both people and agents. It describes current behavior rather than only preserving the plan for one completed feature.Should an RFC be updated after implementation?
Usually, preserve an approved RFC as decision history and update separate maintained documentation with the shipped behavior. If your team intentionally uses a living-spec model, revise the specification and keep its derived plan and tasks consistent. State the convention explicitly.Should an AI agent update documentation automatically?
It can draft the update and identify likely affected pages. A reviewer should compare the draft with the approved request, code, tests, and observed behavior before treating it as current documentation.How do you prevent codebase documentation from becoming stale?
Put a documentation-impact decision in the implementation and review workflow, update affected documents in the same pull request, assign owners, and add automated checks for build failures, broken links, schemas, and executable examples where those checks are possible.Does every AI-generated code change need a documentation update?
No. Changes that do not alter durable behavior, contracts, constraints, or operating procedures should use the fast path and record that there is no documentation impact.Are repository Markdown files enough for coding agents?
They work well as a default because they are portable, versioned, searchable, and easy for agents to read. They are not enough when the files conflict, lack clear ownership, omit runtime facts, or cannot express a comparison or interaction that would be clearer in another artifact.When a consequential change is complete
Treat a consequential change as complete when the code, executable evidence, and maintained explanation agree. If they do not agree, record the remaining disagreement. The workflow in How Teams Understand AI-Generated Code Before Shipping It shows how teams check that agreement. Future engineers and agents can start from the system the team operates while retaining the original request and decision trail for historical context.Annotate maintained documents
Open Markdown, text, HTML, or a folder in Plannotator and return annotations to the active coding agent.

