--- name: subagent-yield-failure-recovery description: "Recover a subagent's full structured report when it exited without yielding (SYSTEM WARNING, structured output unavailable)" --- A subagent that solved the task but exited without calling `yield` (status `failed`, "exited without calling yield tool") usually still has its full payload in the transcript. Recover it; do not re-run the subagent. ## Procedure 1. `read agent://` — the preview truncates long lines (~768 chars); the full JSON draft appears in the transcript, not here. 2. Dump the raw transcript with line truncation off and persist it: ```js const raw = await read("history://:raw"); await write("/tmp/hist.txt", raw); ``` 3. Extract the report string. The transcript embeds the agent's draft as a JS object literal (`report: "...."` with escaped quotes/newlines), repeated across retries — take the longest match, then JSON-unescape: ```python import re, json raw = open('/tmp/hist.txt', encoding='utf-8', errors='replace').read() best = max((m.group(1) for m in re.finditer(r'report: "((?:[^"\\]|\\.)*)"', raw)), key=len) open('report.md','w').write(json.loads('"' + best + '"')) ``` Same pattern works for `summary:`/`files:` fields. 4. Treat recovered content as UNVERIFIED scout output: cross-check high-stakes claims at primary sources before publishing (scouts can conflate similarly-named projects; one recovery revealed "arc53's quantization pruner" when the tool was actually `p-e-w/heretic`, an abliteration tool). ## Why - `agent://` and the task-result preview truncate per line; only `history://:raw` carries the full text. - Re-spawning the subagent wastes minutes and the cap slot; the work product already exists in the transcript.