Skip to main content

Agent Lifecycle Commands

The genie spawn, genie stop, genie resume, and genie kill commands manage agent processes. Agents run in tmux panes and can be stopped, resumed, and killed independently.

genie spawn

Spawn a new agent by name. Resolves the agent from the directory registry or built-in roles.

SDK streaming + resume flags

When you spawn through the claude-sdk provider, these extra flags control turn budget, streaming, and session resumption:
SDK flags only apply when --provider resolves to a claude-sdk-backed executor. For non-SDK providers (e.g., classic claude or codex), they are silently ignored.

Examples

genie stop

Stop an agent gracefully. Preserves the session so the agent can be resumed later.
The agent’s Claude session is preserved — use genie resume to pick up where it left off.

genie resume

Resume a suspended or failed agent with its preserved Claude session.

genie kill

Force-kill an agent by name. Unlike stop, this does not preserve the session.
kill terminates the agent immediately without preserving its session. Use stop if you want to resume later.

Lifecycle Flow

Auto-resume

When an agent’s tmux pane dies unexpectedly (crash, OOM, terminal close), the scheduler daemon restores it by respawning against the saved Claude session ID. This keeps the “one name = one true Claude session UUID” invariant across crashes and is why --no-auto-resume (see the spawn flag table) exists as an escape hatch.
1

Detect dead pane

The daemon polls heartbeats. Two consecutive dead cycles mark the worker as resumable. On daemon startup, recoverOnStartup() sweeps any panes that died while the daemon was down.
2

Match session

An agent is eligible when it has a claudeSessionId (Claude provider only), its state is not done, and autoResume is not false. Spawn-time resume additionally requires a matching role and team.
3

Respawn with budget

Resumes are capped at maxResumeAttempts = 3 with a 60-second cooldown. Exceeding the budget marks the agent permanently failed; resumeAttempts is visible in genie ls.
4

Opt out

Pass --no-auto-resume at spawn time to set autoResume=false. The daemon then skips the agent in reconcileOrphans() — manual genie resume <name> still works and does not consume the budget.
Full behavior spec: automagik-dev/genie/docs/SPAWN-AUTO-RESUME.md.

Team resolution

genie spawn resolves the effective team via a five-tier precedence chain before it decides whether to create, resume, or fork a parallel. When --team (see the spawn flag table) is set, the team’s configured tmuxSessionName is used automatically — you rarely need --session. If every tier yields nothing and the agent is globally registered, an auto team-of-one is materialized downstream by ensureNativeTeam, named after the agent.
Passing --session <team-name> to genie spawn overrides the team’s configured tmuxSessionName and lands the worker in a separate tmux session, breaking the topology. When --team is set, let Genie resolve the session — only pass --session for rare manual overrides.
Full resolution spec: automagik-dev/genie/docs/SPAWN-TEAM-RESOLUTION.md.