Skip to Content
caffeine docs

Command reference

Every command and flag, exit codes, environment variables.

Every command accepts --plain (no colors, no animations, one timestamped line per event), -h/--help and -V/--version.

caffeine run

caffeine run <pipeline> [targets...] [--all] [-n/--dry-run] [-q/--quiet]
FormRuns on
caffeine run pthe current folder
caffeine run p site apithe targets site and api from workspace.yaml
caffeine run p . or caffeine run p ~/code/sitethat folder, in place
caffeine run p --allevery target whose pipelines lists p
FlagEffect
-n, --dry-runEverything runs except commit, push and pull request (caffeine pr does nothing), and {{last_run}} does not move. The diff is in the run's logs. In a folder run in place, the files are still changed: use a named git target for a run that leaves your checkout untouched.
-q, --quietHide agent text and tool calls, keep steps, checks and results.
--allEvery target that lists the pipeline. Cannot be combined with target names.

Up to max_parallel targets run at the same time. In a terminal, each target gets a live progress line, and a receipt sums up the run at the end: cost, duration, pull requests, and where the logs are.

A folder (the current one, . or a path) that is a declared target is run as that target, in place: same name, same context, same {{last_run}} history. A folder matches a target when it is the target's dir:, or when one of its git remotes points to the target's git: repo, whatever the spelling ([email protected]:me/site.git, https://github.com/me/site, ssh://[email protected]:22/me/site.git…). A folder that matches two targets is refused: name the one you want. A name declared in workspace.yaml always wins over a folder with the same name.

caffeine runs

caffeine runs [-n/--limit 15]

Recent runs, newest first: status (✔ ok, ⏭ nothing to do, ✘ failed), time, pipeline, target, cost, duration, and the pull request or the error.

caffeine list

caffeine list [pipelines|targets|sessions|models] [--pipeline <name>]
  • pipelines (default): steps, which targets use each one, description. A pipeline that fails to load is shown in red with the reason.
  • targets: kind (git, dir, scratch) and pipelines. --pipeline p keeps only the targets that use p.
  • sessions: open work sessions.
  • models: model roles and their runner.

caffeine init

Creates the home (~/.caffeine or $CAFFEINE_HOME) with a commented config.yaml and workspace.yaml, prompts/rules.md, and an example pipeline hello. Existing files are never overwritten.

caffeine doctor

Checks the home, config.yaml, workspace.yaml, git, gh and its login, the Claude Code CLI, the API key variables of the model roles (api_key_env, and ANTHROPIC_API_KEY for auth: api_key), the cache store (writable, and whether copies share blocks), each sandbox's engine binary and image (present, or pullable: nothing is pulled), the Claude Code CLI in it and its login when a claude step runs there (for kubernetes: the context answers, you may create pods, exec, Secrets and network policies, and the Cilium API and hubble CLI when set), every pipeline (loaded and validated like a run would), and that every pipeline a target lists exists. Exits 1 when something is broken. Warnings (!) don't fail it.

caffeine open / close

caffeine open <target> [--no-shell]
caffeine close [<target>] [--force]

A work session is a full clone of a git target in ~/.caffeine/work/<target>, for working by hand next to the pipelines. Runs never touch it.

  • open clones (or resumes an open session) and starts your $SHELL in it. exit leaves the shell and keeps the session. --no-shell clones and prints the path.
  • close deletes the clone. It is refused when deleting it would lose work: changed or untracked files, commits never pushed, or stashes. --force deletes anyway. Without a target, it lists the open sessions.

caffeine changed

caffeine changed

Inside a run, lists the files the run changed so far, one per line, compared with a snapshot taken when the run started. Work that was already in the folder (uncommitted edits, untracked files) never shows up. Use it in your check scripts instead of git diff HEAD. Outside a run, it falls back to git: changes since HEAD plus untracked files.

caffeine scope

caffeine scope <glob>...

For verify:. Exits 1 and lists the offending files when the run changed a file outside the globs. See Pipelines.

caffeine pr

caffeine pr [--auto-merge] [--title <title>]

For the last step of a pipeline on git targets: commits, pushes to the target's git: URL (not the clone's origin, which a step could change) and opens or updates the pull request on that repository (gh … --repo). The default title is [<pipeline>] <date>. See Pipelines. Refused in a podman, docker or bwrap sandbox; on kubernetes, only the last step, which alone gets the token (Pull requests from a pod).

caffeine completions

caffeine completions zsh  > "${fpath[1]}/_caffeine"
caffeine completions bash > ~/.local/share/bash-completion/completions/caffeine
caffeine completions fish > ~/.config/fish/completions/caffeine.fish

The zsh completion is dynamic: caffeine run <Tab> lists your pipelines, then the targets that use the chosen pipeline. open lists targets and close lists open sessions. Bash and fish complete commands and flags.

caffeine stats

caffeine stats [-d/--days 30] [--no-gh]

Runs, cost, cost per useful run and duration per pipeline; steps, cost and fallback rate per model role; and with gh, what became of the pull requests. See Automation.

caffeine inbox / approve / reject

caffeine inbox [<id>] [--all]
caffeine approve <id> [--only a1,a3] [-q]
caffeine reject <id> [reason...]

What waits for your decision, and the decision. See Inbox.

caffeine gate

caffeine gate changed <url> | --cmd "<command>" [--key <name>]
caffeine gate release <owner/repo>
caffeine gate cargo
caffeine gate npm

First steps that exit 78 when there is nothing to do. See Automation.

caffeine check

caffeine check urls <file>... [--strict]
caffeine check json <file>...
caffeine check unchanged <glob>...
caffeine check actions [file]
caffeine check smoke --start "<cmd>" --url <base> <route>... [--save] [--status-only] [--wait 120] [--baseline <file>]
caffeine check deployed <url> [--status 200] [--contains <text>] [--wait 600] [--interval 15]

Checks for verify:. See Pipelines.

caffeine feedback / digest / gc

caffeine feedback [<pipeline> <reason...>] [--target <t>] [--pr <url>] [-d 30]
caffeine digest [-d/--days 7] [-o/--out <file>]
caffeine gc [-d/--days 90] [--keep-summaries] [-n/--dry-run]
caffeine cache ls
caffeine cache rm <pipeline> [--target <t>] [--key <k>] [--memory]

Notes on what you edited or rejected, a Markdown digest of the period, and housekeeping: old runs, the pipelines' caches, and containers or pods left by sandboxed runs. See Automation.

caffeine pack

caffeine pack add <git url or folder> [--name <n>] [--subdir <dir>]
caffeine pack list | update [<name>] | remove <name>

See Packs.

caffeine mcp

caffeine mcp [--read-only] [--allow-decisions]

See MCP server.

caffeine schedule

caffeine schedule list | install [--no-load] | remove [--no-load] | cron

See Automation.

caffeine secret

caffeine secret set <NAME>
caffeine secret delete <NAME>

macOS keychain entries for keychain_env. See Automation.

Exit codes

CodeMeaning
0Success. For run: every target ok or skipped.
1Error before or outside the run (bad config, unknown pipeline…), doctor found a problem, close refused, scope found files out of bounds.
2run: at least one target failed. approve: the apply run failed.
78gate: nothing to do (the pipeline stops as a success).
130run: interrupted by Ctrl-C or SIGTERM.

Environment variables

VariableEffect
CAFFEINE_HOMEThe home folder. Default ~/.caffeine.
CAFFEINE_CLAUDE_BINClaude Code CLI to use. Wins over claude_bin.
CAFFEINE_NO_ANIM=1No animations, colors kept.
NO_COLORNo colors and no animations.
CAFFEINE_LAUNCHD_DIRWhere caffeine schedule writes LaunchAgents. Default ~/Library/LaunchAgents.
CLAUDE_CODE_OAUTH_TOKENPassed to the claude runner. When set, ANTHROPIC_API_KEY is removed from its environment.

Output is plain automatically when stdout is not a terminal or TERM=dumb.

Environment variables for steps

run: steps, verify: commands and the cmd runner get:

VariableValue
CAFFEINE_HOMEThe home folder.
CAFFEINE_PIPELINEPipeline name.
CAFFEINE_TARGETTarget name.
CAFFEINE_TODAYRun date, YYYY-MM-DD.
CAFFEINE_LOGDIRThis run's log folder.
CAFFEINE_DRY_RUN1 in a dry run, empty otherwise.
CAFFEINE_BASECommit the workspace started from (git workspaces).
CAFFEINE_BRANCHThe run's branch (git targets only).
CAFFEINE_GITThe target's git: URL, where caffeine pr pushes (git targets only).
CAFFEINE_WORKDIRThe workspace folder (clone, folder or scratch).
CAFFEINE_SNAPSHOTThe snapshot taken at the start of the run, read by caffeine changed and caffeine scope.

The folder of the running caffeine binary is put first on PATH, so caffeine scope and caffeine pr inside steps use the same version.

On this page