The AI Daemon: Unpacking gsd-build/gsd-2
How a TypeScript state machine and a native Rust core turned conversational coding agents into deterministic, headless subprocesses.

Apologies on this - I've been trying to fix this serious foundational problems that will be ideally shipped this evening.
- GSD-2 Abandons conversational interfaces in favor of a headless subprocess that uses the filesystem as its literal program counter.
- A native Rust core handles Git operations and AST parsing to prevent slow I/O loops from crippling the TypeScript orchestration layer.
- Aggressive context compaction and explicit exit codes solve the infinite hallucination loops common in autonomous agents.
- The project explicitly rejects enterprise workflows in favor of raw execution speed for individual vibe coders.
The Autonomy Paradox
Leaving an artificial intelligence coding agent alone for an hour usually results in one of two outcomes. You either return to a destroyed repository, or you find the agent stuck in an infinite loop of failing tests. This is the autonomy paradox. The more freedom you give an agent, the faster it spirals into a hallucinated state.
GSD-2 solves this with a surprisingly simple concept: knowing when to stop. Instead of guessing how to fix a complex block of code, a mature agent must know how to fail gracefully. The orchestrator uses specific process exit codes, like Exit Code 10 for 'Blocked', to pause execution and request human input rather than destroying the codebase.
The Filesystem as the Program Counter
The original version of GSD was a prompt framework for Claude Code. It failed because it relied on the LLM to remember what it was doing. GSD-2 pivots entirely. It treats the filesystem as the brain.
The `.gsd/STATE.md` directory acts as a literal program counter. If the Node.js process crashes or the LLM times out, the agent simply reads the markdown file to resume exactly where it left off. The prompt is dead. The markdown specification is the new database.
One command. Walk away. Come back to a built project with clean git history.
Forging the Rust Core
A TypeScript state machine is elegant, but relying on `execSync` for shell commands kills agent performance. Latency is the enemy of autonomy. To solve this, the maintainers built a native Rust core.
Using `napi-rs`, GSD-2 binds Node.js directly to a Rust workspace for AST parsing and native `libgit2` operations. This enables the 'Branchless Worktree' architecture. The agent can carve out invisible Git worktrees, experiment, and fail without ever touching the main branch or spawning expensive subshells.
Engineering Amnesia
Context rot is a phenomenon where agents forget the overarching architecture after executing too many terminal commands. They get lost in the weeds of a specific compiler error and forget the system design.
GSD-2 combats this with aggressive context resets. It uses a Runtime ToolKit (RTK) to compress shell output. When a new task starts, the orchestrator spins up a fresh subagent context, injecting only the necessary files like `DECISIONS.md`. It forces the LLM to read the architectural constraints fresh every time.
Execution Over Ceremony
The Spec-Driven Development landscape is diverging. On one side are enterprise tools built for organizational standardization and phase gates. On the other side is GSD-2, built explicitly for raw execution speed and solo creators.
Other spec-driven development tools exist—BMAD, Speckit… But they all seem to make things way more complicated than they need to be. Sprint ceremonies, story points, stakeholder syncs, retrospectives, Jira workflows. I’m not a 50-person software company. I don’t want to play enterprise theater.
| Feature | GSD-2 | Spec Kit | OpenSpec |
|---|---|---|---|
| Core Philosophy | Execution-layer orchestration | Structured organizational phases | Lightweight change isolation |
| Context Strategy | Aggressive resets and fresh contexts | Agent-agnostic portability | Brownfield-first adaptation |
| Primary Language | TypeScript / Rust | N/A | N/A |