doc: fix stale session management references

Update s/new syntax (no 'new' prefix), rm -r for kill, and correct
Python script to use s/new and shutil.rmtree instead of top-level ctl.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-16 21:50:40 +02:00
parent 54af56c8d7
commit 4ad8e52ce9
2 changed files with 8 additions and 8 deletions

View File

@ -38,9 +38,9 @@ cd ~/mnt/ollie
# Count existing sessions so we can identify the newly created ones by offset.
n=$(ls s/ | wc -l)
echo "new agent=developer cwd=$cwd" > ctl
echo "new agent=reviewer cwd=$cwd" > ctl
echo "new agent=tester cwd=$cwd" > ctl
echo "agent=developer cwd=$cwd" > s/new
echo "agent=reviewer cwd=$cwd" > s/new
echo "agent=tester cwd=$cwd" > s/new
dev=$(ls s/ | sort | sed -n "$((n+1))p")
rev=$(ls s/ | sort | sed -n "$((n+2))p")
@ -89,7 +89,7 @@ Each agent only sees what the script explicitly sends it. Each can use a differe
### Sub-Agents
A session can spawn ephemeral child sessions to handle a focused task, then tear them down when done. The parent uses `execute_code` to write `new` to `ctl`, send an initial context and task to the child's `prompt`, poll until `reply` is ready, read the result, and write `kill <id>` to `ctl`. From the child's perspective it is just a normal session; it has no knowledge of its own ephemerality.
A session can spawn ephemeral child sessions to handle a focused task, then tear them down when done. The parent uses `execute_code` to write a key=value spec to `s/new`, send an initial context and task to the child's `prompt`, poll until `reply` is ready, read the result, and `rm -r s/{id}` to clean up. From the child's perspective it is just a normal session; it has no knowledge of its own ephemerality.
**Sub-agents as function calls** — the parent primes the child with exactly the context it needs (excerpts from its own `chat`, relevant beads, local file contents) and receives a single focused reply. Failures are isolated; a child that errors or stalls can be killed and retried without affecting the parent. The pattern composes naturally: a sub-agent can itself spawn sub-agents, building a call tree bounded only by the number of sessions open at once.
@ -105,7 +105,7 @@ Output (stdout): JSON array of {"agent": str, "reply": str}
Install in ~/.config/ollie/tools/ to make available as a {tool} step.
"""
import json, os, sys, threading, time
import json, os, shutil, sys, threading, time
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
@ -120,7 +120,7 @@ def session_ids():
def spawn_session(agent="default", cwd=""):
with _spawn_lock:
before = session_ids()
(BASE / "ctl").write_text(f"new agent={agent} cwd={cwd}\n")
(BASE / "s" / "new").write_text(f"agent={agent} cwd={cwd}\n")
while True:
new = session_ids() - before
if new:
@ -128,7 +128,7 @@ def spawn_session(agent="default", cwd=""):
time.sleep(0.1)
def kill_session(sid):
(BASE / "ctl").write_text(f"kill {sid}\n")
shutil.rmtree(BASE / "s" / sid)
def wait_reply(sid):
path = BASE / "s" / sid / "reply"

View File

@ -52,7 +52,7 @@ Use this to discover other sessions for cooperation. Sessions sharing your `cwd`
**Session lifecycle:**
- Create: write a key=value string to `{{.OllieMountPath}}/s/new`
- Kill: write `kill` to `{{.OllieMountPath}}/s/{id}/ctl` (do not use `rm -r`)
- Kill: `rm -r {{.OllieMountPath}}/s/{id}`
- Rename: `mv {{.OllieMountPath}}/s/{id} {{.OllieMountPath}}/s/{newname}` — this also updates `$OLLIE_SESSION_ID` in the session environment
**`ctl` commands** (write to `{{.OllieMountPath}}/s/{id}/ctl`):