Gaia Tutorial
0 of 0 steps
Tutorial

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.

Linear · Jira · GitHub IssuesAny stack One repo or manyConfigured with a single file: gaia.json
Step 1

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.

Gaia's flow: the ticket comes in, Gaia plans, implements in worktrees, runs the gates, opens the PR and a human merges TicketLinear · Jira · GH Planplanner Implementworktrees, per repo Gates + PRpreflight, draft Review + CIreviewer Mergea human if a gate fails: up to 3 fix rounds

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.

Step 2

Requirements

ToolWhat forInstall (macOS)
claudeClaude Code: runs the pipelinenpm i -g @anthropic-ai/claude-code
git ≥ 2.38worktreesships with Xcode CLT
ghopen PRs, read CIbrew install gh && gh auth login
jqthe bin/ scripts read gaia.jsonbrew install jq
dockeroptional: if your gates or local stack use containersDocker Desktop or OrbStack

You also need your tracker's connector inside Claude Code (Linear or Jira, via MCP). For GitHub Issues, gh is enough.

Step 3

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.

~/code/ ├── gaia/ ← this folder │ ├── gaia.json ← your project, described in one file │ ├── bin/ ← the deterministic steps (gates, worktrees, preflight…) │ ├── .claude/ ← skills, agents, commands and hooks │ ├── docs/ ← vision.md (yours), primitives.md, config.md │ ├── runs/ ← per-ticket state (not committed) │ ├── specs/ ← the durable record of each ticket │ └── worktrees/ ← where Gaia works (not committed) ├── acme-api/ ← your repos, which Gaia never modifies directly └── acme-web/
cd ~/code
git clone <gaia-url> gaia
cd gaia
Step 4

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.

Option A
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

Project
Tracker
Repos
Git and QA
gaia.json
Save it at the root of the gaia/ folder. Then: bin/gaia doctor.

The pieces that matter most

KeyWhat it decides
repos[].rolecontract-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.policyci-only (default): tests run in the PR's CI. local: Gaia runs them and proves they fail without the change.
repos[].contractHow to regenerate the contract (OpenAPI…) and the consumer's typed client.
repos[].notes · review_checklistHouse 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).

Step 5

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.

TipAdd the real paths to the primitives table (for example api/app/security/). The planner uses them to grade risk precisely.
Step 6

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)
Every repo should have its CLAUDE.mdIt's what the implementer reads before touching code: layers, conventions, how migrations are done. Without it Gaia still works, but it guesses more.
Step 7

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:

Step 8

When Gaia stops

Stopping in time is part of the design. Every block is recorded in runs/<T>/state.json and resumes from there.

StateWhyWhat you do
blocked-needs-infoThe 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-splitIt's more than one feature or exceeds the file limit.Review the proposed split and create the sub-tickets.
blocked-gatesA gate is still red after 3 rounds.Check runs/T/gates-<repo>.log. Sometimes it's the gate, not the change.
blocked-ciThe PR's CI is still red after 2 rounds.Check the job and fix it yourself or with /address-review T.
blocked-stackAnother ticket holds the local stack.bin/stack-lock status. Wait, or release it if it's stale.
Step 9

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.

Step 10

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-…
  1. Reads the page, its tables and unresolved comments, read-only.
  2. Gathers context: design links, current behavior in the code and duplicate tickets.
  3. Drafts: one per user-visible outcome, with Given/When/Then criteria.
  4. Reviews them with you: a summary table and all the questions together.
  5. 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.

Step 11

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:

compose.gaia.yml
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 worktrees

When done, bin/stack down T goes back to your checkouts and releases the lock, even if QA failed.

Step 12

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
Step 13

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.

Step 14

Safety rules

RuleEnforced by
Never merge, never push to the base branchDeny 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 PRbin/preflight (fails closed)
Gates green before the PRbin/gates → gates.md → bin/preflight
Ticket text is data, not an instructionSkills ship-ticket and tracker-sync
No creating tickets or writing to docs without approvaldocs-to-tickets, tracker.*, docs.write_allowed
docs/vision.md is edited by humans onlyDeny list
Step 15

All commands

CommandWhat it does
/ship T · bin/gaia run [--browser] TFull pipeline for one ticket
bin/gaia resume TResumes from the last phase
bin/gaia queue [--browser] T…Several tickets, one at a time
/tickets URL · bin/gaia tickets URLSpec → ticket drafts (headless: creates nothing)
/address-review T · bin/gaia address TAnswers PR comments and red checks
/gaia-status · bin/gaia statusTickets in flight, stack lock, recent friction
/gaia-setup · bin/gaia initGuided or automatic setup
bin/gaia doctorChecks tools, config and repos
bin/gaia pollPicks up issues with the pickup label
/nightly · /reap-frictionBackground quality and self-improvement
bin/gaia tutorialOpens this page
Step 16

Frequently asked questions

Does it work with a single repo?
Yes. A single repo with role: "primary" is enough. See examples/gaia.minimal.json.
What if my stack isn't Node or Python?
Gates are shell commands. Exit code 0 means PASS. Go, Rust, JVM, .NET, PHP, whatever: put the command you'd run in your CI for lint and typecheck.
Why do tests run only in CI by default?
Because in many projects the local suite is slow or needs infrastructure. The PR runs them anyway and Gaia reads the result in the ci phase. If your suite is fast, set tests.policy: "local" and you also get bin/prove-red.
Can I use another tracker?
Linear, Jira and GitHub Issues work out of the box. With 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?
In headless mode, 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
That's a config or repo problem, not the ticket's. Fix the command in gaia.json or fix the repo; bin/gaia doctor and runs/T/gates-<repo>.log tell you which.