Docs Sync Guardian
Choose one owner
Use this for ordinary implementation-to-documentation updates. If the project already uses doc-memory and its shard index, let doc-memory own retrieval and sealing; reuse its evidence instead of running both full pipelines. Use handoff-auditor when reviewing another party’s completion claim, not as a mandatory second pass for every small edit.
Overview
Treat docs as part of the change, not an afterthought. The goal is to leave future agents and humans with a truthful map of what changed, what did not change, and what remains intentionally out of scope.
Core Rule
After code changes, documentation is suspicious until checked against the current implementation. Be aggressive when searching for drift and conservative when editing.
Use this trust order:
- Working implementation, generated artifacts, and current runtime behavior.
- Public API, schema, CLI, configuration, exported types, and examples that compile or run.
- Tests, fixtures, migrations, and release artifacts.
- Documentation.
When docs and implementation conflict, update the docs or explicitly report why the apparent conflict is not drift. If the conflicting doc is a normative spec, security policy, product contract, or user-authored requirement, do not silently rewrite it to match implementation; flag the contract/code mismatch and ask which source should change.
Sync Workflow
1. Read the Repo's Documentation Contract
Start with the files that define how documentation is maintained:
- Agent instructions such as
AGENTS.md, CLAUDE.md, HERMES.md, or equivalent.
- Collaboration/status docs such as
COLLABORATION.md, ROADMAP.md, PROJECT_LOG.md, changelogs, release notes, or current specs.
- Architecture docs when module boundaries or ownership change.
- User-facing docs when behavior, setup, commands, configuration, or workflows change.
Follow project-local instructions over generic habits.
2. Establish Ground Truth
Before editing docs, find the strongest local evidence for what is true now:
- Read the changed implementation and any public API/schema/config it affects.
- Check deletions, renames, and removed examples in the diff; removals often create stale docs.
- Find one or two working examples, tests, fixtures, or generated artifacts that show the correct current pattern.
- For API or type docs, prefer the compiler, typechecker, generated declarations, schema validator, or existing executable examples over memory.
If the task starts from a doc file instead of code changes, run the same process in reverse: extract claims, paths, commands, signatures, and examples from the doc, then verify each against the current codebase.
3. Derive Doc Scope From the Diff
Inspect the actual changes before editing docs. Map each changed surface to likely documentation:
- User-visible behavior -> README, product docs, current collaboration/status docs, changelog.
- Public API, schema, config, CLI, environment variables -> API docs, examples, setup docs, migration notes.
- Architecture, ownership, module boundaries -> architecture docs and agent instructions.
- Release/version status -> changelog, release notes, roadmap, collaboration docs.
- Workflow or handoff rules -> agent instructions, handoff docs, lessons files.
- Visual/product changes -> note deterministic checks and defer subjective acceptance when the project requires human visual approval.
Do not update unrelated docs just to make the tree look busy.
4. Search for Stale Language
Before finalizing, search current docs for contradicted status:
- Future-tense descriptions of completed work.
- Old version labels or release lines.
next, todo, not done, pending, or blocked text that no longer matches reality.
- Feature lists that omit the newly delivered behavior.
- Handoff instructions that still point at obsolete files, modules, or manual steps.
If stale text is found, update it or explicitly explain why it remains true.
5. Write Narrow, Truthful Updates
A good doc sync says both sides of the boundary:
- What changed.
- What did not change.
- What remains manual, deferred, or visually/user accepted.
- Which checks were run, when the repo normally records that.
- Any compatibility or migration notes future work needs.
Do not inflate scope. Do not describe intended future work as already delivered. Do not erase historical context unless the project treats that doc as current-only state.
6. Use a Risk Gate for Human-Judgment Text
Auto-update factual drift: paths, command names, version strings, signatures, option names, feature availability, links, counts, and current status.
Flag or ask before rewriting:
- Philosophy, vision, principles, or product positioning.
- Security, threat model, privacy, or trust claims beyond factual version/path fixes.
- Architecture decision rationale or historical explanations.
- Changelog entries that already shipped, except appending or correcting clearly factual mistakes according to project convention.
- User-authored narrative, tone, or subjective product language.
When a risky section is stale, say what evidence contradicts it and propose the smallest truthful edit.
7. Recheck Consistency
After editing docs:
- Review the diff of docs and code together.
- Confirm version/status lines agree across current docs.
- Confirm examples, file paths, commands, and module names still exist.
- Confirm changelogs or release notes are append-only when the project expects historical records.
- Confirm important docs are reachable from normal entry points when adding a new doc.
- Confirm public examples, snippets, and signatures match the current implementation or executable examples.
- Confirm final response mentions doc updates when they are part of the task.
Stop Rules
Do not finish a repo modification when:
- Current docs still call the delivered work future or unfinished.
- The final claim relies on behavior not documented anywhere the project expects.
- A doc update would require product decisions the user has not made.
- You cannot tell which docs are authoritative; ask or state the blocker.
For no-code tasks, do not invent doc churn. Report that no repository docs were changed because the repository did not change.
1---2name: docs-sync-guardian3description: Keep repository documentation aligned with code, configuration, asset, API, release, workflow, or product changes. Use whenever Codex modifies a repo that has docs-as-contract expectations, when a user says docs must stay in sync, before finalizing a feature/fix, or when reviewing a diff for stale README, roadmap, specs, changelog, agent instructions, or handoff notes.4---56# Docs Sync Guardian78## Choose one owner910Use this for ordinary implementation-to-documentation updates. If the project already uses doc-memory and its shard index, let doc-memory own retrieval and sealing; reuse its evidence instead of running both full pipelines. Use handoff-auditor when reviewing another party’s completion claim, not as a mandatory second pass for every small edit.1112## Overview1314Treat docs as part of the change, not an afterthought. The goal is to leave future agents and humans with a truthful map of what changed, what did not change, and what remains intentionally out of scope.1516## Core Rule1718After code changes, documentation is suspicious until checked against the current implementation. Be aggressive when searching for drift and conservative when editing.1920Use this trust order:21221. Working implementation, generated artifacts, and current runtime behavior.232. Public API, schema, CLI, configuration, exported types, and examples that compile or run.243. Tests, fixtures, migrations, and release artifacts.254. Documentation.2627When docs and implementation conflict, update the docs or explicitly report why the apparent conflict is not drift. If the conflicting doc is a normative spec, security policy, product contract, or user-authored requirement, do not silently rewrite it to match implementation; flag the contract/code mismatch and ask which source should change.2829## Sync Workflow3031### 1. Read the Repo's Documentation Contract3233Start with the files that define how documentation is maintained:3435- Agent instructions such as `AGENTS.md`, `CLAUDE.md`, `HERMES.md`, or equivalent.36- Collaboration/status docs such as `COLLABORATION.md`, `ROADMAP.md`, `PROJECT_LOG.md`, changelogs, release notes, or current specs.37- Architecture docs when module boundaries or ownership change.38- User-facing docs when behavior, setup, commands, configuration, or workflows change.3940Follow project-local instructions over generic habits.4142### 2. Establish Ground Truth4344Before editing docs, find the strongest local evidence for what is true now:4546- Read the changed implementation and any public API/schema/config it affects.47- Check deletions, renames, and removed examples in the diff; removals often create stale docs.48- Find one or two working examples, tests, fixtures, or generated artifacts that show the correct current pattern.49- For API or type docs, prefer the compiler, typechecker, generated declarations, schema validator, or existing executable examples over memory.5051If the task starts from a doc file instead of code changes, run the same process in reverse: extract claims, paths, commands, signatures, and examples from the doc, then verify each against the current codebase.5253### 3. Derive Doc Scope From the Diff5455Inspect the actual changes before editing docs. Map each changed surface to likely documentation:5657- User-visible behavior -> README, product docs, current collaboration/status docs, changelog.58- Public API, schema, config, CLI, environment variables -> API docs, examples, setup docs, migration notes.59- Architecture, ownership, module boundaries -> architecture docs and agent instructions.60- Release/version status -> changelog, release notes, roadmap, collaboration docs.61- Workflow or handoff rules -> agent instructions, handoff docs, lessons files.62- Visual/product changes -> note deterministic checks and defer subjective acceptance when the project requires human visual approval.6364Do not update unrelated docs just to make the tree look busy.6566### 4. Search for Stale Language6768Before finalizing, search current docs for contradicted status:6970- Future-tense descriptions of completed work.71- Old version labels or release lines.72- `next`, `todo`, `not done`, `pending`, or `blocked` text that no longer matches reality.73- Feature lists that omit the newly delivered behavior.74- Handoff instructions that still point at obsolete files, modules, or manual steps.7576If stale text is found, update it or explicitly explain why it remains true.7778### 5. Write Narrow, Truthful Updates7980A good doc sync says both sides of the boundary:8182- What changed.83- What did not change.84- What remains manual, deferred, or visually/user accepted.85- Which checks were run, when the repo normally records that.86- Any compatibility or migration notes future work needs.8788Do not inflate scope. Do not describe intended future work as already delivered. Do not erase historical context unless the project treats that doc as current-only state.8990### 6. Use a Risk Gate for Human-Judgment Text9192Auto-update factual drift: paths, command names, version strings, signatures, option names, feature availability, links, counts, and current status.9394Flag or ask before rewriting:9596- Philosophy, vision, principles, or product positioning.97- Security, threat model, privacy, or trust claims beyond factual version/path fixes.98- Architecture decision rationale or historical explanations.99- Changelog entries that already shipped, except appending or correcting clearly factual mistakes according to project convention.100- User-authored narrative, tone, or subjective product language.101102When a risky section is stale, say what evidence contradicts it and propose the smallest truthful edit.103104### 7. Recheck Consistency105106After editing docs:107108- Review the diff of docs and code together.109- Confirm version/status lines agree across current docs.110- Confirm examples, file paths, commands, and module names still exist.111- Confirm changelogs or release notes are append-only when the project expects historical records.112- Confirm important docs are reachable from normal entry points when adding a new doc.113- Confirm public examples, snippets, and signatures match the current implementation or executable examples.114- Confirm final response mentions doc updates when they are part of the task.115116## Stop Rules117118Do not finish a repo modification when:119120- Current docs still call the delivered work future or unfinished.121- The final claim relies on behavior not documented anywhere the project expects.122- A doc update would require product decisions the user has not made.123- You cannot tell which docs are authoritative; ask or state the blocker.124125For no-code tasks, do not invent doc churn. Report that no repository docs were changed because the repository did not change.