Repository navigation
Description
Motivation
templates/memory/constitution.md is the designated home for a project's agent contract — and it is generic boilerplate ("Quality First — never sacrifice code quality for speed", a command table, naming-convention platitudes). Nothing in it is machine-checked, and no skill references it at a decision point. It is shipped to every consumer project as the always-on prose class that #608 measured at a 0% action rate: words with no consumer.
Meanwhile the actual agent contract exists, scattered and mostly implicit:
| Contract element | Where it lives | Documented for consumers? |
|---|---|---|
| Definition of Done | /qa §7 gates |
No — internal skill prose |
| Scope boundary | Non-Goals parsing (parseNonGoals) |
Partially |
| Protected paths | hardcoded regex in qa/SKILL.md |
No |
| Budgets | ready/loop iteration + token caps in settings | Settings table only |
| Stop conditions | human merge gate, waiting_for_human_merge |
No |
A consumer project adopting sequant cannot currently answer "what will the agent refuse to do, what must every PR satisfy, and where does it stop for me?" without reading skill internals. And issue authors can't distinguish per-issue ACs from the project-wide DoD, which produces the AC-hygiene duplication ("add tests", "CI passes" as issue ACs) that the AC standard tries to lint away.
Proposal
Rewrite the constitution template as the enforceable contract surface — every section either machine-checked or referenced by a named skill at a named decision point; anything that is neither gets deleted.
Sections:
- Definition of Done — the §7 gate list, generated (not hand-written): a script renders the gate table from the qa skill's §7 collection list so the constitution cannot drift from the real gates (
lint-skill-gatesalready parses this region; reuse it). States explicitly: these are project-wide; do not restate them as issue ACs. - AC authoring standard — the house AC format: single-line ACs (parser constraint stated as a rule, with the truncation failure mode), named
Evidence:where testable,Risk:/Human decisiondeclarations, Non-Goals section. One screen, with one good/bad example pair. This is the human-facing docs home for the AC-field issues. - Boundaries — protected paths (pointing at
settings.riskPathsonce configurable), force-push/amend prohibitions (already hook-enforced — documented here as contract, with the hook named), worktree-only editing rule. - Budgets & stop conditions — iteration/token caps with their settings keys, the human merge gate, and gap-prompt discipline: diagnostic ("what are the gaps?") is cheap and high-yield; imperative ("fix all gaps") requires triage first (the audited fix(lint): exclude gitignored scripts/dev from the widened lint/typecheck scope #930 regression is the cited incident).
- Project-specific notes — unchanged customization region.
Consumers (what makes this not-prose):
/specAC-quality check links its lint warnings to §2 ("see constitution AC standard") — the linter and the doc cite each other.sequant setup/initrenders the DoD table at generation time;validate-skillsCI job (or a small new check) fails when the generated DoD table drifts from the §7 list.
Non-Goals
- No new enforcement mechanisms — this issue documents and cross-links existing teeth (hooks, gates, settings); new gates are their own issues (mutation gate, tautology CI, risk override, filed alongside).
- No consumer-project migration tooling — existing projects keep their customized constitutions; sync semantics below.
- No principles/values prose — deleted, not rewritten. A value with no consumer is dead weight by measurement.
Tailored caveats
- The constitution is a
CUSTOMIZABLE_FILESentry — fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708/fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814 established that sync must not overwrite in-place customizations. A template rewrite this large must verify the update/sync path treats it as customized-preserving, and the PR must state the expected behavior for projects with edited constitutions (they keep theirs; release notes point at the new template). - The DoD generation script reads the §7 region of
qa/SKILL.md— scope the extraction to the delimited §7 block (whole-file matching lets unrelated text satisfy it; gate-test scoping rule), and it must run identically over all three skill dirs (byte-identical anyway, but assert on one canonical source). - Docs-coverage ACs verify content, not file existence, across main README, marketplace README, and docs/ (all-locations rule).
- Template placeholders (
{{PROJECT_NAME}},{{STACK_NOTES}}) must survive —templates.tssubstitution tests cover the rewrite.
Acceptance Criteria
- AC-1: The constitution template's DoD section is generated from the qa skill's §7 gate list by a script, and a CI check fails on drift between them. Evidence: delete one gate from the generated table and confirm the check fails (mutation-verified), restore.
- AC-2: The AC authoring standard section documents single-line ACs, Evidence/Risk/Human-decision clauses, and Non-Goals, with one good/bad example pair, and
/spec's lint output references it. Evidence: content-coverage assertion scoped to the section; scoped gate test on the spec skill's reference, mutation-verified. - AC-3: Boundaries and budgets sections name their enforcing mechanism (hook, gate, or settings key) for every listed rule — zero unenforced aspirational statements remain in the template. Evidence: review checklist in the PR body mapping each rule to its mechanism; the old boilerplate principles section is gone.
- AC-4:
update/syncpreserve an existing customized constitution unchanged and the new template reaches freshinitprojects only. Evidence: existing customizable-file integration tests pass; one new case with a modified constitution asserting no overwrite. - AC-5: Placeholder substitution (
{{PROJECT_NAME}},{{STACK_NOTES}}) works in the rewritten template. Evidence:templates.test.tsgreen with the new content. - AC-6: README (main + marketplace) and docs/ describe the constitution's role as the agent contract, content-verified in all locations. Evidence: docs-coverage assertions on all three locations.
Human decisions required
- Should the gap-prompt discipline section (diagnostic vs imperative) live here or in CLAUDE.md-style operator docs? (It is operator guidance, not agent contract — but it has no other durable home today.)
Context
From the 2026-08-13 strategy review (agent-contract consolidation: per-issue clauses live in AC fields; the repo-level contract is this document, with teeth). Related: #708/#814 (customizable-file sync semantics), #834 (lint-skill-gates precedent for parsing §7), #930 (the imperative-prompt incident cited in §4), the Evidence/Risk/Human-decision field issues filed alongside this one.
Activity
admarble commentedon Aug 29, 2026
Context for the implementation run (2026-08-29) — repo state has moved since this issue was written:
Mutation-verified:markers (machine-anchoredSEQUANT_MUTATIONJSON) in PR bodies for gate-test ACs. AC-1 and AC-2's mutation-verified evidence should use that exact marker format. When mapping rules to enforcement mechanisms (AC-3), the mutation gate is now an existing tooth to cite, not a future issue.awaiting_verificationis now a real workflow state anddocs/features/qa-verdict-workflow-states.mddocuments the verdict→state contract. The Budgets & stop-conditions section (§4) should list it among the stop/hold states and cross-link that doc rather than restating it.CUSTOMIZABLE_FILESentry — AC-4's no-overwrite behavior is load-bearing; and all skill-file changes must be mirrored across the three skill dirs per repo convention.admarble commentedon Aug 29, 2026
Complexity: Standard (6 ACs, ~6 directories)
AC Quality Check
All six ACs carry a declared Evidence: clause and a measurable outcome — well above the house standard (this issue is itself the source for that standard, §2). Two notes:
Mutation-verified: AC-N — <mutation>; <test> failed; restored.marker (machine-anchored<!-- SEQUANT_MUTATION: {...} -->) in the PR body, or/qa§6i floors the verdict.No vague/unmeasurable/open-ended patterns found. AC lint: clean.
Scope Assessment
Non-Goals: Present and strong — (1) no new enforcement mechanisms (documents existing teeth only); (2) no consumer-project migration tooling; (3) no principles/values prose (deleted, not rewritten).
/speccross-link; boundaries/budgets doc; sync-preservation + docs coverage)templates/memory/×3 mirror,src/lib/,scripts/×2,skills/spec/×3 mirror,README.md+ marketplace,docs/)Verdict:⚠️ SCOPE_WARNING — the work is broad but cohesive: everything orbits one artifact (the constitution template) and its cross-links. Not a split candidate. Quality loop auto-enables. The real risk here is mirror drift, not scope creep: every skill/template edit lands in three directories (
.claude/,templates/,skills/for the spec skill;.claude/memory/,templates/memory/,memory/for the constitution).Acceptance Criteria
AC-1: DoD section generated from qa §7 gate list + CI drift check
Verification: Integration Test (+ gate test, mutation-verified)
Scenario: Given
qa/SKILL.md§7's status-token collection list → When the generator runs → Thenconstitution.md's DoD table matches the §7 gates; When a gate is deleted from the generated table → Then the CI drift check exits non-zero.Assumptions: The generator reads the delimited §7 region only (the
Verdict Determination Algorithmblock, ~line 2590 ofskills/qa/SKILL.md, step-2Check verification gateslist). Scoping to the block is mandatory — whole-file matching lets unrelated prose satisfy the assertion (CLAUDE.md gate-test scoping rule; #830). The canonical source is one skill dir (§7 is byte-identical across the three; assert on.claude/skills/qa/SKILL.mdperlint-skill-gates.ts'sSCAN_ROOTSprecedent).AC-2: AC authoring standard section +
/speclint cross-referenceVerification: Integration Test (content-coverage + scoped gate test, mutation-verified)
Scenario: Given the rewritten constitution → When asserting §2 content → Then it documents single-line ACs (with the parser-truncation failure mode),
Evidence:/Risk:/Human decisionclauses, Non-Goals, and one good/bad example pair; And/spec's AC-quality-check output references the constitution AC standard.Assumptions: Content assertion is scoped to the §2 region, not the whole file. The
/speccross-link lands in the AC Quality Check step ofspec/SKILL.md— mirrored across all three spec skill dirs.AC-3: Boundaries + budgets sections name an enforcing mechanism for every rule
Verification: Manual Test (PR-body review checklist)
Scenario: Given the rewritten template → When reviewing §3 (Boundaries) and §4 (Budgets & stop conditions) → Then every listed rule cites its hook / gate / settings key, zero aspirational statements remain, and the old Core-Principles/Naming/Error-Handling boilerplate is gone.
Assumptions: Mechanisms to cite include: force-push/amend hook (
pre-tool.sh), protected paths (settings.riskPaths), worktree-only editing,/qa§7 gates, the mutation gate (#939, now an existing tooth — not a future issue), iteration/token caps (settings keys), the human merge gate +waiting_for_human_merge/awaiting_verificationstate (cross-linkdocs/features/qa-verdict-workflow-states.md, #972), and gap-prompt discipline (§4, diagnostic-vs-imperative, #930).AC-4:
update/syncpreserve a customized constitution; new template reaches freshinitonlyVerification: Integration Test
Scenario: Given an existing project whose
constitution.mddiffers from the template → Whensync/updateruns → Then the customized file is untouched (it's inCUSTOMIZABLE_FILES); Given a freshinit→ Then the new template renders.Assumptions:
CUSTOMIZABLE_FILES = [".claude/memory/constitution.md"](src/lib/templates.ts:238) already guards this viaisCustomizableFile; the rewrite must not change the path or the guard. Add one new integration case with a modified constitution asserting no overwrite (existingtemplates.test.tscases at :178/:364 are the pattern).AC-5: Placeholder substitution works in the rewritten template
Verification: Unit Test
Scenario: Given the new constitution content → When
templates.tssubstitution runs → Then{{PROJECT_NAME}}and{{STACK_NOTES}}expand correctly (templates.test.tsgreen).Assumptions: Both placeholders must survive the rewrite verbatim;
{{STACK_NOTES}}still fed bystacks.tsnote injection.AC-6: README (main + marketplace) and docs/ describe the constitution's role
Verification: Integration Test (docs content-coverage, all three locations)
Scenario: Given the three doc surfaces → When asserting content → Then each describes the constitution as the project's agent contract (DoD + boundaries + budgets), content-verified (not file-existence).
Assumptions: The marketplace README is generated from the
README_CONTENTconstant inscripts/prepare-marketplace.ts:287— edit that constant, not a static marketplace file. Third location isdocs/(docs/README.mdor a dedicated page). Coverage asserts on content, not existence (docs-all-locations rule).Implementation Plan
Phase 1: DoD generator + drift gate (AC-1)
scripts/generate-constitution-dod.ts, or extend an existing render step) that parses the delimited §7Check verification gatesblock from.claude/skills/qa/SKILL.mdand renders the DoD table intotemplates/memory/constitution.md. Reuselint-skill-gates.ts's region-scoping approach rather than re-inventing a parser.lint-skill-gatesor a small sibling script wired into thevalidate-skillsjob) that fails when the rendered DoD table diverges from the §7 list. This is the AC-1 mutation-verified gate test.Phase 2: Rewrite the constitution template (AC-2, AC-3)
templates/memory/constitution.mdwholesale with the five-section structure: (1) generated DoD, (2) AC authoring standard w/ good-bad pair, (3) Boundaries, (4) Budgets & stop conditions, (5) Project-specific notes (preserve{{PROJECT_NAME}}/{{STACK_NOTES}}and the customization region). Delete Core Principles / Naming / Error Handling / Commands boilerplate..claude/memory/,templates/memory/,memory/). Note: the drift check andinitrender fromtemplates/memory/; confirm which copies are load-bearing vs mirrors before assuming byte-identity.spec/SKILL.mdcopies, make the AC Quality Check step reference the constitution AC standard (AC-2 second half).Phase 3: Sync/docs verification (AC-4, AC-5, AC-6)
README.md, theREADME_CONTENTconstant inscripts/prepare-marketplace.ts, and adocs/page to describe the constitution-as-contract; add content-coverage assertions for all three.Dependency note: Phase 1 must land before Phase 2's DoD section is meaningful (the section is generated). Phases 2 and 3 can overlap once the template shape is fixed.
Rule Touchpoints
AC-3 is itself a touchpoint-enumeration exercise: it requires naming the enforcing site for each documented rule. Rather than run the behavior-rule detector (the ACs document existing rules, they don't implement new ones), the enforcing touchpoints to cite are:
templates/hooks/pre-tool.sh(hook)settings.riskPaths(settings key)skills/qa/SKILL.md§7 verdict algorithm (gate)/qa§6i +SEQUANT_MUTATIONmarker (gate, #939).sequant/settings.json(settings keys)waiting_for_human_merge,awaiting_verification(#972);docs/features/qa-verdict-workflow-states.mdDesign Review
scripts/alongsidelint-skill-gates.ts(same §7-parsing concern, samevalidate-skillsCI home). The template content belongs intemplates/memory/constitution.md; the sync guard already lives insrc/lib/templates.tsand needs no change beyond a test.lint-skill-gates's region parser instead of a new §7 parser.lint-skill-gates.ts(§7 region parsing +validate-skillsgate) and theCUSTOMIZABLE_FILESpreservation pattern (fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708/fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814). Marketplace docs follow the generated-README_CONTENTpattern.lint-skill-gates?" — answer in the PR: generation (write) vs linting (read) are different verbs; keep the drift check in the lint job but the render separate, or justify merging. Also: "Did you verify all three constitution mirrors and which oneinitactually reads?" — the mirror-drift trap is the most likely defect here.Feature Quality Planning
Notable items:
.claude/memory/,templates/memory/,memory/) and the spec skill (.claude/skills/,templates/skills/,skills/). The TS↔shell/mirror drift guard compares literal strings only — verify each file independently, don't assume byte-identity.SEQUANT_MUTATIONmarker in the PR body (feat(qa): mutation-verification becomes a parseable §7 gate instead of honor-system prose #939 now enforces this in §6i). Scope each assertion to its delimited region (§7 block, §2 section) — whole-file grep is the feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 false-negative trap.Derived ACs
lint:skill-syncgreen)Open Questions
init/sync? — Recommendation:templates/memory/constitution.mdis the shipped source;.claude/memory/andmemory/are dev/self-host mirrors. Confirm before editing. Impact if wrong: freshinitprojects get the old boilerplate despite a green build.lint-skill-gatesor ship a sibling script? — Recommendation: sibling generator script + drift assertion wired into the samevalidate-skillsCI job (keeps write/read verbs separate). Impact: minor; either satisfies AC-1.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled
Reasoning: AC-1/AC-4/AC-6 declare Integration-Test evidence and AC-5 declares a Unit-Test — stubbing these (drift check, no-overwrite case, docs-coverage asserts) before implementation is high-yield. SCOPE_WARNING + the six-directory mirror surface auto-enables the quality loop. No UI/
.tsxchanges → notestphase. Not security-sensitive → nosecurity-review.Label Review
Current: (none)
Recommended:
enhancement,docs,plannedReason: It's a feature (
feat(setup):) that is largely documentation + one generation script + a CI gate. Nocomplex/breakinglabel warranted (6 ACs, cohesive), but the mirror surface is why the quality loop runs.Quality Loop: Will auto-enable (SCOPE_WARNING).
→
gh issue edit 943 --add-label enhancement --add-label docs--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan posted. See structured sections above. Key decisions: (1) generate only the DoD table from qa §7, hand-write §2–§5; (2) reuse
lint-skill-gatesregion-parsing for the drift check; (3) edit the marketplaceREADME_CONTENTconstant, not a static file; (4) mirror-drift across the two skill/memory triads is the top defect risk; (5) AC-1/AC-2 gate tests must carrySEQUANT_MUTATIONmarkers per #939. Open questions on canonical constitution copy and drift-check placement flagged above.admarble commentedon Aug 29, 2026
QA Review for Issue #943
AC Coverage
generate-constitution-dod.tsparses §7 step-4 (scoped to the fenced block),check-constitution-dod.tscompares the delimitedBEGIN/END:DOD-GATESregion;lint:constitution-dodwired in CI. Drift check passes; deleting a row fails the gate test (verified)./specreferences it/specAC Quality Check step carries the cross-link in all 3 mirrors (skill-sync 44/44).update/syncpreserve a customized constitution; new template reaches freshinitonlytemplates.test.ts(#943 AC-4); 59 tests pass;CUSTOMIZABLE_FILESalready includes the constitution.{{PROJECT_NAME}},{{STACK_NOTES}}) workstemplates.ts:278,280); template carries both;templates.test.tsgreen.prepare-marketplace.tsREADME_CONTENT, anddocs/guides/customization.md.Coverage: 5/6 AC items fully met — AC-3 NOT_MET blocks merge
CI Status
CI Summary: 9 passed, 0 pending, 0 failed. CI is not a blocking factor; the verdict is driven by AC-3.
Quality Metrics
any)Code Review
Strengths:
generate-constitution-dod.ts(render) vscheck-constitution-dod.ts(drift gate), reusinglint-skill-gates.ts's SCAN_ROOTS precedence for the canonical qa skill.BEGIN/END:DOD-GATESdelimiters for the drift check — avoiding the feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 whole-file-matching trap.Issues (blocking — AC-3):
Protected paths require explicit override → \settings.riskPaths` (settings key; override prompt required).riskPathsappears **nowhere** in the codebase except this template — it is not insrc/lib/settings.ts, and no "override prompt" mechanism exists. The issue body itself flags this: the real enforcer today is a "hardcoded regex inqa/SKILL.md", andsettings.riskPathsis future work ("pointing atsettings.riskPaths` once configurable"). This is exactly the "unenforced aspirational statement" AC-3 forbids.Quality-loop max iterations → \ready.maxIterations`. That key does not resolve (ready.maxIterations→undefined);maxIterationslives inRunSettingsSchema, so the real key isrun.maxIterations(thereadysection only haspolicy).run.autoWaitMinutes` in the same table is correct.Suggestions (non-blocking):
Test Coverage Analysis
scripts/generate-constitution-dod.tsscripts/check-constitution-dod.test.tsscripts/check-constitution-dod.tsscripts/check-constitution-dod.test.tstemplates/memory/constitution.mdtemplates.test.tsAC-4Coverage: core scripts fully covered (14 gate tests). No critical-path files.
Anti-Pattern Detection
No code anti-patterns in the changed
.tsfiles (0any, 0 security patterns, no empty catches, no N+1).package.jsonchange is an npm-script addition only — no dependency audit needed.Trust-Boundary Check
Finding: Clean — the issue is a normal feature spec; the diff implements only product requirements. No agent-directed instruction embedded in the issue/comments was acted on.
Status: Clean
Behavior-Rule Survival Check
quality first/never sacrifice/principlesin template + byte-identical mirror)Status: Clean
Mutation Verification
AC-1: DoD table matches §7 gates > …failedTestnames a describe title, not a fileAC-2: spec skill cross-references… > …Status: Not-Applicable to the automated §7 floor (no AC state populated for #943 via the state manager), but both markers are malformed: §6i's classifier reads the segment before the first
>as the test file (canonical shape<file> > <test name>, e.g.injection.test.ts > rejects payload). These markers put<describe> > <it>with no file path, soparseMutationMarkersclassifies both astest_not_in_diff(fabricated). The verification genuinely happened during exec, but the PR's own evidence records would fail the very gate this feature reinforces. Fix thefailedTestvalues toscripts/check-constitution-dod.test.ts > <test name>.CHANGELOG Verification
Result:⚠️ No
[Unreleased]entry found for this user-facing change. Non-blocking on its own (AC-3 already floors the verdict), but add an entry before merge. (Note: recorded as a secondary item, not the gating cause.)Risk Assessment
settings.riskPaths/ready.maxIterations, finds neither, and concludes the "enforceable contract" is inaccurate — undermining the exact trust the rewrite is meant to establish.settings.Xkey against the settings schema (and each hook path against the filesystem) would have caught both defects and would prevent regression — consider adding it as the AC-3 enforcement evidence.memory/constitution.md(byte-identical) — any fix must touch bothtemplates/memory/constitution.mdandmemory/constitution.md. No other cross-file copies.docs/guides/customization.mdand README describe the sections but do not repeat the specific keys, so they are unaffected.templates/hooks/pre-tool.shforce-push (20 hits) + worktree guard (47 hits) ✅ real;/qa §6i+SEQUANT_MUTATION✅ real;/qa §7✅ real;run.autoWaitMinutes✅ real. Onlysettings.riskPathsandready.maxIterationsare wrong.Adversarial Re-Read
Findings: (1) Traced each §3–§4 named enforcer to source —
settings.riskPathsandready.maxIterationsdo not exist; both mirrored intomemory/constitution.md. (2) Audited the PR's mutation-verification evidence claim againstmutation-marker.ts— bothSEQUANT_MUTATIONmarkers are malformed (test_not_in_diff). (3) Confirmed issue AC-5 (placeholder substitution) is genuinely met despite the PR checklist mislabeling AC-5 as CI-step ordering. (4) Verified old principles boilerplate removed from template and mirror. (5) No Non-Goals were expanded into scope (no new enforcement mechanism added — consistent with the issue's Non-Goals).Status: Severe Gap (a contract that names nonexistent enforcers, plus an unverified evidence-record format — the AC-3 requirement "zero unenforced aspirational statements" is literally violated)
Verdict: AC_NOT_MET
AC-3 is NOT_MET: the constitution's Boundaries (§3) and Budgets (§4) sections name two enforcing mechanisms that do not exist —
settings.riskPaths(no such settings key; the real enforcer is the hardcoded sensitive-path regex inqa/SKILL.md) andready.maxIterations(wrong path; the key isrun.maxIterations). AC-3's explicit requirement is "name their enforcing mechanism … for every listed rule — zero unenforced aspirational statements remain in the template", so these are literal violations, not stylistic nits. The other 5 ACs are met and code quality is otherwise high, but oneNOT_METAC floors the verdict.Required Fixes
templates/memory/constitution.mdandmemory/constitution.md): Replacesettings.riskPathswith the mechanism that exists today — the hardcoded sensitive-path regex inqa/SKILL.md(grep -iE 'auth|payment|security|server-action|middleware|admin', §Small-Diff / anti-pattern detection) — or drop the row untilsettings.riskPathsis actually implemented. Also remove/qualify the "override prompt required" claim, which has no mechanism.ready.maxIterations→run.maxIterations.SEQUANT_MUTATIONfailedTestvalues to the<file> > <test name>shape (scripts/check-constitution-dod.test.ts > …,src/lib/templates.test.ts > …) so they classify asvalid.settings.Xkey named in §3–§4 resolves in the settings schema and each hook path exists — this both proves AC-3 and prevents regression.[Unreleased]entry; realign the PR AC checklist to the issue's AC numbers.Next Steps
npm run lint:constitution-dod,npm run lint:skill-sync, and the test suite./qa 943.Structured Gap Findings
fix(#943): AC-3 — cite only real enforcers; gate citation resolution;…
admarble commentedon Aug 29, 2026
QA Review for Issue #943
AC Coverage
generate-constitution-dod.tsrenders the 22-row table from §7 step-4 (scoped to the delimited fenced block);check-constitution-dod.ts/lint:constitution-dodwired into CI. Mutation-verified and spot-checked live: deleting the "All ACs MET" row fails both the drift check and the AC-1 test; restored → passes./speccross-linkDEFAULT_SETTINGSand every hook/script path exists (scoped to §3–§5), in both template and repo mirror (byte-identical). Prior-cycle bad citations (riskPaths,ready.maxIterations) corrected. Mutation-verified (×2).CUSTOMIZABLE_FILESpreservation testpreserves a multi-section constitution customized for the project (#943 AC-4)passes intemplates.test.ts.{{PROJECT_NAME}}/{{STACK_NOTES}}present in template;templates.test.ts45/45 green.README.md:184anddocs/guides/customization.md:38describe §3 Boundaries as naming "the protected-paths settings key" as an enforcer — a mechanism that does not exist (noriskPaths/protectedPathskey anywhere insettings.ts) and a rule that is not in the constitution (the AC-3 fix correctly removed it). This re-introduces the exact false-citation defect AC-3 exists to forbid.Coverage: 5/6 AC items fully met.
CI Status
CI Summary: 8 passed, 1 pending (build 22.x). Not blocking the verdict below, which is already
AC_NOT_METon a code/content defect (§7: theNOT_MET/PARTIALLY_METbranch precedes the pending branch).Quality Metrics
Code Review
Strengths:
parseStep4Branchesbreaks at the next numbered step) — avoids the feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 whole-file-matching trap. Drift check scoped toBEGIN/END:DOD-GATES. Clean separation: generate vs check, with the check importing the generator.GATE_LABELSentry still emit (raw condition) → drift fails → forces the author to add a label. Good failure-open-to-visible design.Issues:
README.md:184anddocs/guides/customization.md:38cite "the protected-paths settings key" as a §3 Boundaries enforcer. No such settings key exists and no such rule is in the constitution. This is the AC-3 defect class surviving in the docs sibling sites — the AC-3 fix's blast radius stopped at the constitution files and the AC-6 gate tests assert only phrase presence, not enforcer accuracy. Fix: drop the "protected-paths settings key" clause (or replace with a real enforcer such as the worktree-only editing guard) in both files.scripts/prepare-marketplace.tsuses the generic "(hook, gate, or settings key)" phrasing and is fine.Suggestions:
.toContain— per the gate-test scoping rule, scope them to the "Agent Contract"/"Constitution" section to prevent an unrelated header satisfying them.Test Coverage Analysis
scripts/generate-constitution-dod.tscheck-constitution-dod.test.ts(generator + parser units)scripts/check-constitution-dod.tscheck-constitution-dod.test.ts(extract + AC-1 drift)templates/memory/constitution.mdTrust-Boundary Check
Finding: Clean — the issue body's imperatives are legitimate product requirements; "Human decisions required" is author process guidance with no execute/fetch/exfiltrate payload. The diff implements only product/doc requirements. No agent-directed external-text instruction was acted on.
Status: Clean
Behavior-Rule Survival Check
Status: N/A — no AC triggers the behavior-rule heuristic (prose/template contract work; the "old principles boilerplate deleted" claim is verified — no principles section remains in either constitution file).
Declared-Evidence Execution
templates.test.tsStatus: Complete
Mutation Verification
check-constitution-dod.test.ts > constitution DoD region matches…check-constitution-dod.test.ts > .claude/skills/spec/SKILL.md contains…cross-linkStatus: Verified for AC-1/2/3; AC-6 docs-coverage gate test lacks a recorded mutation marker. Moot for this verdict but worth adding.
CHANGELOG Verification
Result: CHANGELOG requirements met —
[Unreleased] > Changedentry present for #943, includes issue number.Risk Assessment
README.md:184anddocs/guides/customization.md:38(surfaced above).prepare-marketplace.tsavoids it with generic phrasing.Adversarial Re-Read
Findings: Ran the drift check, the 18 gate tests, and
templates.test.tslive; live-mutated the AC-1 gate to confirm it isn't vacuous. Traced every §3–§4 citation to a real settings key / hook path. Surfaced one real gap the structured pipeline missed: the docs re-cite the nonexistent "protected-paths settings key" enforcer removed from the constitution by the AC-3 fix (README.md:184, customization.md:38) — a cross-file sibling of the AC-3 defect, invisible to the phrase-only AC-6 gate tests. No injection; process state clean (0 behind main, committed, no divergence); Non-Goals respected (no new enforcement mechanisms added).Status: Gaps Found
Verdict: AC_NOT_MET
AC-1 through AC-5 are fully met with genuinely-gating, mutation-verified tests (AC-1 live-checked). AC-6 is PARTIALLY_MET: all three doc locations describe the constitution's role, but two (
README.md:184,docs/guides/customization.md:38) cite "the protected-paths settings key" as a Boundaries enforcer — a settings key that does not exist and a rule that is not in the constitution (correctly removed by this PR's own AC-3 fix). Per §7, aPARTIALLY_METAC blocks merge. This is the same false-citation defect the AC-3 fix addressed, surviving in the docs because the fix didn't propagate there and AC-6's gate tests check phrase presence, not accuracy — a small, well-scoped fix.Next Steps
README.md:184anddocs/guides/customization.md:38, remove the "protected-paths settings key" clause from the Boundaries description (or replace it with a real enforcer, e.g. the worktree-only editing guard). Then re-run/qa 943.Structured Gap Findings
fix(#943): AC-6 — docs cite real enforcers; scope AC-6 gates; pin reg…
admarble commentedon Aug 29, 2026
QA Review for Issue #943
AC Coverage
generate-constitution-dod.tsparses §7 step-4 branches (scoped to the delimited algorithm fence),check-constitution-dod.tscompares theBEGIN/END:DOD-GATESregion, wired aslint:constitution-dod+ CI step. Independently mutation-verified: deleting a DoD row fails the gate test andlint:constitution-dod(exit 1); restore → green./specreferences itDEFAULT_SETTINGSand every cited hook/script path exists, scoped to §3–§4, in both constitution copies. Old boilerplate principles removed.update/syncpreserve a customized constitution; new template to freshinitonlytemplates.test.tscase seeds a customized multi-section constitution and asserts byte-for-byte preservation +preservedCustomizablemembership. Existing customizable-file tests pass (45/45).{{PROJECT_NAME}},{{STACK_NOTES}}) worksbuildTemplateVariables, templates.ts:278/280); template carries both; templates.test.ts green.README_CONTENT, anddocs/guides/customization.md. Gate tests are section-scoped (not whole-file) foragent contract/Definition of Done/constitution, plus a regression pin against the removed protected-paths phrase.Coverage: 6/6 AC items fully met
CI Status
typecheckvalidate-skillsvalidate-pluginnode-floor-guardPlugin Structure ValidationHooks ValidationSetup Directory Creationtautology-advisorybuild (22.x)CI Summary: 8 passed, 1 pending (
build (22.x)). Diff is not markdown-only (.tsfiles present) so the build-matrix relaxation does not apply —build (22.x)is a gating pending check. Localnpm run buildis clean and CItypecheckalready passed, so it is expected to go green; per §7 a gating-pending check holds the verdict at NEEDS_VERIFICATION rather than READY_FOR_MERGE.Quality Metrics
any)Test Coverage Analysis
scripts/generate-constitution-dod.tsscripts/check-constitution-dod.test.tsscripts/check-constitution-dod.tsscripts/check-constitution-dod.test.tsscripts/prepare-marketplace.tsscripts/check-constitution-dod.test.tssrc/lib/templates.ts(indirect)src/lib/templates.test.tsCoverage: All changed executable/content surfaces have gate or behavioral tests. Local run:
check-constitution-dod.test.ts+templates.test.ts= 64/64 pass;lint:constitution-dodexit 0;npm run buildclean.Code Review
Strengths:
GATE_LABELSfallback emits raw conditions so a new gate surfaces as drift rather than silently vanishing.templates/memory/andmemory/copies.Issues:
Suggestions:
memory/constitution.mdDoD region is verified in sync manually here but is not covered by thelint:constitution-dodCI step (which checks onlytemplates/memory/). Consider extending the drift check to the repo copy in a follow-up so the dogfooded contract can't drift unnoticed.Anti-Pattern Detection
No hardcoded secrets, SQL concatenation, empty catches, or unbounded loops in the diff. Scripts use synchronous
readFileSyncon 1–3 local paths (acceptable). Nopackage.jsondependency changes (only a script entry added).Trust-Boundary Check
Finding: Clean — the issue body is a standard feature request with no HTML-comment/fenced agent-directed instructions. The diff implements only product requirements (template rewrite, generator/check scripts, docs). The "Human decisions required" note (where gap-prompt discipline should live) was resolved as a product/content placement, not an injected agent action.
Status: Clean
Behavior-Rule Survival Check
Status: N/A (no AC triggers the behavior-rule heuristic; the OLD-rule sweep — removing the nonexistent protected-paths/riskPaths enforcer across template, README, guide, and marketplace — was already completed and is regression-pinned in iterations 2–3)
Declared-Evidence Execution
lint:constitution-dod+ drift gate testtemplates.test.tsStatus: Complete
Mutation Verification
check-constitution-dod.test.ts > constitution DoD region matches …… > .claude/skills/spec/SKILL.md contains the constitution AC-standard cross-link… settings key resolves in DEFAULT_SETTINGS/… hook/script path exists… docs never cite the removed protected-paths enforcer/… README describes the constitutionAll markers name tests present in the diff (
check-constitution-dod.test.tsis an added file) → no fabricated markers. AC-1 marker independently reproduced this pass.Status: Verified
CHANGELOG Verification
Result: CHANGELOG requirements met
Risk Assessment
lint:constitution-dodin CI (verified biting). The unguarded surface is the repo's ownmemory/constitution.mdcopy (see Suggestions).{{STACK_NOTES}}for every stack variant in the new template (only substitution mechanism is covered, which is stack-agnostic).templates/memory/,memory/) checked; DoD regions byte-identical, §3–§4 citations gate-tested in both.Adversarial Re-Read
Findings: No gaps found because: (1) no verbatim motivating-example fixtures exist in the issue body to run — the issue is a spec, not a repro; (2) evidence claims are post-fix validations, not bug repros — I re-ran the AC-1 gate mutation myself (delete DoD row → test + lint fail → restore → green) rather than trusting the PR record; (3) process state is clean (tree committed, 0 behind main, no uncommitted/stashed changes); (4) sibling sites cited above (cross-file doc sweep done + regression-pinned; intra-file both constitution copies checked); (5) Non-Goals respected — no new enforcement mechanisms were added (only existing teeth documented/cross-linked), no consumer-migration tooling, principles prose deleted not rewritten.
Status: Clean
Verdict: NEEDS_VERIFICATION
All 6 acceptance criteria are MET and code quality is A+: the DoD table is genuinely generated and drift-gated (independently mutation-verified to bite), the AC standard is documented and cross-linked in all three spec mirrors, §3/§4 citations are machine-checked to resolve to real mechanisms, customized-constitution preservation and placeholder substitution are tested, and all three doc locations carry section-scoped content gates with a regression pin. The only open item is the
build (22.x)CI check, still IN_PROGRESS — a gating pending check on a non-markdown diff. Localnpm run buildis clean and CItypecheck/validate-skillsalready passed, so this is a CI-timing hold, not a code concern. This finding is not loopable — no code fix applies.Documentation
Next Steps
build (22.x)to finish, then re-run/qa 943. If it reports SUCCESS (expected), the verdict promotes to READY_FOR_MERGE.lint:constitution-dodto also check the repo's ownmemory/constitution.mdDoD region so the dogfooded contract can't drift unnoticed.Structured Gap Findings
admarble commentedon Aug 29, 2026
QA Update — verdict promoted to READY_FOR_MERGE
build (22.x)— the only gating check pending at review time — has since completed SUCCESS. All 9 CI checks now pass, all 6 ACs are MET, code quality is A+, and the DoD drift gate was independently mutation-verified to bite. The NEEDS_VERIFICATION hold is cleared.Verdict: READY_FOR_MERGE
Documentation: run
/docs 943before merge if not already covered.admarble commentedon Aug 29, 2026
QA Verdict: READY_FOR_MERGE
feat(#943): constitution with teeth — generated DoD + AC standard (#978)
fix(hooks): let subshell code count for segment selection, heredoc bo…
fix(hooks): scope commit-message extraction to the git-commit segment (…
feat(#943): constitution with teeth — generated DoD + AC standard
fix(#943): AC-3 — cite only real enforcers; gate citation resolution;…
fix(#943): AC-6 — docs cite real enforcers; scope AC-6 gates; pin reg…