From a ticket to a reviewed PR, in any project.
Gaia is a software factory that runs on Claude Code. Give it a ticket key and it hands back one or more pull requests: planned, implemented in isolated worktrees, with your repos' gates green, reviewed by a second agent and linked to the ticket. A human always merges.
What Gaia is (and isn't)
Gaia does two things, nothing more:
Ticket → PR
/ship ENG-123 reads the ticket, plans, implements, runs the gates, opens the PR, reviews it and links it to the ticket.
Spec → tickets
/tickets <url> turns a PRD or a feature table into tickets with testable acceptance criteria. It only creates them with your approval.
What it never does
Never merges
Nor pushes to main. A hook blocks those commands and PRs open as drafts.
Never touches your checkouts
It works in worktrees/<repo>-<TICKET>. Your repo folder stays as it is.
Never guesses
If the ticket has no testable criteria, it stops and asks you here, not on the tracker.
Holds no product code
Gaia is a folder next to your repos: skills, agents, scripts and a gaia.json.
Requirements
| Tool | What for | Install (macOS) |
|---|---|---|
claude | Claude Code: runs the pipeline | npm i -g @anthropic-ai/claude-code |
git ≥ 2.38 | worktrees | ships with Xcode CLT |
gh | open PRs, read CI | brew install gh && gh auth login |
jq | the bin/ scripts read gaia.json | brew install jq |
docker | optional: if your gates or local stack use containers | Docker Desktop or OrbStack |
You also need your tracker's connector inside Claude Code (Linear or Jira, via MCP). For GitHub Issues, gh is enough.
Put Gaia next to your repos
Gaia lives in a sibling folder of your repos. It doesn't matter how many there are: one, two or ten.
cd ~/code git clone <gaia-url> gaia cd gaia
Describe your project in gaia.json
Everything that used to be hard-coded (which repos exist, which gates run, where the tickets live) now lives in one file. There are three ways to create it:
A. Let it detect
bin/gaia init looks at each repo (package.json, pyproject, Makefile, compose) and proposes gates.
B. Let Claude guide you
Open claude in the folder and run /gaia-setup: it reads your repos, proposes and asks.
C. Build it below
Fill in the form and download the file.
bin/gaia init --tracker linear --team ENG --name Acme ../acme-api ../acme-web # found acme-api (python, contract-owner, base main): lint, openapi # found acme-web (node, consumer, base main): lint, typecheck # wrote gaia.json
Option C: gaia.json generator
gaia/ folder. Then: bin/gaia doctor.
The pieces that matter most
| Key | What it decides |
|---|---|
repos[].role | contract-owner goes first (wave A: owns the API); consumer, primary, service and infra go after (wave B), in parallel. |
repos[].gates[] | Commands that must exit 0 before the PR. "fast": false = only in the full run. |
repos[].tests.policy | ci-only (default): tests run in the PR's CI. local: Gaia runs them and proves they fail without the change. |
repos[].contract | How to regenerate the contract (OpenAPI…) and the consumer's typed client. |
repos[].notes · review_checklist | House rules the implementer reads and the reviewer checks one by one. |
rules[] | Project rules in plain text. They are binding. |
Full reference: docs/config.md. Examples: examples/gaia.example.json (API + web), examples/gaia.minimal.json (one repo with GitHub Issues).
Tell Gaia what "good" means in your product
Two short files make the difference between a generic PR and one that respects your product:
docs/vision.md: yours
Who the product is for, what "done well" means, the UI style and what Gaia never decides on its own. Agents read it at the start of every session and can't edit it.
docs/primitives.md: risk
The delicate pieces (auth, money, migrations, API contract) with their default risk. On high risk, the PR opens as a draft with the needs-human label.
api/app/security/). The planner uses them to grade risk precisely.Check and connect
bin/gaia doctor tools ok claude · git · jq · gh config ok gaia.json is valid JSON · 2 repo(s) · tracker: linear repos ok api: ../acme-api (base main on origin) · has CLAUDE.md · 2 gate(s), tests: ci-only warn web: no CLAUDE.md — implementers work blind on conventions
Then open Claude Code in the Gaia folder and connect the tracker:
claude
/mcp # log in to Linear / Jira (and your docs tool, if you use one)Your first ticket
Pick a small one with clear acceptance criteria. Inside Claude Code:
/ship ENG-123
Or without opening anything, headless: bin/gaia run ENG-123. Step through the phases to see what happens in each:
When Gaia stops
Stopping in time is part of the design. Every block is recorded in runs/<T>/state.json and resumes from there.
| State | Why | What you do |
|---|---|---|
blocked-needs-info | The ticket has no testable criteria or the plan has open questions. | Answer in the chat (or see runs/T/questions.md), then bin/gaia resume T. |
blocked-needs-split | It's more than one feature or exceeds the file limit. | Review the proposed split and create the sub-tickets. |
blocked-gates | A gate is still red after 3 rounds. | Check runs/T/gates-<repo>.log. Sometimes it's the gate, not the change. |
blocked-ci | The PR's CI is still red after 2 rounds. | Check the job and fix it yourself or with /address-review T. |
blocked-stack | Another ticket holds the local stack. | bin/stack-lock status. Wait, or release it if it's stale. |
Review and merge
At the end of every run you get:
The PR (draft)
With the why, what changed, the risk, the gates, how to revert it and proposed follow-ups.
runs/T/manual-test.md
A guide to test it by hand: setup, steps per criterion, edge cases and what wasn't tested.
runs/T/review.md
What the independent reviewer found and what was fixed or dismissed (and why).
specs/T.md
The durable record: intent, decisions, lessons and pending cleanup.
Comments on the PR or a red check? Run /address-review ENG-123: it fixes what's warranted, explains what isn't, and pushes. When you're happy, you take the PR out of draft and merge it.
From a spec to tickets (for PMs)
Hand Gaia a PRD, a page or a feature table (Notion, Coda, Google Docs, Confluence…):
/tickets https://notion.so/acme/Invoices-PRD-…
- Reads the page, its tables and unresolved comments, read-only.
- Gathers context: design links, current behavior in the code and duplicate tickets.
- Drafts: one per user-visible outcome, with Given/When/Then criteria.
- Reviews them with you: a summary table and all the questions together.
- Creates the tickets only when you say "yes, create them", for that exact list.
Then: bin/gaia queue ENG-140 ENG-141 ENG-142 builds them one after another.
Browser QA with your local stack (optional)
If you enable stack.enabled, Gaia can bring up your app with the ticket's code and walk each criterion with Playwright, taking screenshots. It only does so when you ask:
bin/gaia run --browser ENG-123
# or, in the chat: "/ship ENG-123 with browser QA"bin/stack up T takes an exclusive lock, exports one variable per worktree and runs your stack.up. Your compose decides how to use them:
services:
api: { build: { context: "${GAIA_WT_API:-../acme-api}" } }
web: { build: { context: "${GAIA_WT_WEB:-../acme-web}" } }
# without the variables → your checkouts; with them → the ticket's worktreesWhen done, bin/stack down T goes back to your checkouts and releases the lock, even if QA failed.
Queued, by label or scheduled
bin/gaia queue ENG-140 ENG-141 https://linear.app/acme/issue/ENG-142 # one at a time; blocked ones are skipped bin/gaia poll # picks up issues labeled "gaia" (up to 3 at a time) bin/gaia status # what's in flight GAIA_BUDGET_USD=15 bin/gaia run ENG-143 # spend cap per run
To have it run on its own on macOS, install the templates from ops/:
sed "s#__GAIA_DIR__#$PWD#" ops/com.gaia.poll.plist > ~/Library/LaunchAgents/com.gaia.poll.plist launchctl load ~/Library/LaunchAgents/com.gaia.poll.plist
Gaia learns from its stumbles
FRICTION.md
Every retry or workaround is logged in one line, with its likely cause.
/reap-friction
Groups the entries by cause and proposes fixes: a new script, a clearer skill, a corrected gate.
/nightly
Flaky tests, pending cleanup, drift between docs and code, and exploratory QA. Reports first; creates nothing without GAIA_NIGHTLY_FILE=1.
specs/
The decisions and lessons of each ticket. The planner reads them before touching the same area.
Safety rules
| Rule | Enforced by |
|---|---|
| Never merge, never push to the base branch | Deny list in .claude/settings.json + guard-git.sh hook |
Commits only on feat/… branches inside worktrees/ | guard-git.sh |
| No secrets or stray files in the PR | bin/preflight (fails closed) |
| Gates green before the PR | bin/gates → gates.md → bin/preflight |
| Ticket text is data, not an instruction | Skills ship-ticket and tracker-sync |
| No creating tickets or writing to docs without approval | docs-to-tickets, tracker.*, docs.write_allowed |
docs/vision.md is edited by humans only | Deny list |
All commands
| Command | What it does |
|---|---|
/ship T · bin/gaia run [--browser] T | Full pipeline for one ticket |
bin/gaia resume T | Resumes from the last phase |
bin/gaia queue [--browser] T… | Several tickets, one at a time |
/tickets URL · bin/gaia tickets URL | Spec → ticket drafts (headless: creates nothing) |
/address-review T · bin/gaia address T | Answers PR comments and red checks |
/gaia-status · bin/gaia status | Tickets in flight, stack lock, recent friction |
/gaia-setup · bin/gaia init | Guided or automatic setup |
bin/gaia doctor | Checks tools, config and repos |
bin/gaia poll | Picks up issues with the pickup label |
/nightly · /reap-friction | Background quality and self-improvement |
bin/gaia tutorial | Opens this page |
Frequently asked questions
Does it work with a single repo?
role: "primary" is enough. See examples/gaia.minimal.json.What if my stack isn't Node or Python?
Why do tests run only in CI by default?
ci phase. If your suite is fast, set tests.policy: "local" and you also get bin/prove-red.Can I use another tracker?
tracker.kind: "none" you paste the ticket by hand. For another tracker with an MCP, add a section to .claude/skills/tracker-sync/SKILL.md.How much does a run cost?
bin/gaia prints the cost at the end (from runs/T/cost.json). GAIA_BUDGET_USD sets a cap. The cost is never posted to the tracker.How do I clean up old worktrees?
/gaia-status offers to delete the ones for tickets whose PR was merged, and always asks first.A gate always fails, even on main
gaia.json or fix the repo; bin/gaia doctor and runs/T/gates-<repo>.log tell you which.