formerly ralph-orchestrator // open source // mit
keep agents looping
until the job is done.
hats runs AI coding agents in autonomous loops. give it a task, it iterates until done or your budget runs out. hat-based personas, backpressure gates, cost tracking, git checkpoints.
$
npm install -g @hats/cli
click to copy
$ hats run -p "add jwt auth with tests"
hat: default | backend: claude | max: 15 iterations
backpressure: tests, lint, typecheck
[1/15] reading specs... planning implementation [2/15] writing auth middleware + jwt helpers [3/15] writing tests... 14 pass, 2 fail [4/15] fixing token expiry edge case [5/15] all tests pass. lint clean. typecheck clean. LOOP_COMPLETE 5 iterations | $0.43 | 3m 12s
$ _
[1/15] reading specs... planning implementation [2/15] writing auth middleware + jwt helpers [3/15] writing tests... 14 pass, 2 fail [4/15] fixing token expiry edge case [5/15] all tests pass. lint clean. typecheck clean. LOOP_COMPLETE 5 iterations | $0.43 | 3m 12s
$ _
claude
kiro
codex
gemini
amp
copilot
pi
opencode
// features
what it does
- hat system agents wear specialized hats -- planning, coding, review, debugging. each hat has its own persona, backend, and constraints.
- backpressure gates that reject incomplete work. tests must pass. lint must be clean. typecheck must succeed. the loop keeps going until quality is met.
- cost tracking per-iteration token and cost tracking. set budgets. kill loops that burn too much. know exactly what each task costs.
- git checkpoints automatic git commits between iterations. roll back to any point. never lose work to a bad iteration.
- multi-backend claude, kiro, codex, gemini, amp, copilot, pi, opencode. switch backends per hat. use the cheapest model for planning, the best for coding.
- presets 31 built-in presets: tdd, spec-driven, debugging, refactor, docs, deploy, pr-review. start productive in seconds.
- telegram human-in-the-loop via telegram. agents ask questions and block until answered. send guidance mid-loop from your phone.
-
web dashboard
monitor loops, view iteration history, track costs.
hats webopens a local dashboard.
// quickstart
running in two minutes
-
install
npm i -g @hats/cliorbrew install hatsorcargo install hats-cli -
init
hats init --backend claudecreates ahats.ymlconfig in your project. -
run
hats run -p "your task here"starts looping. it stops when done or when limits are hit.
# hats.yml
hats:
default:
backend: claude
planning:
backend: gemini # cheap model for planning
review:
backend: claude # best model for review
event_loop:
max_iterations: 15
completion_promise: LOOP_COMPLETE
// the stack
hats is part of a larger system
hats
the loop
iterate until done
pi
the runtime
LLM + tools + extensions
use hats standalone for task loops. pair with rho for persistent agents that remember across sessions.