agentafk
Reference

CLI reference

Commands, arguments, and options accepted by afk.

Use afk for the interactive REPL or choose a command below. Commands follow stable registration order; hidden commands and options are omitted. Run afk --version for the installed version.

afk

AI agent CLI. Starts interactive REPL by default; use afk chat for one-shot.

Usage: afk [options] [command]

Options

FlagsDescriptionDefault
-V, --versionoutput the version number
--no-update-checkSkip update version check
-h, --helpdisplay help for command

Subcommands

CommandDescription
chatSend a message to the agent
configView or edit AFK configuration (afk.config.json + afk.env)
daemonRun agent-afk as a daemon that fires scheduled tasks (e.g. /forge-friction --auto)
webServe a local web UI for live agent sessions
queueManage the pull-trigger task queue (used with afk daemon --trigger pull)
eventsEvent ingress producers that write into the pull queue (Part of #3896)
interactiveStart interactive chat session
loginSave an Anthropic API key or OAuth token for afk to use
pluginManage AFK plugins (install / update / list / remove / enable / disable)
marketplaceManage AFK plugin marketplaces (install / list / plugins / install-plugin / remove / update)
statusCheck agent connection status
usageShow API usage per provider/account: per-minute headroom, 429 freezes, 5h/7d windows, data age
doctorCheck system health and configuration
migrateImport plugins, skills, and MCP servers from Claude Code / Codex into AFK
providerProvider diagnostics and configuration
completionEmit shell completion script (zsh|bash|fish)
telegramManage the Agent AFK Telegram bot (setup, start, stop, status)
farmRun a task across N speculative git worktree branches in parallel
worktreeManage git worktrees created by afk
branchManage remote branches created by afk worktrees
updateUpdate agent-afk to the latest published version
scheduleManage scheduled daemon tasks
bgInspect persisted background subagent job logs. Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.
traceInspect the witness-layer trace of a session — the durable record of everything the agent did. Reads ~/.afk/state/witness/<session>/trace.jsonl.
whatifPredict how a proposed change to your AFK environment will affect the agent's behaviour. Optionally run episodes to verify empirically. Pass a plain-English description, explicit flags, or a --spec file.
witnessSearch and filter the witness-layer trace history — the durable record of everything agents did across sessions.
serviceManage AFK background services (launchd on macOS, systemd --user on Linux, Task Scheduler on Windows) — always-on, auto-restart
restartRestart AFK background services (<telegram|daemon>); with no name, restarts every installed service
browserGive the agent web hands: connect your real Chrome, or save a login it reuses
improveSelf-improvement pipeline: scan traces, triage cards, draft proposals, generate replay eval-cases.
shell-initEmit the optional afk shell wrapper that cd's the parent shell into a preserved worktree on exit. Default: auto-detect from $SHELL (falls back to bash). Install: eval "$(afk shell-init)" (or pipe to source in fish). NOTE: the emitted function overrides any existing afk alias or function in your shell.
transcriptSearch and index session transcripts. Transcripts are autosaved at ~/.afk/state/transcripts/. Run afk transcript reindex once before searching.
insightsGenerate a local usage analytics report from AFK telemetry
capturesList bash output captures — full output files written when a command produces more than 100 KB. Captures live under the witness directory and are evicted automatically by the 30-day / 2 GiB retention sweep.
defectsShow top recurring pre-existing defects from the session ledger
acpStart an Agent Client Protocol (ACP) JSON-RPC 2.0 server over stdio (compatible with Zed, JetBrains, and other ACP clients)

afk chat

Send a message to the agent

Usage: afk chat [options] [message]

Aliases: c

Guide: chat

Arguments

ArgumentDescriptionDefault
[message]Message to send; use - or omit to read from stdin

Options

FlagsDescriptionDefault
-m, --model <model>Model to use. Short aliases: opus|opus_1m|opus-5.5|opus-5.5_1m|sonnet|sonnet_1m|haiku. Any other value (e.g. auto for cursor-api-proxy, or a full claude-* ID) passes through to the SDK/proxy untouched."medium"
--max-turns <number>Maximum conversation turns"10"
--thinking <mode>Thinking mode: 'adaptive' | 'disabled' | 'max' | 'enabled:<N>'"enabled:max"
--effort <level>Effort level: low|medium|high|xhigh|max
--theme <mode>TUI color palette: dark|light|umber|auto. Default dark. umber matches the Umber terminal (dark-only). Also: AFK_THEME env, or theme in afk.config.json.
--max-output-tokens <n|max>Per-response output cap ('max' = model ceiling). Env: AFK_MAX_OUTPUT_TOKENS
--provider <name>Provider to use: anthropic|anthropic-direct|openai|openai-compatible|xai|xai-oauth. Default: auto-selected by model
--dump-prompt [path]Dump resolved SDK prompt+options+provenance to file (default: ~/.afk/logs/prompt-dump-<ISO>.json) or "stderr"
-w, --worktree [branch]Create a git worktree for an isolated one-shot. Optional value sets the branch name; otherwise auto-named. On clean exit (no uncommitted changes) the worktree and branch are auto-removed; on dirty exit the worktree is preserved.
--worktree-base <ref>Base git ref for the worktree created by --worktree. Default: the remote's default branch (origin/main), fetched fresh. Pass HEAD to base on your local checkout instead. Also: AFK_WORKTREE_BASE.
--mcp-config <path>Path to an additional MCP config file (highest priority — merges over ~/.afk/config/mcp.json, project-local .mcp.json, and plugin-contributed configs). File format identical to mcp.json.
--resume <id>Resume a persisted session by id
--continueContinue the most recent persisted session in cwd
--permission-mode <mode>Permission mode: default|acceptEdits|bypassPermissions|plan|dontAsk|auto|autonomous. Overrides afk.config.json permissionMode. Does not affect ask_question.
--dangerously-skip-permissionsForce bypass mode (already the default for new installs): skip path-approval prompts; read/write ANY path with no confirmation (permissionMode=bypassPermissions). Disable persistently with afk config set permissionMode default. Does not affect ask_question.
-s, --stream[no-op] reserved; use --format stream-json for headless streamingfalse
-f, --format <format>Output format (text|json|stream-json)"text"
--max-budget-usd <usd>Hard session cost ceiling in USD. Env: AFK_MAX_BUDGET_USD
--task-budget <tokens>Soft per-task token budget. Env: AFK_TASK_BUDGET
--session-id <uuid>Assign a specific UUID to this session (creates new; errors if already exists)
--post <targets>Headless publish of the final assistant message: github, telegram, or github,telegram
--post-pr <ref>PR number, URL, or branch for --post github (defaults to the current-branch PR)
-h, --helpdisplay help for command

afk config

View or edit AFK configuration (afk.config.json + afk.env)

Usage: afk config [options] [command]

Guide: editing-config

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

Subcommands

CommandDescription
getRead afk.config.json — a dotted key (e.g. telegram.notify.mode) or the whole file
setSet an afk.config.json key (dotted path; agent + human-tier keys)
unsetRemove an afk.config.json key
envView or edit afk.env environment variables

afk config get

Read afk.config.json — a dotted key (e.g. telegram.notify.mode) or the whole file

Usage: afk config get [options] [key]

Guide: editing-config

Arguments

ArgumentDescriptionDefault
[key]

Options

FlagsDescriptionDefault
--jsonOutput JSON
-h, --helpdisplay help for command

afk config set

Set an afk.config.json key (dotted path; agent + human-tier keys)

Usage: afk config set [options] <key> <value>

Guide: editing-config

Arguments

ArgumentDescriptionDefault
<key>
<value>

Options

FlagsDescriptionDefault
--jsonOutput JSON
-h, --helpdisplay help for command

afk config unset

Remove an afk.config.json key

Usage: afk config unset [options] <key>

Guide: editing-config

Arguments

ArgumentDescriptionDefault
<key>

Options

FlagsDescriptionDefault
--jsonOutput JSON
-h, --helpdisplay help for command

afk config env

View or edit afk.env environment variables

Usage: afk config env [options] [command]

Guide: editing-config

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
getRead afk.env — one var or all present (secrets masked)
setSet an afk.env var. Secret vars are prompted (masked) unless --stdin is given.
unsetRemove an afk.env var

afk config env get

Read afk.env — one var or all present (secrets masked)

Usage: afk config env get [options] [key]

Guide: editing-config

Arguments

ArgumentDescriptionDefault
[key]

Options

FlagsDescriptionDefault
--allInclude every known var, not just those set
--jsonOutput JSON
-h, --helpdisplay help for command

afk config env set

Set an afk.env var. Secret vars are prompted (masked) unless --stdin is given.

Usage: afk config env set [options] <key> [value]

Guide: editing-config

Arguments

ArgumentDescriptionDefault
<key>
[value]

Options

FlagsDescriptionDefault
--stdinRead the value from stdin (for scripted secret entry)
--jsonOutput JSON
-h, --helpdisplay help for command

afk config env unset

Remove an afk.env var

Usage: afk config env unset [options] <key>

Guide: editing-config

Arguments

ArgumentDescriptionDefault
<key>

Options

FlagsDescriptionDefault
--jsonOutput JSON
-h, --helpdisplay help for command

afk daemon

Run agent-afk as a daemon that fires scheduled tasks (e.g. /forge-friction --auto)

Usage: afk daemon [options]

Guide: daemon

Options

FlagsDescriptionDefault
-p, --port <number>Control HTTP port"7777"
--host <address>Bind address for the control HTTP surface. Overrides AFK_DAEMON_HOST. Defaults to 127.0.0.1 (loopback only). The control surface is UNAUTHENTICATED — bind a non-loopback address (e.g. 0.0.0.0) only on a trusted or firewalled network.
-t, --task <command>Command to fire on each tick. Required for the cron and both triggers; optional otherwise.
-c, --cron <expression>Cron expression (e.g. "0 */6 * * *"). Required when --trigger includes cron.
-i, --task-id <id>Task identifier (default: default)
--onceFire one tick and exit (for testing)false
--timeout-ms <ms>Per-tick session timeout in ms. Overrides AFK_TIMEOUT_MS. Defaults to no timeout (0 = unlimited) when unset.
--thinking <mode>Thinking mode: 'adaptive' | 'disabled' | 'max' | 'enabled:<N>'
--effort <level>Effort level: low|medium|high|xhigh|max
--trigger <mode>Trigger mode: cron | sessionstart | both | pull. Defaults to 'cron' when --cron is set, else 'sessionstart'.
--sessionstart-cooldown-ms <ms>Cooldown between Phase 6 sessionstart fires. Overrides AFK_SESSIONSTART_COOLDOWN_MS. Defaults to 6h.
--dump-prompt [path]Dump resolved SDK prompt+options+provenance to file (default: ~/.afk/logs/prompt-dump-<ISO>.json) or "stderr"
-h, --helpdisplay help for command

afk web

Serve a local web UI for live agent sessions

Usage: afk web [options]

Guide: web

Options

FlagsDescriptionDefault
-p, --port <port>port to listen on (default 4141, or AFK_WEB_PORT)
-H, --host <host>bind address (default 127.0.0.1, or AFK_WEB_HOST)
--token <token>bearer token (default: randomly minted per run)
--no-opendo not open a browser window
-m, --model <model>model for sessions started from the browser
--bypass-permissionsrun browser-started sessions without tool approvals (they are approved automatically)
-h, --helpdisplay help for command

afk queue

Manage the pull-trigger task queue (used with afk daemon --trigger pull)

Usage: afk queue [options] [command]

Guide: scheduling

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
addEnqueue a command for the pull-trigger daemon to execute
listList all pending queued tasks in FIFO order
removeRemove a pending task by id
clearRemove all pending tasks from the queue

afk queue add

Enqueue a command for the pull-trigger daemon to execute

Usage: afk queue add [options] <command>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<command>

Options

FlagsDescriptionDefault
--notify-on <mode>When to send a notification: failure | always | never
-h, --helpdisplay help for command

afk queue list

List all pending queued tasks in FIFO order

Usage: afk queue list [options]

Guide: scheduling

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk queue remove

Remove a pending task by id

Usage: afk queue remove [options] <id>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk queue clear

Remove all pending tasks from the queue

Usage: afk queue clear [options]

Guide: scheduling

Options

FlagsDescriptionDefault
-y, --yesSkip the confirmation prompt (non-interactive / CI)
-h, --helpdisplay help for command

afk events

Event ingress producers that write into the pull queue (Part of #3896)

Usage: afk events [options] [command]

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
githubPoll GitHub for events and enqueue tasks into the pull queue. Requires gh CLI authenticated (gh auth status). Supported event types: pr_comment, check_failure, issue_opened

afk events github

Poll GitHub for events and enqueue tasks into the pull queue. Requires gh CLI authenticated (gh auth status). Supported event types: pr_comment, check_failure, issue_opened

Usage: afk events github [options]

Options

FlagsDescriptionDefault
--repo <owner/repo>GitHub repository to watch (e.g. owner/repo)
--on <events>Comma-separated event types to watch: pr_comment, check_failure, issue_opened
--command <template>Command template for enqueued tasks. Placeholders: {{event_type}}, {{repo}}, {{event_id}}. Event payload is appended as untrusted data."A GitHub event occurred in {{repo}}. Event type: {{event_type}}. Event id: {{event_id}}. Review the untrusted payload below and take appropriate action if warranted."
--interval <ms>Poll interval in milliseconds"60000"
--oncePoll once and exit (useful for cron or testing)
-h, --helpdisplay help for command

afk interactive

Start interactive chat session

Usage: afk interactive [options] [input...]

Aliases: i

Guide: repl

Arguments

ArgumentDescriptionDefault
[input...]Optional first message — or a /slash-command — auto-submitted as the opening turn. E.g. afk "what does this project do" or afk /review. A bare afk starts an empty REPL.

Options

FlagsDescriptionDefault
-m, --model <model>Model to use. Short aliases: opus|opus_1m|opus-5.5|opus-5.5_1m|sonnet|sonnet_1m|haiku. Any other value (e.g. auto for cursor-api-proxy, or a full claude-* ID) passes through to the SDK/proxy untouched."medium"
--max-turns <number>Maximum conversation turns"100"
--thinking <mode>Thinking mode: 'adaptive' | 'disabled' | 'max' | 'enabled:<N>'"enabled:max"
--effort <level>Effort level: low|medium|high|xhigh|max
--theme <mode>TUI color palette: dark|light|umber|auto. Default dark. umber matches the Umber terminal (dark-only). Also: AFK_THEME env, or theme in afk.config.json. Toggle live with /theme.
--max-output-tokens <n|max>Per-response output cap ('max' = model ceiling). Env: AFK_MAX_OUTPUT_TOKENS
--provider <name>Provider to use: anthropic|anthropic-direct|openai|openai-compatible|xai|xai-oauth. Default: auto-selected by model
--dump-prompt [path]Dump resolved SDK prompt+options+provenance to file (default: ~/.afk/logs/prompt-dump-<ISO>.json) or "stderr"
-w, --worktree [branch]Create a git worktree for an isolated session. Optional value sets the branch name; otherwise auto-named. On clean interactive exit, choose whether to keep or delete it; dirty worktrees are always preserved.
--worktree-base <ref>Base git ref for the worktree created by --worktree. Default: the remote's default branch (origin/main), fetched fresh. Pass HEAD to base on your local checkout instead. Also: AFK_WORKTREE_BASE, or interactive.worktreeBase in afk.config.json.
--mcp-config <path>Path to an additional MCP config file (highest priority — merges over ~/.afk/config/mcp.json, project-local .mcp.json, and plugin-contributed configs). File format identical to mcp.json.
--resume <id>Resume a persisted session by id
--continueContinue the most recent persisted session in cwd
--permission-mode <mode>Permission mode: default|acceptEdits|bypassPermissions|plan|dontAsk|auto|autonomous. Overrides afk.config.json permissionMode. Does not affect ask_question.
--dangerously-skip-permissionsForce bypass mode (already the default for new installs): skip path-approval prompts; read/write ANY path with no confirmation. Toggle live with Shift+Tab (permission-mode cycle); disable persistently with afk config set permissionMode default. Does not affect ask_question.
--thinking-ui <mode>Thinking display mode: summary|live|digest|off. Default live. Also: AFK_THINKING_UI env, or interactive.thinkingUi in afk.config.json.
--debugShow SDK init metadata on startup; enables /debug commandfalse
--worktree-on-exit <ask|keep|remove>Clean-worktree quit policy. Default: ask on TTY, remove otherwise. Also: AFK_WORKTREE_ON_EXIT, or interactive.worktreeOnExit in afk.config.json.
--no-worktree-autonameDisable mid-session rename of auto-named worktrees from the first user message via haiku. Default on. Also: AFK_WORKTREE_AUTONAME=0, or interactive.worktreeAutoname:false in afk.config.json.
--no-shell-passthroughDisable the ! shell-passthrough feature. When set, inputs beginning with ! are sent to the model as literal text instead of being executed as shell commands. Also: AFK_SHELL_PASSTHROUGH set to 0, false, off, or no.
--plainForce the session to fully behave like a non-TTY surface for rendering: append-only plain-stdout output instead of the live-overlay renderer, AND the input surface downgrades to the simple line reader — even when stdout/stdin ARE a TTY. Full opt-out escape hatch for tmux/SSH/multiplexer sessions. Also: AFK_PLAIN_OUTPUT=1. Non-TTY sessions (pipes, CI) already use this path by default.
-h, --helpdisplay help for command

afk login

Save an Anthropic API key or OAuth token for afk to use

Usage: afk login [options] [token]

Guide: api-keys

Arguments

ArgumentDescriptionDefault
[token]

Options

FlagsDescriptionDefault
--forceOverride existing credentials even if already authenticated
-h, --helpdisplay help for command

afk plugin

Manage AFK plugins (install / update / list / remove / enable / disable)

Usage: afk plugin [options] [command]

Guide: mcp-plugins

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
installInstall a plugin from a git URL, owner/repo shorthand, local path, or <marketplace>:<plugin>
updateUpdate one plugin, or all if no name is given
listList installed plugins with their source, version, and enabled state
removeRemove a plugin (directory + index entry)
enableRe-enable a previously disabled plugin
disableKeep the plugin on disk but skip it from SDK init
configGet or set userConfig options for a plugin. afk plugin config <name> — list current option values afk plugin config <name> <key> — show one option value afk plugin config <name> <key> <value> — set an option afk plugin config <name> <key> --unset — remove a stored value

afk plugin install

Install a plugin from a git URL, owner/repo shorthand, local path, or <marketplace>:<plugin>

Usage: afk plugin install [options] <source> [name]

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<source>
[name]

Options

FlagsDescriptionDefault
-r, --ref <ref>Install a specific tag, branch, or SHA
-f, --forceReplace an existing plugin with the same name
-y, --yesSkip the install warning and countdown (non-interactive / CI)
-h, --helpdisplay help for command

afk plugin update

Update one plugin, or all if no name is given

Usage: afk plugin update [options] [name]

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
[name]

Options

FlagsDescriptionDefault
-r, --ref <ref>Pin to a specific ref instead of the latest tag
-h, --helpdisplay help for command

afk plugin list

List installed plugins with their source, version, and enabled state

Usage: afk plugin list [options]

Guide: mcp-plugins

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

afk plugin remove

Remove a plugin (directory + index entry)

Usage: afk plugin remove [options] <name>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk plugin enable

Re-enable a previously disabled plugin

Usage: afk plugin enable [options] <name>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk plugin disable

Keep the plugin on disk but skip it from SDK init

Usage: afk plugin disable [options] <name>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk plugin config

Get or set userConfig options for a plugin. afk plugin config <name> — list current option values afk plugin config <name> <key> — show one option value afk plugin config <name> <key> <value> — set an option afk plugin config <name> <key> --unset — remove a stored value

Usage: afk plugin config [options] <name> [key] [value]

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>
[key]
[value]

Options

FlagsDescriptionDefault
--unsetRemove the stored value for the given key
-h, --helpdisplay help for command

afk marketplace

Manage AFK plugin marketplaces (install / list / plugins / install-plugin / remove / update)

Usage: afk marketplace [options] [command]

Guide: mcp-plugins

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
installClone or symlink a marketplace into the local plugin cache
listList installed marketplaces with their source and ref
pluginsList plugins inside a marketplace, with [installed] / [available] markers
install-pluginInstall a single plugin from a marketplace
removeRemove a marketplace and cascade-delete its installed plugins
updateUpdate one marketplace, or all if no name is given

afk marketplace install

Clone or symlink a marketplace into the local plugin cache

Usage: afk marketplace install [options] <source> [name]

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<source>
[name]

Options

FlagsDescriptionDefault
-r, --ref <ref>Install a specific tag, branch, or SHA
-f, --forceReplace an existing marketplace with the same name
-h, --helpdisplay help for command

afk marketplace list

List installed marketplaces with their source and ref

Usage: afk marketplace list [options]

Guide: mcp-plugins

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

afk marketplace plugins

List plugins inside a marketplace, with [installed] / [available] markers

Usage: afk marketplace plugins [options] <name>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

afk marketplace install-plugin

Install a single plugin from a marketplace

Usage: afk marketplace install-plugin [options] <marketplace> <plugin>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<marketplace>
<plugin>

Options

FlagsDescriptionDefault
-r, --ref <ref>For git-sourced plugins, pin to a specific tag/branch/SHA
-f, --forceReplace an existing plugin with the same key
-y, --yesSkip the install warning and countdown (non-interactive / CI)
-h, --helpdisplay help for command

afk marketplace remove

Remove a marketplace and cascade-delete its installed plugins

Usage: afk marketplace remove [options] <name>

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk marketplace update

Update one marketplace, or all if no name is given

Usage: afk marketplace update [options] [name]

Guide: mcp-plugins

Arguments

ArgumentDescriptionDefault
[name]

Options

FlagsDescriptionDefault
-r, --ref <ref>Pin to a specific ref instead of the latest tag
-h, --helpdisplay help for command

afk status

Check agent connection status

Usage: afk status [options]

Aliases: s

Guide: repl

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

afk usage

Show API usage per provider/account: per-minute headroom, 429 freezes, 5h/7d windows, data age

Usage: afk usage [options]

Guide: usage-and-cost

Options

FlagsDescriptionDefault
--jsonOutput machine-readable JSON and exit
-h, --helpdisplay help for command

afk doctor

Check system health and configuration

Usage: afk doctor [options]

Guide: troubleshooting

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
-h, --helpdisplay help for command

afk migrate

Import plugins, skills, and MCP servers from Claude Code / Codex into AFK

Usage: afk migrate [options] [binary]

Guide: migrate

Arguments

ArgumentDescriptionDefault
[binary]

Options

FlagsDescriptionDefault
--from <binary>Source binary to import from (claude-code | codex)
--dry-runShow what would be imported without writing config
--mcpAlso import MCP servers (off by default — discloses each command first)
-y, --yesApply without the interactive confirmation (non-interactive / CI)
-h, --helpdisplay help for command

afk provider

Provider diagnostics and configuration

Usage: afk provider [options] [command]

Guide: models-providers

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
authInspect and manage provider auth state

afk provider auth

Inspect and manage provider auth state

Usage: afk provider auth [options] [command]

Guide: models-providers

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
diagnoseReport OpenAI and xAI auth sources. Never prints raw tokens.
xaiSuperGrok / SuperGrok Heavy / X Premium+ OAuth for Grok models

afk provider auth diagnose

Report OpenAI and xAI auth sources. Never prints raw tokens.

Usage: afk provider auth diagnose [options]

Guide: models-providers

Options

FlagsDescriptionDefault
-f, --format <format>Output format (text|json)"text"
--family <family>Exit-code family: openai (default, back-compat), xai, or any"openai"
--slot <name>Model slot name (local|small|medium|large or custom name) to resolve auth as that slot
-h, --helpdisplay help for command

afk provider auth xai

SuperGrok / SuperGrok Heavy / X Premium+ OAuth for Grok models

Usage: afk provider auth xai [options] [command]

Guide: models-providers

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
loginSign in with SuperGrok / SuperGrok Heavy / X Premium+ (device-code by default)
logoutClear stored SuperGrok / SuperGrok Heavy / X Premium+ OAuth tokens

afk provider auth xai login

Sign in with SuperGrok / SuperGrok Heavy / X Premium+ (device-code by default)

Usage: afk provider auth xai login [options]

Guide: models-providers

Options

FlagsDescriptionDefault
--device-codeUse RFC 8628 device-code flow (default)false
--browserUse browser PKCE loopback on 127.0.0.1:56121false
-h, --helpdisplay help for command

afk provider auth xai logout

Clear stored SuperGrok / SuperGrok Heavy / X Premium+ OAuth tokens

Usage: afk provider auth xai logout [options]

Guide: models-providers

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk completion

Emit shell completion script (zsh|bash|fish)

Usage: afk completion [options] <shell>

Guide: installation

Arguments

ArgumentDescriptionDefault
<shell>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram

Manage the Agent AFK Telegram bot (setup, start, stop, status)

Usage: afk telegram [options] [command]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
setupInteractive setup: validate bot token, discover chat ID, persist to ~/.afk/config/afk.env
check-tokenValidate TELEGRAM_BOT_TOKEN via getMe; emit JSON {set, valid, username?, botId?, reason?}
discover-chatPoll getUpdates for chats that have DM'd the bot; emit JSON {found, chats, reason?}
set-allowed-chatPersist AFK_TELEGRAM_ALLOWED_CHAT_IDS=<chatId> to ~/.afk/config/afk.env; emit JSON {ok, path}
startStart the bot as a background daemon
stopStop the bot (SIGTERM, then SIGKILL after 5s)
restartStop and restart the bot
statusShow running state, uptime, memory, and recent log entries
logsShow or follow the bot log

afk telegram setup

Interactive setup: validate bot token, discover chat ID, persist to ~/.afk/config/afk.env

Usage: afk telegram setup [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram check-token

Validate TELEGRAM_BOT_TOKEN via getMe; emit JSON {set, valid, username?, botId?, reason?}

Usage: afk telegram check-token [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram discover-chat

Poll getUpdates for chats that have DM'd the bot; emit JSON {found, chats, reason?}

Usage: afk telegram discover-chat [options]

Guide: telegram

Options

FlagsDescriptionDefault
--timeout-sec <n>How long to poll before giving up"60"
-h, --helpdisplay help for command

afk telegram set-allowed-chat

Persist AFK_TELEGRAM_ALLOWED_CHAT_IDS=<chatId> to ~/.afk/config/afk.env; emit JSON {ok, path}

Usage: afk telegram set-allowed-chat [options] <chatId>

Guide: telegram

Arguments

ArgumentDescriptionDefault
<chatId>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram start

Start the bot as a background daemon

Usage: afk telegram start [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram stop

Stop the bot (SIGTERM, then SIGKILL after 5s)

Usage: afk telegram stop [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram restart

Stop and restart the bot

Usage: afk telegram restart [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram status

Show running state, uptime, memory, and recent log entries

Usage: afk telegram status [options]

Guide: telegram

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk telegram logs

Show or follow the bot log

Usage: afk telegram logs [options]

Guide: telegram

Options

FlagsDescriptionDefault
-f, --followStream new log entries (like tail -f)false
-n, --lines <count>Number of trailing lines to show"50"
-h, --helpdisplay help for command

afk farm

Run a task across N speculative git worktree branches in parallel

Usage: afk farm [options] <task>

Guide: farm

Arguments

ArgumentDescriptionDefault
<task>Task description to run on each branch

Options

FlagsDescriptionDefault
-n, --branches <number>Number of branches to spawn (1-16)"3"
--labels <labels>Comma-separated branch labels (count must equal --branches)
-m, --model <model>Model to use"medium"
--base-ref <ref>Base git ref (default: HEAD)
--cwd <path>Source repo root (default: process.cwd())
--fail-fastAbort remaining branches on first failurefalse
--task-slug <slug>Deterministic task slug override (for tests)
--no-scoreSkip the post-run scorer (tests + lint + LoC)
--score-timeout <ms>Per-branch test timeout in ms (default 120000)
--no-memorySkip writing the farm-run fact to cross-session memory
--no-digestSkip pushing the Telegram digest on completion
-h, --helpdisplay help for command

afk worktree

Manage git worktrees created by afk

Usage: afk worktree [options] [command]

Guide: worktrees

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList all afk-managed worktrees and show prune candidates (dry-run only)
pruneRemove stale, empty, and orphaned worktrees

afk worktree list

List all afk-managed worktrees and show prune candidates (dry-run only)

Usage: afk worktree list [options]

Guide: worktrees

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk worktree prune

Remove stale, empty, and orphaned worktrees

Usage: afk worktree prune [options]

Guide: worktrees

Options

FlagsDescriptionDefault
--applyExecute removals (default is dry-run)false
--max-age-days-clean <n>Max age (days) for clean worktrees before removal
--max-age-days-dirty <n>Max age (days) for dirty worktrees before warning
--scope <scope>Scope: interactive | diagnose | all"all"
-h, --helpdisplay help for command

afk branch

Manage remote branches created by afk worktrees

Usage: afk branch [options] [command]

Guide: worktrees

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
pruneList (and optionally delete) stale remote afk/* branches whose PRs are closed/merged

afk branch prune

List (and optionally delete) stale remote afk/* branches whose PRs are closed/merged

Usage: afk branch prune [options]

Guide: worktrees

Options

FlagsDescriptionDefault
--executeActually delete branches (default is dry-run — prints what would be pruned)false
--remote <name>Remote to operate on"origin"
--base <branch>Base branch for commit-ahead comparison"main"
--prefix <prefix>Branch prefix to filter on"afk/"
-h, --helpdisplay help for command

afk update

Update agent-afk to the latest published version

Usage: afk update [options]

Aliases: upgrade

Guide: installation

Options

FlagsDescriptionDefault
--checkOnly check whether an update is available; do not install
--pin <version>Install a specific version instead of latest (must be valid semver)
--no-restartSkip install lifecycle scripts and forced service restarts (idle version watchdogs remain active)
-h, --helpdisplay help for command

afk schedule

Manage scheduled daemon tasks

Usage: afk schedule [options] [command]

Guide: scheduling

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
addAdd a new scheduled task
listList all scheduled tasks
removePermanently remove a scheduled task
enableEnable a scheduled task
disableDisable a scheduled task
logsShow recent execution history for a task

afk schedule add

Add a new scheduled task

Usage: afk schedule add [options]

Guide: scheduling

Options

FlagsDescriptionDefault
--name <name>Human-readable label
--command <cmd>Command to run
--cron <expr>Cron expression (5-field)
--executor <type>agent | shell (default: agent)"agent"
--trigger <mode>cron | sessionstart | both"cron"
--notify <when>failure | always | never"failure"
--cwd <path>Per-task working directory (absolute path or ~/…)
--disabledAdd in disabled statefalse
-h, --helpdisplay help for command

afk schedule list

List all scheduled tasks

Usage: afk schedule list [options]

Guide: scheduling

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk schedule remove

Permanently remove a scheduled task

Usage: afk schedule remove [options] <id>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk schedule enable

Enable a scheduled task

Usage: afk schedule enable [options] <id>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk schedule disable

Disable a scheduled task

Usage: afk schedule disable [options] <id>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk schedule logs

Show recent execution history for a task

Usage: afk schedule logs [options] <id>

Guide: scheduling

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
-n, --limit <n>Number of records to show"10"
-h, --helpdisplay help for command

afk bg

Inspect persisted background subagent job logs. Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.

Usage: afk bg [options] [command]

Guide: background-processes

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList background jobs from disk (most recent first)
tailStream events from a background job log. Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.
replayReplay all persisted events for a background job (alias for tail --from-start --no-follow). Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.

afk bg list

List background jobs from disk (most recent first)

Usage: afk bg list [options]

Guide: background-processes

Options

FlagsDescriptionDefault
-n, --max <number>Maximum jobs to show"20"
-h, --helpdisplay help for command

afk bg tail

Stream events from a background job log. Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.

Usage: afk bg tail [options] <jobId>

Guide: background-processes

Arguments

ArgumentDescriptionDefault
<jobId>

Options

FlagsDescriptionDefault
--from-startReplay all history before following new eventsfalse
--no-followExit after replaying existing events; do not wait for new onesfalse
-h, --helpdisplay help for command

afk bg replay

Replay all persisted events for a background job (alias for tail --from-start --no-follow). Note: bg jobs are tied to the parent REPL process — if the REPL exits, the job dies. This command reads the persisted log.

Usage: afk bg replay [options] <jobId>

Guide: background-processes

Arguments

ArgumentDescriptionDefault
<jobId>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk trace

Inspect the witness-layer trace of a session — the durable record of everything the agent did. Reads ~/.afk/state/witness/<session>/trace.jsonl.

Usage: afk trace [options] [command]

Guide: observability

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
showPretty-print a session's trace for humans. [session] is a session id or "latest" (the default) — the most recently written trace.
listList sessions that have a trace, most recent first
export-otlpConvert a sealed witness trace to OTLP/JSON (ExportTraceServiceRequest). Emits GenAI semantic convention spans: one session root, one span per subagent fork (gen_ai.agent.invoke), one span per tool call. Output is written to stdout; pipe to a collector or save with -o. Set --endpoint (or AFK_OTLP_ENDPOINT) to also POST the payload to a live OTLP/HTTP collector. A dead endpoint never fails the command. [session] is a session id or "latest" (default).

afk trace show

Pretty-print a session's trace for humans. [session] is a session id or "latest" (the default) — the most recently written trace.

Usage: afk trace show [options] [session]

Guide: observability

Arguments

ArgumentDescriptionDefault
[session]

Options

FlagsDescriptionDefault
--allInclude low-signal events (latency phases, paired tool starts)false
--jsonEmit the raw NDJSON record unchanged (for piping to jq)false
-n, --limit <number>Show only the last N events
--resultsPrint each tool call's full result (from the message journal) under its rowfalse
--results-lines <number>Max lines per result with --results (0 = no limit, default 40)
--evasionRun the block-evasion and lost-work analyzer and print its reportfalse
--evasion-window <number>Tool-call window size for evasion detection (default 10)
-h, --helpdisplay help for command

afk trace list

List sessions that have a trace, most recent first

Usage: afk trace list [options]

Guide: observability

Options

FlagsDescriptionDefault
-n, --max <number>Maximum sessions to show"20"
-h, --helpdisplay help for command

afk trace export-otlp

Convert a sealed witness trace to OTLP/JSON (ExportTraceServiceRequest). Emits GenAI semantic convention spans: one session root, one span per subagent fork (gen_ai.agent.invoke), one span per tool call. Output is written to stdout; pipe to a collector or save with -o. Set --endpoint (or AFK_OTLP_ENDPOINT) to also POST the payload to a live OTLP/HTTP collector. A dead endpoint never fails the command. [session] is a session id or "latest" (default).

Usage: afk trace export-otlp [options] [session]

Guide: observability

Arguments

ArgumentDescriptionDefault
[session]

Options

FlagsDescriptionDefault
-o, --out <file>Write output to a file instead of stdout
--endpoint <url>OTLP/HTTP collector URL to POST the payload to (overrides AFK_OTLP_ENDPOINT)
-h, --helpdisplay help for command

afk whatif

Predict how a proposed change to your AFK environment will affect the agent's behaviour. Optionally run episodes to verify empirically. Pass a plain-English description, explicit flags, or a --spec file.

Usage: afk whatif [options] [change...]

Guide: whatif

Arguments

ArgumentDescriptionDefault
[change...]

Options

FlagsDescriptionDefault
--append <text>Append text to your AFK.md (user scope)
--append-project <text>Append text to project AFK.md
--file <path=localfile>Set a file (path: home:<rel> or project:<rel>)
--hot <localfile>Replace HOT.md with a local file
--memory-add <text>Add a memory fact
--memory-category <cat>Category for next --memory-add (default: preference)
--memory-remove <id>Remove a memory fact by numeric id
--disable-skill <name>Disable a skill by name
--disable-plugin <name>Disable a plugin by name
--model <id>Test a candidate model change
--effort <level>Test a candidate effort level
--env <KEY=VALUE>Set an env var in the candidate sandbox
--spec <file>Load a ChangeSpec from a JSON file
--agent-model <id>Model the agent under test uses
--analyst-model <id>Model for compile/predict/judge (default: sonnet)
--verifyRun episodes and verify predictions empirically
--quickSingle-turn episodes (sets --max-turns 1)
--turns <n>Real turns to replay (default: 12)
--samples <n>Samples per episode per environment (default: 3)
--max-usd <n>Budget cap in USD (default: 5)
--judge <auto|jev|claude>Judge to use (default: auto)
--concurrency <n>Parallel episodes (default: 4)
--max-turns <n>Max turns per episode (default: 3)
--timeout <sec>Episode timeout in seconds (default: 180)
--probes <n>Synthetic probe episodes per prediction (1–12; default 6)
--max-predictions <n>Max predictions to retain (1–8; default 3 when probes>2, else 8)
--keep-sandboxesKeep sandbox directories after run
--no-baseline-sampleSkip the baseline-sample preflight (#2511)
--aaA/A calibration: snapshot both arms with zero changes; structural diff only, not with --verify (#2415)
--predict <text>Supply a prediction directly (can be repeated; skips analyst model)[]
--yesSkip confirmation of compiled spec
--forceBypass the MDE underpowered gate (--verify only)
--jsonPrint results as JSON to stdout
-h, --helpdisplay help for command

afk witness

Search and filter the witness-layer trace history — the durable record of everything agents did across sessions.

Usage: afk witness [options] [command]

Guide: observability

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
readRead and filter events from a session trace (default: latest)
searchText-search across recent sessions' traces

afk witness read

Read and filter events from a session trace (default: latest)

Usage: afk witness read [options] [session]

Guide: observability

Arguments

ArgumentDescriptionDefault
[session]

Options

FlagsDescriptionDefault
-k, --kinds <kinds>Comma-separated event kinds to filter by
-t, --tool <name>Filter tool_call events to this tool name
-e, --errorsShow only error eventsfalse
-n, --limit <number>Max events to return (default: 50, max: 200)
--jsonEmit raw JSON (for piping to jq)false
-h, --helpdisplay help for command

Text-search across recent sessions' traces

Usage: afk witness search [options] <query>

Guide: observability

Arguments

ArgumentDescriptionDefault
<query>

Options

FlagsDescriptionDefault
-n, --sessions <number>Number of recent sessions to scan (default: 20)
-k, --kinds <kinds>Comma-separated event kinds to filter by
--since <date>Only search sessions modified after this ISO date
--jsonEmit raw JSON (for piping to jq)false
-h, --helpdisplay help for command

afk service

Manage AFK background services (launchd on macOS, systemd --user on Linux, Task Scheduler on Windows) — always-on, auto-restart

Usage: afk service [options] [command]

Guide: run-as-service

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
installInstall <telegram|daemon> as an OS service that starts on login and relaunches on crash
uninstallStop the service and remove its config (LaunchAgent plist / systemd unit)
statusShow running PID, last exit status, and log file for one or all services
listList recognised service names and whether each is installed
upgradeRe-render the service config and atomically replace it if the on-disk file has drifted (e.g. after a version upgrade that adds new plist keys)
restartRestart one service, or every installed service when no name is given (launchctl kickstart -k / systemctl --user restart)

afk service install

Install <telegram|daemon> as an OS service that starts on login and relaunches on crash

Usage: afk service install [options] <name>

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
--no-watchDisable auto-restart-on-rebuild (launchd WatchPaths / systemd .path unit)
--dry-runWrite the config file but do not register with the supervisorfalse
-h, --helpdisplay help for command

afk service uninstall

Stop the service and remove its config (LaunchAgent plist / systemd unit)

Usage: afk service uninstall [options] <name>

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk service status

Show running PID, last exit status, and log file for one or all services

Usage: afk service status [options] [name]

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
[name]

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk service list

List recognised service names and whether each is installed

Usage: afk service list [options]

Guide: run-as-service

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk service upgrade

Re-render the service config and atomically replace it if the on-disk file has drifted (e.g. after a version upgrade that adds new plist keys)

Usage: afk service upgrade [options] <name>

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
<name>

Options

FlagsDescriptionDefault
--no-watchDisable auto-restart-on-rebuild
-h, --helpdisplay help for command

afk service restart

Restart one service, or every installed service when no name is given (launchctl kickstart -k / systemctl --user restart)

Usage: afk service restart [options] [name]

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
[name]

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk restart

Restart AFK background services (<telegram|daemon>); with no name, restarts every installed service

Usage: afk restart [options] [name]

Guide: run-as-service

Arguments

ArgumentDescriptionDefault
[name]

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk browser

Give the agent web hands: connect your real Chrome, or save a login it reuses

Usage: afk browser [options] [command]

Guide: browser

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
connectWire chrome-devtools-mcp (--autoConnect) so the agent can drive your real, logged-in Chrome
disconnectRemove the chrome-devtools server from your MCP config
loginOpen a headed browser, log in manually, and save the session to a vault profile the agent's native browser tools reuse
profilesList saved browser session-vault profiles

afk browser connect

Wire chrome-devtools-mcp (--autoConnect) so the agent can drive your real, logged-in Chrome

Usage: afk browser connect [options]

Guide: browser

Options

FlagsDescriptionDefault
--channel <channel>Chrome channel autoConnect targets (stable|beta|canary|dev)"stable"
--no-openDo not open chrome://inspect or System Settings when a setup step is missing
-h, --helpdisplay help for command

afk browser disconnect

Remove the chrome-devtools server from your MCP config

Usage: afk browser disconnect [options]

Guide: browser

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk browser login

Open a headed browser, log in manually, and save the session to a vault profile the agent's native browser tools reuse

Usage: afk browser login [options] <url>

Guide: browser

Arguments

ArgumentDescriptionDefault
<url>

Options

FlagsDescriptionDefault
--profile <name>Vault profile name to save the session under"default"
-h, --helpdisplay help for command

afk browser profiles

List saved browser session-vault profiles

Usage: afk browser profiles [options]

Guide: browser

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk improve

Self-improvement pipeline: scan traces, triage cards, draft proposals, generate replay eval-cases.

Usage: afk improve [options] [command]

Guide: self-improvement

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
scanRun registered detectors against witness traces. Dry-run by default. Some detectors are disabled by default (pass --include-disabled to enable): subagent-block, subagent-read-denial.
cardsInspect and triage failure cards written by afk improve scan
proposeGenerate a template-mode improvement proposal for a failure card. No LLM calls.
proposalsInspect improvement proposals on disk
eval-genGenerate a replay-mode eval-case from a failure card. Slices a byte-identical fixture from the source witness trace.
eval-casesInspect replay-mode eval-cases on disk
eval-runRun the smallest deterministic validation contract for an eval-case's pattern. Validates guardrails (no LLM, no patch/apply). Known contracts: repeat-loop-circuit-breaker, skill-max-depth-recovery-hint, tool-failure-density-enabled, closure-abort-recovery-hint.
approveMark a proposal or eval-case as approved. Pass the proposal id (from proposals list) or eval-case id (from eval-cases list).

afk improve scan

Run registered detectors against witness traces. Dry-run by default. Some detectors are disabled by default (pass --include-disabled to enable): subagent-block, subagent-read-denial.

Usage: afk improve scan [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--since <duration>Only scan sessions newer than this (e.g. 7d, 24h, all)"7d"
--writePersist failure cards to disk. Without this flag, scan is dry-run.false
--min-repeats <n>repeated-tool-use threshold (default 4)"4"
--closure-min-occurrences <n>closure-anomaly threshold (default 1)"1"
--block-min-occurrences <n>subagent-block threshold (default 2)"2"
--read-denial-min-occurrences <n>subagent-read-denial threshold (default 2)"2"
--tool-failure-min-failures <n>tool-failure-density absolute count threshold (default 3)"3"
--tool-failure-min-rate <rate>tool-failure-density rate threshold, 0–1 (default 0.25)"0.25"
--only <names>Comma-separated detector names to run (any of: repeated-tool-use, closure-anomaly, subagent-block, tool-failure-density, subagent-read-denial)
--include-disabledRun detectors marked disabled-by-default (currently: subagent-block, subagent-read-denial)false
-h, --helpdisplay help for command

afk improve cards

Inspect and triage failure cards written by afk improve scan

Usage: afk improve cards [options] [command]

Guide: self-improvement

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList all failure cards, newest first
showPrint a failure card by slug
triageAppend a human note and/or change status on a failure card

afk improve cards list

List all failure cards, newest first

Usage: afk improve cards list [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--pattern <name>Filter by pattern name
--severity <level>Filter by severity: low | medium | high
--status <state>Filter by status: open | deferred | resolved
--regressedOnly show resolved/deferred cards that fired again after their latest triage notefalse
--jsonEmit JSON instead of a tablefalse
-h, --helpdisplay help for command

afk improve cards show

Print a failure card by slug

Usage: afk improve cards show [options] <slug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<slug>

Options

FlagsDescriptionDefault
--jsonEmit raw JSON instead of rendered markdownfalse
-h, --helpdisplay help for command

afk improve cards triage

Append a human note and/or change status on a failure card

Usage: afk improve cards triage [options] <slug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<slug>

Options

FlagsDescriptionDefault
--note <text>Note text to append (non-empty)
--status <state>New status (one of: open, deferred, resolved)
--jsonEmit the resulting card as JSONfalse
-h, --helpdisplay help for command

afk improve propose

Generate a template-mode improvement proposal for a failure card. No LLM calls.

Usage: afk improve propose [options] <slug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<slug>

Options

FlagsDescriptionDefault
--id <override>Override the auto-generated proposal id
--jsonEmit the proposal JSON to stdout (still writes to disk)false
--no-writeRender the proposal without persisting to disk (preview mode)
--forceWrite even if this card already has a proposal (default: refuse)false
-h, --helpdisplay help for command

afk improve proposals

Inspect improvement proposals on disk

Usage: afk improve proposals [options] [command]

Guide: self-improvement

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList all proposals, newest first
showPrint a proposal by id

afk improve proposals list

List all proposals, newest first

Usage: afk improve proposals list [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--card <slug>Filter by card slug
--risk <level>Filter by risk: low | medium | high
--status <state>Filter by status: draft | approved | rejected | superseded
--triageShow only draft proposals, sorted oldest-first by age (highest-priority first for human review)false
--jsonEmit JSON instead of a tablefalse
-h, --helpdisplay help for command

afk improve proposals show

Print a proposal by id

Usage: afk improve proposals show [options] <id>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
--jsonEmit raw JSON instead of rendered markdownfalse
-h, --helpdisplay help for command

afk improve eval-gen

Generate a replay-mode eval-case from a failure card. Slices a byte-identical fixture from the source witness trace.

Usage: afk improve eval-gen [options] <cardSlug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<cardSlug>

Options

FlagsDescriptionDefault
--proposal <id>Back-reference to a proposal (validated to exist). Sprint 3 does NOT mutate the proposal artifact.
--evidence-row <index>0-based index into the card's evidence array. Default: the most recent row (length - 1).
--id <override>Override the auto-generated eval-case id
--jsonEmit the eval-case JSON to stdout (still writes to disk)false
--no-writeRender the eval-case without persisting to disk (preview mode). Still reads the source trace.
--forceWrite even if this card already has an eval-case (default: refuse)false
-h, --helpdisplay help for command

afk improve eval-cases

Inspect replay-mode eval-cases on disk

Usage: afk improve eval-cases [options] [command]

Guide: self-improvement

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList all eval-cases, newest first
showPrint an eval-case by id

afk improve eval-cases list

List all eval-cases, newest first

Usage: afk improve eval-cases list [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--card <slug>Filter by card slug
--pattern <name>Filter by pattern (one of: repeated-tool-use, subagent-block, closure-anomaly, tool-failure-density, subagent-read-denial)
--status <state>Filter by status (one of: draft, approved, rejected, superseded)
--triageShow only draft eval-cases, sorted oldest-first by age (highest-priority first for human review)false
--jsonEmit JSON instead of a tablefalse
-h, --helpdisplay help for command

afk improve eval-cases show

Print an eval-case by id

Usage: afk improve eval-cases show [options] <id>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<id>

Options

FlagsDescriptionDefault
--jsonEmit raw JSON instead of rendered markdownfalse
-h, --helpdisplay help for command

afk improve eval-run

Run the smallest deterministic validation contract for an eval-case's pattern. Validates guardrails (no LLM, no patch/apply). Known contracts: repeat-loop-circuit-breaker, skill-max-depth-recovery-hint, tool-failure-density-enabled, closure-abort-recovery-hint.

Usage: afk improve eval-run [options] <evalCaseIdOrCardSlug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<evalCaseIdOrCardSlug>

Options

FlagsDescriptionDefault
--id <override>Override the auto-generated eval-run id
--jsonEmit the eval-run JSON to stdout (still writes to disk)false
--no-writeRun and render without persisting to disk (preview mode)
-h, --helpdisplay help for command

afk improve approve

Mark a proposal or eval-case as approved. Pass the proposal id (from proposals list) or eval-case id (from eval-cases list).

Usage: afk improve approve [options] <slug>

Guide: self-improvement

Arguments

ArgumentDescriptionDefault
<slug>

Options

FlagsDescriptionDefault
--by <name>Approver identity (defaults to $USER env var, then "unknown")
--forceAllow re-approving an already-approved artifactfalse
--jsonEmit outcome as JSON instead of human-readable textfalse
-h, --helpdisplay help for command

afk shell-init

Emit the optional afk shell wrapper that cd's the parent shell into a preserved worktree on exit. Default: auto-detect from $SHELL (falls back to bash). Install: eval "$(afk shell-init)" (or pipe to source in fish). NOTE: the emitted function overrides any existing afk alias or function in your shell.

Usage: afk shell-init [options] [shell]

Guide: installation

Arguments

ArgumentDescriptionDefault
[shell]

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

afk transcript

Search and index session transcripts. Transcripts are autosaved at ~/.afk/state/transcripts/. Run afk transcript reindex once before searching.

Usage: afk transcript [options] [command]

Guide: observability

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
reindexBuild (or rebuild) the FTS5 full-text index from all transcript files on disk. Safe to run repeatedly — replaces the index atomically.
searchSearch indexed transcripts via FTS5 full-text search. Supports FTS5 syntax: "exact phrase", term*, AND, OR. Run afk transcript reindex first to build the index.

afk transcript reindex

Build (or rebuild) the FTS5 full-text index from all transcript files on disk. Safe to run repeatedly — replaces the index atomically.

Usage: afk transcript reindex [options]

Guide: observability

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Search indexed transcripts via FTS5 full-text search. Supports FTS5 syntax: "exact phrase", term*, AND, OR. Run afk transcript reindex first to build the index.

Usage: afk transcript search [options] <query>

Guide: observability

Arguments

ArgumentDescriptionDefault
<query>

Options

FlagsDescriptionDefault
-n, --limit <number>Maximum results to return (1-1000)"10"
-h, --helpdisplay help for command

afk insights

Generate a local usage analytics report from AFK telemetry

Usage: afk insights [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--days <n>Lookback window in days"30"
--output <path>Output file path for the HTML report
--no-openDo not open the report in a browser after generation
-h, --helpdisplay help for command

afk captures

List bash output captures — full output files written when a command produces more than 100 KB. Captures live under the witness directory and are evicted automatically by the 30-day / 2 GiB retention sweep.

Usage: afk captures [options] [command]

Guide: background-processes

Options

FlagsDescriptionDefault
-h, --helpdisplay help for command

Subcommands

CommandDescription
listList recent bash output captures, newest first

afk captures list

List recent bash output captures, newest first

Usage: afk captures list [options]

Guide: background-processes

Options

FlagsDescriptionDefault
--session <id>Filter to a specific session id
-n, --limit <number>Maximum entries to show (default: 20)"20"
--jsonEmit raw JSON (for piping to jq)false
-h, --helpdisplay help for command

afk defects

Show top recurring pre-existing defects from the session ledger

Usage: afk defects [options]

Guide: self-improvement

Options

FlagsDescriptionDefault
--days <n>Lookback window in days"90"
--top <n>Maximum clusters to show"10"
--jsonEmit raw JSON (for scripting)
-h, --helpdisplay help for command

afk acp

Start an Agent Client Protocol (ACP) JSON-RPC 2.0 server over stdio (compatible with Zed, JetBrains, and other ACP clients)

Usage: afk acp [options]

Options

FlagsDescriptionDefault
-m, --model <model>model to use for sessions (default: configured default)
--max-turns <n>maximum agent turns per prompt (default: 10)"10"
--dangerously-skip-permissionsForce bypass mode: skip all permission prompts for all sessions created by this server
-h, --helpdisplay help for command

On this page

afkOptionsSubcommandsafk chatArgumentsOptionsafk configOptionsSubcommandsafk config getArgumentsOptionsafk config setArgumentsOptionsafk config unsetArgumentsOptionsafk config envOptionsSubcommandsafk config env getArgumentsOptionsafk config env setArgumentsOptionsafk config env unsetArgumentsOptionsafk daemonOptionsafk webOptionsafk queueOptionsSubcommandsafk queue addArgumentsOptionsafk queue listOptionsafk queue removeArgumentsOptionsafk queue clearOptionsafk eventsOptionsSubcommandsafk events githubOptionsafk interactiveArgumentsOptionsafk loginArgumentsOptionsafk pluginOptionsSubcommandsafk plugin installArgumentsOptionsafk plugin updateArgumentsOptionsafk plugin listOptionsafk plugin removeArgumentsOptionsafk plugin enableArgumentsOptionsafk plugin disableArgumentsOptionsafk plugin configArgumentsOptionsafk marketplaceOptionsSubcommandsafk marketplace installArgumentsOptionsafk marketplace listOptionsafk marketplace pluginsArgumentsOptionsafk marketplace install-pluginArgumentsOptionsafk marketplace removeArgumentsOptionsafk marketplace updateArgumentsOptionsafk statusOptionsafk usageOptionsafk doctorOptionsafk migrateArgumentsOptionsafk providerOptionsSubcommandsafk provider authOptionsSubcommandsafk provider auth diagnoseOptionsafk provider auth xaiOptionsSubcommandsafk provider auth xai loginOptionsafk provider auth xai logoutOptionsafk completionArgumentsOptionsafk telegramOptionsSubcommandsafk telegram setupOptionsafk telegram check-tokenOptionsafk telegram discover-chatOptionsafk telegram set-allowed-chatArgumentsOptionsafk telegram startOptionsafk telegram stopOptionsafk telegram restartOptionsafk telegram statusOptionsafk telegram logsOptionsafk farmArgumentsOptionsafk worktreeOptionsSubcommandsafk worktree listOptionsafk worktree pruneOptionsafk branchOptionsSubcommandsafk branch pruneOptionsafk updateOptionsafk scheduleOptionsSubcommandsafk schedule addOptionsafk schedule listOptionsafk schedule removeArgumentsOptionsafk schedule enableArgumentsOptionsafk schedule disableArgumentsOptionsafk schedule logsArgumentsOptionsafk bgOptionsSubcommandsafk bg listOptionsafk bg tailArgumentsOptionsafk bg replayArgumentsOptionsafk traceOptionsSubcommandsafk trace showArgumentsOptionsafk trace listOptionsafk trace export-otlpArgumentsOptionsafk whatifArgumentsOptionsafk witnessOptionsSubcommandsafk witness readArgumentsOptionsafk witness searchArgumentsOptionsafk serviceOptionsSubcommandsafk service installArgumentsOptionsafk service uninstallArgumentsOptionsafk service statusArgumentsOptionsafk service listOptionsafk service upgradeArgumentsOptionsafk service restartArgumentsOptionsafk restartArgumentsOptionsafk browserOptionsSubcommandsafk browser connectOptionsafk browser disconnectOptionsafk browser loginArgumentsOptionsafk browser profilesOptionsafk improveOptionsSubcommandsafk improve scanOptionsafk improve cardsOptionsSubcommandsafk improve cards listOptionsafk improve cards showArgumentsOptionsafk improve cards triageArgumentsOptionsafk improve proposeArgumentsOptionsafk improve proposalsOptionsSubcommandsafk improve proposals listOptionsafk improve proposals showArgumentsOptionsafk improve eval-genArgumentsOptionsafk improve eval-casesOptionsSubcommandsafk improve eval-cases listOptionsafk improve eval-cases showArgumentsOptionsafk improve eval-runArgumentsOptionsafk improve approveArgumentsOptionsafk shell-initArgumentsOptionsafk transcriptOptionsSubcommandsafk transcript reindexOptionsafk transcript searchArgumentsOptionsafk insightsOptionsafk capturesOptionsSubcommandsafk captures listOptionsafk defectsOptionsafk acpOptions