diff --git a/prompts/tools-subagent.md b/prompts/tools-subagent.md index e3254a1..a2d018d 100644 --- a/prompts/tools-subagent.md +++ b/prompts/tools-subagent.md @@ -81,7 +81,7 @@ Remaining args: the task prompt (immediate task only — coordination lives in t - `[parent_plan_start]...[parent_plan_end]` — the parent's current plan file contents (if non-empty) **Constraints**: -- **Always use the pipeline.** Never call `subagent_spawn` without `subagent_generate`. +- **Prefer the pipeline.** Use `subagent_generate` → `subagent_spawn` when the subagent needs a custom identity. For simple delegation with no identity requirements, `subagent_spawn` alone with `-agent` or server defaults is fine. - **Identity carries coordination, prompt carries task.** Roster, shared task, and protocol go in the identity. The seed prompt is purely the task. - Subagents do not share memory. Pass context explicitly in the seed prompt. - Peers are known at spawn time. Assign `-name` to each and include the full roster in each identity. diff --git a/tools/subagent_generate b/tools/subagent_generate index ec9a3e2..864d58f 100755 --- a/tools/subagent_generate +++ b/tools/subagent_generate @@ -1,7 +1,7 @@ #!/usr/bin/env bash # description: Generate a JIT subagent config. No args prints the JSON template. With JSON on stdin, creates the config and prints the agent name. -# Args: none -# Stdin: JSON with structured fields (role, roster, shared_task, protocol, constraints, result_path) or legacy "prompt" +# Args: [json] — JSON config as first arg, or piped via stdin +# Stdin: JSON with structured fields (role, roster, shared_task, protocol, constraints) or legacy "prompt" # Output: template (no stdin) or agent name set -euo pipefail diff --git a/tools/subagent_spawn b/tools/subagent_spawn index cf15d86..574504f 100755 --- a/tools/subagent_spawn +++ b/tools/subagent_spawn @@ -62,9 +62,13 @@ model=${model}" printf '%s\n' "$kv" > "$OLLIE/s/new" || die "failed to create session" B="$OLLIE/s/$name" -SECONDS=0 -until [ -d "$B" ] || [ "$SECONDS" -ge 5 ]; do sleep 0.05; done +wait=0.1 +for _ in 1 2 3 4 5 6 7 8; do + [ -d "$B" ] && break + sleep "$wait" + wait=$(awk "BEGIN{printf \"%.2f\", $wait * 2}") +done [ -d "$B" ] || die "timeout waiting for session $name" printf '%s\n' "$prompt" > "$B/prompt" || die "failed to submit prompt" -printf '%s\n' "$B" +printf 'session=%s\npath=%s\nbackend=%s\nmodel=%s\n' "$name" "$B" "${backend:-default}" "${model:-default}"