Exit codes & environment

What each carol exit code means in v0.1.22, and the environment variables Carol reads, including CAROL_APP_KEY.

Carol v0.1.22

Every Carol command exits with one of these codes. The message on stderr says what to fix.

Exit codes

CodeMeaning
0OK, or a plan with nothing to do. tick also exits 0 when some items were refused.
2Usage, config or a parse error in a planning file. Also a failed doctor check, handoff check findings, several initiatives with none named, and watch without --apply.
3Auth missing: gh isn't logged in, board lacks the project scope, CAROL_APP_KEY isn't set, or [identity] is missing
4Plan refused: two items share one marker, the lock is held, ticket found no scope issue, specify, run or report refused the row, report found no run-report comment on the run pull request, or skills install met an unmanaged copy
5Read-back mismatch: a write didn't stick. The message names the fields.
6Tracker or Zurdo unavailable, a tracker write failed, or a PRD has no run state to read

A parse error always comes before any write. Carol reads every planning file before it opens the tracker, so a malformed file never leaves a half-applied plan.

Zurdo's codes, passed through

CommandPasses through
specifyzurdo scaffold's exit code when it fails. Its last attempt stays under .zurdo/scaffold/<phase>/.
runzurdo run's exits 1 to 4, with nothing pushed. Exits 5 and 6 open a draft pull request, and run exits 0 with Zurdo's code in data.zurdo_exit.
carol run docs/billing/scope.md phase-02 --apply --format json | jq .data.zurdo_exit

Environment

VariableEffectDefault
CAROL_APP_KEYPath to the GitHub App's private key. The file must have no group or other permission bits.Unset. The App commands exit 3 without it.
CAROL_TOKEN_MAX_AGE_SECSThe age, in seconds, at which Carol mints a new App installation token before its next write. GitHub expires one after an hour.2700 (45 minutes)
CAROL_ZURDOThe zurdo binary Carol callszurdo on PATH
CAROL_CLAUDE_BINThe Claude Code CLI the engine loop runs its agent sessions withclaude on PATH
CAROL_HOSTThe machine's name in the AI usage issueThe host name
CLAUDE_CONFIG_DIR, CODEX_HOME, COPILOT_HOMEWhere carol usage reads each harness's store~/.claude, ~/.codex, ~/.copilot
GH_TOKEN, or gh's own loginThe account the sync commands write asgh's login
chmod 600 ~/.config/carol/app.pem
export CAROL_APP_KEY=~/.config/carol/app.pem

Agent sessions get none of the GitHub tokens: Carol removes GH_TOKEN, GITHUB_TOKEN and the askpass helpers from their environment, and makes every write itself.

Files Carol keeps

PathHolds
$(git rev-parse --git-common-dir)/carol/lockThe lock every --apply holds, naming its pid and command
$(git rev-parse --git-common-dir)/carol/journal.jsonlOne JSON line per applied op, for people. Carol never reads it.
.carol/worktrees/<phase>The worktrees specify and run work in, so your checkout is never touched

Next: Internals