Claude Code
Anthropic's CLI coding agent. The default agent in AO.
agent · Name: claude-code · Binary: claudeClaude Code is Anthropic's CLI coding agent. It's AO's default because it has first-class session resume, rich JSONL event logs, and a native hook system AO can register against.
Install
npm install -g @anthropic-ai/claude-codeThen sign in once:
claudeUse
agent: claude-codeThat's it — there are no plugin-level config keys.
How it works
- Launch:
clauderuns inside the worktree. AO setsCLAUDECODE="",AO_SESSION_ID, andAO_ISSUE_IDin the environment. - Activity tracking: AO registers a PostToolUse hook in
.claude/settings.jsonon workspace setup. The hook writes an AO activity entry each time Claude calls a tool, so the dashboard'sactive/ready/idlestates stay accurate. - Session resume:
claude --resume <sessionId>rehydrates the previous chat. AO maps its session ID to Claude's via the JSONL at~/.claude/projects/<project>/...jsonl. - Cost reporting: AO reads Claude's per-message cost field from the JSONL — visible on the dashboard card.
Environment variables
| Variable | Set by AO | Purpose |
|---|---|---|
AO_SESSION_ID | ✓ | Unique AO session identifier |
AO_ISSUE_ID | ✓ (when spawned from an issue) | Issue identifier |
CLAUDECODE | ✓ | Signals to Claude that it's running under a harness |
Your Anthropic API key comes from wherever claude normally reads it — ~/.claude/, env, etc. AO doesn't touch it.
Troubleshooting
`claude` not found
npm install -g @anthropic-ai/claude-code, then reopen your terminal so the PATH picks it up.
Dashboard shows no activity state
AO registers the PostToolUse hook in .claude/settings.json on spawn. If the hook got removed, run ao spawn again — AO re-installs it idempotently.
Session won't resume
Claude's session JSONL lives at ~/.claude/projects/<project-slug>/<sessionId>.jsonl. If that file is gone (cleaned up, moved), resume won't work — spawn fresh.