Sutra runs Claude Code in a loop over your task list. You write the tasks (beads), sutra feeds them to Claude one at a time and tracks progress. Think of it as autopilot for your backlog.
cd your-project
sutra --initThis creates .sutra/config where you can set project defaults (model, timeout, remote host, etc.).
Sutra needs these installed: br (beads_rust), claude (Claude Code CLI), jq, and timeout (or gtimeout on macOS).
sutraSutra queries br ready for unblocked tasks, picks the top one, hands it to Claude, and repeats. It keeps going until all tasks are done, the loop limit is hit, or the circuit breaker trips.
sutra --dry-runShows the next task without invoking Claude. Useful for sanity-checking before a long run.
sutra --max-tasks 3 # Stop after 3 completed tasks
sutra --max-loops 10 # Stop after 10 Claude invocations
sutra --timeout 20 # 20 minutes per invocation (default: 10)
sutra --max-cost 5.00 # Stop after $5 spentsutra --scope "auth" # Only tasks matching "auth"
sutra --scope "api|routing" # Regex — match "api" or "routing"sutra --model opus # Use Opus for harder tasks
sutra --model sonnet # Use Sonnet
sutra --model haiku # Default — fast and cheapPlaylists let you control the exact order of execution. Instead of letting sutra pick tasks, you specify them in a file.
sutra playlist create --epic epic-abc123 -o plan.playlistSutra expands the epic's children, asks Claude to order them sensibly, and injects quality gates.
sutra playlist create task-1 task-2 task-3 -o plan.playlistA playlist file is just a text file. Each line is one of:
# This is a comment
abc123 # A bead ID — run as a normal task
> Run the tests # A raw prompt — sent to Claude as-is
>@opus Review the auth flow # A raw prompt using Opus for this line
sutra playlist init plan.playlistThis checks that all bead IDs exist, validates gate density, and runs a semantic audit via Claude to fill in context for gate tags.
sutra --playlist plan.playlistsutra --dry-run --playlist plan.playlistShows every line, resolves bead titles, flags closed tasks, and reports gate density — without invoking Claude.
You can override settings per-line with @ annotations:
abc123 @model=opus @timeout=20 # This bead gets Opus and 20min timeout
> Quick check @turns=30 # This prompt gets max 30 turns
>@haiku Lightweight review # Shorthand — just the model name
Available annotations: @model, @turns, @timeout.
Gate tags are checkpoints that sutra expands into detailed prompts at runtime:
abc123
def456
ghi789
> @opus #SMOKE_TEST # Tests the endpoints from the last few tasks
jkl012
mno345
> #COMPLETENESS_SCAN # Scans for TODOs, stubs, incomplete work
> @opus #REVIEW # Architecture and test coverage review
Available gates: #SMOKE_TEST, #COMPLETENESS_SCAN, #REVIEW.
You can add context after the tag:
> @opus #SMOKE_TEST curl POST /api/login, verify token in response
By default, sutra creates a branch named after the playlist file. Override it:
sutra --playlist plan.playlist --playlist-branch feature/auth-v2Or put a directive at the top of the playlist file:
# branch: feature/auth-v2
abc123
def456
Open a second terminal:
sutra --monitorShows a live dashboard with current task, circuit breaker state, progress counters, and cost.
sutra --remote oracle # SSH host from config or argumentThis pushes your branch, syncs sutra to the remote, and starts it in a tmux session. Detach with Ctrl+B, D, reattach with tmux attach -t sutra.
sutra -t # or --tmuxWraps sutra in a detachable tmux session so you can close your terminal and come back later.
sutra --statusShows circuit breaker status, loop count, and playlist position.
sutra --resetClears the circuit breaker and all counters. Use this after sutra halts from repeated failures.
Sutra tracks whether Claude is making progress. If Claude finishes but the task isn't closed (no progress), sutra notices:
- 2 consecutive no-progress runs — circuit goes to HALF_OPEN (warning state)
- 3 more no-progress runs — circuit goes to OPEN (sutra halts)
- Any progress at any time — circuit resets to CLOSED
When the circuit opens, run sutra --reset and investigate why tasks aren't completing.
Edit .sutra/config to set defaults for your project:
# Model for all invocations
MODEL="sonnet"
# Kill invocations after 15 minutes
TIMEOUT_MINUTES=15
# Base branch for sutra's working branch
WORKING_BRANCH="main"
# Remote execution target
REMOTE_HOST="opc@oracle"
# Files to include in every prompt as a project map
CONTEXT_FILES="pubspec.yaml,lib/main.dart,lib/core/routing/app_router.dart"CLI flags always override config values.
| What you want | Command |
|---|---|
| Run the loop | sutra |
| Preview next task | sutra --dry-run |
| Run 3 tasks only | sutra --max-tasks 3 |
| Filter by scope | sutra --scope "auth" |
| Use Opus | sutra --model opus |
| Run a playlist | sutra --playlist plan.playlist |
| Preview a playlist | sutra --dry-run --playlist plan.playlist |
| Validate a playlist | sutra playlist init plan.playlist |
| Generate a playlist | sutra playlist create --epic ID -o file |
| Live dashboard | sutra --monitor |
| Remote execution | sutra --remote oracle |
| Check state | sutra --status |
| Reset after halt | sutra --reset |
| Initialize project | sutra --init |