| name | afx |
| description | Agent Farm CLI — the tool for spawning builders, managing Tower, workspaces, and cron tasks. ALWAYS consult this skill BEFORE running any `afx` command to get the exact syntax. This prevents wasting time guessing flags that don't exist. Use this whenever you need to spawn a builder, check status, send messages, clean up worktrees, manage Tower, or run cron tasks. If you're about to type `afx` followed by anything, check here first. |
Agent Farm CLI
afx spawn
Spawns a new builder in an isolated git worktree.
afx spawn [number] [options]
The ONLY flags that exist:
| Flag | Description |
|---|
--protocol <name> | Protocol: spir, aspir, air, bugfix, tick, maintain, experiment. Required for numbered spawns. |
--task <text> | Ad-hoc task (no issue number needed) |
--shell | Bare Claude session |
--worktree | Bare worktree session |
--amends <number> | Original spec number (TICK only) |
--files <files> | Context files, comma-separated. Requires --task. |
--no-comment | Skip commenting on the GitHub issue |
--force | Skip dirty-worktree and collision checks |
--soft | Soft mode (AI follows protocol, you verify) |
--strict | Strict mode (porch orchestrates) — this is the default |
--resume | Resume builder in existing worktree |
--no-role | Skip loading role prompt |
There is NO -t, --title, --name, or --branch flag. The branch name is auto-generated from the issue title.
Examples:
afx spawn 42 --protocol spir
afx spawn 42 --protocol aspir
afx spawn 42 --protocol air
afx spawn 42 --protocol bugfix
afx spawn 42 --protocol tick --amends 30
afx spawn 42 --protocol spir --soft
afx spawn 42 --resume
afx spawn --task "fix the flaky test"
afx spawn 42 --protocol spir --force
Pre-spawn checklist:
git status — worktree must be clean (or use --force)
- Commit specs/plans first — builders branch from HEAD and can't see uncommitted files
--protocol is required for numbered spawns
afx send
Sends a message to a running builder.
afx send [builder] [message]
| Flag | Description |
|---|
--all | Send to all builders |
--file <path> | Include file content |
--interrupt | Send Ctrl+C first |
--raw | Skip structured formatting |
--no-enter | Don't press Enter after message |
afx send 0042 "PR approved, please merge"
afx send 0585 "check the test output" --file /tmp/test-results.txt
Addressing forms — the recipient isn't only a builder ID:
| Form | Routes to |
|---|
afx send 0585 "…" | Builder 0585 (zero-padded). |
afx send architect "…" | From a builder: its spawning architect. From an architect: the main architect (else first registered). |
afx send architect:<name> "…" | A specific named architect (sibling-architect messaging). Architects can address any architect; a builder may only use its own spawnedByArchitect. |
afx send <workspace>:architect "…" | The architect in another workspace (cross-workspace). |
afx send architect:ob-refine "PR-iter-2 feedback ready"
afx send taqwabench:architect "use porch.checks, don't fork protocol.json"
Find the exact workspace name first — guessing fails with NOT_FOUND. The name is the basename of the workspace path, which can differ from how someone refers to it. List active workspaces via the Tower API:
curl -s http://localhost:4100/api/workspaces | python3 -m json.tool
afx interrupt
Sends an ESC keystroke to a builder's PTY — the only thing that reaches it mid-turn.
afx interrupt <builder>
| Flag | Description |
|---|
--no-enter | Send ESC alone, without the trailing Enter |
A builder chaining foreground waits inside one turn queues every afx send unread — including your order
to stop. ESC ends the turn so the queue processes. Distinct from afx send --interrupt (Ctrl+C).
afx interrupt 0042
afx send 0042 "That producer died — stop waiting and report."
afx refresh
Refreshes a builder's context: save working state → /clear → re-orient. Use when a builder's context window
is exhausted; afx spawn --resume reattaches the same conversation and does not give it a fresh one.
afx refresh <builder>
| Flag | Description |
|---|
--dry-run | Print what would be sent; write nothing to the builder |
--note <text> | Extra context appended to the re-orientation |
--file <path> | Append file content (48KB max, read from your filesystem) |
--interrupt-first | ESC before the save request, for a builder already wedged |
--mode <strict|soft> | Override mode if it cannot be detected |
--timeout <seconds> | Wait for the save-state receipt (default 300) |
--min-bytes <n> | Minimum state-file size to accept (default 1000) |
--quiet-window <ms> | Terminal silence counting as turn-ended (default 1500) |
Every gate fails safe: if the state file never arrives, carries a stale nonce, is a stub, is still being
written, or the builder will not go quiet, the command aborts without clearing and exits non-zero,
naming the gate. Requires a harness with in-session context clearing (Claude Code); others abort loudly.
afx reset is a deprecated alias: it still works, prints a one-line notice to stderr, and will be removed
in a future release.
afx refresh 0042 --dry-run
afx refresh 0042
afx refresh 0042 --note "PR #90 merged while you were mid-phase. Rebase first."
afx refresh 0042 --interrupt-first
afx cleanup
Removes a builder's worktree and branch after work is done.
afx cleanup [options]
| Flag | Description |
|---|
-p, --project <id> | Builder project ID (no leading zeros: 585 not 0585) |
-i, --issue <number> | Cleanup bugfix builder by issue number |
-t, --task <id> | Cleanup task builder (e.g., task-bEPd) |
-f, --force | Force cleanup even if branch not merged |
afx cleanup -p 585
afx cleanup -p 585 -f
Note: afx cleanup uses plain numbers (585), not zero-padded (0585). But afx send uses zero-padded IDs (0585).
afx status
afx status
No flags needed. Shows Tower status, workspace, and all active builders.
afx whoami
afx whoami
afx whoami --json
Resolves identity from Tower/global.db's perspective: builder-worktree cwd
match first, then the Tower-injected CODEV_ARCHITECT_NAME env var. Exits 1
with an explanation when identity cannot be determined — it never guesses and
never defaults to main (issue #1094). Builders also get an architect:
field naming their spawning architect when recorded. Works without Tower.
afx tower
afx tower start
afx tower stop
afx tower log
afx tower status
afx tower connect
afx tower disconnect
There is NO afx tower restart — use afx tower stop && afx tower start.
afx workspace
afx workspace start
afx workspace stop
afx dash is a deprecated alias — use afx workspace instead.
afx cron
afx cron list
afx cron status <name>
afx cron run <name>
afx cron enable <name>
afx cron disable <name>
There is NO afx cron add — create YAML files in .af-cron/ directly:
name: Service Health Check
schedule: "*/15 * * * *"
command: ./health-check.sh
message: "Health alert: ${output}"
condition: "exitCode != 0"
target: architect
timeout: 30
enabled: true
condition is a JavaScript expression with two variables in scope: output (string — the command's trimmed output) and exitCode (number — 0 on success, the command's exit code on non-zero exit, 124 on timeout, -1 on spawn failure). With a condition, the message is delivered exactly when it evaluates truthy — including on failed runs (e.g. exitCode != 0 alerts when the command fails). Without a condition, the message is delivered only when the command exits 0.
Other commands
afx open <file>
afx shell
afx attach
afx rename <name>
afx architect