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 commandThe 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 configSlash commands
Type / in the REPL to see available commands. Typos are caught automatically — type /mnt and AFK suggests /mint.
Session control
| Command | Description |
|---|---|
/help | List all available slash commands |
/exit, /quit | Leave the REPL |
/clear | Clear the screen |
/compact | Manually compact conversation history |
/resume | Resume a saved session |
/fork | Duplicate 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
| Command | Description |
|---|---|
/cost | Running cost for the session |
/tokens | Context usage breakdown (total, categories, MCP tools, agents, skills) |
/stats | Show session statistics including skill runs |
/history | Print prior turns |
/transcript | View full session transcript in $PAGER |
/model | Show or switch the active model |
/tools | List registered tools |
/mcp | Show MCP server status |
/limits | Show rate-limit and budget state |
/debug | Toggle verbose debug output |
/keys | Show keybinding reference |
/config | View resolved configuration (model, provider, API keys, env vars) |
/doctor | Run 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
| Command | Description |
|---|---|
/allow-dir <path> | Pre-authorize a directory for file tools (--revoke <path> to remove a grant) |
/afk | Enter 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
| Command | Description |
|---|---|
/plan | Open the plan editor |
/todo | Manage the persistent todo list |
/init | Scan 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.
| Command | Description |
|---|---|
/bgsub | List background subagent jobs |
/bgsub:status | Show 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
| Command | Description |
|---|---|
/mint <idea> | End-to-end feature pipeline: spec → build → verify → ship |
/diagnose <bug> | Parallel root-cause analysis for bugs and failing tests |
/get-started | Guided first-run onboarding for AFK |
/service-setup | Install an AFK background process as a macOS LaunchAgent |
/telegram-setup | First-time Telegram bot onboarding |
Maintainer-loop skills (/forge, /audit-fit) are hidden by default. Set AFK_INTERNAL=1
to surface them.
Plugins and discovery
| Command | Description |
|---|---|
/skills | Discover skills loaded from plugins and user scope |
/agents | List subagents loaded by the SDK |
/reload-plugins | Re-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:
| Choice | What 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 planning | Stays 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)| Mode | What it does |
|---|---|
default | Path containment + approval prompts active |
plan | Writes refused; read-only bash allowed, mutating bash blocked |
bypassPermissions | Path-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 loginin 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/mainShell passthrough
Prefix a line with ! to run it directly in your shell without sending it to the model:
> !ls -la
> !git statusDisable 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.
Build with the SDK
Use Agent AFK as a library — drive the agent loop from your own code with query(), AgentSession, custom tools, subagents, providers, and permission hooks.
One-Shot Chat
afk chat sends a single message and exits — pipe-friendly, scriptable, or a streaming JSON event stream for scripts and CI.