Skip to content

Agents & lifecycle

FeatureDescription
Prompt-spawnwarden start --role general "<prompt>" — no repo needed. Runs claude in the caller’s directory (or --dir).
Auto-classificationThe daemon labels a prompt-spawned agent’s type with claude -p shortly after creation (falls back to other). The label is informational; the role decides behaviour.
Auto-generated subjectEach agent gets a one-line ≤8-word summary of what it’s doing, seeded from the prompt and refreshed by the poller from the transcript or tmux pane (throttled, change-gated).
Managed worktree spawn--role worker --repo <path> creates/adopts an isolated git worktree (--worktree for a scratch one, --in-repo to opt out).
Worktree adoptionIf a worktree for the ticket already exists, the spawn reattaches to it instead of erroring.
Supervised mode--supervised launches with --permission-mode acceptEdits (risky tools prompt → feed the approvals inbox) instead of the default --dangerously-skip-permissions bypass. Persisted and reused on restore.
Command / featureDescription
stopThe single umbrella teardown verb. Default = full teardown: terminate + clear (archive) record + remove worktree (asks first unless --yes). Subtractive flags: --keep-record, --keep-worktree (--keep-worktree alone == done), --hard, --pr/--base, --force, --delete-adopted-branch. Safe order: PR → terminate → remove worktree → clear record. A failure names the failed step and what already completed (e.g. remove worktree failed: … (completed: terminated; record left intact — fix the cause and retry)); the record is cleared last, so a failed guard (running / dirty / unpushed) is safely retryable. An already-deleted branch counts as success.
terminateStop an agent (kill tmux + the agent process); keeps the record and worktree. The safe, reversible “stop” default. Alias for stop --keep-record --keep-worktree.
restoreRecreate and resume a session only when its stored status is orphaned and its tmux session is gone (claude --resume). In Cockpit TUI, select the orphaned agent and press r.
recoverSafety net for the tombstone reaper: revive an archived orphaned record whose tmux session is confirmed still alive. Bare recover only reports candidates; --apply re-inserts each one under its original id (children reconnect automatically).
doneTerminate and clear the record in one step (worktree kept). --hard purges instead of archiving. Alias for stop --keep-worktree.
deleteClear the stored record (archive by default, --hard purge). Leaves tmux + worktree alone. Alias for stop --keep-worktree (record only).
remove-worktreeRemove the git worktree + branch. Destructive — refuses while the agent runs or has uncommitted/unpushed work unless --force. Alias for stop --keep-record (worktree only).
adoptRegister an existing Claude session — resume newest-for-dir under tmux, or live-register a running tmux session.
Cascade cleanupDeleting a pipeline/agent cascades cleanup of its shared-context keys and (on hard-delete) its mailbox inbox.

Archiving is not forever. An archived agent stays restorable for retention.archived_agents (default 24h). The daemon sweeps at startup and then hourly, purging every archive whose window has passed together with its inbox, so with the default an agent is gone 24–25 hours after it was archived.

  • Live agents are never purged.
  • An archived parent that another record still names is kept until its children age out, then goes on a later sweep.
  • retention.archived_agents: off keeps archived agents forever.
  • Each sweep that removed something records one retention_sweep audit event.

Directed messages are deleted when they are delivered (retention.read_messages: 0s, the default), and inboxes whose recipient no longer exists are dropped by the same sweep. Metrics history is kept for retention.metrics_days (default 7).

Presented stateStored/API statusMeaning
pendingspawningLaunching
busyworkingActively working
idleidleAlive, no active turn
need-inputwaiting_for_inputWaiting for input or approval
donedoneFinished
orphanedorphanedProcess gone, record survives; eligible for recovery
rate_limitedrate_limitedPaused at a provider limit; automatically resumes

These are presentation aliases; persisted and raw API statuses retain their existing names. Legacy errored records display as done when an exit code is recorded, otherwise as orphaned; there is no eighth UX state. A displayed alias does not itself grant recovery: restore/recover requires the stored orphaned state. Backend quota switching is a separate automatic mechanism.