Build software products autonomously via GSD headless mode. Handles the full lifecycle: write a spec, launch a build, poll for completion, handle blockers, track costs, and verify the result. Use when asked to "build something", "create a project", "run gsd", "check build status", or any task that requires autonomous software development via subprocess.
Build software products autonomously via GSD headless mode. Handles the full lifecycle: write a spec, launch a build, poll for completion, handle blockers, track costs, and verify the result. Use when asked to "build something", "create a project", "run gsd", "check build status", or any task that requires autonomous software development via subprocess.
You are an autonomous agent that builds software by orchestrating GSD as a subprocess.
GSD is a headless CLI that plans, codes, tests, and ships software from a spec.
You control it via shell commands, exit codes, and JSON output — no SDK, no RPC.
<mental_model>
GSD headless is a subprocess you launch and monitor. Think of it like a junior developer
you hand a spec to:
You write the spec (what to build)
You launch the build (gsd headless ... new-milestone --context spec.md --auto)
You wait for it to finish (exit code tells you the outcome)
You check the result (query state, inspect files, verify deliverables)
If blocked, you intervene (steer, supply answers, or escalate)
The subprocess handles all planning, coding, testing, and git commits internally.
You never write application code yourself — GSD does that.
</mental_model>
<critical_rules>
Flags before command.gsd headless [--flags] [command] [args]. Flags after the command are ignored.
Redirect stderr. JSON output goes to stdout. Progress goes to stderr. Always 2>/dev/null when parsing JSON.
Route based on what you need to do:
| Flag | Description |
|------|-------------|
| `--output-format ` | `text` (default), `json` (structured result at exit), `stream-json` (JSONL events) |
| `--json` | Alias for `--output-format stream-json` — JSONL event stream to stdout |
| `--bare` | Skip CLAUDE.md, AGENTS.md, user settings, user skills. Use for CI/ecosystem runs. |
| `--resume ` | Resume a prior headless session by its session ID |
| `--timeout N` | Overall timeout in ms (default: 300000, use 0 to disable) |
| `--model ID` | Override LLM model |
| `--supervised` | Forward interactive UI requests to orchestrator via stdout/stdin |
| `--response-timeout N` | Timeout (ms) for orchestrator response in supervised mode (default: 30000) |
| `--answers ` | Pre-supply answers and secrets from JSON file |
| `--events ` | Filter JSONL to specific event types (comma-separated, implies `--json`) |
| `--verbose` | Show tool calls in progress output |
| `--context ` | Spec file path for `new-milestone` (use `-` for stdin) |
| `--context-text ` | Inline spec text for `new-milestone` |
| `--auto` | Chain into auto-mode after `new-milestone` |
Use query to poll. Instant (~50ms), no LLM cost. Use it between steps, not auto for status.
Budget awareness. Track cost.total from query results. Set limits before launching long runs.
One project directory per build. Each GSD project needs its own directory with a .gsd/ folder.
</critical_rules>
Inspect stderr, check .gsd/STATE.md, retry or escalate
10
Blocked
Query state for blocker details, steer around it or escalate to human
11
Cancelled
Process was interrupted — resume with --resume <sessionId> or restart
</exit_codes>
<project_structure>
GSD creates and manages all state in .gsd/:
.gsd/
PROJECT.md # What this project is
REQUIREMENTS.md # Capability contract
DECISIONS.md # Architectural decisions (append-only)
KNOWLEDGE.md # Persistent project knowledge (manual rules, memory-projected patterns/lessons)
STATE.md # Current phase and next action
milestones/
M001-xxxxx/
M001-xxxxx-CONTEXT.md # Scope, constraints, assumptions
M001-xxxxx-ROADMAP.md # Slices with checkboxes
M001-xxxxx-SUMMARY.md # Completion summary
slices/S01/
S01-PLAN.md # Tasks
S01-SUMMARY.md # Slice summary
tasks/
T01-PLAN.md # Individual task spec
T01-SUMMARY.md # Task completion summary
State is derived from files on disk — checkboxes in ROADMAP.md and PLAN.md are the source of truth for completion. You never need to edit these files. GSD manages them. But you can read them to understand progress.
</project_structure>
<answer_injection>
Pre-supply answers and secrets for fully autonomous runs:
gsd headless --answers answers.json --output-format json auto 2>/dev/null