Repository navigation
Conversation
- Rewrite templates/memory/constitution.md as a 5-section agent contract (DoD table, AC Authoring Standard, Boundaries, Budgets/Stop Conditions, Stack-Specific Notes) replacing generic boilerplate - Add scripts/generate-constitution-dod.ts: parses §7 step-4 branches from qa/SKILL.md, renders 22-row DoD gate table via GATE_LABELS lookup - Add scripts/check-constitution-dod.ts: drift check comparing committed <!-- BEGIN:DOD-GATES --> region to generated table; exits 1 on mismatch - Add lint:constitution-dod npm script and CI step (fails on drift) - Add cross-reference in spec/SKILL.md AC Quality Check step → constitution §2 - Update README.md, prepare-marketplace.ts, docs/guides/customization.md to describe the constitution as the project agent contract - Add AC-4 test in templates.test.ts for multi-section constitution preservation - Add scripts/check-constitution-dod.test.ts with 14 tests covering generator correctness, drift gate (AC-1), spec cross-link gate (AC-2), docs coverage (AC-6) Entire-Checkpoint: 86ddab9eedd3
… changelog QA findings addressed: - §3 dropped the protected-paths row: no riskPaths key or override-prompt mechanism exists anywhere in the codebase, and §3's own contract says rules without a named enforcer are not in this section. - §4 quality-loop cap key corrected: ready.maxIterations does not resolve (ready has only policy); the real key is run.maxIterations. - New gate test: every backticked settings key in §3–§4 must resolve in DEFAULT_SETTINGS and every cited hook/script path must exist, scoped to the Boundaries/Budgets region, in both the template and the repo mirror. - CHANGELOG [Unreleased] entry added. Claude-Session: https://claude.ai/code/session_0178TZyoqDoCYehwfnQUDyNW
…ression QA iteration-2 finding: README.md and docs/guides/customization.md still described §3 Boundaries as naming 'the protected-paths settings key' — the enforcer AC-3's fix removed from the constitution for not existing. Both now cite the worktree-only editing guard (real, hook-enforced) instead. Hardening per QA suggestions: AC-6 phrase-coverage tests are now scoped to the Agent Contract / Customizing the Constitution sections instead of whole-file matching, and a regression test pins the removed protected-paths phrase out of every doc surface this PR touches. Claude-Session: https://claude.ai/code/session_0178TZyoqDoCYehwfnQUDyNW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #943
Summary
templates/memory/constitution.mdrewritten as a 5-section agent contract: Definition of Done (generated), AC Authoring Standard, Boundaries, Budgets & Stop Conditions, Stack-Specific Notes — replacing the generic boilerplate.scripts/generate-constitution-dod.ts— parses §7 step-4 branches fromqa/SKILL.md, renders a 22-row gate table via aGATE_LABELSlookup; deterministic output so drift is detectable.scripts/check-constitution-dod.ts— drift check comparing the committed<!-- BEGIN:DOD-GATES -->region to the generated table; exits 1 on mismatch.npm run lint:constitution-dod+ CI step — fails the build when the DoD table drifts from live §7 gates.spec/SKILL.md(all 3 mirror copies) — cross-reference added in the AC Quality Check step pointing to constitution §2.scripts/prepare-marketplace.tsREADME_CONTENT, anddocs/guides/customization.mdupdated to describe the constitution as the project agent contract.scripts/check-constitution-dod.test.ts; AC-4 preservation test added tosrc/lib/templates.test.ts.AC Checklist
generate-constitution-dod.ts;check-constitution-dod.ts+npm run lint:constitution-dodCI step fail on drift. Mutation-verified (marker below)./spec's AC Quality Check step cross-references it in all 3 skill mirrors. Mutation-verified (marker below).settings.riskPathsand was removed (no such mechanism exists anywhere in the codebase — §3's own contract says rules without a named enforcer don't belong); the quality-loop cap key was correctedready.maxIterations→run.maxIterations. The rule→mechanism mapping is now machine-gated: a new test asserts every cited settings key resolves inDEFAULT_SETTINGSand every cited hook/script path exists, scoped to the §3–§4 region, in both the template and the repo mirror. Mutation-verified (markers below).templates/hooks/pre-tool.sh(HOOK_BLOCKED: Force push)templates/hooks/pre-tool.shworktree guard/qa§6iSEQUANT_MUTATIONmarker gate (feat(qa): mutation-verification becomes a parseable §7 gate instead of honor-system prose #939)/qa§7 verdict algorithm +lint:constitution-doddrift CIrun.maxIterations,run.autoWaitMinutessettings keysCUSTOMIZABLE_FILESguard preserves a customized constitution onsync; new template reaches freshinitonly. Test:preserves a multi-section constitution customized for the project (#943 AC-4)insrc/lib/templates.test.ts.{{PROJECT_NAME}}and{{STACK_NOTES}}are real substitution tokens and survive the rewrite;src/lib/templates.test.tsgreen.README_CONTENT(scripts/prepare-marketplace.ts), anddocs/guides/customization.mdall describe the constitution as the agent contract, gate-tested for content (not existence).(The CI-step ordering claim previously listed as "AC-5" is AC-1 evidence — folded in above; checklist now maps 1:1 to the issue's AC numbering.)
Mutation Verification Records
Test Plan
npx vitest run scripts/check-constitution-dod.test.ts— 14/14 passnpx vitest run src/lib/templates.test.ts— all 45 pass (including new AC-4 test)npm run lint:constitution-dod— exits 0 (DoD in sync)npm run lint:skill-sync— spec/SKILL.md 3/3 matchnpm run lint— 0 warningsnpm run build— cleannpm test— full suite passesOrchestrator verification (2026-08-29, commit 590d00c)
QA's AC_NOT_MET findings were verified by real execution and fixed: both bad citations confirmed (no
riskPathsanywhere in the codebase;readyschema carries onlypolicy— checked againstDEFAULT_SETTINGSat runtime), corrected in both constitution files (byte-identity re-verified), CHANGELOG[Unreleased]entry added, and the two pre-existing mutation markers corrected to the canonical<file> > <test>form. Re-ran:scripts/check-constitution-dod.test.ts+src/lib/templates.test.ts(63/63),npm run lint:constitution-dod, build, lint — all clean.Mutation-verified: AC-3 — changed the
run.maxIterationscitation torun.nonexistentCapin templates/memory/constitution.md §4; test "templates/memory/constitution.md: every cited settings key resolves in DEFAULT_SETTINGS" failed; restored.Mutation-verified: AC-3 — changed the pre-tool hook citation to
templates/hooks/no-such-hook.shin memory/constitution.md §3; test "memory/constitution.md: every cited hook/script path exists" failed; restored.Orchestrator verification — iteration 3 (2026-08-29, commit 15e95f9)
QA iteration 2 found the AC-3 defect class surviving in doc sibling sites: README.md and docs/guides/customization.md still cited "the protected-paths settings key" as a §3 enforcer. Both now cite the worktree-only editing guard (real, hook-enforced). Per QA's suggestions, the AC-6 phrase-coverage gates are now scoped to their sections (README
### Agent Contract, guide## Customizing the Constitution) instead of whole-file matching, and a regression test pins the removed phrase out of README, the customization guide, and prepare-marketplace.ts. 19/19 gate tests, lint clean.Mutation-verified: AC-6 — reintroduced "the protected-paths settings key" into README.md's Agent Contract section; test "docs never cite the removed protected-paths enforcer (QA iteration-2 regression)" failed; restored.
Mutation-verified: AC-6 — renamed README's
### Agent Contractheader so the scoped region disappears; test "README.md describes the constitution as the agent contract" failed; restored.