/ainb-fleet:ainb-spawnfrom ainb-fleet
Spawns a coding-agent session (Claude/Codex/Gemini/Copilot) into an isolated git worktree via `ainb run`, preventing broken workspaces, shared working trees, and leaked sessions.
Ships in ainb-fleet. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One command, two legal shapes for --repo. Getting that choice wrong is what
shares a working tree between two agents or nests a worktree inside a worktree.
Fresh session off a repo root (the common case):
ainb run \
--repo /absolute/path/to/repo-root \
--worktree --create-branch fix/issue-101 \
--tool claude \
--dangerously-skip-permissions \
-p "$(cat /tmp/task-101.md)"
Existing task worktree (isolation already done, do not nest another):
ainb run --repo /absolute/path/to/existing/worktree --tool claude -p "$(cat task.md)"
Which shape? One command decides it (.git is a file in a real worktree, a
directory in a normal clone):
test -f "$P/.git" && echo "worktree: pass bare" || echo "repo root: add --worktree --create-branch"
| Flag | Why |
|---|---|
--repo <abs-path> | Repo root, or an existing task worktree. Absolute, always. |
--create-branch <branch> | Implies --worktree and names the branch. Prefer over bare --worktree, which invents ainb/session-<shortid>. |
--worktree | Isolation. Lands at ~/.agents-in-a-box/worktrees/by-name/<repo>--<branch>--<shortid>. |
--tool claude|codex|gemini|copilot | Which CLI to launch (default claude). |
--model <id> | Passed through to the provider unchanged. Optional. |
--dangerously-skip-permissions | Unattended runs only. |
-p "<task>" | Initial prompt, sent once the input box is ready. |
--name <handle> | Optional stable tmux handle. Legal: it changes the session/tmux name only, never workspace_name, and fleet routes on the tmux name. Prefer the minted name unless you want something to type at. |
--parent <session-id> | Routes the child's completions to your inbox. Needs your own session id, which you must resolve (see below), not an env var. |
There is no $AINB_SESSION_ID. ainb exports only AINB_PARENT_SESSION into
a session, and that holds the parent's id, not the session's own. Resolve
yours from the tmux session name:
MY_TMUX=$(tmux display-message -p '#{session_name}' 2>/dev/null)
MY_ID=$(ainb list --format json \
| jq -r --arg t "$MY_TMUX" '.[] | select(.tmux_session_name == $t) | .session_id')
ainb run --repo "$REPO" --worktree --create-branch "$BRANCH" --tool claude \
${MY_ID:+--parent "$MY_ID"} -p "$(cat "$TASK_FILE")"
Empty MY_ID (not inside an ainb session) omits the flag and spawns unparented,
which is fine. The ${...:+...} guard is not cosmetic: an unresolved id fails
two different ways, and only one of them is loud.
| Trap | What happens | Do instead |
|---|---|---|
--repo <repo-root> with no --worktree / --create-branch | Agent runs in the repo's own working tree; two agents stomp each other. The TUI used to render that row as (broken); it now names it after the owning repo, so nothing in ainb list flags the mistake. | Add --worktree --create-branch <branch> |
--parent "" (quoted, empty or whitespace-only) | Accepted by the parser, then trimmed and dropped by ainb run. The child spawns UNPARENTED, no warning, and its completions never reach your inbox. | ${MY_ID:+--parent "$MY_ID"} so an empty id emits no flag |
--parent $MY_ID unquoted with MY_ID unset (e.g. "$AINB_SESSION_ID", which ainb never exports) | The token vanishes before clap sees it, so clap consumes the NEXT token as the parent id. Next token starts with -, or --parent was last: clap aborts with error: a value is required for '--parent <PARENT>', exit 2, nothing spawns. Next token is a bare word (path, branch): clap swallows it as the parent id and the flag it belonged to is lost, corrupting the spawn. | Resolve MY_ID from the tmux name (above), then ${MY_ID:+--parent "$MY_ID"} |
ainb kill <id> / ainb git cleanup without --force | Both prompt [y/N] on stdin with no tty check. From a tool call the read returns empty, they print Cancelled. and exit 0, so the session leaks while you believe it is gone. | Always --force |
rm -rf <dir> right after a bare ainb kill | Deletes the checkout out from under a still-live agent. | --force, then confirm via ainb list before deleting |
tmux new-session ... claude -p for repo coding | No worktree, no session record, invisible to every fleet verb. | Use ainb run |
ainb list --format json | jq -r '.[] | "\(.session_id)\t\(.workspace_name)\t\(.worktree_path)"'
ainb status <id> # one-shot state
ainb logs <id> --lines 80 # recent output, -f to follow
ainb kill <id> --force # teardown, exact id only; --force is mandatory here
ainb git cleanup --dry-run # preview the worktree prune
ainb git cleanup --force # perform it
workspace_name == "(broken)" means ainb could not resolve the session root to
a git repository at all: no ancestor directory holds a usable .git, and the
directory name carries no <repo>--<branch>--<shortid> hint to fall back on.
Kill it and respawn with --worktree --create-branch.
A plain checkout, or a subdirectory of one, is not broken. It resolves to the
repository that owns it and is labelled with that repository's name. It is only
unisolated, and ainb list will not tell you that, so a real-looking
workspace_name is not proof you passed the isolation flags.
Point --repo at a subdirectory of a checkout and the TUI workspace row shows
the owning repository's name, not the subdirectory's. That is intended (the
workspace row is the grouping key and the repo owns the group), but it reads as a
rename to anyone who remembers the old labels. Not a bug, and not a sign the
wrong path was passed.
/ainb-fleet:standup to confirm the session joined the fleet./coding-agent (toolkit skill) for choosing between ainb run, a Task subagent, and raw tmux.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub stevengonsalvez/agents-in-a-box --plugin ainb-fleet12 skills in this plugin
/ainb-fleetFleet orchestration overview — the `ainb fleet ...` Rust subcommand
namespace for driving every claude session on the host. Routes to the
sub-skills (ainb-spawn / standup / broadcast / sequence / needs / daemon / atc).
Invoke this for an at-a-glance map of what fleet can do; reach for the
specific sub-skill for the verb you want.
/atcainb-fleet:atcATC (Air Traffic Control) — the single operator-visible fleet supervisor, in
exactly one mode: `lite` (no LLM: deterministic scan, known-transient retry
policy, safety caps, evidence) or `full` (the persistent orchestrating brain).
Full mode is a plain `ainb` session (Claude or Codex) running a generated
policy, woken on a heartbeat (default 15 min) built from the LLM-free `fleet needs`
read — which is itself HOOKS-PRIMARY (event-sourced): ATC learns ASK/WAIT/IDLE
from the materialized `current_state` table, not by scraping panes, with a
tmux fallback for non-Claude agents. `atc setup` installs the global Claude
Code hooks into ~/.claude/settings.json. It auto-clears the safe/blocked
sessions via the fleet verbs (confident ASK → broadcast; ERR → continue within
a retry cap) and escalates the uncertain ones to the phone bridge. Supersedes
the `daemon` skill for managed fleets. Use to provision / inspect / tear down
an ATC instance, or to switch which controller owns the fleet.
/bridgeainb-fleet:bridgeNative phone bridge — relay messages two-way between a chat channel
(Telegram, Slack, and/or Discord) and your ainb sessions. Inbound chat
messages route to a target session (by `name:` prefix, else a conductor-
first default) and are delivered via tmux send-keys; the session's reply is
captured from its JSONL transcript and sent back to the chat. Config lives
in ~/.agents-in-a-box/config/config.toml under [fleet.bridge.*]; tokens
resolve from $ENV / keychain refs and are NEVER passed on argv. Use to run,
install, or check the bridge — this is the channel ATC pages you through.
/broadcastainb-fleet:broadcastFan out a single prompt to selected claude sessions across the fleet.
Use when you need to apply the same instruction (e.g. `/clear`,
`git pull`, `remote-control disconnect`) to many sessions at once.
Routing: tmux send-keys by default (the broker is an opt-in fallback,
toggled via AINB_FLEET_TRANSPORT). Refuses to run without an explicit
targeting flag (--all, --filter <regex>, or --cwd <substring>) — no
implicit fan-out.
/costainb-fleet:costShow fleet spend — per-session, per-model, per-day, and per-group USD
cost rollups for every claude/codex session, sourced live from ainb's
burndown analytics (which already prices every provider call). Use when
you need spend visibility across a multi-session fleet, want to find the
most expensive session/model, or are checking whether any session/group
has crossed a configured budget cap. Budget breaches are also delivered
as notifyd alerts.
Default output: text tables. Pass --format json for LLM consumption.
/daemonainb-fleet:daemonLong-running watcher that scans every claude session every 5s and
auto-sends `continue` to any session whose recent tmux pane buffer
matches a known API-error regex (rate_limited, overloaded_error,
internal_server_error, request_timeout, socket_hang_up, fetch_failed,
ECONNRESET). Use this when you want unattended recovery from
transient API failures across the fleet.
Other plugins' skills for the same job