A continuous, GitHub-native delivery loop for coding agents β Claude Code, Codex & Antigravity.
Install Β· The loop Β· Memory Β· Updating Β· Continuous execution Β· Cross-tool Β· The PAT Β· License
A forward-only delivery loop: work only moves toward shipped, and every failure
path returns to the queue rather than slipping backward or stalling. A drop-in
kit that turns any GitHub repo into a continuous loop run by coding agents, with
humans owning only two jobs: writing good plan files and reviewing PRs.
There is no orchestrator, no database, and no custom service β the protocol
lives entirely in GitHub (issues, branches, labels, Actions, PRs), so it works
with any agent that can run gh and read a markdown file.
The protocol is in GitHub, not in any one tool. The only tool-specific layer is the thin skill/slash-command ergonomics, and the three tools share open standards:
| Layer | Claude Code | GPT Codex | Antigravity |
|---|---|---|---|
| Operating manual | AGENTS.md (+ CLAUDE.md pointer) |
AGENTS.md |
AGENTS.md (+ GEMINI.md pointer) |
| Skills | .claude/skills/ |
.agents/skills/ |
.agents/skills/ |
| GitHub core (workflows, sync, labels) | shared | shared | shared |
.agents/skills/ is the canonical source and is read directly by Codex and
Antigravity. .claude/skills/ is a mirror for Claude Code. setup.sh keeps them
in sync.
AGENTS.md Operating manual (the 7-step loop). Canonical, overwrite-safe.
CLAUDE.md / GEMINI.md One-line pointers to AGENTS.md for each tool.
GATES.md Project config you hand-author (verification gates).
.ratchet-version Installed framework version (managed by the updater).
.agents/skills/<name>/ Canonical skills (Codex + Antigravity)
SKILL.md portable skill body
agents/openai.yaml Codex invocation policy (explicit-only)
.claude/skills/<name>/SKILL.md Mirror for Claude Code
plugin/ Optional Claude Code plugin packaging
.claude-plugin/marketplace.json Optional marketplace (Claude Code only)
plan/
README.md The plan-file format contract
examples/0001-email-login.md Worked example (not synced β kept for reference)
memory/
USER.md Human-owned preferences (agent reads, never edits)
ARCHITECTURE.md Coarse codebase map (generated; scopes the agent's reads)
MEMORY.md Distilled knowledge cache (agent proposes via PR)
scripts/
plan-sync.mjs Zero-dep deterministic planβissue compiler
plan-sync.test.mjs Regression test for the compiler (node scripts/plan-sync.test.mjs)
ratchet-update.sh Pulls framework updates, preserves project files
.github/workflows/ plan-sync, unblock-dependents, sweep-stale-claims, pr-gates, review-verdict, release, ratchet-run
.env.example PAT documentation for local runs
setup.sh Sync skills into each tool's location
The skills: /ratchet-plan (idea β plan/*.md), /ratchet-sync
(compile plan files β issues now), /ratchet-init (one-time: labels, gate
detection into GATES.md, memory scaffold, codebase map, PAT check),
/ratchet-next (advance after merge, or rework after review),
/ratchet-status (read-only: why is nothing ready, and what to do),
/ratchet-metrics (read-only loop health: cycle time, rework, sweeps,
queue depth), /ratchet-memory (prune & dedupe memory/MEMORY.md),
/ratchet-map (regenerate the coarse codebase map),
/ratchet-update (pull a newer framework version, project files untouched),
/ratchet-uninstall (cleanly remove Ratchet; keeps your data by default).
An optional headless fleet supervisor, ratchet-herd (node scripts/herd.mjs run), runs the same loop across many issues at once β one
agent CLI per ready issue, watched to a PR β with adapters, prompts, and env
configured per operator in .ratchet/herd.json. It never merges or reviews;
anything it can't resolve is escalated to a human. See DOCS.md Β§14.
Install from a pinned release with the bootstrap script, run from inside your
project's git repo. It downloads the tag you name, reads
ratchet-manifest.json, and copies in only the framework files your chosen
profile(s) need β it never touches .env or other local secrets (they aren't
in the manifest, so they're never selected).
Download it, inspect it, then run it β the safe default for anything you pipe
into bash. TAG resolves to the latest published release (a ref that is
guaranteed to exist), so the commands run verbatim with nothing to fill in:
TAG=$(curl -fsSL https://api.github.com/repos/praveenvijayan/Ratchet/releases/latest | grep -m1 '"tag_name":' | cut -d'"' -f4)
curl -fsSL "https://raw.githubusercontent.com/praveenvijayan/Ratchet/${TAG}/scripts/bootstrap.sh" -o bootstrap.sh
less bootstrap.sh # read it before you run it
bash bootstrap.sh --version "${TAG}"
A default install ships the core delivery loop plus the herd fleet
supervisor (scripts/herd*.mjs, the ratchet-herd skill, and the mascots/
assets), so node scripts/herd.mjs run and /ratchet-herd work out of the box.
Or, once you trust the source, the one-line convenience form. It pins to that
same resolved release tag, so the install stays reproducible β piping an
unpinned main straight into bash is not reproducible, so always install
from a resolved release tag (to install a specific older version instead,
replace the ${TAG} lookup with a tag from the Releases page):
TAG=$(curl -fsSL https://api.github.com/repos/praveenvijayan/Ratchet/releases/latest | grep -m1 '"tag_name":' | cut -d'"' -f4) \
&& curl -fsSL "https://raw.githubusercontent.com/praveenvijayan/Ratchet/${TAG}/scripts/bootstrap.sh" | bash -s -- --version "${TAG}"
--profile selects profiles on top of the always-included core
(comma-separated). The default is --profile herd; pass --profile core for a
core-only install with no supervisor, or extend it (e.g.
--profile herd,watcher to add the local real-time watcher). The available
profiles:
| Profile | Installs |
|---|---|
core |
The base delivery loop β always installed. Plan sync, claim/verify gates, PR-size and issue-body checks, the skills, and the agent manuals. |
herd |
Headless fleet supervisor (scripts/herd*.mjs + the ratchet-herd skill + mascots/). On by default. |
watcher |
Local real-time watcher (scripts/ratchet-watch.*) that turns a merge/review into a /ratchet-next trigger. |
release |
Versioned-release tooling for teams that cut tagged Ratchet releases. |
unattended-ci |
Optional CI-based runner for unattended execution. Off by default. |
claude-plugin |
Claude Code plugin marketplace packaging. |
See DOCS.md Β§9 for the full file list per profile. --dry-run reports what
would change without writing anything; --force is required to overwrite a
conflicting existing file. If you later install into a core-only project and
try the herd, node scripts/herd.mjs prints the exact bootstrap.sh --profile herd command to add the supervisor files β never a raw module-not-found error.
Then:
./setup.shβ generate the skill mirrors your agent reads (or./setup.sh user-claude/./setup.sh user-agentsto install across all your repos; Codex and Antigravity also read.agents/skills/directly with no setup).- Run
/ratchet-initin your agent. It creates the labels, detects your stack to fillGATES.md, and walks you through the PAT.
/plugin marketplace add praveenvijayan/Ratchet
/plugin install ratchet@ratchet
(Codex and Antigravity do not use this; they use .agents/skills/ + AGENTS.md.)
The issue flow depends on workflows reacting to each other. GitHub's default
token can't trigger one workflow from another's events, so any automated
issue close would stall the loop. The workflows read
${{ secrets.FACTORY_PAT || secrets.GITHUB_TOKEN }}, so set a fine-grained PAT
as the FACTORY_PAT repo secret (and in .env as GITHUB_PAT for local runs).
With pure human merges the fallback works; the PAT makes it bulletproof.
/ratchet-init checks this and guides you. Never commit a real token β
.env is gitignored; only .env.example is committed.
-
Ideate with the LLM until the idea is solid.
-
/ratchet-planβ writesplan/*.md(one for a report, many for a plan) onto the rolling planning branch and opens/updates the planning PR. -
Review and merge the planning PR;
plan-synccreates the issues onmain. -
Issues appear (
state:ready). The agent runs the loop as one-command scripts, not hand-typed multi-step shell β each returns a stable exit code:- claim β
node scripts/ratchet-start.mjs --issue <N> --owner "<id>"(atomic server-sideagent/issue-<N>ref off freshmain, worktree, owner marker, label flip; exit3means another agent already holds it), - build to the acceptance criteria β renew the lease on long builds with
node scripts/ratchet-heartbeat.mjs --issue <N>, or return the issue to the queue withnode scripts/ratchet-requeue.mjs --issue <N> --reason "β¦", - verify the gates fail-fast, then
- hand off β
node scripts/ratchet-submit.mjs --issue <N> --body-file <path>integratesmain, runs the gates, and opens a single PR withCloses #N.
Then it stops. (See DOCS.md Β§13 for every argument and exit code.)
- claim β
-
The PR is reviewed, then merged on a tier: a normal-risk PR is merged by the
auto-mergeworkflow once its checks are green and its recorded review verdict isAPPROVEDβ no human in the path; arisk:highPR also waits for a human approval and a 15-minute hold. GitHub closes the issue. -
unblock-dependentsflips newly-unblocked issues tostate:ready;sweep-stale-claimsreturns abandoned work to the queue. -
Repeat until the backlog is empty. New findings β new
plan/*.md.
Every failure path (red gate, crash, oversized issue, requested changes) returns
the issue to state:ready with a comment β nothing gets silently stuck.
Three tiers, all GitHub-native β no vector DB, no external service:
- Working β the claimed issue + acceptance criteria, in context.
- Durable curated β
memory/USER.md(human-owned preferences),memory/ARCHITECTURE.md(a coarse, generated codebase map that scopes the agent's reads), andmemory/MEMORY.md(agent-proposed distilled knowledge), read at the start of every issue.MEMORY.mdis a cache, not a log: each entry is 1β2 lines linking to the issue/PR that is its real source, so it stays small even as the project grows huge. - Episodic β closed issues, merged PRs,
git log/blame, andplan/*.md, searched on demand. This is the unbounded long-term store.
The agent reads Tiers 1β2 each issue, searches Tier 3 when context is missing,
and proposes MEMORY.md edits inside its PR β so memory changes are reviewed
like code, never written silently. It never edits USER.md. Run
/ratchet-memory periodically to prune stale entries. Because all three tools
read AGENTS.md, this works identically in Claude Code, Codex, and Antigravity.
Repos created from the template don't auto-update (that's the template
trade-off), but upgrading is one command and never needs a manual merge, because
AGENTS.md is 100% framework; the project-specific files (GATES.md config
plus the memory/ files) live outside it and the updater never touches them.
/ratchet-update # pull upstream main onto a review branch
/ratchet-update v1.2.0 # or a specific release tag
It pulls only framework paths (skills, workflows, scripts, AGENTS.md),
re-syncs the skill mirrors, bumps .ratchet-version, and stops for you to review
the diff and open a PR. It never touches GATES.md, memory/, your plan/*.md
issues, .env, README.md, LICENSE, or your code. (Claude Code users who
installed via the plugin can also update skills with
/plugin marketplace update ratchet; the git update covers all three tools.)
By default a human re-invokes the agent after each merge ("pick the next issue").
To make the loop fully hands-off β human involvement ends at the merge until the
next PR β enable the ratchet-run workflow:
gh variable set RATCHET_AUTO --body true
gh secret set ANTHROPIC_API_KEY # the agent runtime in CI (or swap to Codex)
# FACTORY_PAT is already set by /ratchet-init
gh workflow run ratchet-run # kick off the first task after planning
Then every merge β the auto-merge workflow's on a normal-risk PR, yours on a
risk:high one β triggers ratchet-run: it checks out the latest main
(fresh, so the next branch is never stale), picks the top ready issue, and an
agent works it to a PR and stops. The backlog drains one merge at a time, and on
normal-risk work you are not in that loop at all.
It is safe by default: without RATCHET_AUTO=true the workflow exists but
no-ops, so nothing runs or fails unexpectedly. The agent step uses Claude Code;
swap that one step for an OpenAI Codex action if you prefer. (Antigravity is used
interactively rather than in CI.) Mind the cost β each run spends agent API
tokens; set a budget/alert on your provider.