## adopt · machine-rendered from the repo docs/adopt/ at every sync
From zero to your first loop — install it, understand it, hand it one small feature, get answers. The training page is never stale: rendered from docs/adopt/ by scripts/site-sync.sh at every wrap.
on this page
## 01 · quickstart
One command installs the latest release — platform detected, checksum verified, no sudo:
curl -fsSL https://chug.sh/install.sh | sh
What it puts where:
~/.local/bin/chug — the binary, and nothing else. No config files, no daemon, no dotfiles; every run's state lives in the repo it ran in, under .chug/.~/.local/bin is not on your PATH, the installer prints the one export line to add.No release for your platform, or you want to live on source:
git clone https://github.com/tampajohn/chug && cd chug cargo install --path .
chug run takes a spec file with a check: line and a goal, then drives a fixed loop until that check exits zero:
cat > SPEC.md <<'EOF' # Fix the flaky login test The login test passes alone but fails roughly one run in five. Make it deterministic. check: cargo test --test login EOF chug run --spec SPEC.md --goal "Make the login test deterministic" \ --max-iters 40 --max-minutes 120
The check: line is the whole contract: a run only ends when the check exits 0 on a re-run, never when the model says it is done. Point --model at any provider that speaks the Anthropic Messages API — ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN in the env, or your existing ~/.claude/settings.json (chug reads it when the env is empty).
No spec yet? chug run --goal "Fix the flaky login test" --auto-spec drafts one for you, dry-runs its check, and refuses a check that cannot pass on the current tree. chug chat is the interactive sibling; --tui adds the live dashboard to either.
Single runs are one item. The loop makes it a queue that works itself — scaffolded and started in any repo of yours, with no clone of chug anywhere in the flow. The loop's queue is YOUR repo's TODO.md: it files, lands, and commits in your repo's branches, and an empty queue idles (a $0 dormant cycle — it never invents work to stay busy):
cd <your-repo> chug loop init # one-time: LOOP-SPEC.md + TODO.md + .chug/ nohup chug loop run > /dev/null 2>&1 & # start (detached; no clone required) .chug/loopd/loopd.sh status # liveness + recent cycle activity .chug/loopd/loopd.sh stop # exits after the current cycle
chug loop init is idempotent — run it again and every existing file is reported kept, never clobbered (--force overwrites with a .bak backup beside each file). It scaffolds a GENERIC loop contract you are meant to edit: LOOP-SPEC.md states the queue rules, the check:-line contract, and the gate expectations for YOUR repo; TODO.md starts empty. File a row — a spec under specs/ with a mechanical check: line, then one line in TODO.md — and the next cycle picks it up. The loop's model provider comes from the same env as chug run (a profile installed with install.sh --profile <name> is loaded automatically).
▪ iter NN … lines — reading, editing, running bash — and every event appends to .chug/events.jsonlchug: budget low — N iteration(s) remain as the ceiling nears; a budget death leaves LEDGER.md intact and prints a resume linegoal_complete appears only after the spec's check: re-runs and exits 0; a rejected claim keeps the loop in chargechug ledger prints LEDGER.md — the run's external memoryEVALUATION.md body — the loop examining its own recent cycles, dated same-UTC-day at the top.chug/loopd/loopd.log gains one cycle OK line per completed cycle (and a queue empty — dormant line when there is nothing to do — a $0 cycle), .chug/loopd/cycle-*.log holds each cycle's stream, and .chug/loopd/loopd.sh status answers "is it alive"## 02 · mental-model
chug is a driver-in-code loop, not a chat prompt. Five pieces carry everything; every feature lands inside one of them.
--resume keeps it.check: line per spec. The supervisor reads the same files every cycle — the queue is the interface, not a chat channel.
┌─────────────────────────────────────────────┐
│ TODO.md + specs/ the work queue │
└──────────────────────┬──────────────────────┘
▼
┌───────────────────────────────────────────────────┐
│ the driver loop (a program) │
│ │
│ re-read SPEC + GOAL + LEDGER.md each iteration │
│ │ │
│ ▼ │
│ one model turn (read / edit / bash / grep) │
│ │ │
│ ▼ │
│ claim: goal_complete → the check: re-runs │
│ │ │ │
│ exit 0 nonzero ──► keep chugging │
│ ▼ │
│ gates: build + clippy + suite + validator │
└──────────────────────┬────────────────────────────┘
▼
┌─────────────────────────────────────────────┐
│ wrap: merge + push + harvest → next cycle │
└─────────────────────────────────────────────┘
LEDGER.md rides beside the loop the whole way down — rewritten every iteration, so a trimmed or crashed run resumes from the page, not from the model's memory.
## 03 · first-feature
The loop works a file-based queue, so filing a row is the assignment. The whole arc:
specs/tNNN-short-slug.md: the concern, the requirements, the tests, and a mechanical check: line. The loop's goal gate re-runs that check and accepts nothing but exit 0.TODO.md: id, title, spec path, priority, status open. That row is the contract; there is nothing to assign to anyone.chug loop run (after chug loop init) the next cycle takes the highest-priority open row; or run it directly: chug run --spec specs/tNNN-short-slug.md --goal "Land X"..chug/ (events, ledgers, decision records). The wrap is the paper trail.check: is a command, not a vibe: a test that fails before and passes after, a script that exits nonzero on the bug and zero on the fix.Bad first items: sweeping refactors (unbounded), anything without a mechanical check (the loop cannot prove done), and infrastructure your teammates have not agreed to (the queue is public — file it, propose it, let it be picked up deliberately).
## 04 · faq
What does this cost?
The public numbers are on the site: the cost tile on the home page and the per-day table on the docs page — daily spend, baked in at every sync. The loop's own cost boundary: empty days take a $0 mechanical cheap exit, a drained queue goes dormant (a weekly read-only audit, not manufactured work), and routine cycles ride the cheaper routine model unless the day's freshness rule escalates.
Is it safe to point at my repo?
The trust boundary is mechanical, not hopeful. Every shell call passes the risk gate — destructive calls are blocked with an error the model can route around — and .chug/hooks.json can veto any tool call, while .chug/permissions.json deny-rules fail closed. Tools are sandboxed to the run cwd, and the goal gate is the spec's check: re-running, never a model's claim. The README's risk gate, hooks, and permissions sections name every knob. The full story — the gates, the validators, the decision gate, the cost guardrails, and the repo's own redaction history — is on the risk-gate page, rendered from the repo's docs/risk-gate.md at every sync.
Do I need an Anthropic account?
No. chug speaks the Anthropic Messages wire protocol; point ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN at any provider that speaks it. The repo's own loop runs kimi for judgment calls and glm for routine phases — per-phase routing is a mechanical rule in the supervisor, never a model's choice; a profile installed with install.sh --profile <name> carries the same keys for your repo's loop.
How do I uninstall?
.chug/loopd/loopd.sh stop in each repo the loop runs in (and remove the launchd plist, if you installed one), delete the binary — rm ~/.local/bin/chug, or cargo uninstall chug if you installed from source — and delete any per-repo state you do not want (the .chug/ directory inside each repo it ran in). Nothing else was installed.