process: Code-writing skills, hooks and the review keep the knowledge layer in sync
Back to our planType
process
Summary
Teach every step of the work to keep the knowledge layer in sync: the skill for writing code reads the note first and updates it after, the self-review asks about it, the independent review always looks for behavior changes and blocks when the note doesn't match, and a hook reminds the agent while it is still working. The CI check from the sync-gate sub-issue stays the real gate.
Problem
A check at the end catches a missing update late, after the work is done. Summary of the owner's direction (2026-11-06, Claude session, text, recorded on the epic): the code-writing skills, the hooks and the review must all know that documentation follows behavior, in particular when a content type's behavior, its properties or its events change; and the review always checks for behavior changes.
Proposed fix
AGENTS.md. In "Where knowledge lives": what the knowledge layer is, where the index, the notes and the generated reference are, and the one rule (behavior changes and its note change in the same pull request). In step 2: the pull request states whether behavior changed.write-codeskill. Before coding: read the index line and the note of the module you are about to change, and the generated page of any content type you touch, not the whole module. After coding: if behavior changed, update the note in the same pull request; if a content type, a route or a shared component changed, runnpm run docs:generate.change-workflowskill. Step 3 runsnpm run docs:checkwith the other local checks. Step 4 fills in the Knowledge section.self-reviewskill. A sixth item, Knowledge: list what a visitor, an editor or an agent would now see differently, and check the note says so.pr-reviewskill. A step that runs on every review: list every behavior change in the diff; find, for each, the sentence in the note or the generated page that now describes it. A change with no matching sentence is a Blocker. ABehavior change: noneline that the diff contradicts is a Blocker.- Guard rails. One more rule (documentation changes with behavior) and its row in "What enforces them".
- Claude Code hook (adapter only): after an edit to a file under a mapped path, if that module's note is unchanged compared with
main, print one reminder per module per session. It never blocks; CI does. Codex has no hook and relies onAGENTS.md, the skills and CI.
Nothing here lives only in .claude/: the rule is in AGENTS.md and the skills, as the tool-adapters rule requires.
Acceptance criteria
- Not done: Each of the seven changes above is made, and every changed file stays under 250 lines.
- Not done: A reviewer following
pr-reviewon a test pull request that changes behavior without changing the note reports a Blocker. The transcript or the review comment is linked from this issue. - Not done: The hook's logic has tests in
.claude/hooks/rules.test.mjs, and editing a mapped file in a test session prints the reminder once. - Not done: No rule, procedure or fact was added only to
.claude/. - Not done: The review of this PR lists it as a policy change the owner asked for, with the dated summary.
Files likely touched
AGENTS.md, .agents/skills/write-code/SKILL.md, .agents/skills/change-workflow/SKILL.md, .agents/skills/self-review/SKILL.md, .agents/skills/pr-review/SKILL.md, docs/guidelines/guard-rails.md, .claude/hooks/ (script, rules and tests), .claude/settings.json.
Must not touch
src/, .github/ (done in the sync-gate sub-issue), docs/process/.
Open questions
None for the owner.
Area
tooling
Priority
high
Generated by Claude Code, opens in a new tab