instructions
Audit AGENTS.md/CLAUDE.md for rot with verify-references/verify-commands, or capture a session's discovered commands and gotchas — append-only diffs, applied only with approval.
SKILL.md.claude/skills/instructions/SKILL.md
GitHubInstructions
Overview
Two modes over the project constitution, both append-only and approval-gated: audit re-grades what is there against the codebase and fixes rot; capture adds what this session learned that the constitution was missing.
When To Use
- audit: every 4–8 weeks, after a large refactor, or when sessions hit broken commands or dead paths ("AGENTS.md feels off").
- capture: at the end of a session that discovered a command, gotcha, env quirk or non-obvious pattern ("save what we learned", "remember this for next time").
When NOT To Use
- First-time setup →
/mtk-setup. Refreshingarchitecture-principles.md→/mtk-setup --audit. - An engineer correction →
lessons capture(a lesson, not a constitution fact). Session state to resume →handoff. - Audit right after a clean audit, or capture mid-task — both manufacture churn.
Workflow
Both modes
- Resolve the target first. The constitution is
AGENTS.mdwhen it exists, carries noAuto-generated by MTKmarker in its first 10 lines, andCLAUDE.mdis absent or a shim (a bare@AGENTS.mdline); otherwiseCLAUDE.md(legacy repo).bash scripts/resolve-constitution.shanswers the same question. No constitution → stop and point to/mtk-setup. Never migrate legacy → inverted as a side effect; that is/mtk-setup's regen-diff job. - Both files are protected (S1.5):
Editwith explicit old/new strings, neverWrite, even when the engineer asks for a rewrite.
Audit mode
- Mechanical currency checks — run, do not eyeball.
Extract the constitution's build/test/lint/format commands asCONST="$(bash scripts/resolve-constitution.sh)" bash scripts/verify-references.sh "$CONST" .claude/rules/*.md # exit 3 = STALE lines bash scripts/check-instruction-load.sh # exit 1 = a file a harness truncates, shadows or ignores; 2/missing = report "not checked"name<TAB>commandlines and run them throughbash scripts/verify-commands.sh --timeout 120. Never pass deploy, migrate, publish, push or anything that writes outside the tree — list those as unverified instead. Also runbash scripts/resolve-tech-stack.sh "$PWD": a constitution naming a different stack, or only the root's stack in a polyglot repo with per-subtree pins, is a currency finding. - Shim integrity. When
CLAUDE.mdis a shim, confirm@AGENTS.mdis present and bare (inside a code fence or backticks it is inert). A shim has no## Critical Rulesby design — not rot. Nested package files get a full pass only when they carry package-local content. - Judge what scripts cannot: architecture clarity, captured gotchas, conciseness, and vague rules ("write good tests") that need a concrete replacement. A line that is true but belongs elsewhere gets Move → <named owner> (README, a rule file, a skill, the spec); the test: would a newcomer act differently because of this line here? No numeric grade — name the line and the reason.
- Report, then stop. List every STALE path and failed command with its line, the judgement findings, and proposed changes. A clean file is reported as clean; never invent issues. Ask: "Approve these changes? (yes / partial / no)"
- Apply only the approved subset as one
Editper change. Removals need per-line approval; "approve all" does not cover deletions. Then re-run step 1 on the edited file and confirm the line count moved less than 10%.
Capture mode
- Reflect. Which commands, gotchas, env/config quirks or patterns, had they been in the constitution at the start, would have saved time? None → say "nothing to capture" and stop.
- Destination. Project fact → the resolved constitution (nearest package file in a monorepo when the fact is local to one package). Harness-only quirk → that shim's own short section, rarely. First-person preference or machine path →
CLAUDE.local.md(gitignored; check.gitignorebefore creating it). When in doubt it is a constitution fact, not a shim one. - Dedupe.
grep -in "<keyword>" AGENTS.md CLAUDE.md CLAUDE.local.md tasks/lessons.md. Already documented → update the line only if it is now wrong. - Draft one line per concept,
`<command or pattern>` — <why>, in the file's existing style. Budget:AGENTS.md60–80 lines, hard cap 120; aCLAUDE.mdshim 20. Over budget → move detail to.claude/rules/or drop the weakest candidate. The proposal must also passbash scripts/growth-gate.sh <target> <proposed>. - Propose, then stop. Each addition as a diff with its destination and a one-line why. Ask: "Apply these? (yes / partial / no)"
- Apply only the approved subset with
Edit, appended into the relevant section, never restructuring.
Verification
- Target resolved (or
/mtk-setupredirect); noWriteonAGENTS.md/CLAUDE.md - Audit:
verify-references.sh,verify-commands.shandcheck-instruction-load.shoutput cited, or "none found" stated - Every finding or addition names a line and a reason; no edits before approval; partial approval applied exactly
- Capture: duplicates grep-checked; growth gate passed;
AGENTS.md≤ 120 lines and the shim ≤ 20 after edits - Personal items went to
CLAUDE.local.md, not the committed file