Overview
- Project: gstack — Garry Tan's open-source AI engineering workflow
- GitHub: https://github.com/garrytan/gstack (~90K stars)
- Author: Garry Tan — YC President & CEO
- Core claim: one person + AI = the output of a past 15-person engineering team
- Harness layer (thin): Claude Code (AI execution), Bun runtime (compiled to a 58MB single-file executable), Playwright, and a persistent Chromium daemon.
- Skills layer (thick): 23 expert roles, each a detailed SKILL.md containing role definitions, review checklists (SQL safety, race conditions, LLM trust boundaries), output formats (AUTO-FIX vs ASK), and workflows.
- Markdown + YAML frontmatter makes skills git-diff-friendly, portable across Claude Code, Codex CLI, Cursor, and VS Code, human-editable, and reviewable in PRs.
- Traditional Playwright flows restart Chromium per command (~3s each) and lose cookies, sessions, and tabs.
- gstack runs a
Bun.serve()daemon with headless Chromium: first call ~3s, subsequent calls ~100-200ms via HTTP POST on localhost; auto-shutdown after 30 minutes idle. - Bun chosen for
bun build --compile(no node_modules/npx), native SQLite (reads Chromium's cookie DB directly), native TypeScript, and a built-in HTTP server. - Instead of injecting
data-refattributes (broken by CSP, React/Vue hydration, Shadow DOM), gstack snapshots Playwright's accessibility tree, assigns sequential refs (@e1, @e2...), and maps them to Playwright Locators viagetByRole(). - Stale detection in
resolveRef()uses an asynccount()check (~5ms) to fail fast instead of hitting a 30s timeout. -Cflag yields @c-refs for clickable elements missing from the ARIA tree (cursor:pointer, onclick, custom tabindex).- Two physical HTTP listeners (local vs tunnel) so tunnel callers cannot reach
/healthor/cookie-picker— socket separation is un-spoofable. - Prompt-injection defense layers: content sanitization (L1-L3), a 22MB BERT-small ONNX classifier running locally via TestSavantAI (L4), a Claude Haiku conversation-shape classifier with LOG_ONLY gating (L4b), canary tokens with deterministic BLOCK on leakage (L5), and a combiner requiring two ML classifiers to agree at ≥ WARN (0.75) before blocking (L6).
- Templates +
gen-skill-docs.tsauto-generate command references from source metadata; generated files are committed to git so Claude can read them at skill load, CI can verify freshness (--dry-run+git diff --exit-code), and git blame works. - Three-tier testing: static validation of every
$Bcommand (free, <2s), E2E via realclaude -psessions (~$3.85, ~20min), and LLM-as-judge (~$0.15, ~30s). - Errors are rewritten via
wrapError()to be actionable (e.g., "Runsnapshot -ito see available elements") so agents can self-recover without human help. - Crash recovery: if Chromium dies, the server exits immediately rather than self-healing; the CLI restarts it on the next command — fail loudly and recoverably.
- First
/scraperun: AI explores the page (~30s)./skillifysynthesizes a Playwright script + tests + fixture and commits it. Subsequent runs execute the deterministic script (~200ms) — a ~150x speedup. - With AI making complete implementation nearly free, the post's claimed compression ratios: scaffolding 100×, tests 50×, features 30×, bug fixes 20×.
- Anti-patterns: choosing a 90%-coverage option to save 70 lines, skipping edge cases, deferring tests, quoting only human time.
- Three ring buffers (50,000 entries each, O(1) push) for console, network, and dialog events; async flush every second to
.gstack/*.log. HTTP handling never blocks on disk I/O; bounded memory; at most 1s of data lost on crash. - Tests spawn
claude -pas independent subprocesses with streamed NDJSON and a pure-functionparseNDJSON()parser. - Diff-based test selection via declared touchfiles; two-tier testing: Gate (every CI commit) and Periodic (weekly cron for quality benchmarks and non-deterministic tests).
Released March 12, 2026, gstack gained 25K+ stars in 6 days and approached 90K in two months. Its distinguishing idea is not a novel AI algorithm but treating prompts as software engineering artifacts — prompt engineering as engineering, not just better prompting.
Key points
1. Thin Harness + Fat Skills
2. Persistent browser daemon: 40 seconds → 100ms
3. Ref system: bypassing the DOM
4. Security model: L1-L6 defense in depth
5. SKILL.md template system
6. Error philosophy: errors written for AI
7. Productivity flywheel: /scrape + /skillify
8. "Burn the lake" completeness principle
9. Logging architecture
10. E2E test infrastructure
Takeaways for architects
1. Treat prompts as configuration, not code — markdown lets PMs and designers review AI behavior. 2. State is the biggest enemy of performance — persistent daemons eliminate per-command startup costs. 3. Error messages are part of the API — design for AI self-repair. 4. Defense in depth, not single points — multiple independent layers survive any single breach. 5. Layered abstraction from exploration to execution — high layers flexible, low layers fast.
Why it matters
The post concludes gstack demonstrates that (1) one person can orchestrate parallel AI agent development, (2) prompts can be managed with real software engineering practices, and (3) when AI's marginal cost approaches zero, complete implementations are cheaper than minimal ones. The productivity gain comes from managing AI like an engineering team, not hiring a faster senior programmer.
References: https://github.com/garrytan/gstack, ARCHITECTURE.md, BROWSER.md, docs/skills.md, docs/ON_THE_LOC_CONTROVERSY.md, CLAUDE.md, AGENTS.md