main
md 64 lines 3.7 KB
Rendered Raw
1 # After Agent Reference
2
3 ### After Agent Work
4
5 <!-- KNOWN PLATFORM BUGS: (1) "Silent Success" — ~7-10% of background spawns complete
6 file writes but return no text. Mitigated by RESPONSE ORDER + filesystem checks.
7 (2) "Server Error Retry Loop" — context overflow after fan-out. Mitigated by lean
8 post-work turn + Scribe delegation + compact result presentation. -->
9
10 **⚡ Keep the post-work turn LEAN.** Coordinator's job: (1) present compact results, (2) spawn Scribe. That's ALL. No orchestration logs, no decision consolidation, no heavy file I/O.
11
12 **⚡ Context budget rule:** After collecting results from 3+ agents, use compact format (agent + 1-line outcome). Full details go in orchestration log via Scribe.
13
14 After each batch of agent work:
15
16 1. **Collect results** via `read_agent` (wait: true, timeout: 300).
17
18 2. **Silent success detection** — when `read_agent` returns empty/no response:
19 - Check filesystem: history.md modified? New decision inbox files? Output files created?
20 - Files found → `"⚠️ {Name} completed (files verified) but response lost."` Treat as DONE.
21 - No files → `"❌ {Name} failed — no work product."` Consider re-spawn.
22
23 3. **Show compact results:** `{emoji} {Name} — {1-line summary of what they did}`
24
25 4. **Spawn Scribe** (background, never wait). Only if agents ran or inbox has files:
26
27 ```
28 agent_type: "general-purpose"
29 model: "claude-haiku-4.5"
30 mode: "background"
31 name: "scribe"
32 description: "📋 Scribe: Log session & merge decisions"
33 prompt: |
34 You are the Scribe. Read .squad/agents/scribe/charter.md.
35 TEAM ROOT: {team_root}
36 CURRENT_DATETIME: <resolved CURRENT_DATETIME literal>
37 STATE_BACKEND: {state_backend}
38
39 SPAWN MANIFEST: {spawn_manifest}
40
41 Tasks (in order):
42 0. PRE-CHECK: Run `squad_state_health` when available. If state tools are unavailable,
43 stop without mutating files or git state.
44 0b. PRE-CHECK: Read `decisions.md` and list `decisions/inbox` with state tools.
45 Record measurements.
46 1. DECISIONS ARCHIVE [HARD GATE]: If decisions.md >= 20480 bytes, archive entries older than 30 days NOW. If >= 51200 bytes, archive entries older than 7 days. Do not skip this step.
47 2. DECISION INBOX: Use `squad_state_list` and `squad_state_read` on `decisions/inbox`,
48 merge entries into `decisions.md` with `squad_state_write`, delete processed inbox
49 entries with `squad_state_delete`, and deduplicate.
50 3. ORCHESTRATION LOG: Write `orchestration-log/{timestamp}-{agent}.md` with `squad_state_write` per agent. Use ISO 8601 UTC timestamp. Replace `:` with `-` in `{timestamp}` so filenames are valid on all platforms (e.g. `2026-06-02T21-15-30Z`).
51 4. SESSION LOG: Write `log/{timestamp}-{topic}.md` with `squad_state_write`. Brief. Use ISO 8601 UTC timestamp. Replace `:` with `-` in `{timestamp}` so filenames are valid on all platforms.
52 5. CROSS-AGENT: Append team updates to affected agents' `agents/{agent}/history.md` with `squad_state_append`.
53 6. HISTORY SUMMARIZATION [HARD GATE]: If any history.md >= 15360 bytes (15KB), summarize now.
54 7. HEALTH REPORT: Log decisions.md before/after size, inbox count processed, history files summarized with `squad_state_write` or `squad_state_append`.
55
56 Runtime state tools own persistence. Never switch branches, push note refs, reset
57 `.squad/`, or commit mutable squad state from this prompt.
58
59 Never speak to user. ⚠️ End with plain text summary after all tool calls.
60 ```
61
62 5. **Immediately assess:** Does anything trigger follow-up work? Launch it NOW.
63
64 6. **Ralph check:** If Ralph is active (see Ralph — Work Monitor), after chaining any follow-up work, IMMEDIATELY run Ralph's work-check cycle (Step 1). Do NOT stop. Do NOT wait for user input. Ralph keeps the pipeline moving until the board is clear.