From 2703ea5d3f0d0fc4d7bf38bb5fd286a053bc2c55 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 17 May 2026 13:58:41 +0200 Subject: [PATCH] subagent_spawn: auto-cleanup JIT config; report resolved backend/model - Remove JIT agent config from a/ after session creation (server has already loaded it), eliminating identity debris accumulation. - Read actual backend/model from session cfg instead of echoing CLI-level defaults. - Remove manual cleanup instruction from prompt (now automatic). --- prompts/tools-subagent.md | 1 - tools/subagent_spawn | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/prompts/tools-subagent.md b/prompts/tools-subagent.md index a2d018d..0898ab3 100644 --- a/prompts/tools-subagent.md +++ b/prompts/tools-subagent.md @@ -86,7 +86,6 @@ Remaining args: the task prompt (immediate task only — coordination lives in t - 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. - Names must be globally unique under `s/`. Duplicate names fail silently. -- Clean up when done: `rm $OLLIE/a/.json` ## Returning results to the parent diff --git a/tools/subagent_spawn b/tools/subagent_spawn index 574504f..6a3fe94 100755 --- a/tools/subagent_spawn +++ b/tools/subagent_spawn @@ -71,4 +71,11 @@ done [ -d "$B" ] || die "timeout waiting for session $name" printf '%s\n' "$prompt" > "$B/prompt" || die "failed to submit prompt" -printf 'session=%s\npath=%s\nbackend=%s\nmodel=%s\n' "$name" "$B" "${backend:-default}" "${model:-default}" + +# Clean up JIT agent config now that the server has loaded it. +[ -n "$agent" ] && rm -f "$OLLIE/a/${agent}.json" 2>/dev/null || true + +# Report resolved values from the live session. +resolved_backend=$(grep -m1 '^backend=' "$B/cfg" 2>/dev/null | cut -d= -f2- || echo "${backend:-default}") +resolved_model=$(grep -m1 '^model=' "$B/cfg" 2>/dev/null | cut -d= -f2- || echo "${model:-default}") +printf 'session=%s\npath=%s\nbackend=%s\nmodel=%s\n' "$name" "$B" "$resolved_backend" "$resolved_model"