/gsd auto, Pi takes the current project state, derives the next unit of work from the database, and runs the full development loop — planning, implementing, verifying, committing, and advancing — without you having to orchestrate each step. You can walk away and come back to built, committed, tested code with clean git history.
How the Loop Works
Auto Mode operates as a state machine driven by the SQLite database at your project root. For each unit of work, Pi creates a fresh context window, injects a focused prompt with all relevant context pre-loaded (task plan, prior summaries, decisions register, roadmap excerpt), executes the work, persists the result, and dispatches the next unit. The loop flows through these phases for each slice:- Plan — Pi scouts the codebase, researches relevant documentation, and decomposes the slice into tasks with clear must-haves
- Execute — Pi runs each task in its own fresh context window; no context bloat from previous tasks
- Complete — Pi writes task summaries, generates a UAT script, marks the roadmap, and commits
- Reassess — Pi checks whether the roadmap still makes sense given what was learned during execution
- Validate Milestone — after all slices complete, Pi reconciles success criteria against actual results before sealing the milestone
Controlling Auto Mode
Start
Pause
Press Escape to pause auto mode. The conversation is preserved and the current unit’s state is saved. You can inspect the work, ask Pi questions, or read the planning files — then resume when ready.Resume
Advance One Step
Stop
Interrupt Immediately
Press Escape during an active unit to interrupt Pi mid-execution. Pi saves whatever state it has written so far and pauses. Run/gsd auto to recover and continue.
Planning Depth
By default, Pi useslight planning depth — a focused milestone discussion flow that writes context and roadmap artifacts immediately. For projects that benefit from more up-front discovery, enable deep planning mode:
PROJECT.md, REQUIREMENTS.md, and optional research artifacts (STACK.md, FEATURES.md, ARCHITECTURE.md, PITFALLS.md) before any slice planning begins.
Budget Controls
Configure a spending ceiling and enforcement policy in.gsd/PREFERENCES.md:
- warn
- pause
- halt
Pi logs a warning when the ceiling is hit but continues running. Use this when you want visibility without hard stops.
Timeout Supervision
Three timeout tiers protect against runaway sessions:| Timeout | Setting | Default | Behavior |
|---|---|---|---|
| Soft | soft_timeout_minutes | 20 min | Sends Pi a wrap-up signal to finish durable output |
| Idle | idle_timeout_minutes | 10 min | Detects stalls and intervenes |
| Hard | hard_timeout_minutes | 30 min | Starts timeout recovery; pauses auto mode only if recovery cannot make progress |
.gsd/PREFERENCES.md:
Verification
Pi can run your project’s test and lint commands automatically after every task execution. Set them in.gsd/PREFERENCES.md:
If you don’t configure
verification_commands, Pi attempts to discover your project’s checks automatically — it looks for package.json scripts (typecheck, lint, test) for JavaScript projects and pytest markers for Python projects.Crash Recovery
Auto mode persists worker state, dispatch state, and session metadata in the database. If Pi crashes or your machine restarts, run/gsd auto again. Pi reconstructs the interrupted unit from the database, reads the surviving session file, synthesizes a recovery briefing from every tool call that completed, and resumes with full context.
For unattended overnight runs, headless mode adds automatic crash recovery with exponential backoff:
Key Behaviors
Fresh Context Per Unit
Fresh Context Per Unit
Every task, planning step, and research phase runs in a clean context window. Pi pre-loads all necessary context (task plan, prior summaries, decisions register, codebase notes) into the dispatch prompt, so the agent starts fully oriented instead of spending tool calls reading files. This eliminates context bloat and keeps quality consistent across long autonomous runs.
Adaptive Replanning
Adaptive Replanning
After each slice completes, Pi reassesses the roadmap. If the work revealed new information that changes the plan — a dependency that turned out to be more complex, a simpler approach that covers multiple planned slices — Pi reorders, adds, or removes future slices before continuing. You can skip reassessment with the
budget token profile.Stuck Loop Detection
Stuck Loop Detection
Pi uses a sliding-window analysis on recent dispatch history to detect stuck loops. On detection, it retries once with a deep diagnostic prompt. If the second attempt also fails, auto mode stops so you can intervene. Run
/gsd forensics for a structured post-mortem.Provider Error Recovery
Provider Error Recovery
Pi automatically handles transient provider errors:
- Rate limits (429) → waits and retries after the retry-after header or 60 seconds
- Server errors (500, 502, 503) → retries after 30 seconds
- Permanent errors (invalid key, billing) → pauses and surfaces a clear message
Meaningful Commit Messages
Meaningful Commit Messages
Pi generates commit messages from task summaries — not generic “complete task” boilerplate. Each commit reflects what was actually built, giving you a
git log that reads like a changelog.Context Pressure Monitor
Context Pressure Monitor
When context usage reaches 70%, Pi sends itself a wrap-up signal, nudging it to finish durable output — commits, summaries, artifacts — before the context window fills. This prevents a session from hitting the hard context limit mid-task with nothing written to disk.
Post-Mortem Investigation
If auto mode fails or behaves unexpectedly, run/gsd forensics for a full analysis:
