Teach parent agents to clean up the processes they spawn

Add a `lifecycle` help topic spelling out that the caller owns the
processes it spawns and should `close_process` when a sub-agent or
spawned child is no longer needed. The `spawn_agent` and `spawn_process`
descriptions advertised via `tools/list` now restate the same duty
inline (with a pointer to `help('lifecycle')`), so vendor TUIs see the
expectation at the moment they reach for the tool. The `spawning` topic
and `topics` index cross-reference the new content.

Bundles two already-staged improvements that fall in the same area:
- OnChildSpawned primes the snapshot-replay budget for new panes so
  diff-based vendor TUIs come up clean without a manual Ctrl+W/Ctrl+S
  refresh.
- TODO drops the three items now actioned (prompt-injection preface,
  agent cleanup duty, opencode→claude view corruption) and keeps the
  unicode `<?>` entry with the investigation notes.
This commit is contained in:
2026-05-14 21:17:03 +01:00
parent b361d12d14
commit 56fd461fb3
6 changed files with 147 additions and 9 deletions

View File

@@ -1,4 +1,7 @@
- [ ] There's a unicode <?> being displayed in opencode
- [ ] Opencode opening a sub claude agent fucks up the view bigtime. Hitting ctrl + W and ctrl + S to switch back to opencode then back to claude again fixes it
- [ ] Sub agents need to have context injected into their prompt to let them know they're a sub agent or they don't report back
- [ ] Agents should also be informed they should clean up after themselves where possible
- Investigated 2026-05-14: patterm passes ghostty grapheme codepoints
through unchanged (vt/ghostty.go:452-462), so the `<?>` glyph is
most likely the *host* terminal's font fallback for opencode's
Nerd Font private-use codepoints, not a patterm substitution.
Need a concrete reproduction (which codepoint, which host
terminal/font) before changing rendering.