Expand description
Agent spawn orchestration.
Renders the full system prompt, writes it to a per-agent file under
~/.netsky/state/prompts/<session>.md, writes a per-agent MCP config,
asks the configured runtime to assemble its claude/codex/…
command line, then delegates to netsky_sh::tmux to create the
detached tmux session with AGENT_N + NETSKY_PROMPT_FILE (the
path, not the content) propagated via -e.
The shell that tmux launches reads the prompt content at exec time
via $(cat "$NETSKY_PROMPT_FILE"). This indirection exists because
tmux’s command parser rejects oversized argv elements with “command
too long” — passing the 20KB+ rendered prompt directly through
-e NETSKY_PROMPT=<content> took down every agent0 restart in
session-11 (see INFINITY_EMERGENCY_FIX.md).
Single code path for agent0, clones, and agentinfinity. Per-agent
differences (MCP servers, channel flags) live here; runtime-flavor
differences (CLI syntax) live in crate::runtime.
Structs§
- Spawn
Options - Per-spawn options. Runtime-agnostic: the
runtimefield owns flavor-specific config (claude model + effort, codex knobs, …).
Enums§
- Spawn
Outcome - Spawn outcome for idempotent callers.
Functions§
- dismiss_
tos - Dismiss the Claude dev-channels TOS dialog on
sessionby sending Enter once the prompt is visible. Polls for up totimeoutat 1Hz. Returns true iff the prompt was seen and Enter was delivered. - is_up
- True if the tmux session for
agentalready exists. - kill
- Tear down
agent’s tmux session if present. Idempotent. - require_
deps - Verify the runtime deps the default claude runtime requires. Kept for call sites (e.g. the restart path) that don’t yet thread a SpawnOptions through.
- require_
deps_ for - Verify the runtime deps the configured flavor requires.
- spawn
- Idempotently spawn
agentin a detached tmux session.