Files
msd-core/gsd-core/templates
0xdhx 003d982c83 fix(#4623): keep repo-wide planning docs out of the verification digest, and accept --files on verification.fingerprint (#4749)
* fix(#4623): keep repo-wide planning docs out of the verification digest, and accept --files on verification.fingerprint

Two defects in the covered-input fingerprint (#4155), one issue.

1. `computeCoveredDigest` hashed the whole bytes of every declared path
   uniformly, so `.planning/ROADMAP.md` and `.planning/REQUIREMENTS.md` —
   which every phase rewrites as ordinary bookkeeping, and which the closing
   phase's own `phase.complete` / `requirements mark-complete` rewrite AFTER
   the verifier ran — flipped every phase that declared them to `stale` on
   zero implementation change, and from there `isPhaseComplete` →
   `init.manager` → `complete-milestone`'s `ALL_PHASES_VERIFIED` gate.
   Fingerprint v2 leaves any direct child of a planning root out of the
   hash: `.planning/` itself, plus the phase's own planning root (the parent
   of its `phases/`, so `planningDir`'s `<project>/` and `workstreams/<ws>/`
   layouts are covered without the digest knowing what a workstream is —
   `sharedPlanningRoots` / `isSharedPlanningDoc`, defined by position rather
   than a name list so the set cannot drift; a root is accepted only when the
   phase dir sits under a `phases/` directory inside `.planning/`). Such a path is still validated
   exactly as every other covered path (confined, present, a regular file —
   the fail-closed contract is unchanged); only its bytes are ignored, and a
   declaration made only of shared documents fails closed like an empty one.
   A stored digest names its version, and `readVerificationStatus` now
   recomputes under THAT version (`parseFingerprintVersion`,
   `KNOWN_FINGERPRINT_VERSIONS`): a legacy v1 report keeps v1 semantics
   until it is re-fingerprinted, so the upgrade alone stales nothing; a
   version this build cannot recompute fails closed.

2. `verification.fingerprint` received a raw positional slice, so
   `--files a`, `--files "a,b"` and `--files a --files b` all put the literal
   token into the covered set and failed closed as "a covered file is
   missing, unreadable, or escapes the project root" — the message that
   convinced the reporting project the digest was permanently
   unrecomputable. `parseFingerprintFileArgs` accepts every form (plus
   `--files=a,b`, freely mixed with bare positionals), treats any other
   `--flag` and an empty `--files` value as usage errors that say so, and
   the phase-dir argument must now be an existing directory: omitting it
   used to take the first covered file as the phase dir and print a
   plausible digest over the rest at exit 0.

Regression tests (tests/verification-status.test.cjs, #4623 block): the
cross-phase case from the report, the same-phase `requirements
mark-complete` / `phase.complete` cases from the thread, a workstream-scoped
root, v1-preserved / unknown-version-stale, the fail-closed cases (missing,
directory, escaping symlink, all-shared), every `--files` form against the
bare form, the unknown-flag / empty-value / omitted-phase-dir errors, and
AC5's zero-file error. Verified failing against the pre-fix source: 29 of 34
fail, the 7 that pass pin behaviour the fix must leave unchanged.

Docs: CONTEXT.md Verification Module, agents/gsd-verifier.md's
covered_files instruction (rewritten in place — the file sits 21 bytes under
its LARGE hard cap), gsd-core/templates/verification-report.md.

Fixes #4623

Emitted-Drift-Ack-Growth: gsd-verifier.md — the #4155 covered_files instruction now states that planning-root docs are digest-inert (#4623); +18 bytes, under the LARGE cap
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCMY8P8s6dp4g3Rxu3nNAi

* chore(#4623): set changeset fragment pr to 4749

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
2026-09-16 05:26:44 -04:00
..

GSD Canonical Artifact Registry

This directory contains the template files for every artifact that GSD workflows officially produce. The table below is the authoritative index: if a .planning/ root file is not listed here, gsd-health will flag it as W019 (unrecognized artifact).

Agents should query this file before treating a .planning/ file as authoritative. If the file name does not appear below, it is not a canonical GSD artifact.


.planning/ Root Artifacts

These files live directly at .planning/ — not inside phase subdirectories.

File Template Produced by Purpose
PROJECT.md project.md /gsd:new-project Project identity, goals, requirements summary
ROADMAP.md roadmap.md /gsd:new-milestone, /gsd:new-project Phase plan with milestones and progress tracking
STATE.md state.md /gsd:new-project, /gsd:health --repair Current session state, active phase, last activity
REQUIREMENTS.md requirements.md /gsd:new-milestone Functional requirements with traceability
MILESTONES.md milestone.md /gsd:complete-milestone Log of completed milestones with accomplishments
BACKLOG.md (inline) /gsd-add-backlog Pending ideas and deferred work
LEARNINGS.md (inline) /gsd:extract-learnings, /gsd:execute-phase (gated: features.global_learnings) Phase retrospective learnings for future plans
THREADS.md (inline) /gsd:thread Persistent discussion threads
config.json config.json /gsd:new-project, /gsd:health --repair Project-specific GSD configuration
CLAUDE.md (inline) /gsd-profile Auto-assembled Claude Code context file
RETROSPECTIVE.md (inline) /gsd:complete-milestone Living milestone retrospective updated at each milestone close
WINDOWS.md (none) broken-windows ledger (src/broken-windows.cts) Tracked known-broken items pending resolution (#3224)
STATE-ARCHIVE.md (none) state.cts's cmdStatePrune Pruned historical STATE.md entries
milestone.lock (none) src/milestone-lock.cts Persistent milestone (phase + session) claim, unlike the transient STATE.md.lock/WAITING.json (#3311)
state.json (none) src/state-contract.cts Machine-readable state contract published at step boundaries (#3227)
skill-manifest.json (none) init.cts's cmdSkillManifest --write Project-scoped skill manifest (#3964)
PATTERNS.md (inline) /gsd:extract-learnings (graduation, workflows/graduation.md, patterns target) Graduated cross-phase patterns -- distinct from the per-phase NN-PATTERNS.md below (#4282)

Version-stamped artifacts (pattern: vX.Y-*.md)

Pattern Produced by Purpose
vX.Y-MILESTONE-AUDIT.md /gsd:audit-milestone Milestone audit report before archiving

These files are archived to .planning/milestones/ by /gsd:complete-milestone. Finding them at the .planning/ root after completion indicates the archive step was skipped.


Phase Subdirectory Artifacts (.planning/phases/NN-name/)

These files live inside a phase directory. They are NOT checked by W019 (which only inspects the .planning/ root).

File Pattern Template Produced by Purpose
NN-MM-PLAN.md phase-prompt.md /gsd:plan-phase Executable implementation plan
NN-MM-SUMMARY.md summary.md /gsd:execute-phase Post-execution summary with learnings
NN-CONTEXT.md context.md /gsd:discuss-phase Scoped discussion decisions for the phase
NN-RESEARCH.md research.md /gsd:plan-phase, /gsd:plan-phase --research-phase <N> Technical research for the phase
NN-VALIDATION.md VALIDATION.md /gsd:plan-phase (Nyquist) Validation architecture (Nyquist method)
NN-UAT.md UAT.md /gsd:validate-phase User acceptance test results
NN-PATTERNS.md (inline) /gsd:plan-phase (pattern mapper) Analog file mapping for the phase
NN-UI-SPEC.md UI-SPEC.md /gsd:ui-phase UI design contract
NN-SECURITY.md SECURITY.md /gsd:secure-phase Security threat model
NN-AI-SPEC.md AI-SPEC.md /gsd:ai-integration-phase AI integration spec with eval strategy
NN-DEBUG.md DEBUG.md /gsd:debug Debug session log
NN-REVIEWS.md (inline) /gsd:review Cross-AI review feedback

Milestone Archive (.planning/milestones/)

Files archived by /gsd:complete-milestone. These are never checked by W019.

File Pattern Source
vX.Y-ROADMAP.md Snapshot of ROADMAP.md at milestone close
vX.Y-REQUIREMENTS.md Snapshot of REQUIREMENTS.md at milestone close
vX.Y-MILESTONE-AUDIT.md Moved from .planning/ root
vX.Y-phases/ Archived phase directories (if --archive-phases used)

Adding a New Canonical Artifact

When a new workflow produces a .planning/ root file:

  1. Add the file name to CANONICAL_EXACT in gsd-core/bin/lib/artifacts.cjs
  2. Add a row to the .planning/ Root Artifacts table above
  3. Add the template to gsd-core/templates/ if one exists