Spaces:
Runtime error
A newer version of the Gradio SDK is available: 6.26.0
Auto Mode Detection
Check if --auto flag is present in $ARGUMENTS.
If auto mode:
- Skip brownfield mapping offer (assume greenfield)
- Skip deep questioning (extract context from provided document)
- Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
- After config: run Steps 6-9 automatically with smart defaults:
- Research: Always yes
- Requirements: Include all table stakes + features from provided document
- Requirements approval: Auto-approve
- Roadmap approval: Auto-approve
Document requirement: Auto mode requires an idea document β either:
- File reference:
/gsd-new-project --auto @prd.md - Pasted/written text in the prompt
If no document content provided, error:
Error: --auto requires an idea document.
Usage:
/gsd-new-project --auto @your-idea.md
/gsd-new-project --auto [paste or write your idea here]
The document should describe what you want to build.
1. Setup
MANDATORY FIRST STEP β Execute these checks before ANY user interaction:
_GSD_SHIM_NAME="gsd-tools.cjs"; _GSD_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; GSD_TOOLS="${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${GSD_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${GSD_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
INIT=$(gsd_run query init.new-project)
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
AGENT_SKILLS_RESEARCHER=$(gsd_run query agent-skills gsd-project-researcher)
AGENT_SKILLS_SYNTHESIZER=$(gsd_run query agent-skills gsd-research-synthesizer)
AGENT_SKILLS_ROADMAPPER=$(gsd_run query agent-skills gsd-roadmapper)
Parse JSON for: researcher_model, synthesizer_model, roadmapper_model, commit_docs, project_exists, has_codebase_map, planning_exists, has_existing_code, has_package_file, is_brownfield, needs_codebase_map, has_git, git_worktree_root, in_nested_subdir, project_path, agents_installed, missing_agents, agent_runtime, agents_dir, required_agents, required_agents_installed, missing_required_agents, agent_skill_payloads_available, agent_skill_payload_agents.
If agents_installed is false: Display a warning before proceeding:
β GSD agents not installed. The following agents are missing from your agents directory:
{missing_agents joined with newline}
Runtime checked: {agent_runtime}
Agents directory checked: {agents_dir}
Required new-project agents missing:
{missing_required_agents joined with newline, or "none"}
Agent skill payloads available: {agent_skill_payloads_available}
Agent skill payload agents:
{agent_skill_payload_agents joined with newline, or "none"}
Skill payloads only provide prompt context. Named subagent spawns still require agent
definitions to be installed for this runtime.
Subagent spawns (gsd-project-researcher, gsd-research-synthesizer, gsd-roadmapper) will fail
with "agent type not found" if `required_agents_installed` is false. Run the installer with --global to make agents available:
npx @opengsd/gsd-core@latest --global
Proceeding without research subagents β roadmap will be generated inline.
Skip Steps 6β7 (parallel research and synthesis) and proceed directly to roadmap creation in Step 8.
Detect runtime and set instruction file name:
Derive RUNTIME from the invoking prompt's execution_context path:
- Path contains
/.codex/βRUNTIME=codex - Path contains
/.gemini/βRUNTIME=gemini - Path contains
/.config/opencode/or/.opencode/βRUNTIME=opencode - Otherwise β
RUNTIME=claude
If execution_context path is not available, fall back to env vars:
if [ -n "$CODEX_HOME" ]; then RUNTIME="codex"
elif [ -n "$GEMINI_CONFIG_DIR" ]; then RUNTIME="gemini"
elif [ -n "$OPENCODE_CONFIG_DIR" ] || [ -n "$OPENCODE_CONFIG" ]; then RUNTIME="opencode"
else RUNTIME="claude"; fi
Set the instruction file variable:
if [ "$RUNTIME" = "codex" ]; then INSTRUCTION_FILE="AGENTS.md"; else INSTRUCTION_FILE=".claude/AGENTS.md"; fi
All subsequent references to the project instruction file use $INSTRUCTION_FILE.
If project_exists is true: Error β project already initialized. Use /gsd-progress.
Git init (#3491 β never nest .git inside an existing worktree):
- If
has_gittrue andin_nested_subdirtrue: skipgit init; warnβ Initializing inside existing worktree (${git_worktree_root}); planning files will track to outer repo. - If
has_gittrue andin_nested_subdirfalse: skipgit init(already at worktree root). - If
has_gitfalse:git init.
2. Brownfield Offer
If auto mode: Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
If needs_codebase_map is true (from init β existing code detected but no codebase map):
Text mode (workflow.text_mode: true in config or --text flag): Set TEXT_MODE=true if --text is present in $ARGUMENTS OR text_mode from init JSON is true. When TEXT_MODE is active, replace every question call with a plain-text numbered list and ask the user to type their choice number. This is required for non-the agent runtimes (OpenAI Codex, Gemini CLI, etc.) where question is not available.
Use question:
- header: "Codebase"
- question: "I detected existing code in this directory. Would you like to map the codebase first?"
- options:
- "Map codebase first" β Run /gsd-map-codebase to understand existing architecture (Recommended)
- "Skip mapping" β Proceed with project initialization
If "Map codebase first":
Run `/gsd-map-codebase` first, then return to `/gsd-new-project`
Exit command.
If "Skip mapping" OR needs_codebase_map is false: Continue to Step 3.
2a. Auto Mode Config (auto mode only)
If auto mode: Collect config settings upfront before processing the idea document.
YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
Round 1 β Core settings (3 questions, no Mode question):
question([
{
header: "Granularity",
question: "How finely should scope be sliced into phases?",
multiSelect: false,
options: [
{ label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
{ label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
]
},
{
header: "Execution",
question: "Run plans in parallel?",
multiSelect: false,
options: [
{ label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
{ label: "Sequential", description: "One plan at a time" }
]
},
{
header: "Git Tracking",
question: "Commit planning docs to git?",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
{ label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
]
}
])
Round 2 β Workflow agents (same as Step 5):
question([
{
header: "Research",
question: "Research before planning each phase? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
{ label: "No", description: "Plan directly from requirements" }
]
},
{
header: "Plan Check",
question: "Verify plans will achieve their goals? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
{ label: "No", description: "Execute plans without verification" }
]
},
{
header: "Verifier",
question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
{ label: "No", description: "Trust execution, skip verification" }
]
},
{
header: "Drift Guard",
question: "Enable the plan drift-guard? It verifies that symbols your plans cite (decorators, classes, functions, CLI flags) actually exist in your source at review time, catching hallucinated names before execution. [Y/n]",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Resolve symbol references against live source during plan review β catches hallucinated names before execution" },
{ label: "No", description: "Skip symbol grounding β plan review proceeds without source verification" }
]
},
{
header: "AI Models",
question: "Which AI models for planning agents?",
multiSelect: false,
options: [
{ label: "Balanced (Recommended)", description: "Sonnet for most agents β good quality/cost ratio" },
{ label: "Quality", description: "Opus for research/roadmap β higher cost, deeper analysis" },
{ label: "Budget", description: "Haiku where possible β fastest, lowest cost" },
{ label: "Inherit", description: "Use the current session model for all agents (OpenCode /model)" }
]
}
])
Round 3 β PR body onboarding:
Ask which optional PRD-style sections /gsd-ship should append to generated PR bodies. These map to ship.pr_body_sections; selected sections are written with "enabled": true, unselected seeded sections are written with "enabled": false so the project can enable them later without editing ship.md.
Prefer lean/agile PRD sections that make the delivered increment clear: user stories, acceptance criteria, Definition of Done or release criteria, risks, dependencies, and stakeholder review.
question([
{
header: "PR Body",
question: "Which optional PRD-style sections should /gsd-ship include in PR bodies?",
multiSelect: true,
options: [
{ label: "User Stories & Acceptance Criteria", description: "Append user-facing stories and acceptance checks from REQUIREMENTS.md" },
{ label: "Risks & Dependencies", description: "Append rollout risks, dependencies, and rollback notes from PLAN.md" },
{ label: "Success Metrics & Release Criteria", description: "Append measurable Definition of Done and release checks for stakeholder review" },
{ label: "Stakeholder Review & Approval", description: "Append approval checklist for projects that need sign-off traceability" }
]
}
])
Build ship.pr_body_sections from those choices. For selected options, set enabled: true; for seeded but unselected options, set enabled: false. If the user selects none, use "ship":{"pr_body_sections":[]}.
Create .planning/config.json with all settings (CLI fills in remaining defaults automatically):
mkdir -p .planning
gsd_run query config-new-project '{"mode":"yolo","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":true|false,"auto_advance":true},"plan_review":{"source_grounding":true|false},"ship":{"pr_body_sections":[{"heading":"User Stories & Acceptance Criteria","enabled":true|false,"source":"REQUIREMENTS.md ## User Stories || REQUIREMENTS.md ## Acceptance Criteria","fallback":"- Acceptance criteria are covered by the linked requirements and verification evidence."},{"heading":"Risks & Dependencies","enabled":true|false,"source":"PLAN.md ## Risks || PLAN.md ## Dependencies","fallback":"- No known high-risk rollout dependencies."},{"heading":"Success Metrics & Release Criteria","enabled":true|false,"source":"REQUIREMENTS.md ## Definition of Done || VERIFICATION.md ## Release Criteria","fallback":"- Release when automated verification and required manual checks pass."},{"heading":"Stakeholder Review & Approval","enabled":true|false,"template":"- Product owner approval pending for {phase_name}."}]}}'
If commit_docs = No: Add .planning/ to .gitignore.
Commit config.json:
mkdir -p .planning
gsd_run query commit "chore: add project config" --files .planning/config.json
Persist auto-advance chain flag to config (survives context compaction):
gsd_run query config-set workflow._auto_chain_active true
Proceed to Step 4 (skip Steps 3 and 5).
2b. Prior Spike/Sketch Detection
Check for existing spike and sketch work that should inform project setup:
# Check for spike findings skill (project-local)
SPIKE_SKILL=$(ls ./.opencode/skills/spike-findings-*/SKILL.md 2>/dev/null | head -1 || true)
# Check for sketch findings skill (project-local)
SKETCH_SKILL=$(ls ./.opencode/skills/sketch-findings-*/SKILL.md 2>/dev/null | head -1 || true)
# Check for raw spikes/sketches in .planning/
HAS_SPIKES=$(ls .planning/spikes/MANIFEST.md 2>/dev/null)
HAS_SKETCHES=$(ls .planning/sketches/MANIFEST.md 2>/dev/null)
If any of these exist, surface them before questioning:
β‘ Prior exploration detected:
{if SPIKE_SKILL} β Spike findings skill: {path} β validated patterns from experiments
{if SKETCH_SKILL} β Sketch findings skill: {path} β validated design decisions
{if HAS_SPIKES && !SPIKE_SKILL} β Raw spikes in .planning/spikes/ β consider `/gsd-spike --wrap-up` to package findings
{if HAS_SKETCHES && !SKETCH_SKILL} β Raw sketches in .planning/sketches/ β consider `/gsd-sketch --wrap-up` to package findings
These findings will be incorporated into project context and available to planning agents.
If spike/sketch findings skills exist, read their SKILL.md files to inform the questioning phase β they contain validated patterns, constraints, and design decisions that should shape the project definition.
3. Deep Questioning
If auto mode: Skip (already handled in Step 2a). Extract project context from provided document instead and proceed to Step 4.
Display stage banner:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ QUESTIONING
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Open the conversation:
Ask inline (freeform, NOT question):
"What do you want to build?"
Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
Research-before-questions mode: Check if workflow.research_before_questions is enabled in .planning/config.json (or the config from init context). When enabled, before asking follow-up questions about a topic area:
- Do a brief web search for best practices related to what the user described
- Mention key findings naturally as you ask questions (e.g., "Most projects like this use X β is that what you're thinking, or something different?")
- This makes questions more informed without changing the conversational flow
When disabled (default), ask questions directly as before.
Follow the thread:
Based on what they said, ask follow-up questions that dig into their response. Use question with options that probe what they mentioned β interpretations, clarifications, concrete examples.
Keep following threads. Each answer opens new threads to explore. Ask about:
- What excited them
- What problem sparked this
- What they mean by vague terms
- What it would actually look like
- What's already decided
Consult questioning.md for techniques:
- Challenge vagueness
- Make abstract concrete
- Surface assumptions
- Find edges
- Reveal motivation
Check context (background, not out loud):
As you go, mentally check the context checklist from questioning.md. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
Decision gate:
When you could write a clear PROJECT.md, use question:
- header: "Ready?"
- question: "I think I understand what you're after. Ready to create PROJECT.md?"
- options:
- "Create PROJECT.md" β Let's move forward
- "Keep exploring" β I want to share more / ask me more
If "Keep exploring" β ask what they want to add, or identify gaps and probe naturally.
Loop until "Create PROJECT.md" selected.
4. Write PROJECT.md
If auto mode: Synthesize from provided document. No "Ready?" gate was shown β proceed directly to commit.
Synthesize all context into .planning/PROJECT.md using the template from templates/project.md.
For greenfield projects:
Initialize requirements as hypotheses:
## Requirements
### Validated
(None yet β ship to validate)
### Active
- [ ] [Requirement 1]
- [ ] [Requirement 2]
- [ ] [Requirement 3]
### Out of Scope
- [Exclusion 1] β [why]
- [Exclusion 2] β [why]
All Active requirements are hypotheses until shipped and validated.
For brownfield projects (codebase map exists):
Infer Validated requirements from existing code:
- Read
.planning/codebase/ARCHITECTURE.mdandSTACK.md - Identify what the codebase already does
- These become the initial Validated set
## Requirements
### Validated
- β [Existing capability 1] β existing
- β [Existing capability 2] β existing
- β [Existing capability 3] β existing
### Active
- [ ] [New requirement 1]
- [ ] [New requirement 2]
### Out of Scope
- [Exclusion 1] β [why]
Key Decisions:
Initialize with any decisions made during questioning:
## Key Decisions
| Decision | Rationale | Outcome |
|----------|-----------|---------|
| [Choice from questioning] | [Why] | β Pending |
Last updated footer:
---
*Last updated: [date] after initialization*
Evolution section (include at the end of PROJECT.md, before the footer):
## Evolution
This document evolves at phase transitions and milestone boundaries.
**After each phase transition** (via `/gsd-transition`):
1. Requirements invalidated? β Move to Out of Scope with reason
2. Requirements validated? β Move to Validated with phase reference
3. New requirements emerged? β Add to Active
4. Decisions to log? β Add to Key Decisions
5. "What This Is" still accurate? β Update if drifted
**After each milestone** (via `/gsd-complete-milestone`):
1. Full review of all sections
2. Core Value check β still the right priority?
3. Audit Out of Scope β reasons still valid?
4. Update Context with current state
Do not compress. Capture everything gathered.
Commit PROJECT.md:
mkdir -p .planning
gsd_run query commit "docs: initialize project" --files .planning/PROJECT.md
5. Workflow Preferences
If auto mode: Skip β config was collected in Step 2a. Proceed to Step 5.5.
Check for global defaults at ~/.gsd/defaults.json. If the file exists, read and display its contents before asking:
DEFAULTS_RAW=$(cat ~/.gsd/defaults.json 2>/dev/null)
Format the JSON into human-readable bullets using these label mappings:
modeβ "Mode"granularityβ "Granularity"parallelizationβ "Execution" (trueβ "Parallel",falseβ "Sequential")commit_docsβ "Git Tracking" (trueβ "Yes",falseβ "No")model_profileβ "AI Models"workflow.researchβ "Research" (trueβ "Yes",falseβ "No")workflow.plan_checkβ "Plan Check" (trueβ "Yes",falseβ "No")workflow.verifierβ "Verifier" (trueβ "Yes",falseβ "No")plan_review.source_groundingβ "Drift Guard" (trueβ "Yes",falseβ "No")
Display above the prompt:
Your saved defaults (~/.gsd/defaults.json):
β’ Mode: [value]
β’ Granularity: [value]
β’ Execution: [Parallel|Sequential]
β’ Git Tracking: [Yes|No]
β’ AI Models: [value]
β’ Research: [Yes|No]
β’ Plan Check: [Yes|No]
β’ Verifier: [Yes|No]
β’ Drift Guard: [Yes|No]
Then ask:
question([
{
question: "Use these saved defaults?",
header: "Defaults",
multiSelect: false,
options: [
{ label: "Use as-is (Recommended)", description: "Proceed with the defaults shown above" },
{ label: "Modify some settings", description: "Keep defaults, change a few" },
{ label: "Configure fresh", description: "Walk through all questions from scratch" }
]
}
])
If "Use as-is": use the defaults values for config.json and skip directly to Commit config.json below.
If "Modify some settings": present a selection of every setting with its current saved value.
If TEXT_MODE is active (non-the agent runtimes): display a numbered list and ask the user to type the numbers of settings they want to change (comma-separated). Parse the response and proceed.
Which settings do you want to change? (enter numbers, comma-separated)
1. Mode β Currently: [value]
2. Granularity β Currently: [value]
3. Execution β Currently: [Parallel|Sequential]
4. Git Tracking β Currently: [Yes|No]
5. AI Models β Currently: [value]
6. Research β Currently: [Yes|No]
7. Plan Check β Currently: [Yes|No]
8. Verifier β Currently: [Yes|No]
9. Drift Guard β Currently: [Yes|No]
Otherwise (the agent runtime with question): use a two-block split to stay within the 4-option runtime cap.
question([
{
question: "Do you want to change any core workflow settings (Mode, Granularity, Execution, Git Tracking)?",
header: "Core Settings",
multiSelect: false,
options: [
{ label: "Yes", description: "Choose from core workflow settings" },
{ label: "No", description: "Skip core workflow settings" }
]
}
])
If "Yes", ask:
question([
{
question: "Which core workflow settings do you want to change?",
header: "Core Select",
multiSelect: true,
options: [
{ label: "Mode", description: "Currently: [value]" },
{ label: "Granularity", description: "Currently: [value]" },
{ label: "Execution", description: "Currently: [Parallel|Sequential]" },
{ label: "Git Tracking", description: "Currently: [Yes|No]" }
]
}
])
Then ask:
question([
{
question: "Do you want to change any model/agent settings (AI Models, Research, Plan Check, Verifier)?",
header: "Agent Settings",
multiSelect: false,
options: [
{ label: "Yes", description: "Choose from model/agent settings" },
{ label: "No", description: "Skip model/agent settings" }
]
}
])
If "Yes", ask:
question([
{
question: "Which model/agent settings do you want to change?",
header: "Agent Select",
multiSelect: true,
options: [
{ label: "AI Models", description: "Currently: [value]" },
{ label: "Research", description: "Currently: [Yes|No]" },
{ label: "Plan Check", description: "Currently: [Yes|No]" },
{ label: "Verifier", description: "Currently: [Yes|No]" }
]
}
])
Then ask:
question([
{
question: "Do you want to change the Drift Guard setting (plan-review source-grounding)?",
header: "Drift Guard",
multiSelect: false,
options: [
{ label: "Yes", description: "Toggle Drift Guard (currently: [Yes|No])" },
{ label: "No", description: "Keep current Drift Guard setting" }
]
}
])
For each selected setting across both blocks, ask only that question using the option set from Round 1 / Round 2 below. Merge user answers over the saved defaults β unchanged settings retain their saved values. Then skip to Commit config.json.
If "Configure fresh" or ~/.gsd/defaults.json doesn't exist: proceed with the questions below.
Round 1 β Core workflow settings (4 questions):
questions: [
{
header: "Mode",
question: "How do you want to work?",
multiSelect: false,
options: [
{ label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
{ label: "Interactive", description: "Confirm at each step" }
]
},
{
header: "Granularity",
question: "How finely should scope be sliced into phases?",
multiSelect: false,
options: [
{ label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
{ label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
]
},
{
header: "Execution",
question: "Run plans in parallel?",
multiSelect: false,
options: [
{ label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
{ label: "Sequential", description: "One plan at a time" }
]
},
{
header: "Git Tracking",
question: "Commit planning docs to git?",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
{ label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
]
}
]
Round 2 β Workflow agents:
These spawn additional agents during planning/execution. They add tokens and time but improve quality.
| Agent | When it runs | What it does |
|---|---|---|
| Researcher | Before planning each phase | Investigates domain, finds patterns, surfaces gotchas |
| Plan Checker | After plan is created | Verifies plan actually achieves the phase goal |
| Verifier | After phase execution | Confirms must-haves were delivered |
All recommended for important projects. Skip for quick experiments.
questions: [
{
header: "Research",
question: "Research before planning each phase? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
{ label: "No", description: "Plan directly from requirements" }
]
},
{
header: "Plan Check",
question: "Verify plans will achieve their goals? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
{ label: "No", description: "Execute plans without verification" }
]
},
{
header: "Verifier",
question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
{ label: "No", description: "Trust execution, skip verification" }
]
},
{
header: "AI Models",
question: "Which AI models for planning agents?",
multiSelect: false,
options: [
{ label: "Balanced (Recommended)", description: "Sonnet for most agents β good quality/cost ratio" },
{ label: "Quality", description: "Opus for research/roadmap β higher cost, deeper analysis" },
{ label: "Budget", description: "Haiku where possible β fastest, lowest cost" },
{ label: "Inherit", description: "Use the current session model for all agents (OpenCode /model)" }
]
}
]
PR body onboarding: Ask which optional PRD-style sections /gsd-ship should append to generated PR bodies. Use the same ship.pr_body_sections mapping as Step 2a: selected sections get enabled: true, seeded-but-unselected sections get enabled: false, and selecting none writes an empty list. Prefer lean/agile PRD sections that make user value, acceptance criteria, Definition of Done, and stakeholder traceability explicit.
Recommended options:
User Stories & Acceptance CriteriaRisks & DependenciesSuccess Metrics & Release CriteriaStakeholder Review & Approval
Create .planning/config.json with all settings (CLI fills in remaining defaults automatically):
mkdir -p .planning
gsd_run query config-new-project '{"mode":"[yolo|interactive]","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":[false if granularity=coarse, true otherwise]},"plan_review":{"source_grounding":true|false},"ship":{"pr_body_sections":[{"heading":"User Stories & Acceptance Criteria","enabled":true|false,"source":"REQUIREMENTS.md ## User Stories || REQUIREMENTS.md ## Acceptance Criteria","fallback":"- Acceptance criteria are covered by the linked requirements and verification evidence."},{"heading":"Risks & Dependencies","enabled":true|false,"source":"PLAN.md ## Risks || PLAN.md ## Dependencies","fallback":"- No known high-risk rollout dependencies."},{"heading":"Success Metrics & Release Criteria","enabled":true|false,"source":"REQUIREMENTS.md ## Definition of Done || VERIFICATION.md ## Release Criteria","fallback":"- Release when automated verification and required manual checks pass."},{"heading":"Stakeholder Review & Approval","enabled":true|false,"template":"- Product owner approval pending for {phase_name}."}]}}'
Note: Run /gsd-settings anytime to update model profile, workflow agents, branching strategy, and other preferences.
If commit_docs = No:
- Set
commit_docs: falsein config.json - Add
.planning/to.gitignore(create if needed)
If commit_docs = Yes:
- No additional gitignore entries needed
Commit config.json:
gsd_run query commit "chore: add project config" --files .planning/config.json
5.1. Sub-Repo Detection
Detect multi-repo workspace:
Check for directories with their own .git folders (separate repos within the workspace):
find . -maxdepth 1 -type d -not -name ".*" -not -name "node_modules" -exec test -d "{}/.git" \; -print
If sub-repos found:
Strip the ./ prefix to get directory names (e.g., ./backend β backend).
Use question:
- header: "Multi-Repo Workspace"
- question: "I detected separate git repos in this workspace. Which directories contain code that GSD should commit to?"
- multiSelect: true
- options: one option per detected directory
- "[directory name]" β Separate git repo
If user selects one or more directories:
- Set
planning.sub_reposin config.json to the selected directory names array (e.g.,["backend", "frontend"]) - Auto-set
planning.commit_docstofalse(planning docs stay local in multi-repo workspaces) - Add
.planning/to.gitignoreif not already present
Config changes are saved locally β no commit needed since commit_docs is false in multi-repo mode.
If no sub-repos found or user selects none: Continue with no changes to config.
5.5. Resolve Model Profile
Use models from init: researcher_model, synthesizer_model, roadmapper_model.
6. Research Decision
If auto mode: Default to "Research first" without asking.
Use question:
- header: "Research"
- question: "Research the domain ecosystem before defining requirements?"
- options:
- "Research first (Recommended)" β Discover standard stacks, expected features, architecture patterns
- "Skip research" β I know this domain well, go straight to requirements
If "Research first":
Display stage banner:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ RESEARCHING
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Researching [domain] ecosystem...
Create research directory:
mkdir -p .planning/research
Determine milestone context:
Check if this is greenfield or subsequent milestone:
- If no "Validated" requirements in PROJECT.md β Greenfield (building from scratch)
- If "Validated" requirements exist β Subsequent milestone (adding to existing app)
Display spawning indicator:
β Spawning 4 researchers in parallel... (each runs in a subagent β no output until they return, ~1β5 min; expected, not a freeze)
β Stack research
β Features research
β Architecture research
β Pitfalls research
Spawn 4 parallel gsd-project-researcher agents with path references:
Agent(prompt="<research_type>
Project Research β Stack dimension for [domain].
</research_type>
<milestone_context>
[greenfield OR subsequent]
Greenfield: Research the standard stack for building [domain] from scratch.
Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
</milestone_context>
<question>
What's the standard 2025 stack for [domain]?
</question>
<files_to_read>
- {project_path} (Project context and goals)
</files_to_read>
${AGENT_SKILLS_RESEARCHER}
<downstream_consumer>
Your STACK.md feeds into roadmap creation. Be prescriptive:
- Specific libraries with versions
- Clear rationale for each choice
- What NOT to use and why
</downstream_consumer>
<quality_gate>
- [ ] Versions are current (verify with Context7/official docs, not training data)
- [ ] Rationale explains WHY, not just WHAT
- [ ] Confidence levels assigned to each recommendation
</quality_gate>
<output>
Write to: .planning/research/STACK.md
Use template: /Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/templates/research-project/STACK.md
</output>
", subagent_type="gsd-project-researcher", model="{researcher_model}", description="Stack research")
Agent(prompt="<research_type>
Project Research β Features dimension for [domain].
</research_type>
<milestone_context>
[greenfield OR subsequent]
Greenfield: What features do [domain] products have? What's table stakes vs differentiating?
Subsequent: How do [target features] typically work? What's expected behavior?
</milestone_context>
<question>
What features do [domain] products have? What's table stakes vs differentiating?
</question>
<files_to_read>
- {project_path} (Project context)
</files_to_read>
${AGENT_SKILLS_RESEARCHER}
<downstream_consumer>
Your FEATURES.md feeds into requirements definition. Categorize clearly:
- Table stakes (must have or users leave)
- Differentiators (competitive advantage)
- Anti-features (things to deliberately NOT build)
</downstream_consumer>
<quality_gate>
- [ ] Categories are clear (table stakes vs differentiators vs anti-features)
- [ ] Complexity noted for each feature
- [ ] Dependencies between features identified
</quality_gate>
<output>
Write to: .planning/research/FEATURES.md
Use template: /Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/templates/research-project/FEATURES.md
</output>
", subagent_type="gsd-project-researcher", model="{researcher_model}", description="Features research")
Agent(prompt="<research_type>
Project Research β Architecture dimension for [domain].
</research_type>
<milestone_context>
[greenfield OR subsequent]
Greenfield: How are [domain] systems typically structured? What are major components?
Subsequent: How do [target features] integrate with existing [domain] architecture?
</milestone_context>
<question>
How are [domain] systems typically structured? What are major components?
</question>
<files_to_read>
- {project_path} (Project context)
</files_to_read>
${AGENT_SKILLS_RESEARCHER}
<downstream_consumer>
Your ARCHITECTURE.md informs phase structure in roadmap. Include:
- Component boundaries (what talks to what)
- Data flow (how information moves)
- Suggested build order (dependencies between components)
</downstream_consumer>
<quality_gate>
- [ ] Components clearly defined with boundaries
- [ ] Data flow direction explicit
- [ ] Build order implications noted
</quality_gate>
<output>
Write to: .planning/research/ARCHITECTURE.md
Use template: /Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/templates/research-project/ARCHITECTURE.md
</output>
", subagent_type="gsd-project-researcher", model="{researcher_model}", description="Architecture research")
Agent(prompt="<research_type>
Project Research β Pitfalls dimension for [domain].
</research_type>
<milestone_context>
[greenfield OR subsequent]
Greenfield: What do [domain] projects commonly get wrong? Critical mistakes?
Subsequent: What are common mistakes when adding [target features] to [domain]?
</milestone_context>
<question>
What do [domain] projects commonly get wrong? Critical mistakes?
</question>
<files_to_read>
- {project_path} (Project context)
</files_to_read>
${AGENT_SKILLS_RESEARCHER}
<downstream_consumer>
Your PITFALLS.md prevents mistakes in roadmap/planning. For each pitfall:
- Warning signs (how to detect early)
- Prevention strategy (how to avoid)
- Which phase should address it
</downstream_consumer>
<quality_gate>
- [ ] Pitfalls are specific to this domain (not generic advice)
- [ ] Prevention strategies are actionable
- [ ] Phase mapping included where relevant
</quality_gate>
<output>
Write to: .planning/research/PITFALLS.md
Use template: /Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/templates/research-project/PITFALLS.md
</output>
", subagent_type="gsd-project-researcher", model="{researcher_model}", description="Pitfalls research")
ORCHESTRATOR RULE β CODEX RUNTIME: After calling all 4 researcher Agent() calls above, do NOT read research files or synthesize content independently while the subagents are active. Wait for all 4 researchers to complete before spawning the synthesizer. This prevents duplicate work and wasted context.
After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
Agent(prompt="
<task>
Synthesize research outputs into SUMMARY.md.
</task>
<files_to_read>
- .planning/research/STACK.md
- .planning/research/FEATURES.md
- .planning/research/ARCHITECTURE.md
- .planning/research/PITFALLS.md
</files_to_read>
${AGENT_SKILLS_SYNTHESIZER}
<output>
Write to: .planning/research/SUMMARY.md
Use template: /Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/templates/research-project/SUMMARY.md
Commit after writing.
</output>
", subagent_type="gsd-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
ORCHESTRATOR RULE β CODEX RUNTIME: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
Synthesizer output self-heal (#222) β verify SUMMARY.md materialized: The synthesizer's canonical output is .planning/research/SUMMARY.md on disk; its brief structured return (## SYNTHESIS COMPLETE plus a few ### confirmation lines) is NOT the file content. A known LLM false-refusal (issue #222) sometimes makes the agent return the full SUMMARY.md document inline β fabricating a write restriction (e.g. "the runtime is blocking file writes") β instead of writing the file. Prompt hardening alone does not fully eliminate it, so the orchestrator MUST absorb the failure deterministically before spawning gsd-roadmapper:
- Verify
.planning/research/SUMMARY.mdexists AND is substantive β non-empty, and free of any leftover<!-- gsd:write-continue -->continuation sentinel (which marks a truncated/incomplete write). You may validate withgsd-tools verify-summary .planning/research/SUMMARY.mdβ it exits 0 regardless, so check its JSONpassedfield ("passed": falsemeans missing or invalid), not the process exit code. If it passes, continue normally. - If it is MISSING or invalid AND the synthesizer's return message contains the FULL SUMMARY.md document β recognizable by the template's top-level markers
# Project Research Summary,## Key Findings,## Implications for Roadmap, and## Sources, not merely the brief## SYNTHESIS COMPLETEconfirmation β the false-refusal fired: write that returned document to.planning/research/SUMMARY.mdwith the Write tool, then commit ALL research artifacts the synthesizer owns (it commits on behalf of the four researchers) withgsd-tools query commit "docs: complete project research" --files .planning/research/unless they are already committed. Logβ #222 self-heal: synthesizer returned SUMMARY.md inline without writing it; orchestrator persisted the file. - If it is MISSING or invalid AND the return is only a brief confirmation (no full SUMMARY document to recover), the synthesizer genuinely failed β surface the error and stop; do NOT spawn
gsd-roadmapperagainst a missing or incomplete SUMMARY.md.
This guarantees gsd-roadmapper (which lists SUMMARY.md as required reading) never runs against a missing or truncated SUMMARY.md.
Display research complete banner and key findings:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ RESEARCH COMPLETE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
## Key Findings
**Stack:** [from SUMMARY.md]
**Table Stakes:** [from SUMMARY.md]
**Watch Out For:** [from SUMMARY.md]
Files: `.planning/research/`
If "Skip research": Continue to Step 7.
7. Define Requirements
Display stage banner:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ DEFINING REQUIREMENTS
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Load context:
Read PROJECT.md and extract:
- Core value (the ONE thing that must work)
- Stated constraints (budget, timeline, tech limitations)
- Any explicit scope boundaries
If research exists: Read research/FEATURES.md and extract feature categories.
If auto mode:
- Auto-include all table stakes features (users expect these)
- Include features explicitly mentioned in provided document
- Auto-defer differentiators not mentioned in document
- Skip per-category question loops
- Skip "Any additions?" question
- Skip requirements approval gate
- Generate REQUIREMENTS.md and commit directly
Present features by category (interactive mode only):
Here are the features for [domain]:
## Authentication
**Table stakes:**
- Sign up with email/password
- Email verification
- Password reset
- Session management
**Differentiators:**
- Magic link login
- OAuth (Google, GitHub)
- 2FA
**Research notes:** [any relevant notes]
---
## [Next Category]
...
If no research: Gather requirements through conversation instead.
Ask: "What are the main things users need to be able to do?"
For each capability mentioned:
- Ask clarifying questions to make it specific
- Probe for related capabilities
- Group into categories
Scope each category:
For each category, use question:
- header: "[Category]" (max 12 chars)
- question: "Which [category] features are in v1?"
- multiSelect: true
- options:
- "[Feature 1]" β [brief description]
- "[Feature 2]" β [brief description]
- "[Feature 3]" β [brief description]
- "None for v1" β Defer entire category
Track responses:
- Selected features β v1 requirements
- Unselected table stakes β v2 (users expect these)
- Unselected differentiators β out of scope
Identify gaps:
Use question:
- header: "Additions"
- question: "Any requirements research missed? (Features specific to your vision)"
- options:
- "No, research covered it" β Proceed
- "Yes, let me add some" β Capture additions
Validate core value:
Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
Generate REQUIREMENTS.md:
Create .planning/REQUIREMENTS.md with:
- v1 Requirements grouped by category (checkboxes, REQ-IDs)
- v2 Requirements (deferred)
- Out of Scope (explicit exclusions with reasoning)
- Traceability section (empty, filled by roadmap)
REQ-ID format: [CATEGORY]-[NUMBER] (AUTH-01, CONTENT-02)
Requirement quality criteria:
Good requirements are:
- Specific and testable: "User can reset password via email link" (not "Handle password reset")
- User-centric: "User can X" (not "System does Y")
- Atomic: One capability per requirement (not "User can login and manage profile")
- Independent: Minimal dependencies on other requirements
Reject vague requirements. Push for specificity:
- "Handle authentication" β "User can log in with email/password and stay logged in across sessions"
- "Support sharing" β "User can share post via link that opens in recipient's browser"
Present full requirements list (interactive mode only):
Show every requirement (not counts) for user confirmation:
## v1 Requirements
### Authentication
- [ ] **AUTH-01**: User can create account with email/password
- [ ] **AUTH-02**: User can log in and stay logged in across sessions
- [ ] **AUTH-03**: User can log out from any page
### Content
- [ ] **CONT-01**: User can create posts with text
- [ ] **CONT-02**: User can edit their own posts
[... full list ...]
---
Does this capture what you're building? (yes / adjust)
If "adjust": Return to scoping.
Commit requirements:
gsd_run query commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
7.5. Project Structure Mode
If auto mode: Set PROJECT_MODE=mvp and skip this prompt.
Mode prompt: Vertical MVP vs Horizontal Layers.
Ask the user how they want to structure the project. Use question with two options:
- Vertical MVP β get a working app fast, add features slice by slice. Each phase delivers an end-to-end user capability. (Recommended for new products and rapid-iteration MVPs.)
- Horizontal Layers β build complete technical layers (DB β API β UI β wiring) and assemble at the end. (Better for infrastructure-heavy projects with multiple developers.)
Set PROJECT_MODE=mvp if the user picks Vertical MVP, otherwise PROJECT_MODE=standard.
When TEXT_MODE=true (per the workflow's existing TEXT_MODE handling for non-the agent runtimes), present the same two options as a plain-text numbered list and ask the user to type their choice number.
8. Create Roadmap
Display stage banner:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ CREATING ROADMAP
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Spawning roadmapper... (runs in a subagent β no output until it returns, ~1β5 min; expected, not a freeze)
ROADMAP.md template β mode-aware emit. When generating the initial ROADMAP.md:
- If
PROJECT_MODE=mvp: under each### Phase N:header, emit**Mode:** mvpon the line immediately following**Goal:**. This sets every initial phase to MVP mode (per Phase-4-Persistence decision: per-phase mode, not project-wide config). - If
PROJECT_MODE=standard: emit the standard ROADMAP.md template with no**Mode:**lines (Horizontal Layers standard template β no behavioral change for users who pick Horizontal Layers).
Example MVP-mode emit for Phase 1:
### Phase 1: [Name]
**Goal:** [Goal]
**Mode:** mvp
**Success Criteria**:
1. [Criterion]
Pass PROJECT_MODE to the roadmapper so it applies the correct template.
Spawn gsd-roadmapper agent with path references:
Agent(prompt="
<planning_context>
<files_to_read>
- .planning/PROJECT.md (Project context)
- .planning/REQUIREMENTS.md (v1 Requirements)
- .planning/research/SUMMARY.md (Research findings - if exists)
- .planning/config.json (Granularity and mode settings)
</files_to_read>
${AGENT_SKILLS_ROADMAPPER}
</planning_context>
<instructions>
Create roadmap:
1. Derive phases from requirements (don't impose structure)
2. Map every v1 requirement to exactly one phase
3. Derive 2-5 success criteria per phase (observable user behaviors)
4. Validate 100% coverage
5. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
6. Return ROADMAP CREATED with summary
Write files first, then return. This ensures artifacts persist even if context is lost.
</instructions>
", subagent_type="gsd-roadmapper", model="{roadmapper_model}", description="Create roadmap")
ORCHESTRATOR RULE β CODEX RUNTIME: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
Handle roadmapper return:
If ## ROADMAP BLOCKED:
- Present blocker information
- Work with user to resolve
- Re-spawn when resolved
If ## ROADMAP CREATED:
Read the created ROADMAP.md and present it nicely inline:
---
## Proposed Roadmap
**[N] phases** | **[X] requirements mapped** | All v1 requirements covered β
| # | Phase | Goal | Requirements | Success Criteria |
|---|-------|------|--------------|------------------|
| 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
| 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
| 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
...
### Phase Details
**Phase 1: [Name]**
Goal: [goal]
Requirements: [REQ-IDs]
Success criteria:
1. [criterion]
2. [criterion]
3. [criterion]
**Phase 2: [Name]**
Goal: [goal]
Requirements: [REQ-IDs]
Success criteria:
1. [criterion]
2. [criterion]
[... continue for all phases ...]
---
If auto mode: Skip approval gate β auto-approve and commit directly.
CRITICAL: Ask for approval before committing (interactive mode only):
Use question:
- header: "Roadmap"
- question: "Does this roadmap structure work for you?"
- options:
- "Approve" β Commit and continue
- "Adjust phases" β Tell me what to change
- "Review full file" β Show raw ROADMAP.md
If "Approve": Continue to commit.
If "Adjust phases":
Get user's adjustment notes
Re-spawn roadmapper with revision context:
Agent(prompt=" <revision> User feedback on roadmap: [user's notes] <files_to_read> - .planning/ROADMAP.md (Current roadmap to revise) </files_to_read> ${AGENT_SKILLS_ROADMAPPER} Update the roadmap based on feedback. Edit files in place. Return ROADMAP REVISED with changes made. </revision> ", subagent_type="gsd-roadmapper", model="{roadmapper_model}", description="Revise roadmap")ORCHESTRATOR RULE β CODEX RUNTIME: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
Present revised roadmap
Loop until user approves
If "Review full file": Display raw cat .planning/ROADMAP.md, then re-ask.
Generate or refresh project instruction file before final commit:
gsd_run query generate-claude-md --output "$INSTRUCTION_FILE"
This ensures new projects get the default GSD workflow-enforcement guidance and current project context in $INSTRUCTION_FILE.
Commit roadmap (after approval or auto mode):
gsd_run query commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md "$INSTRUCTION_FILE"
9. Done
Present completion summary:
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
GSD βΊ PROJECT INITIALIZED β
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
**[Project Name]**
| Artifact | Location |
|----------------|-----------------------------|
| Project | `.planning/PROJECT.md` |
| Config | `.planning/config.json` |
| Research | `.planning/research/` |
| Requirements | `.planning/REQUIREMENTS.md` |
| Roadmap | `.planning/ROADMAP.md` |
| Project guide | `$INSTRUCTION_FILE` |
**[N] phases** | **[X] requirements** | Ready to build β
If auto mode:
ββββββββββββββββββββββββββββββββββββββββββββ
β AUTO-ADVANCING β DISCUSS PHASE 1 β
ββββββββββββββββββββββββββββββββββββββββββββ
Exit skill and invoke skill("/gsd-discuss-phase 1 --auto")
If interactive mode:
Check if Phase 1 has UI indicators (look for **UI hint**: yes in Phase 1 detail section of ROADMAP.md):
PHASE1_SECTION=$(gsd_run query roadmap.get-phase 1 2>/dev/null)
PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false")
If Phase 1 has UI (PHASE1_HAS_UI is true):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
## βΆ Next Up β [${PROJECT_CODE}] ${PROJECT_TITLE}
**Phase 1: [Phase Name]** β [Goal from ROADMAP.md]
/clear then:
/gsd-discuss-phase 1 β gather context and clarify approach
---
**Also available:**
- /gsd-ui-phase 1 β generate UI design contract (recommended for frontend phases)
- /gsd-plan-phase 1 β skip discussion, plan directly
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
If Phase 1 has no UI:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
## βΆ Next Up β [${PROJECT_CODE}] ${PROJECT_TITLE}
**Phase 1: [Phase Name]** β [Goal from ROADMAP.md]
/clear then:
/gsd-discuss-phase 1 β gather context and clarify approach
---
**Also available:**
- /gsd-plan-phase 1 β skip discussion, plan directly
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- .planning/ directory created
- Git repo initialized
- Brownfield detection completed
- Deep questioning completed (threads followed, not rushed)
- PROJECT.md captures full context β committed
- config.json has workflow mode, granularity, parallelization β committed
- Research completed (if selected) β 4 parallel agents spawned β committed
- Requirements gathered (from research or conversation)
- User scoped each category (v1/v2/out of scope)
- REQUIREMENTS.md created with REQ-IDs β committed
- gsd-roadmapper spawned with context
- Roadmap files written immediately (not draft)
- User feedback incorporated (if any)
- ROADMAP.md created with phases, requirement mappings, success criteria
- STATE.md initialized
- REQUIREMENTS.md traceability updated
-
$INSTRUCTION_FILEgenerated with GSD workflow guidance (AGENTS.md for Codex,.claude/AGENTS.mdotherwise; an existing hand-crafted file without GSD markers is left untouched unless--force) - User knows next step is
/gsd-discuss-phase 1
Atomic commits: Each phase commits its artifacts immediately. If context is lost, artifacts persist.