agentafk
Surfaces

Interactive REPL

afk i launches a full-featured interactive REPL with slash commands, plan mode, background tasks, and streaming output.

The interactive REPL is Agent AFK's primary surface. Launch it with:

afk i
# or
afk interactive
# or just
afk          # interactive is the default command

The REPL gives you a persistent session with full tool access — bash, file ops, web fetch, subagents, MCP servers, memory — plus slash commands for built-in and plugin skills.

Common options

afk i --model opus           # pick a model
afk i --max-turns 200        # raise the turn limit (default 100)
afk i --resume <id>          # resume a saved session
afk i --continue             # continue the most recent session in cwd
afk i -w                     # create a git worktree for isolation
afk i -w my-feature          # worktree on a named branch
afk i --mcp-config ./mcp.json  # load an additional MCP config

Slash commands

Type / in the REPL to see available commands. Typos are caught automatically — type /mnt and AFK suggests /mint.

Session control

CommandDescription
/helpList all available slash commands
/exit, /quitLeave the REPL
/clearClear the screen
/compactManually compact conversation history
/resumeResume a saved session
/forkDuplicate this conversation into a new, independent session
/name [name]Show or set this session's name
/sh [list | show \<id\> | kill \<id\>]Inspect or kill user-typed !cmd shell jobs

Information

CommandDescription
/costRunning cost for the session
/tokensContext usage breakdown (total, categories, MCP tools, agents, skills)
/statsShow session statistics including skill runs
/historyPrint prior turns
/transcriptView full session transcript in $PAGER
/modelShow or switch the active model
/toolsList registered tools
/mcpShow MCP server status
/limitsShow rate-limit and budget state
/debugToggle verbose debug output
/keysShow keybinding reference
/configView resolved configuration (model, provider, API keys, env vars)
/doctorRun system health checks (API keys, directories, config, Telegram)
/font-size [size] [editor]Get or set the terminal font size in Cursor / VS Code
/reauth [--check]Re-read keychain credentials and swap the running session's client

Permissions

CommandDescription
/allow-dir <path>Pre-authorize a directory for file tools (--revoke <path> to remove a grant)
/afkEnter autonomous mode — risk-gated, with remote answer/abort over Telegram (/afk off to exit)

There is no /bypass command — cycle into bypassPermissions with Shift+Tab (the REPL shows a ⚠ BYPASS badge while it is active). See Permissions for the full model behind these commands.

Planning and state

CommandDescription
/planOpen the plan editor
/todoManage the persistent todo list
/initScan the current project and generate an AFK.md
/changelog [--dry-run]Generate CHANGELOG entries from commits since last tag

Background tasks

Press Ctrl+B to background a running foreground subagent (there is no whole-turn detach). The status bar at the bottom of the REPL shows running background-subagent counts.

CommandDescription
/bgsubList background subagent jobs
/bgsub:statusShow status of background subagent jobs
/bgsub:join <id>Wait for and inject a background subagent's result
/bgsub:cancel <id>Cancel a running background subagent job

Built-in skills

CommandDescription
/mint <idea>End-to-end feature pipeline: spec → build → verify → ship
/diagnose <bug>Parallel root-cause analysis for bugs and failing tests
/get-startedGuided first-run onboarding for AFK
/service-setupInstall an AFK background process as a macOS LaunchAgent
/telegram-setupFirst-time Telegram bot onboarding

Maintainer-loop skills (/forge, /audit-fit) are hidden by default. Set AFK_INTERNAL=1 to surface them.

Plugins and discovery

CommandDescription
/skillsDiscover skills loaded from plugins and user scope
/agentsList subagents loaded by the SDK
/reload-pluginsRe-scan plugin and user directories after edits

Plan mode

/plan opens an in-REPL plan editor. You can write a multi-step plan, iterate on it, and then let the agent execute it. Plan state is saved to ~/.afk/state/ and survives session restarts.

Exiting plan mode

When the model judges its plan ready, it calls the exit_plan_mode tool. This presents a three-choice picker:

ChoiceWhat happens
Approve — implement now (restore your previous mode)Restores the permission mode you were in before entering plan mode (e.g. default, acceptEdits) and seeds the implement turn
Approve — implement now (bypass mode)Escalates to bypassPermissions — no approval prompts, read/write any path — then seeds the implement turn
Keep planningStays in plan mode; the model continues refining

The mode flip is deferred to the start of the next turn — the gate stays locked in plan mode for the remainder of the current turn. On approval, the model is instructed to first save the plan to .afk/plans/ as a markdown file, then implement it.

You can also exit plan mode manually with /plan off.

Shift+Tab permission cycle

Press Shift+Tab at any time to cycle the active permission mode. The cycle order is:

default → plan → bypassPermissions → default (wraps)
ModeWhat it does
defaultPath containment + approval prompts active
planWrites refused; read-only bash allowed, mutating bash blocked
bypassPermissionsPath-approval prompts and containment off; read/write any path

Each press advances one step and prints a one-line status message. If the session is already in autonomous (AFK) mode, Shift+Tab exits AFK and lands on default — the key never enters AFK. Use /afk to enter autonomous mode.

See Permissions for full mode descriptions.

Streaming output

The REPL streams model output token-by-token with markdown rendering. Tool calls render as collapsible lane entries showing the tool name, arguments, and result. Extended thinking renders as a summary lane (or live, depending on --thinking-ui).

Type-ahead and queueing

You don't have to wait for the agent to finish a turn before typing your next message. Press Enter on a non-empty buffer while a turn is in flight and the message is queued — the input clears so you can draft the next one. The input line shows [queued] for one pending message or [N queued] for several.

Queued messages drain in order (FIFO), one per completed turn. To revise the message you most recently queued, press (Up arrow) on an empty buffer: the last queued message pops back into the input as an editable draft (non-destructive). Backspace does not dequeue — committed type-ahead is only ever recalled for editing with ↑, never silently discarded.

Usage limits

When your Claude subscription hits its hourly limit mid-session, the REPL shows a usage-limit notice rather than failing the turn. By default AFK auto-resumes when the limit resets — you don't need to retype anything. The notice also lists the actions you can take right now:

  • Switch model — type /model <name> then Enter to continue on a different model.
  • Switch account — run claude login in any terminal; the session resumes automatically.
  • Stop waiting — press Esc.

Set autoResumeOnUsageLimit: false in afk.config.json to opt out of automatic resume (the notice then prompts you to resend, switch to API-key billing, or re-auth). The /limits command shows current rate-limit and budget state at any time.

Worktree isolation

-w / --worktree creates a git worktree for the session. Every bash command and file operation the agent runs lands in the isolated worktree, not your main working tree. On a clean exit (no uncommitted changes), the worktree and branch are removed automatically. On a dirty exit, the worktree is preserved so you can review or commit the changes.

afk i -w                     # auto-named worktree
afk i -w my-feature          # named branch
afk i -w --worktree-base HEAD  # base on local checkout instead of origin/main

Shell passthrough

Prefix a line with ! to run it directly in your shell without sending it to the model:

> !ls -la
> !git status

Disable with --no-shell-passthrough or AFK_SHELL_PASSTHROUGH=0.

Session persistence

Sessions are saved to ~/.afk/state/sessions/. Resume from the REPL with /resume, or at startup:

afk i --resume <session-id>
afk i --continue              # most recent session in cwd

/resume lists sessions saved from the current working directory first — so the picker in a project shows that project's sessions, not every session on the machine. When no session was saved from the current directory, it falls back to listing all saved sessions.

On this page