* chore(#604): rename get-shit-done/ runtime directory to gsd-core/ Renames the installed runtime directory `get-shit-done/` to `gsd-core/` so the on-disk name matches the package (`@opengsd/gsd-core`), repo, and binary (`gsd-tools`). The npm package name and binary are unchanged; npx/npm consumers are unaffected. Mechanical (bulk, ~90% of the diff): - `git mv get-shit-done gsd-core` - Swept path/identifier references across the repo via `perl -pe 's/get-shit-done(?!-\w)/gsd-core/g'`. The negative lookahead preserves the five legitimate slug variants that are NOT the directory: get-shit-done-{OLD,cc,classic,cli,redux} (old package/repo names). - Build/manifest wiring: package.json (bin, files, coverage globs), tsconfig.build.json (outDir), ~86 .gitignore build-output entries, stryker.config.mjs, scan-ignore files, install.js path strings. - Frozen (not rewritten): CHANGELOG.md history; translated docs (README.<locale>.md and docs/{ja-JP,ko-KR,pt-BR,zh-CN}/). New logic (review here): - src/installer-migrations/003-rename-get-shit-done-to-gsd-core.cts: a proper ADR-0008 installer migration. On upgrade it walks the legacy `~/.claude/get-shit-done/` tree, classifies each file via the prior install manifest, and emits remove-managed / backup-and-remove for managed files while PRESERVING unknown user-added files. Symlink-safe (skips a symlinked root and symlinked entries; bounds-checks every path under configDir). The framework rolls back on install failure. Emptied dirs may remain (framework has no recursive dir-removal primitive) — documented. - scripts/lint-legacy-dir-name.cjs: CI regression guard forbidding the bare `get-shit-done` directory token (split token to avoid self-match; case- insensitive; `(?!-\w)` lookahead allows the slug variants; allowlists CHANGELOG, translated docs, and `gsd-allow-legacy-name` marker lines). Wired into the lint-tests CI job. - Restored scripts/lint-package-identity-drift.cjs detection regexes (the mechanical sweep had wrongly rewritten the old-name patterns it exists to detect) and marked them as intentional legacy references. - TDD tests for the migration and the guard; do.md slash-command guard regex tightened so a `/gsd-core/bin` path segment is not mistaken for a command; changeset + docs/installer-migrations.md row added. Breaking: the installed runtime path moves `~/.claude/get-shit-done/` -> `~/.claude/gsd-core/`. Migration 003 removes the stale legacy dir's managed files (preserving user files) on upgrade. Users with custom hooks/configs hardcoding the old path must update them. Closes #604 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): unsweep pending changesets + allowlist injection-example docs CI fixes for the rename PR: - Do not sweep pending .changeset/*.md (ephemeral release-note fragments, like CHANGELOG); reverted those body edits so 5 pre-existing malformed fragments (missing type/pr) no longer enter the PR diff and trip docs-lint. Allowlisted .changeset/ in the legacy-name guard accordingly. - Allowlisted TEST-EXAMPLES.md and docs/explanation/security-model.md in prompt-injection-scan.sh: they contain intentional injection examples / security-model prose; the path-reference rewrites are kept. CodeQL alerts on this PR are pre-existing (alert lines unchanged by this PR; none in the new migration/guard) and are out of scope for the rename. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): resolve CodeQL alerts surfaced on this PR The rename diff touched files carrying pre-existing CodeQL findings; per the no-pre-existing-dismissal rule, fixing every surfaced alert rather than waving them off. All behavior-preserving: - scripts/ci-test-scope.cjs: build the config-path match from string .includes() instead of a RegExp over an arg-derived value (js/regex-injection). - src/profile-output.cts: escape backslashes before pipe-escaping desc/safeName so the table-cell escape is complete (js/incomplete-sanitization). - tests/{bug-2643,bug-2808,docs-parity-live-registry}: two-pass HTML-comment strip so a bare/unclosed `<!--` cannot survive (js/incomplete-multi-character-sanitization). - tests/inline-plan-threshold: drop the no-op `\s`->`\s` identity replace, keep the meaningful POSIX-class conversion (js/identity-replacement). Verified: build:lib green; the touched test files + ci-test-scope + profile-output suites pass; lint:legacy-name clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): correctly resolve remaining CodeQL alerts (regex-injection + sanitization) The prior commit's fixes for two alerts were ineffective: - ci-test-scope.cjs js/regex-injection: the alert is the CLI-arg-derived `file` reaching static regex `.test(file)` calls (not the config rule). Removed ALL regex over file/t — startsWith/includes/=== string checks + an isWindowsHint helper — so there is no regex sink for the tainted value. - js/incomplete-multi-character-sanitization (3 test files): a single `.replace(/<!--...-->/g,'')` can let `<!--` re-form. Replaced with a fixpoint loop (replace until stable) plus a final bare-opener strip. Verified: no regex over file/t remains; ci-test-scope + the 3 test suites pass; lint:legacy-name clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): make ci-test-scope + comment-strippers regex-free to clear CodeQL CodeQL flags the regex PATTERNS syntactically (regex-injection on the --files arg split; incomplete-multi-character-sanitization on the <!--...--> replace), so loop fixes do not satisfy it. Made these paths regex-free: - ci-test-scope.cjs splitFiles: char-by-char separator tokenizer (no /[,\\s]+/). - 3 test files: indexOf/slice HTML-comment stripper (no .replace(/<!--/)). Behavior preserved; ci-test-scope + the 3 suites pass; guard clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): unblock security base64 scan on the large rename diff The security job hit its 10m timeout: base64-scan.sh choked on the binary test fixture tests/feat-3594-parser-property-style.test.cjs (embedded NUL/ non-UTF8 bytes -> thousands of bogus blobs + "ignored null byte" warnings), and the ~800-file rename diff is slow to scan regardless. - scripts/base64-scan.sh: skip binary-by-content files (grep -Iq .) — they can't carry base64-obfuscated *text* and feeding NUL bytes through the per-line scanner is pathologically slow. collect_files already filtered binary *extensions*; this catches binary *content* in text extensions. - .github/workflows/security-scan.yml: raise the security job timeout 10m->30m to accommodate very large diffs (the scan itself is unchanged). Verified locally: scan skips the fixture, 0 "ignored null byte" warnings, 0 findings, exit 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): sweep get-shit-done refs introduced by merging next The branch was updated with next (#614/#384/#618 etc.), which reference the get-shit-done/ dir (still named that on next). Swept the stale references in the merged files to gsd-core so the rename stays consistent and lint:legacy-name passes: - commands/gsd/discuss-phase.md (runtime-launcher shim paths) - src/core.cts (getAgentsDir layout comments) - tests/bug-384-agents-runtime-aware.test.cjs (require path to runtime lib) Verified: guard 0 violations; build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): exclude gsd-core/ path segments from bug-3683 command cross-ref invariant The #614 runtime-launcher shim added to discuss-phase.md references `${_GSD_RUNTIME_ROOT}/gsd-core/bin/...`. bug-3683's REF_PATTERN excluded path-y refs only via lookbehind, but `}` precedes `/gsd-core/` in the shim, so it mis-read the directory path as a dangling `/gsd-core` command ref (same class as the #604 bug-2954 fix). Added a trailing `(?![\w-]*\/)` so `/gsd-<x>/...` path segments are not treated as slash-command references. Verified locally on BOTH platforms before pushing: - mac (node 26) full suite: 0 failures - gsd-test-runner (linux, node22 image) full suite: 0 failures - bug-3683 + bug-2954 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): lazily resolve findProjectRoot in gsd-tools (harden flaky CI) CI intermittently failed state.test's gsd-tools subprocess with "findProjectRoot is not a function" (flip-flopping across legs; not reproducible on mac full suite, gsd-test linux full suite, test:unit, or state.test x8). findProjectRoot is a re-export from core.cjs (sourced from project-root.cjs); binding it via destructure at module-load can be undefined under a load-ordering edge. Resolve it lazily at call time via a small wrapper so the lookup happens after core.cjs is fully initialized. Verified green on BOTH platforms before pushing: - mac (node 26) full suite: 0 failures - gsd-test-runner (linux, node22) full suite: 0 failures - state.test.cjs: 106/106; gsd-tools loads cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#604): allowlist verification-patterns.md placeholder examples in secret scan The rename git-mv'd references/verification-patterns.md into gsd-core/, pulling it into the secret-scan diff. It documents stub/placeholder RED-FLAG env-var examples (illustrative Stripe test-key / database-URL / API-key placeholders) — not real credentials. Added it to .secretscanignore with the strict annotation, mirroring the existing gsd-core/workflows/plan-phase.md exception. Verified locally: secret-scan-lint --strict OK; secret-scan --diff origin/next exits 0 with 0 findings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 KiB
STATE.md schema reference
STATE.md is GSD Core's living project-memory file — a single Markdown document that records where a project stands, what happened last, and what to run next. This page documents its structure. See docs index.
Overview
Every project managed by GSD Core keeps one STATE.md at .planning/STATE.md. It is read at the start of every workflow and written after every significant action. The file combines:
- YAML frontmatter — machine-readable fields consumed by the status-line hook (
parseStateMd) and thegsd-tools statecommands. - Markdown body — human-readable sections covering current position, accumulated context, session continuity, and performance metrics.
The file is intentionally small (target: under 100 lines). It is a digest of the project's state, not an archive.
YAML frontmatter
Frontmatter appears between --- delimiters at the very start of the file. All fields except gsd_state_version and status are optional; fields may be absent when their data is not yet available.
Annotated example
---
gsd_state_version: '1.0'
milestone: v2.0
milestone_name: Code Quality
status: executing
# Phase-lifecycle fields — all optional (added in v1.40.0, issue #2833)
active_phase: "4.5"
next_action: execute-phase
next_phases: ["4.5"]
progress:
total_phases: 17
completed_phases: 10
total_plans: 84
completed_plans: 47
percent: 59
# Additional fields written by syncStateFrontmatter
current_phase: "4"
current_phase_name: Observability
current_plan: "3"
last_updated: "2026-06-01T12:34:56.789Z"
last_activity: "2026-06-01"
stopped_at: "Phase 4 P3 execution complete"
paused_at: null
---
Field reference
| Field | Type | When populated | Purpose |
|---|---|---|---|
gsd_state_version |
string ('1.0') |
Always | Schema version; written on first state.* call by syncStateFrontmatter. |
milestone |
string (e.g. v2.0) |
When a milestone is configured | Current milestone version, read from the project's config. |
milestone_name |
string | When a milestone is configured | Human-readable milestone label (e.g. Code Quality). |
status |
string | Always | Current lifecycle stage. Normalised by normalizeStateStatus() — see status values. |
active_phase |
string (e.g. "4.5") |
An orchestrator command is in flight on this phase | The phase number currently being processed. Set to null when between phases. |
next_action |
string | Idle, with a recommended command | The slash command to run next: discuss-phase, plan-phase, execute-phase, or verify-phase. Set to null when an orchestrator is in flight or no recommendation is available. |
next_phases |
YAML flow array (e.g. ["4.5"]) |
Goes with next_action |
The phase ID(s) the next_action applies to (typically 1–2 entries). Set to null under the same conditions as next_action. |
progress.total_phases |
integer | When phase data is available | Total number of phases in the current milestone, derived from ROADMAP.md and the phases directory. |
progress.completed_phases |
integer | When phase data is available | Number of phases that have all plan summaries on disk (i.e. every plan completed). |
progress.total_plans |
integer | When plan files exist | Sum of all plan files across phases in the current milestone. |
progress.completed_plans |
integer | When summary files exist | Sum of completed plan summaries (one SUMMARY.md per executed plan). |
progress.percent |
integer 0–100 | When progress data is available | Milestone progress in the phase dimension (min(completed_plans/total_plans, completed_phases/total_phases)). The status-line progress bar is only rendered when this field is present — its absence suppresses the bar. |
current_phase |
string | When a phase is executing | Phase number extracted from the body Current Phase: field. |
current_phase_name |
string | When a phase has a name | Phase name extracted from the body Current Phase Name: field. |
current_plan |
string | When a plan is in progress | Plan number extracted from the body Current Plan: field. |
last_updated |
ISO-8601 timestamp | Always (on write) | Timestamp of the last syncStateFrontmatter call; written by realClock.nowIso(). |
last_activity |
string | When set in body | Date of the last activity, extracted from the body Last Activity: field. |
stopped_at |
string | When a stop point was recorded | Description of the last completed action; scoped to the ## Session body section to avoid matching archive prose. |
paused_at |
string | When the project is paused | Freeform description of the pause point; absent or null when not paused. |
Status values
normalizeStateStatus() in gsd-core/bin/lib/state-document.cjs maps raw body text to these canonical values:
| Canonical value | Matched text (case-insensitive) |
|---|---|
discussing |
contains discussing |
planning |
contains planning or ready to plan |
executing |
contains executing, in progress, or ready to execute |
verifying |
contains verif |
completed |
contains complete or done |
paused |
contains paused or stopped, or paused_at is present |
unknown |
none of the above |
When an orchestrator command is in flight, the convention (issue #2833) is to write the lifecycle stage directly to status:
| Command | status while in flight |
|---|---|
/gsd-discuss-phase |
discussing |
/gsd-plan-phase |
planning |
/gsd-execute-phase |
executing |
/gsd-verify-work |
verifying |
Status-line rendering scenes
formatGsdState() in hooks/gsd-statusline.js reads the parsed frontmatter and emits the first matching scene. If no new lifecycle fields apply, rendering falls through to the original format byte-for-byte unchanged from v1.38.x.
| Scene | Trigger | Display example |
|---|---|---|
| 1. Phase active | active_phase is populated |
v2.0 [██░░░░░░░░] 20% · Phase 4.5 executing |
| 2. Idle, next recommended | active_phase is null AND both next_action and next_phases are populated |
v2.0 [██░░░░░░░░] 20% · next execute-phase 4.5 |
| 3. Milestone complete | percent is 100 OR completed_phases == total_phases |
v2.0 [██████████] 100% · milestone complete |
| 4. Default fallback | None of the above match | v1.9 Code Quality · executing · ph 1/5 (existing format) |
Scene priority: when both active_phase and next_action are populated, Scene 1 wins — an orchestrator is in flight, so a "next recommendation" would be misleading. This priority is enforced by check order in formatGsdState() and covered by the "scene priority" suite in tests/enh-2833-phase-lifecycle-statusline.test.cjs.
The progress bar ([██░░░░░░░░] 20%) is appended to the milestone segment only when progress.percent is present in frontmatter; absent means no bar.
Frontmatter parsing constraints
The status-line hook uses regex-based parsing (no full YAML library), so the following constraints apply. They are tested in tests/enh-2833-phase-lifecycle-statusline.test.cjs.
-
Frontmatter must start at the very first character of the file. Anything — including comments — above the opening
---invalidates the match. The opening---line must be exactly that, with no trailing spaces. -
Comments inside nested blocks are not supported. The
progress:block parser requires the next line to be[ \t]+\w+:. Inserting a# commentbetweenprogress:and its first key breaks the match and the bar disappears. Any documentation belongs in theSTATE.mdbody, not inside frontmatter blocks. -
next_phasesprimary format is single-line flow. The parser first triesnext_phases: ["4.5", "4.6"]. Block sequences (- 4.5\n- 4.6) are also parsed but are less reliable for status-line rendering. Prefer single-line flow fornext_phasesto keep the regex-based parser predictable. If many candidate phases need recording for documentation purposes, store them in theSTATE.mdbody.
If a future change replaces the regex parser with a full YAML library, these constraints can be relaxed and the tests updated accordingly.
Markdown body sections
The body (everything after the closing ---) follows the template in gsd-core/templates/state.md. The standard sections are:
Project Reference
Points to .planning/PROJECT.md. Contains:
- Core value — the one-liner from
PROJECT.md's Core Value section. - Current focus — which phase is active.
Current Position
Where the project stands right now:
| Field | Format |
|---|---|
Phase: |
X of Y (Phase name) |
Plan: |
A of B in current phase |
Status: |
Free text, e.g. Ready to execute, Executing Phase 4, Phase complete — ready for verification |
Last activity: |
ISO date (YYYY-MM-DD) when handler-written; narrative prose when executor-authored |
Progress: |
Visual bar, e.g. [████░░░░░░] 40% |
The Status: and Last activity: fields in this section are updated by GSD handlers when the existing value is a known template default (Knuth invariant: executor-authored values are preserved). The full list of known handler defaults is in KNOWN_TEMPLATE_DEFAULTS inside gsd-core/bin/lib/state-document.cjs.
Performance Metrics
Execution velocity tracking:
- Total plans completed, average duration per plan.
- Per-phase breakdown table (
Phase | Plans | Total | Avg/Plan). - Recent trend: Improving / Stable / Degrading.
Updated after each plan completion.
Accumulated Context
Decisions — a summary of recent decisions affecting current work (full log lives in PROJECT.md). Added via gsd-tools state add-decision.
Pending Todos — count and reference to .planning/todos/pending/. Captured via /gsd-capture.
Blockers/Concerns — issues affecting future work, prefixed with the originating phase. Added via gsd-tools state add-blocker; resolved via gsd-tools state resolve-blocker.
Session Continuity
Enables instant session resumption:
Last session:— ISO-8601 timestamp of the last session.Stopped at:— description of the last completed action.Resume file:— path to a.continue-here*.mdfile if one exists, otherwiseNone.
Backward compatibility
The phase-lifecycle fields (active_phase, next_action, next_phases, and progress.percent for the bar) are additive and opt-in per project:
- A
STATE.mdwith none of the lifecycle fields populated renders byte-for-byte identically to v1.38.x and earlier. - Adding any lifecycle field is opt-in — the renderer degrades gracefully when fields are absent.
- The progress bar is opt-in even when the
progressblock exists: onlyprogress.percenttriggers the bar;total_phasesandcompleted_phasesalone do not.
The formatGsdState #2833 backward compatibility test suite in tests/enh-2833-phase-lifecycle-statusline.test.cjs locks this guarantee; any change that breaks legacy STATE.md rendering will fail the suite.