Tom Boucher 60bc6ddd6e fix(#2568): commit the debug session doc on the manager-driven terminal path (#2731)
* test(#2568): failing-first contract for the debug manager's doc commit

agents/gsd-debug-session-manager.md contains zero occurrences of 'commit', so on
the manager-driven path — the normal /gsd-debug flow — nothing consults
commit_docs and session docs are left untracked. The step exists only in
gsd-debugger.md, which does not reach the end of a multi-cycle session.

Two layers. The spec placement is asserted against the shipped agent text because
that text is what the orchestrator executes; the commit_docs gate the fix relies
on is exercised behaviorally through the CLI in temp git projects, because 'the
CLI no-ops when disabled' is the assumption that makes calling it unconditionally
correct — asserting it in prose would be assuming the load-bearing part.

The most important case is the negative: CONTINUE_REQUIRED is non-terminal and
must NOT commit. A fix that satisfied the positive cases by committing
unconditionally would strand a half-finished session looking done, which is worse
than the bug.

RED expected on the five spec assertions; the three CLI gate tests pin existing
behavior and pass both sides.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

* fix(#2568): commit the debug session doc on the manager-driven terminal path

agents/gsd-debug-session-manager.md contained zero occurrences of "commit", so on
the normal /gsd-debug flow nothing ever consulted commit_docs and session docs
were left untracked — reproduced by the reporter across three consecutive real
sessions.

An obligation left behind during a responsibility move. gsd-debugger.md commits
the doc at :1214, but that runs only when the debugger carries a fix to completion
inside a single spawn. The multi-cycle manager took over checkpointing, fix
application, archival to resolved/, and the terminal summary — every step that
finishes a session — without the commit step. The debugger's copy still exists and
still works on its own path, so "is this handled anywhere" answered yes.

The manager now commits before both terminal shapes, and explicitly NOT on
CONTINUE_REQUIRED. That exclusion is the load-bearing part: the manager's own
contract already forbids fabricating a terminal summary on that path, and
committing there would be the same lie in git form — a half-finished session
stranded looking done. CHECKPOINT REACHED likewise does not commit.

Two facts kept the fix small. The manager already carries the gsd_run preamble
(:96, used at :97 for resolve-model), so no new plumbing. And cmdCommit
(src/commands.cts:809-814) already gates on commit_docs and returns
skipped_commit_docs_false when disabled — so the agent calls it unconditionally
and correctness follows from the CLI rather than from a second copy of the config
check that could drift. Calling git commit directly was rejected for exactly that
reason: it would bypass a user's explicit commit_docs:false.

In-session fix code is staged by specific file, never git add -A, which would
sweep unrelated working-tree changes into a debug commit.

Body-only edit — frontmatter untouched, so the research-profiles/AGENTS.md ripple
does not apply. gsd-debugger.md's own commit step is preserved; the single-spawn
path still ends there, and a double commit is harmless since the second finds
nothing to stage.

Fixes #2568

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

* fix(#2568): bind the commit paths, define gsd_run in-block, and make the fix commit idempotent

Three defects in my own first cut, all found by the isolated adversarial pass.

1. BLOCKER — {debug_dir} was a dangling substitution. I copied it verbatim from
   the issue's suggested patch without checking scope. It is a real variable in
   gsd-core/workflows/debug.md, where the ORCHESTRATOR receives it from init JSON
   and uses it to build debug_file_path — but this agent never receives it:
   <session_parameters> declares only slug, debug_file_path, symptoms_prefilled,
   tdd_mode, goal and specialist_dispatch_enabled. An unbound token makes --files
   resolve to a nonexistent path; cmdCommit skips missing explicit files, staging
   stays empty, and the doc silently never commits — reproducing #2568 through a
   different broken path. Same class as #2684's dangling placeholders. Now spelled
   literally as .planning/debug/resolved/{slug}.md, matching gsd-debugger.md:1214
   and this file's own prose.

2. MAJOR — gsd_run was undefined in the commit block's shell. Shell state does not
   persist across tool invocations, and the Step 2 preamble is ~230 lines and an
   entire spawn-and-loop earlier. gsd-debugger.md redeclares the full preamble
   immediately before each of its own call sites; the commit block now does the
   same, byte-identical to this file's existing definition.

3. MAJOR — the in-session fix commit was not idempotent. gsd-debugger.md's
   archive_session already commits the fix on the confirmed-checkpoint path, which
   is the standard find_and_fix flow, so `git add X && git commit` would hit an
   empty diff, exit non-zero, and abort the step before the summary was returned.
   Guarded with `git diff --cached --quiet || git commit`. The doc-commit half was
   already safe — query commit treats an empty diff as nothing_to_commit and exits
   0 — and that asymmetry is now stated rather than assumed.

Three tests added for exactly these, since the reviewer correctly noted the suite
would have caught none of them: every token substituted into a commit command must
be a declared session parameter; the preamble must sit in the same block as the
call with no step boundary between; and the fix commit must carry the staged-content
guard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

* fix(#2568): keep the single canonical gsd_run preamble

The previous commit added a second preamble to the commit block, on the isolated
review's theory that shell state does not persist across tool invocations. That
theory is reasonable in general and wrong for this corpus: the repo enforces
"each agent .md using gsd_run contains exactly ONE canonical preamble, before the
first gsd_run call". Adding a second broke that invariant and five suites with
it — the B-agents preamble check, runtime-launcher-parity, and three slash-
namespace guards.

The single Step 2 preamble already precedes the commit call, so coverage was
never actually missing. Reverted to one, and the test now asserts the real
property — exactly one preamble, positioned before the call that needs it —
rather than the locality I had wrongly encoded.

Recorded because the direction of the mistake matters: the review was right that
the question needed asking and wrong about the answer, and I shipped the wrong
answer without checking the invariant that already governs it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

* fix(#2568): use the canonical /gsd:debug slash form in the new prose

My explanatory sentence wrote `/gsd-debug`, the retired syntax. Three
slash-namespace guards caught it: the #3443 invariant, the #1975 folded
bug-2543 check, and the retired-syntax scan over Claude-facing source.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

* chore(#2568): backfill changeset PR number

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPq9ovaovP2UvSVLjD4Lso

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 20:10:11 -04:00

GSD Core

Git. Ship. Done.

English · Português · 简体中文 · 日本語 · 한국어

A light-weight meta-prompting, context engineering, and spec-driven development system for Claude Code, OpenCode, Antigravity CLI, Kimi CLI, Kilo, Codex, Copilot, Cursor, Windsurf, and more.

npm version npm downloads Tests Discord GitHub stars License


What is GSD Core

GSD Core is a context-engineering and spec-driven development framework that drives AI coding agents (Claude Code, Codex, Antigravity CLI, Kimi CLI, Copilot, Cursor, and more) through a disciplined phase loop. It solves context rot — the quality degradation that accumulates as an AI fills its context window — by running all heavy research, planning, and execution work in fresh-context subagents while keeping your main session lean.


How it works

Each milestone repeats the same five-step loop, one phase at a time:

  1. Discuss — capture implementation decisions before anything is planned
  2. Plan — research, decompose, and verify the plan fits a fresh context window
  3. Execute — run plans in parallel waves; each executor starts with a clean 200k-token context
  4. Verify — walk through what was built; diagnose and fix before declaring done
  5. Ship — create the PR, archive the phase, repeat for the next one

Quickstart

npx @opengsd/gsd-core@latest

The installer prompts for your runtime (Claude Code, OpenCode, Antigravity CLI, Kimi CLI, Kilo, Codex, Copilot, Cursor, Windsurf, and more) and whether to install globally or locally. The installer is required for cross-runtime compatibility — do not copy files from agents/ or commands/ directly.

On another runtime or without Node.js? See Install on your runtime.

Once installed, start a new project or onboard an existing repo:

/gsd-new-project   # greenfield project
/gsd-onboard       # existing codebase

New here? Follow Your first project for a guided walkthrough from install to first shipped phase, or Onboarding an existing codebase for brownfield setup.


Documentation

What's new in 1.7.0 → docs/whats-new-1.7.0.md

Tutorials — learning by doing:

How-to guides — task-focused recipes:

Reference — authoritative facts:

Explanation — concepts and design decisions:

Full index: docs/README.md. Other languages: 日本語 · 한국어 · Português · 简体中文.


Why it works

Most AI-coding setups fail at scale because context bloat silently degrades output quality, there is no shared memory between sessions, and nothing verifies that code actually works. GSD Core solves all three: heavy work runs in fresh subagents, structured artifacts like STATE.md and CONTEXT.md survive session boundaries, and the verify step walks through what was built and generates fix plans before a phase is declared done. See docs/explanation/context-engineering.md for the full reasoning.

Troubleshooting? See docs/how-to/recover-and-troubleshoot.md.


Community

Project Platform
gsd-opencode Original OpenCode port
Discord Community support

Star History

Star History Chart

License

MIT License. See LICENSE for details.


Claude Code is powerful. GSD Core makes it reliable.

Description
No description provided
Readme MIT 77 MiB
Languages
JavaScript 82.3%
TypeScript 17.4%
Shell 0.3%