@os-eco/overstory-cli 0.9.4 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +50 -19
  2. package/agents/builder.md +19 -9
  3. package/agents/coordinator.md +6 -6
  4. package/agents/lead.md +204 -87
  5. package/agents/merger.md +25 -14
  6. package/agents/reviewer.md +22 -16
  7. package/agents/scout.md +17 -12
  8. package/package.json +6 -3
  9. package/src/agents/capabilities.test.ts +85 -0
  10. package/src/agents/capabilities.ts +125 -0
  11. package/src/agents/headless-mail-injector.test.ts +448 -0
  12. package/src/agents/headless-mail-injector.ts +219 -0
  13. package/src/agents/headless-prompt.test.ts +102 -0
  14. package/src/agents/headless-prompt.ts +68 -0
  15. package/src/agents/hooks-deployer.test.ts +514 -14
  16. package/src/agents/hooks-deployer.ts +141 -0
  17. package/src/agents/mail-poll-detect.test.ts +153 -0
  18. package/src/agents/mail-poll-detect.ts +73 -0
  19. package/src/agents/overlay.test.ts +60 -4
  20. package/src/agents/overlay.ts +63 -8
  21. package/src/agents/scope-detect.test.ts +190 -0
  22. package/src/agents/scope-detect.ts +146 -0
  23. package/src/agents/turn-lock.test.ts +181 -0
  24. package/src/agents/turn-lock.ts +235 -0
  25. package/src/agents/turn-runner-dispatch.test.ts +182 -0
  26. package/src/agents/turn-runner-dispatch.ts +105 -0
  27. package/src/agents/turn-runner.test.ts +2312 -0
  28. package/src/agents/turn-runner.ts +1383 -0
  29. package/src/commands/agents.ts +9 -0
  30. package/src/commands/clean.ts +54 -0
  31. package/src/commands/coordinator.test.ts +254 -0
  32. package/src/commands/coordinator.ts +273 -8
  33. package/src/commands/dashboard.test.ts +188 -0
  34. package/src/commands/dashboard.ts +14 -4
  35. package/src/commands/doctor.ts +3 -1
  36. package/src/commands/group.test.ts +94 -0
  37. package/src/commands/group.ts +49 -20
  38. package/src/commands/init.test.ts +8 -0
  39. package/src/commands/init.ts +8 -1
  40. package/src/commands/log.test.ts +187 -11
  41. package/src/commands/log.ts +171 -71
  42. package/src/commands/mail.test.ts +162 -0
  43. package/src/commands/mail.ts +64 -9
  44. package/src/commands/merge.test.ts +230 -1
  45. package/src/commands/merge.ts +68 -12
  46. package/src/commands/nudge.test.ts +351 -4
  47. package/src/commands/nudge.ts +356 -34
  48. package/src/commands/run.test.ts +43 -7
  49. package/src/commands/serve/build.test.ts +202 -0
  50. package/src/commands/serve/build.ts +206 -0
  51. package/src/commands/serve/coordinator-actions.test.ts +339 -0
  52. package/src/commands/serve/coordinator-actions.ts +408 -0
  53. package/src/commands/serve/dev.test.ts +168 -0
  54. package/src/commands/serve/dev.ts +117 -0
  55. package/src/commands/serve/mail-actions.test.ts +312 -0
  56. package/src/commands/serve/mail-actions.ts +167 -0
  57. package/src/commands/serve/rest.test.ts +1323 -0
  58. package/src/commands/serve/rest.ts +708 -0
  59. package/src/commands/serve/static.ts +51 -0
  60. package/src/commands/serve/ws.test.ts +361 -0
  61. package/src/commands/serve/ws.ts +332 -0
  62. package/src/commands/serve.test.ts +459 -0
  63. package/src/commands/serve.ts +565 -0
  64. package/src/commands/sling.test.ts +177 -1
  65. package/src/commands/sling.ts +243 -71
  66. package/src/commands/status.test.ts +9 -0
  67. package/src/commands/status.ts +12 -4
  68. package/src/commands/stop.test.ts +255 -1
  69. package/src/commands/stop.ts +107 -8
  70. package/src/commands/watch.test.ts +43 -0
  71. package/src/commands/watch.ts +153 -28
  72. package/src/config.ts +23 -0
  73. package/src/doctor/consistency.test.ts +106 -0
  74. package/src/doctor/consistency.ts +48 -1
  75. package/src/doctor/serve.test.ts +95 -0
  76. package/src/doctor/serve.ts +86 -0
  77. package/src/doctor/types.ts +2 -1
  78. package/src/doctor/watchdog.ts +57 -1
  79. package/src/events/tailer.test.ts +234 -1
  80. package/src/events/tailer.ts +90 -0
  81. package/src/index.ts +57 -6
  82. package/src/insights/quality-gates.test.ts +141 -0
  83. package/src/insights/quality-gates.ts +156 -0
  84. package/src/json.ts +29 -0
  85. package/src/logging/theme.ts +4 -0
  86. package/src/mail/client.ts +15 -2
  87. package/src/mail/store.test.ts +82 -0
  88. package/src/mail/store.ts +41 -4
  89. package/src/merge/lock.test.ts +149 -0
  90. package/src/merge/lock.ts +140 -0
  91. package/src/merge/predict.test.ts +387 -0
  92. package/src/merge/predict.ts +249 -0
  93. package/src/merge/resolver.ts +1 -1
  94. package/src/mulch/client.ts +3 -3
  95. package/src/runtimes/__fixtures__/claude-stream-fixture.ts +22 -0
  96. package/src/runtimes/claude.test.ts +791 -1
  97. package/src/runtimes/claude.ts +323 -1
  98. package/src/runtimes/connections.test.ts +141 -1
  99. package/src/runtimes/connections.ts +73 -4
  100. package/src/runtimes/headless-connection.test.ts +264 -0
  101. package/src/runtimes/headless-connection.ts +158 -0
  102. package/src/runtimes/types.ts +10 -0
  103. package/src/schema-consistency.test.ts +1 -0
  104. package/src/sessions/store.test.ts +657 -29
  105. package/src/sessions/store.ts +286 -23
  106. package/src/test-setup.test.ts +31 -0
  107. package/src/test-setup.ts +28 -0
  108. package/src/types.ts +107 -2
  109. package/src/utils/pid.test.ts +85 -1
  110. package/src/utils/pid.ts +86 -1
  111. package/src/utils/process-scan.test.ts +53 -0
  112. package/src/utils/process-scan.ts +76 -0
  113. package/src/watchdog/daemon.test.ts +1607 -376
  114. package/src/watchdog/daemon.ts +462 -88
  115. package/src/watchdog/health.test.ts +282 -0
  116. package/src/watchdog/health.ts +126 -27
  117. package/src/worktree/manager.test.ts +218 -1
  118. package/src/worktree/manager.ts +55 -0
  119. package/src/worktree/process.test.ts +71 -0
  120. package/src/worktree/process.ts +25 -5
  121. package/src/worktree/tmux.test.ts +28 -0
  122. package/src/worktree/tmux.ts +27 -3
  123. package/templates/CLAUDE.md.tmpl +19 -8
  124. package/templates/overlay.md.tmpl +5 -2
package/README.md CHANGED
@@ -6,7 +6,7 @@ Multi-agent orchestration for AI coding agents.
6
6
  [![CI](https://github.com/jayminwest/overstory/actions/workflows/ci.yml/badge.svg)](https://github.com/jayminwest/overstory/actions/workflows/ci.yml)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
8
 
9
- Overstory turns a single coding session into a multi-agent team by spawning worker agents in git worktrees via tmux, coordinating them through a custom SQLite mail system, and merging their work back with tiered conflict resolution. A pluggable `AgentRuntime` interface lets you swap between 11 runtimes — Claude Code, [Pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Aider](https://aider.chat), [Goose](https://github.com/block/goose), [Amp](https://amp.dev), or your own adapter.
9
+ Overstory turns a single coding session into a multi-agent team by spawning worker agents in isolated git worktrees, coordinating them through a custom SQLite mail system, and merging their work back with tiered conflict resolution. New projects spawn Claude agents headless and surface them through a web UI (`ov serve`); `tmux attach` is the opt-in escape hatch for live steering. A pluggable `AgentRuntime` interface lets you swap between 11 runtimes — Claude Code, [Pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Aider](https://aider.chat), [Goose](https://github.com/block/goose), [Amp](https://amp.dev), or your own adapter.
10
10
 
11
11
  > **Warning: Agent swarms are not a universal solution.** Do not deploy Overstory without understanding the risks of multi-agent orchestration — compounding error rates, cost amplification, debugging complexity, and merge conflicts are the normal case, not edge cases. Read [STEELMAN.md](STEELMAN.md) for a full risk analysis and the [Agentic Engineering Book](https://github.com/jayminwest/agentic-engineering-book) ([web version](https://jayminwest.com/agentic-engineering-book)) before using this tool in production.
12
12
 
@@ -14,7 +14,7 @@ Overstory turns a single coding session into a multi-agent team by spawning work
14
14
 
15
15
  ## Install
16
16
 
17
- Requires [Bun](https://bun.sh) v1.0+, git, and tmux. At least one supported agent runtime must be installed:
17
+ Requires [Bun](https://bun.sh) v1.0+ and git. `tmux` is optional — only needed if you want to spawn workers with `--no-headless` or attach to a coordinator/worker pane directly. At least one supported agent runtime must be installed:
18
18
 
19
19
  - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (`claude` CLI)
20
20
  - [Pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent) (`pi` CLI)
@@ -64,20 +64,29 @@ ov hooks install
64
64
  # Start a coordinator (persistent orchestrator)
65
65
  ov coordinator start
66
66
 
67
- # Or spawn individual worker agents
68
- ov sling <task-id> --capability builder --name my-builder
67
+ # Open the web UI — primary operator surface for the swarm
68
+ ov serve # then open http://localhost:7321
69
+ ```
69
70
 
70
- # Check agent status
71
- ov status
71
+ `ov serve` is where you watch the fleet, read the mail bus, and inspect
72
+ per-agent timelines. New projects spawn Claude workers headless by default,
73
+ so the UI sees them with full structured-event fidelity.
74
+
75
+ Other common commands:
72
76
 
73
- # Live dashboard for monitoring the fleet
74
- ov dashboard
77
+ ```bash
78
+ # Spawn an individual worker agent (coordinator usually does this for you)
79
+ ov sling <task-id> --capability builder --name my-builder
75
80
 
76
- # Nudge a stalled agent
77
- ov nudge <agent-name>
81
+ # Force a worker into tmux when you want to attach mid-session
82
+ ov sling <task-id> --capability builder --name my-builder --no-headless
83
+ tmux attach -t ov-my-builder
78
84
 
79
- # Check mail from agents
85
+ # Inspect state from the CLI (also visible in the UI)
86
+ ov status
87
+ ov dashboard # live TUI alternative to the web UI
80
88
  ov mail check --inject
89
+ ov nudge <agent-name> # send a follow-up to a stalled agent
81
90
  ```
82
91
 
83
92
  ## Commands
@@ -89,7 +98,7 @@ Every command supports `--json` where noted. Global flags: `-q`/`--quiet`, `--ti
89
98
  | Command | Description |
90
99
  |---------|-------------|
91
100
  | `ov init` | Initialize `.overstory/` and bootstrap os-eco tools (`--yes`, `--name`, `--tools`, `--skip-mulch`, `--skip-seeds`, `--skip-canopy`, `--skip-onboard`, `--json`) |
92
- | `ov sling <task-id>` | Spawn a worker agent (`--capability`, `--name`, `--spec`, `--files`, `--parent`, `--depth`, `--skip-scout`, `--skip-review`, `--max-agents`, `--dispatch-max-agents`, `--skip-task-check`, `--no-scout-check`, `--runtime`, `--base-branch`, `--profile`, `--json`) |
101
+ | `ov sling <task-id>` | Spawn a worker agent (`--capability`, `--name`, `--spec`, `--files`, `--parent`, `--depth`, `--skip-scout`, `--skip-review`, `--max-agents`, `--dispatch-max-agents`, `--skip-task-check`, `--no-scout-check`, `--runtime`, `--base-branch`, `--profile`, `--headless`, `--no-headless`, `--recover`, `--json`) |
93
102
  | `ov stop <agent-name>` | Terminate a running agent (`--clean-worktree`, `--json`) |
94
103
  | `ov prime` | Load context for orchestrator/agent (`--agent`, `--compact`) |
95
104
  | `ov spec write <task-id>` | Write a task specification (`--body`) |
@@ -176,7 +185,8 @@ Every command supports `--json` where noted. Global flags: `-q`/`--quiet`, `--ti
176
185
  | `ov monitor status` | Show monitor state |
177
186
  | `ov log <event>` | Log a hook event (`--agent`) |
178
187
  | `ov clean` | Clean up worktrees, sessions, artifacts (`--completed`, `--all`, `--run`) |
179
- | `ov doctor` | Run health checks on overstory setup — 12 categories (`--category`, `--fix`, `--json`) |
188
+ | `ov doctor` | Run health checks on overstory setup — 13 categories (`--category`, `--fix`, `--json`) |
189
+ | `ov serve` | HTTP + WebSocket surface for the web UI (`--port`, `--host`, `--json`) |
180
190
  | `ov ecosystem` | Show os-eco tool versions and health (`--json`) |
181
191
  | `ov upgrade` | Upgrade overstory to latest npm version (`--check`, `--all`, `--json`) |
182
192
  | `ov agents discover` | Discover agents by capability/state/parent (`--capability`, `--state`, `--parent`, `--json`) |
@@ -184,12 +194,14 @@ Every command supports `--json` where noted. Global flags: `-q`/`--quiet`, `--ti
184
194
 
185
195
  ## Architecture
186
196
 
187
- Overstory uses instruction overlays and tool-call guards to turn agent sessions into orchestrated workers. Each agent runs in an isolated git worktree via tmux. Inter-agent messaging is handled by a custom SQLite mail system (WAL mode, ~1-5ms per query) with typed protocol messages and broadcast support. A FIFO merge queue with 4-tier conflict resolution merges agent branches back to canonical. A tiered watchdog system (Tier 0 mechanical daemon, Tier 1 AI-assisted triage, Tier 2 monitor agent) ensures fleet health. See [CLAUDE.md](CLAUDE.md) for full technical details.
197
+ Overstory uses instruction overlays and tool-call guards to turn agent sessions into orchestrated workers. Each agent runs in an isolated git worktree; new projects spawn Claude workers as headless subprocesses (stream-json over stdout) and surface them through `ov serve`'s web UI, with tmux available as an opt-in for live attach. Inter-agent messaging is handled by a custom SQLite mail system (WAL mode, ~1-5ms per query) with typed protocol messages and broadcast support. A FIFO merge queue with 4-tier conflict resolution merges agent branches back to canonical. A tiered watchdog system (Tier 0 mechanical daemon, Tier 1 AI-assisted triage, Tier 2 monitor agent) ensures fleet health. See [CLAUDE.md](CLAUDE.md) for full technical details.
188
198
 
189
199
  ### Runtime Adapters
190
200
 
191
201
  Overstory is runtime-agnostic. The `AgentRuntime` interface (`src/runtimes/types.ts`) defines the contract — each adapter handles spawning, config deployment, guard enforcement, readiness detection, and transcript parsing for its runtime. Set the default in `config.yaml` or override per-agent with `ov sling --runtime <name>`.
192
202
 
203
+ Claude Code agents can run in **headless mode** (the default for new projects — `-p --output-format stream-json` subprocess, NDJSON events parsed by `ClaudeRuntime.parseEvents`, surfaced through `ov serve`'s web UI) or **tmux mode** (escape hatch for live attach — operator can `tmux attach` to watch and steer mid-session). `ov init` writes `runtime.claudeHeadlessByDefault: true` for new projects; legacy projects upgrading from earlier overstory versions keep tmux until they edit config. Override per-spawn with `ov sling --no-headless` (force tmux) or `--headless` (force headless). Sapling is statically headless; Pi, Codex, and Cursor have no `buildDirectSpawn` and reject `--headless`.
204
+
193
205
  | Runtime | CLI | Guard Mechanism | Stability |
194
206
  |---------|-----|-----------------|-----------|
195
207
  | Claude Code | `claude` | `settings.local.json` hooks | Stable |
@@ -251,7 +263,7 @@ overstory/
251
263
  config.ts Config loader + validation
252
264
  errors.ts Custom error types
253
265
  json.ts Standardized JSON envelope helpers
254
- commands/ One file per CLI subcommand (37 commands)
266
+ commands/ One file per CLI subcommand (38 commands)
255
267
  agents.ts Agent discovery and querying
256
268
  coordinator.ts Persistent orchestrator lifecycle
257
269
  supervisor.ts Team lead management [DEPRECATED]
@@ -274,7 +286,7 @@ overstory/
274
286
  run.ts Orchestration run lifecycle
275
287
  trace.ts Agent/task timeline viewing
276
288
  clean.ts Worktree/session cleanup
277
- doctor.ts Health check runner (12 check modules)
289
+ doctor.ts Health check runner (13 check modules)
278
290
  inspect.ts Deep per-agent inspection
279
291
  spec.ts Task spec management
280
292
  errors.ts Aggregated error view
@@ -288,6 +300,8 @@ overstory/
288
300
  discover.ts Brownfield codebase discovery via coordinator-driven scout swarm
289
301
  orchestrator.ts Multi-repo coordination (PersistentAgentSpec)
290
302
  completions.ts Shell completion generation (bash/zsh/fish)
303
+ serve.ts HTTP + WebSocket surface for the web UI
304
+ serve/ REST handlers, WebSocket broadcaster, static SPA fallback
291
305
  canopy/
292
306
  client.ts Canopy client (prompt rendering, listing, emission)
293
307
  agents/ Agent lifecycle management
@@ -299,15 +313,17 @@ overstory/
299
313
  hooks-deployer.ts Deploy hooks + tool enforcement
300
314
  copilot-hooks-deployer.ts Deploy hooks config to Copilot worktrees
301
315
  guard-rules.ts Shared guard constants (tool lists, bash patterns)
316
+ mail-poll-detect.ts Bash mail-poll pattern detector (runtime backstop)
317
+ scope-detect.ts Soft FILE_SCOPE violation detection (builder/merger)
302
318
  worktree/ Git worktree + tmux management
303
319
  mail/ SQLite mail system (typed protocol, broadcast)
304
- merge/ FIFO queue + conflict resolution
320
+ merge/ FIFO queue + conflict resolution + sentinel-file lock + dry-run prediction
305
321
  watchdog/ Tiered health monitoring (daemon, triage, health)
306
322
  logging/ Multi-format logger + sanitizer + reporter + color control + shared theme/format
307
323
  metrics/ SQLite metrics + pricing + transcript parsing
308
- doctor/ Health check modules (12 checks)
324
+ doctor/ Health check modules (13 checks)
309
325
  utils/ Shared utilities (bin, fs, pid, time, version)
310
- insights/ Session insight analyzer for auto-expertise
326
+ insights/ Session insight analyzer + quality-gate runner (success/partial/failure)
311
327
  runtimes/ AgentRuntime abstraction (registry + adapters: Claude, Pi, Copilot, Codex, Gemini, Sapling, OpenCode, Cursor, Aider, Goose, Amp)
312
328
  tracker/ Pluggable task tracker (beads + seeds backends)
313
329
  mulch/ mulch client (programmatic API + CLI wrapper)
@@ -358,6 +374,21 @@ models:
358
374
 
359
375
  ## Troubleshooting
360
376
 
377
+ ### Recovering a dead lead (or any agent that exited mid-task)
378
+
379
+ If a lead exits without sending `merge_ready` (process termination, watchdog kill, manual `ov stop`) and the task was already closed, both `ov nudge` and `ov sling` would normally refuse to re-engage:
380
+
381
+ - `ov nudge <name>` reports `No active session for agent "..." (state: completed)`. The agent's process is gone, so there's nothing to send keystrokes to.
382
+ - `ov sling <task-id> --capability lead` reports `Task "..." is not workable (status: closed)`.
383
+
384
+ To re-dispatch a fresh lead against the same task, pass `--recover`:
385
+
386
+ ```bash
387
+ ov sling <task-id> --capability lead --recover --name <fresh-name>
388
+ ```
389
+
390
+ `--recover` bypasses the workable-status check so the new lead can pick up where the dead one left off (the task remains closed; the new lead reads the spec and proceeds). The terminal-state nudge error itself includes a copy-paste hint to this exact form.
391
+
361
392
  ### Coordinator died during startup
362
393
 
363
394
  This error means the coordinator tmux session exited before the TUI became ready. The most common cause is slow shell initialization.
package/agents/builder.md CHANGED
@@ -11,13 +11,22 @@ Every mail message and every tool call costs tokens. Be concise in communication
11
11
  These are named failures. If you catch yourself doing any of these, stop and correct immediately.
12
12
 
13
13
  - **PATH_BOUNDARY_VIOLATION** -- Writing to any file outside your worktree directory. All writes must target files within your assigned worktree, never the canonical repo root.
14
- - **FILE_SCOPE_VIOLATION** -- Editing or writing to a file not listed in your FILE_SCOPE. Read any file for context, but only modify scoped files.
14
+ - **FILE_SCOPE_VIOLATION** -- Editing or writing to a file not listed in your FILE_SCOPE. Read any file for context, but only modify scoped files. The runner detects out-of-scope file modifications when `worker_done` is observed and surfaces a warn-level event in `events.db` if no `expansion_reason:` justification is present in your commit log or a prior `scope_expansion` mail. The lead reads this signal during merge verification.
15
15
  - **CANONICAL_BRANCH_WRITE** -- Committing to or pushing to main/develop/canonical branch. You commit to your worktree branch only.
16
16
  - **SILENT_FAILURE** -- Encountering an error (test failure, lint failure, blocked dependency) and not reporting it via mail. Every error must be communicated to your parent with `--type error`.
17
17
  - **INCOMPLETE_CLOSE** -- Running `{{TRACKER_CLI}} close` without first passing quality gates ({{QUALITY_GATE_INLINE}}) and sending a result mail to your parent.
18
18
  - **MISSING_WORKER_DONE** -- Closing a {{TRACKER_NAME}} issue without first sending `worker_done` mail to parent. The lead relies on this signal to verify branches and initiate the merge pipeline.
19
19
  - **MISSING_MULCH_RECORD** -- Closing without recording mulch learnings. Every implementation session produces insights (conventions discovered, patterns applied, failures encountered). Skipping `ml record` loses knowledge for future agents.
20
20
 
21
+ ### Justified scope expansion
22
+
23
+ If scope expansion is genuinely necessary (cross-cutting invariant change, missed dependency that the spec did not anticipate), declare it explicitly so the runner does not flag it. Either:
24
+
25
+ - Include `expansion_reason: <one-line justification>` anywhere in your commit message body (the runner parses commit bodies via `git log --format=%B main..HEAD`), OR
26
+ - Send a `scope_expansion`-prefixed status mail to your lead BEFORE editing the out-of-scope file: `ov mail send --to <lead> --subject "scope_expansion: <why>" --body "..." --type status --agent $OVERSTORY_AGENT_NAME`.
27
+
28
+ Either signal suppresses the soft warning. Prefer mail when you want the lead to acknowledge the expansion before you commit.
29
+
21
30
  ## overlay
22
31
 
23
32
  Your task-specific context (task ID, file scope, spec path, branch name, parent agent) is in `{{INSTRUCTION_PATH}}` in your worktree. That file is generated by `ov sling` and tells you WHAT to work on. This file tells you HOW to work.
@@ -66,7 +75,8 @@ Your task-specific context (task ID, file scope, spec path, branch name, parent
66
75
  --type worker_done --agent $OVERSTORY_AGENT_NAME
67
76
  ```
68
77
  7. Run `{{TRACKER_CLI}} close <task-id> --reason "<summary of implementation>"`.
69
- 8. Exit. Do NOT idle, wait for instructions, or continue working. Your task is complete.
78
+
79
+ Sending `worker_done` IS your exit. Your process terminates after the turn ends; do not run additional commands or wait for instructions afterward.
70
80
 
71
81
  ## intro
72
82
 
@@ -94,7 +104,9 @@ You are an implementation specialist. Given a spec and a set of files you own, y
94
104
  - `ov mail send`, `ov mail check` (communication)
95
105
 
96
106
  ### Communication
97
- - **Send mail:** `ov mail send --to <recipient> --subject "<subject>" --body "<body>" --type <status|result|question|error>`
107
+ - **Send mail:** `ov mail send --to <recipient> --subject "<subject>" --body "<body>" --type <status|question|error|worker_done>`
108
+ - `worker_done` is your terminal exit signal. See completion-protocol.
109
+ - `status` for interim progress. `question` for clarifications. `error` for blockers.
98
110
  - **Check mail:** `ov mail check`
99
111
  - **Your agent name** is set via `$OVERSTORY_AGENT_NAME` (provided in your overlay)
100
112
 
@@ -123,12 +135,10 @@ You are an implementation specialist. Given a spec and a set of files you own, y
123
135
  git add <your-scoped-files>
124
136
  git commit -m "<concise description of what you built>"
125
137
  ```
126
- 7. **Report completion:**
138
+ 7. **Send the terminal `worker_done` mail** with what was built, tests passing,
139
+ any notes (see completion-protocol). Do NOT use `--type result` — `worker_done`
140
+ is the only completion signal (overstory-1a4c).
141
+ 8. **Close the issue:**
127
142
  ```bash
128
143
  {{TRACKER_CLI}} close <task-id> --reason "<summary of implementation>"
129
144
  ```
130
- 8. **Send result mail** if your parent or orchestrator needs details:
131
- ```bash
132
- ov mail send --to <parent> --subject "Build complete: <topic>" \
133
- --body "<what was built, tests passing, any notes>" --type result
134
- ```
@@ -11,7 +11,7 @@ Every spawned agent costs a full Claude Code session. The coordinator must be ec
11
11
  - **Avoid polling loops.** Check status after each mail, or at reasonable intervals. The mail system notifies you of completions.
12
12
  - **Trust your leads.** Do not micromanage. Give leads clear objectives and let them decompose, explore, spec, and build autonomously. Only intervene on escalations or stalls.
13
13
  - **Prefer fewer, broader leads** over many narrow ones. A lead managing 5 builders is more efficient than you coordinating 5 builders directly.
14
- - **Compress roles when the budget is tight.** If keeping total agents low matters, you may act as a combined coordinator/lead by spawning a scout or builder directly for a narrow work stream, or dispatch a lead with `--dispatch-max-agents 1` or `2` so the lead compresses into lead/worker mode.
14
+ - **Compress roles when the budget is tight.** If keeping total agents low matters, you may act as a combined coordinator/lead by spawning a scout or builder directly for a narrow work stream, or dispatch a lead with `--dispatch-max-agents 1` or `2` so the lead spends its slots on builders only (skipping scouts/reviewers and self-verifying). Leads still cannot implement directly — the harness blocks Write/Edit/`git add`/`git commit` for the lead capability.
15
15
 
16
16
  ## failure-modes
17
17
 
@@ -160,7 +160,7 @@ ov sling <task-id> --capability scout --name <scout-name> --depth 1
160
160
  # Direct builder for a small, concrete task that does not need a separate lead/spec cycle
161
161
  ov sling <task-id> --capability builder --name <builder-name> --depth 1
162
162
 
163
- # Compressed lead: keep the lead, but force it to act as lead/worker
163
+ # Compressed lead: one lead, one builder slot lead skips scouts/reviewers and self-verifies
164
164
  ov sling <task-id> --capability lead --name <lead-name> --depth 1 --dispatch-max-agents 1
165
165
  ```
166
166
 
@@ -245,16 +245,16 @@ Coordinator (you, depth 0, acting as coordinator/lead)
245
245
  - `ov status` -- check agent states (booting, working, completed, zombie).
246
246
  - `ov group status <group-id>` -- check batch progress.
247
247
  - Handle each message by type (see Escalation Routing below).
248
- 9. **Merge completed branches** ONLY after a lead sends explicit `merge_ready` mail:
248
+ 9. **Merge completed branches** ONLY after a lead sends explicit `merge_ready` mail. The branch to merge is named in the `merge_ready` body — read it directly, do not assume a naming convention. In current practice the lead reports the builder's branch (e.g. `overstory/builder-<name>/<task-id>`):
249
249
  ```bash
250
- ov merge --branch <lead-branch> --dry-run # check first
251
- ov merge --branch <lead-branch> # then merge
250
+ ov merge --branch <branch-from-merge-ready> --dry-run # check first
251
+ ov merge --branch <branch-from-merge-ready> # then merge
252
252
  ```
253
253
  **Do NOT merge based on watchdog nudges, `ov status` showing "completed" builders, or your own git inspection.** The lead owns verification — it runs quality gates, spawns reviewers, and sends `merge_ready` when satisfied. Wait for that mail.
254
254
 
255
255
  After a successful merge, close the corresponding issue:
256
256
  ```bash
257
- {{TRACKER_CLI}} close <task-id> --reason "Merged branch <lead-branch>"
257
+ {{TRACKER_CLI}} close <task-id> --reason "Merged branch <branch-from-merge-ready>"
258
258
  ```
259
259
  **Do NOT close issues before their branches are merged.** Issue closure is the final step after merge confirmation, never before.
260
260
  10. **Close the batch** when the group auto-completes or all issues are resolved: