subagent_spawn: inject parent plan as context header

This commit is contained in:
Levi Neely 2026-05-17 10:26:57 +02:00
parent 5f0e25bd1d
commit 9c0d22960b
1 changed files with 11 additions and 2 deletions

View File

@ -31,9 +31,18 @@ name=${name:-$(/bin/date +%s%N)-$$}
[ -n "$OLLIE_SESSION_ID" ] && name="${OLLIE_SESSION_ID}__${name}"
cwd=${cwd:-$(pwd)}
# Prepend parent identity so the child always knows who spawned it.
# Prepend parent identity and plan so the child always knows who spawned it.
parent_plan=""
if [ -n "$OLLIE_SESSION_ID" ]; then
plan_file="$OLLIE/s/$OLLIE_SESSION_ID/plan"
[ -s "$plan_file" ] && parent_plan=$(cat "$plan_file")
fi
prompt="[parent_session_id=${OLLIE_SESSION_ID}]
[session_id=${name}]
[session_id=${name}]${parent_plan:+
[parent_plan_start]
${parent_plan}
[parent_plan_end]}
$*"
kv="name=${name}