@os-eco/overstory-cli 0.6.10 → 0.7.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 (66) hide show
  1. package/README.md +156 -274
  2. package/agents/lead.md +29 -19
  3. package/package.json +5 -3
  4. package/src/agents/hooks-deployer.test.ts +53 -0
  5. package/src/agents/hooks-deployer.ts +4 -4
  6. package/src/agents/manifest.test.ts +1 -0
  7. package/src/agents/overlay.test.ts +102 -0
  8. package/src/agents/overlay.ts +45 -6
  9. package/src/commands/completions.ts +3 -3
  10. package/src/commands/coordinator.ts +25 -13
  11. package/src/commands/costs.test.ts +1 -1
  12. package/src/commands/costs.ts +13 -20
  13. package/src/commands/dashboard.ts +38 -138
  14. package/src/commands/doctor.test.ts +1 -1
  15. package/src/commands/doctor.ts +2 -2
  16. package/src/commands/ecosystem.ts +2 -1
  17. package/src/commands/errors.test.ts +4 -5
  18. package/src/commands/errors.ts +4 -62
  19. package/src/commands/feed.test.ts +2 -2
  20. package/src/commands/feed.ts +12 -106
  21. package/src/commands/group.ts +4 -4
  22. package/src/commands/inspect.ts +10 -44
  23. package/src/commands/logs.ts +7 -63
  24. package/src/commands/mail.test.ts +63 -1
  25. package/src/commands/mail.ts +18 -1
  26. package/src/commands/merge.ts +2 -2
  27. package/src/commands/metrics.test.ts +2 -2
  28. package/src/commands/metrics.ts +3 -17
  29. package/src/commands/monitor.ts +19 -9
  30. package/src/commands/replay.test.ts +2 -2
  31. package/src/commands/replay.ts +12 -135
  32. package/src/commands/run.ts +7 -23
  33. package/src/commands/sling.test.ts +227 -27
  34. package/src/commands/sling.ts +120 -21
  35. package/src/commands/status.ts +5 -18
  36. package/src/commands/supervisor.ts +22 -12
  37. package/src/commands/trace.test.ts +5 -6
  38. package/src/commands/trace.ts +13 -111
  39. package/src/config.test.ts +22 -0
  40. package/src/config.ts +22 -0
  41. package/src/doctor/agents.test.ts +1 -0
  42. package/src/doctor/config-check.test.ts +1 -0
  43. package/src/doctor/consistency.test.ts +1 -0
  44. package/src/doctor/databases.test.ts +1 -0
  45. package/src/doctor/dependencies.test.ts +1 -0
  46. package/src/doctor/ecosystem.test.ts +1 -0
  47. package/src/doctor/logs.test.ts +1 -0
  48. package/src/doctor/merge-queue.test.ts +1 -0
  49. package/src/doctor/structure.test.ts +1 -0
  50. package/src/doctor/version.test.ts +1 -0
  51. package/src/index.ts +8 -4
  52. package/src/logging/format.ts +214 -0
  53. package/src/logging/theme.ts +132 -0
  54. package/src/metrics/store.test.ts +46 -0
  55. package/src/metrics/store.ts +11 -0
  56. package/src/mulch/client.test.ts +20 -0
  57. package/src/mulch/client.ts +312 -45
  58. package/src/runtimes/claude.test.ts +616 -0
  59. package/src/runtimes/claude.ts +218 -0
  60. package/src/runtimes/registry.test.ts +53 -0
  61. package/src/runtimes/registry.ts +33 -0
  62. package/src/runtimes/types.ts +125 -0
  63. package/src/types.ts +15 -0
  64. package/src/worktree/tmux.test.ts +28 -13
  65. package/src/worktree/tmux.ts +14 -28
  66. package/templates/overlay.md.tmpl +3 -1
package/README.md CHANGED
@@ -1,68 +1,40 @@
1
1
  # Overstory
2
2
 
3
- [![CI](https://img.shields.io/github/actions/workflow/status/jayminwest/overstory/ci.yml?branch=main)](https://github.com/jayminwest/overstory/actions/workflows/ci.yml)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-orange)](https://bun.sh)
6
- [![GitHub release](https://img.shields.io/github/v/release/jayminwest/overstory)](https://github.com/jayminwest/overstory/releases)
3
+ Multi-agent orchestration for Claude Code.
7
4
 
8
- Project-agnostic swarm system for Claude Code agent orchestration. Overstory turns a single Claude Code 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.
5
+ [![npm](https://img.shields.io/npm/v/@os-eco/overstory-cli)](https://www.npmjs.com/package/@os-eco/overstory-cli)
6
+ [![CI](https://github.com/jayminwest/overstory/actions/workflows/ci.yml/badge.svg)](https://github.com/jayminwest/overstory/actions/workflows/ci.yml)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
9
8
 
10
- > **⚠️ 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.
9
+ Overstory turns a single Claude Code 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.
11
10
 
12
- ## How It Works
13
-
14
- CLAUDE.md + hooks + the `ov` CLI turn your Claude Code session into a multi-agent orchestrator. A persistent coordinator agent manages task decomposition and dispatch, while a mechanical watchdog daemon monitors agent health in the background.
15
-
16
- ```
17
- Coordinator (persistent orchestrator at project root)
18
- --> Supervisor (per-project team lead, depth 1)
19
- --> Workers: Scout, Builder, Reviewer, Merger (depth 2)
20
- ```
21
-
22
- ### Agent Types
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.
23
12
 
24
- | Agent | Role | Access |
25
- |-------|------|--------|
26
- | **Coordinator** | Persistent orchestrator — decomposes objectives, dispatches agents, tracks task groups | Read-only |
27
- | **Supervisor** | Per-project team lead — manages worker lifecycle, handles nudge/escalation | Read-only |
28
- | **Scout** | Read-only exploration and research | Read-only |
29
- | **Builder** | Implementation and code changes | Read-write |
30
- | **Reviewer** | Validation and code review | Read-only |
31
- | **Lead** | Team coordination, can spawn sub-workers | Read-write |
32
- | **Merger** | Branch merge specialist | Read-write |
33
- | **Monitor** | Tier 2 continuous fleet patrol — ongoing health monitoring | Read-only |
13
+ ## Install
34
14
 
35
- ### Key Architecture
15
+ Requires [Bun](https://bun.sh) v1.0+, [Claude Code](https://docs.anthropic.com/en/docs/claude-code), git, and tmux.
36
16
 
37
- - **Agent Definitions**: Two-layer system — base `.md` files define the HOW (workflow), per-task overlays define the WHAT (task scope). Base definition content is injected into spawned agent overlays automatically.
38
- - **Messaging**: Custom SQLite mail system with typed protocol — 8 message types (`worker_done`, `merge_ready`, `dispatch`, `escalation`, etc.) for structured agent coordination, plus broadcast messaging with group addresses (`@all`, `@builders`, etc.)
39
- - **Worktrees**: Each agent gets an isolated git worktree — no file conflicts between agents
40
- - **Merge**: FIFO merge queue (SQLite-backed) with 4-tier conflict resolution
41
- - **Watchdog**: Tiered health monitoring — Tier 0 mechanical daemon (tmux/pid liveness), Tier 1 AI-assisted failure triage, Tier 2 monitor agent for continuous fleet patrol
42
- - **Tool Enforcement**: PreToolUse hooks mechanically block file modifications for non-implementation agents and dangerous git operations for all agents
43
- - **Task Groups**: Batch coordination with auto-close when all member issues complete
44
- - **Session Lifecycle**: Checkpoint save/restore for compaction survivability, handoff orchestration for crash recovery
45
- - **Token Instrumentation**: Session metrics extracted from Claude Code transcript JSONL files
17
+ ```bash
18
+ bun install -g @os-eco/overstory-cli
19
+ ```
46
20
 
47
- ## Requirements
21
+ Or try without installing:
48
22
 
49
- - [Bun](https://bun.sh) (v1.0+)
50
- - [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
51
- - git
52
- - tmux
23
+ ```bash
24
+ npx @os-eco/overstory-cli --help
25
+ ```
53
26
 
54
- ## Installation
27
+ ### Development
55
28
 
56
29
  ```bash
57
- # Clone the repository
58
30
  git clone https://github.com/jayminwest/overstory.git
59
31
  cd overstory
60
-
61
- # Install dev dependencies
62
32
  bun install
33
+ bun link # Makes 'ov' available globally
63
34
 
64
- # Link the CLI globally
65
- bun link
35
+ bun test # Run all tests
36
+ bun run lint # Biome check
37
+ bun run typecheck # tsc --noEmit
66
38
  ```
67
39
 
68
40
  ## Quick Start
@@ -94,233 +66,134 @@ ov nudge <agent-name>
94
66
  ov mail check --inject
95
67
  ```
96
68
 
97
- ## CLI Reference
98
-
99
- ```
100
- ov agents discover Discover agents by capability/state/parent
101
- --capability <type> Filter by capability type
102
- --state <state> Filter by agent state
103
- --parent <name> Filter by parent agent
104
- --json JSON output
105
-
106
- ov init Initialize .overstory/ in current project
107
- (deploys agent definitions automatically)
108
- --yes, -y Skip interactive prompts
109
- --name <name> Set project name (default: auto-detect)
110
-
111
- ov coordinator start Start persistent coordinator agent
112
- --attach / --no-attach TTY-aware tmux attach (default: auto)
113
- --watchdog Auto-start watchdog daemon with coordinator
114
- --monitor Auto-start Tier 2 monitor agent
115
- ov coordinator stop Stop coordinator
116
- ov coordinator status Show coordinator state
117
-
118
- ov supervisor start Start per-project supervisor agent
119
- --attach / --no-attach TTY-aware tmux attach (default: auto)
120
- ov supervisor stop Stop supervisor
121
- ov supervisor status Show supervisor state
122
-
123
- ov sling <task-id> Spawn a worker agent
124
- --capability <type> builder | scout | reviewer | lead | merger
125
- | coordinator | supervisor | monitor
126
- --name <name> Unique agent name
127
- --spec <path> Path to task spec file
128
- --files <f1,f2,...> Exclusive file scope
129
- --parent <agent-name> Parent (for hierarchy tracking)
130
- --depth <n> Current hierarchy depth
131
- --skip-scout Skip scout phase (passed to lead overlay)
132
- --skip-task-check Skip task existence validation
133
- --json JSON output
134
-
135
- ov stop <agent-name> Terminate a running agent
136
- --clean-worktree Remove the agent's worktree (best-effort)
137
- --json JSON output
138
-
139
- ov prime Load context for orchestrator/agent
140
- --agent <name> Per-agent priming
141
- --compact Restore from checkpoint (compaction)
142
-
143
- ov status Show all active agents, worktrees, tracker state
144
- --json JSON output
145
- --verbose Show detailed agent info
146
- --all Show all runs (default: current run only)
147
-
148
- ov dashboard Live TUI dashboard for agent monitoring
149
- --interval <ms> Refresh interval (default: 2000)
150
- --all Show all runs (default: current run only)
151
-
152
- ov hooks install Install orchestrator hooks to .claude/settings.local.json
153
- --force Overwrite existing hooks
154
- ov hooks uninstall Remove orchestrator hooks
155
- ov hooks status Check if hooks are installed
156
-
157
- ov mail send Send a message
158
- --to <agent> --subject <text> --body <text>
159
- --to @all | @builders | @scouts ... Broadcast to group addresses
160
- --type <status|question|result|error>
161
- --priority <low|normal|high|urgent> (urgent/high auto-nudges recipient)
162
-
163
- ov mail check Check inbox (unread messages)
164
- --agent <name> --inject --json
165
- --debounce <ms> Skip if checked within window
166
-
167
- ov mail list List messages with filters
168
- --from <name> --to <name> --unread
169
-
170
- ov mail read <id> Mark message as read
171
- ov mail reply <id> --body <text> Reply in same thread
172
-
173
- ov nudge <agent> [message] Send a text nudge to an agent
174
- --from <name> Sender name (default: orchestrator)
175
- --force Skip debounce check
176
- --json JSON output
177
-
178
- ov group create <name> Create a task group for batch tracking
179
- ov group status <name> Show group progress
180
- ov group add <name> <issue-id> Add issue to group
181
- ov group list List all groups
182
-
183
- ov merge Merge agent branches into canonical
184
- --branch <name> Specific branch
185
- --all All completed branches
186
- --into <branch> Target branch (default: session-branch.txt > canonicalBranch)
187
- --dry-run Check for conflicts only
188
-
189
- ov worktree list List worktrees with status
190
- ov worktree clean Remove completed worktrees
191
- --completed Only finished agents
192
- --all Force remove all
193
- --force Delete even if branches are unmerged
194
-
195
- ov monitor start Start Tier 2 monitor agent
196
- ov monitor stop Stop monitor agent
197
- ov monitor status Show monitor state
198
-
199
- ov log <event> Log a hook event
200
- ov watch Start watchdog daemon (Tier 0)
201
- --interval <ms> Health check interval
202
- --background Run as background process
203
- ov run list List orchestration runs
204
- ov run show <id> Show run details
205
- ov run complete <id> Mark a run complete
206
-
207
- ov trace View agent/bead timeline
208
- --agent <name> Filter by agent
209
- --run <id> Filter by run
210
-
211
- ov clean Clean up worktrees, sessions, artifacts
212
- --completed Only finished agents
213
- --all Force remove all
214
- --run <id> Clean a specific run
215
-
216
- ov doctor Run health checks on overstory setup
217
- --json JSON output
218
- --category <name> Run a specific check category only
219
- --fix Auto-fix fixable issues
220
-
221
- ov ecosystem Show os-eco tool versions and health
222
- --json JSON output
223
-
224
- ov upgrade Upgrade overstory to latest npm version
225
- --check Compare versions without installing
226
- --all Upgrade all 4 ecosystem tools
227
- --json JSON output
228
-
229
- ov inspect <agent> Deep per-agent inspection
230
- --json JSON output
231
- --follow Polling mode (refreshes periodically)
232
- --interval <ms> Refresh interval for --follow
233
- --no-tmux Skip tmux capture
234
- --limit <n> Limit events shown
235
-
236
- ov spec write <task-id> Write a task specification
237
- --body <content> Spec content (or pipe via stdin)
238
-
239
- ov errors Aggregated error view across agents
240
- --agent <name> Filter by agent
241
- --run <id> Filter by run
242
- --since <ts> --until <ts> Time range filter
243
- --limit <n> --json
244
-
245
- ov replay Interleaved chronological replay
246
- --run <id> Filter by run
247
- --agent <name> Filter by agent(s)
248
- --since <ts> --until <ts> Time range filter
249
- --limit <n> --json
250
-
251
- ov feed [options] Unified real-time event stream across agents
252
- --follow, -f Continuously poll for new events
253
- --interval <ms> Polling interval (default: 2000)
254
- --agent <name> --run <id> Filter by agent or run
255
- --json JSON output
256
-
257
- ov logs [options] Query NDJSON logs across agents
258
- --agent <name> Filter by agent
259
- --level <level> Filter by log level (debug|info|warn|error)
260
- --since <ts> --until <ts> Time range filter
261
- --follow Tail logs in real time
262
- --json JSON output
263
-
264
- ov costs Token/cost analysis and breakdown
265
- --live Show real-time token usage for active agents
266
- --self Show cost for current orchestrator session
267
- --agent <name> Filter by agent
268
- --run <id> Filter by run
269
- --by-capability Group by capability type
270
- --last <n> --json
271
-
272
- ov metrics Show session metrics
273
- --last <n> Last N sessions
274
- --json JSON output
275
-
276
- Global Flags:
277
- --quiet, -q Suppress non-error output
278
- --timing Print command execution time to stderr
279
- --completions <shell> Generate shell completions (bash, zsh, fish)
280
- ```
281
-
282
- ## Tech Stack
283
-
284
- - **Runtime**: Bun (TypeScript directly, no build step)
285
- - **Dependencies**: Minimal runtime — `chalk` (color output), `commander` (CLI framework), core I/O via Bun built-in APIs
286
- - **Database**: SQLite via `bun:sqlite` (WAL mode for concurrent access)
287
- - **Linting**: Biome (formatter + linter)
288
- - **Testing**: `bun test` (2241 tests across 79 files, colocated with source)
289
- - **External CLIs**: `bd` (beads) or `sd` (seeds), `mulch`, `git`, `tmux` — invoked as subprocesses
290
-
291
- ## Development
69
+ ## Commands
70
+
71
+ Every command supports `--json` where noted. Global flags: `-q`/`--quiet`, `--timing`. ANSI colors respect `NO_COLOR`.
72
+
73
+ ### Core Workflow
74
+
75
+ | Command | Description |
76
+ |---------|-------------|
77
+ | `ov init` | Initialize `.overstory/` in current project (`--yes`, `--name`) |
78
+ | `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`, `--runtime`, `--json`) |
79
+ | `ov stop <agent-name>` | Terminate a running agent (`--clean-worktree`, `--json`) |
80
+ | `ov prime` | Load context for orchestrator/agent (`--agent`, `--compact`) |
81
+ | `ov spec write <task-id>` | Write a task specification (`--body`) |
82
+
83
+ ### Coordination
84
+
85
+ | Command | Description |
86
+ |---------|-------------|
87
+ | `ov coordinator start` | Start persistent coordinator agent (`--attach`/`--no-attach`, `--watchdog`, `--monitor`) |
88
+ | `ov coordinator stop` | Stop coordinator |
89
+ | `ov coordinator status` | Show coordinator state |
90
+ | `ov supervisor start` | Start per-project supervisor agent (`--attach`/`--no-attach`) |
91
+ | `ov supervisor stop` | Stop supervisor |
92
+ | `ov supervisor status` | Show supervisor state |
93
+
94
+ ### Messaging
95
+
96
+ | Command | Description |
97
+ |---------|-------------|
98
+ | `ov mail send` | Send a message (`--to`, `--subject`, `--body`, `--type`, `--priority`) |
99
+ | `ov mail check` | Check inbox — unread messages (`--agent`, `--inject`, `--debounce`, `--json`) |
100
+ | `ov mail list` | List messages with filters (`--from`, `--to`, `--unread`) |
101
+ | `ov mail read <id>` | Mark message as read |
102
+ | `ov mail reply <id>` | Reply in same thread (`--body`) |
103
+ | `ov nudge <agent> [message]` | Send a text nudge to an agent (`--from`, `--force`, `--json`) |
104
+
105
+ ### Task Groups
106
+
107
+ | Command | Description |
108
+ |---------|-------------|
109
+ | `ov group create <name>` | Create a task group for batch tracking |
110
+ | `ov group status <name>` | Show group progress |
111
+ | `ov group add <name> <issue-id>` | Add issue to group |
112
+ | `ov group list` | List all groups |
113
+
114
+ ### Merge
115
+
116
+ | Command | Description |
117
+ |---------|-------------|
118
+ | `ov merge` | Merge agent branches into canonical (`--branch`, `--all`, `--into`, `--dry-run`, `--json`) |
119
+
120
+ ### Observability
121
+
122
+ | Command | Description |
123
+ |---------|-------------|
124
+ | `ov status` | Show all active agents, worktrees, tracker state (`--json`, `--verbose`, `--all`) |
125
+ | `ov dashboard` | Live TUI dashboard for agent monitoring (`--interval`, `--all`) |
126
+ | `ov inspect <agent>` | Deep per-agent inspection (`--follow`, `--interval`, `--no-tmux`, `--limit`, `--json`) |
127
+ | `ov trace` | View agent/task timeline (`--agent`, `--run`, `--since`, `--until`, `--limit`, `--json`) |
128
+ | `ov errors` | Aggregated error view across agents (`--agent`, `--run`, `--since`, `--until`, `--limit`, `--json`) |
129
+ | `ov replay` | Interleaved chronological replay (`--run`, `--agent`, `--since`, `--until`, `--limit`, `--json`) |
130
+ | `ov feed` | Unified real-time event stream (`--follow`, `--interval`, `--agent`, `--run`, `--json`) |
131
+ | `ov logs` | Query NDJSON logs across agents (`--agent`, `--level`, `--since`, `--until`, `--follow`, `--json`) |
132
+ | `ov costs` | Token/cost analysis and breakdown (`--live`, `--self`, `--agent`, `--run`, `--by-capability`, `--last`, `--json`) |
133
+ | `ov metrics` | Show session metrics (`--last`, `--json`) |
134
+ | `ov run list` | List orchestration runs (`--last`, `--json`) |
135
+ | `ov run show <id>` | Show run details |
136
+ | `ov run complete` | Mark current run as completed |
137
+
138
+ ### Infrastructure
139
+
140
+ | Command | Description |
141
+ |---------|-------------|
142
+ | `ov hooks install` | Install orchestrator hooks to `.claude/settings.local.json` (`--force`) |
143
+ | `ov hooks uninstall` | Remove orchestrator hooks |
144
+ | `ov hooks status` | Check if hooks are installed |
145
+ | `ov worktree list` | List worktrees with status |
146
+ | `ov worktree clean` | Remove completed worktrees (`--completed`, `--all`, `--force`) |
147
+ | `ov watch` | Start watchdog daemon — Tier 0 (`--interval`, `--background`) |
148
+ | `ov monitor start` | Start Tier 2 monitor agent |
149
+ | `ov monitor stop` | Stop monitor agent |
150
+ | `ov monitor status` | Show monitor state |
151
+ | `ov log <event>` | Log a hook event (`--agent`) |
152
+ | `ov clean` | Clean up worktrees, sessions, artifacts (`--completed`, `--all`, `--run`) |
153
+ | `ov doctor` | Run health checks on overstory setup (`--category`, `--fix`, `--json`) |
154
+ | `ov ecosystem` | Show os-eco tool versions and health (`--json`) |
155
+ | `ov upgrade` | Upgrade overstory to latest npm version (`--check`, `--all`, `--json`) |
156
+ | `ov agents discover` | Discover agents by capability/state/parent (`--capability`, `--state`, `--parent`, `--json`) |
157
+ | `ov completions <shell>` | Generate shell completions (bash, zsh, fish) |
158
+
159
+ ## Architecture
160
+
161
+ Overstory uses CLAUDE.md overlays and PreToolUse hooks to turn Claude Code sessions into orchestrated agents. 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.
292
162
 
293
- ```bash
294
- # Run tests (2241 tests across 79 files)
295
- bun test
296
-
297
- # Run a single test
298
- bun test src/config.test.ts
299
-
300
- # Lint + format check
301
- biome check .
163
+ ## How It Works
302
164
 
303
- # Type check
304
- tsc --noEmit
165
+ CLAUDE.md + hooks + the `ov` CLI turn your Claude Code session into a multi-agent orchestrator. A persistent coordinator agent manages task decomposition and dispatch, while a mechanical watchdog daemon monitors agent health in the background.
305
166
 
306
- # All quality gates
307
- bun test && biome check . && tsc --noEmit
167
+ ```
168
+ Coordinator (persistent orchestrator at project root)
169
+ --> Supervisor (per-project team lead, depth 1)
170
+ --> Workers: Scout, Builder, Reviewer, Merger (depth 2)
308
171
  ```
309
172
 
310
- ### Versioning
311
-
312
- Version is maintained in two places that must stay in sync:
313
-
314
- 1. `package.json` — `"version"` field
315
- 2. `src/index.ts` — `VERSION` constant
173
+ ### Agent Types
316
174
 
317
- Use the bump script to update both:
175
+ | Agent | Role | Access |
176
+ |-------|------|--------|
177
+ | **Coordinator** | Persistent orchestrator — decomposes objectives, dispatches agents, tracks task groups | Read-only |
178
+ | **Supervisor** | Per-project team lead — manages worker lifecycle, handles nudge/escalation | Read-only |
179
+ | **Scout** | Read-only exploration and research | Read-only |
180
+ | **Builder** | Implementation and code changes | Read-write |
181
+ | **Reviewer** | Validation and code review | Read-only |
182
+ | **Lead** | Team coordination, can spawn sub-workers | Read-write |
183
+ | **Merger** | Branch merge specialist | Read-write |
184
+ | **Monitor** | Tier 2 continuous fleet patrol — ongoing health monitoring | Read-only |
318
185
 
319
- ```bash
320
- bun run version:bump <major|minor|patch>
321
- ```
186
+ ### Key Architecture
322
187
 
323
- Git tags, npm publishing, and GitHub releases are handled automatically by the `publish.yml` workflow when a version bump is pushed to `main`.
188
+ - **Agent Definitions**: Two-layer system base `.md` files define the HOW (workflow), per-task overlays define the WHAT (task scope). Base definition content is injected into spawned agent overlays automatically.
189
+ - **Messaging**: Custom SQLite mail system with typed protocol — 8 message types (`worker_done`, `merge_ready`, `dispatch`, `escalation`, etc.) for structured agent coordination, plus broadcast messaging with group addresses (`@all`, `@builders`, etc.)
190
+ - **Worktrees**: Each agent gets an isolated git worktree — no file conflicts between agents
191
+ - **Merge**: FIFO merge queue (SQLite-backed) with 4-tier conflict resolution
192
+ - **Watchdog**: Tiered health monitoring — Tier 0 mechanical daemon (tmux/pid liveness), Tier 1 AI-assisted failure triage, Tier 2 monitor agent for continuous fleet patrol
193
+ - **Tool Enforcement**: PreToolUse hooks mechanically block file modifications for non-implementation agents and dangerous git operations for all agents
194
+ - **Task Groups**: Batch coordination with auto-close when all member issues complete
195
+ - **Session Lifecycle**: Checkpoint save/restore for compaction survivability, handoff orchestration for crash recovery
196
+ - **Token Instrumentation**: Session metrics extracted from Claude Code transcript JSONL files
324
197
 
325
198
  ## Project Structure
326
199
 
@@ -353,7 +226,7 @@ overstory/
353
226
  logs.ts NDJSON log query
354
227
  feed.ts Unified real-time event stream
355
228
  run.ts Orchestration run lifecycle
356
- trace.ts Agent/bead timeline viewing
229
+ trace.ts Agent/task timeline viewing
357
230
  clean.ts Worktree/session cleanup
358
231
  doctor.ts Health check runner (10 check modules)
359
232
  inspect.ts Deep per-agent inspection
@@ -377,21 +250,30 @@ overstory/
377
250
  mail/ SQLite mail system (typed protocol, broadcast)
378
251
  merge/ FIFO queue + conflict resolution
379
252
  watchdog/ Tiered health monitoring (daemon, triage, health)
380
- logging/ Multi-format logger + sanitizer + reporter + color control
253
+ logging/ Multi-format logger + sanitizer + reporter + color control + shared theme/format
381
254
  metrics/ SQLite metrics + transcript parsing
382
255
  doctor/ Health check modules (10 checks)
383
256
  insights/ Session insight analyzer for auto-expertise
257
+ runtimes/ AgentRuntime abstraction (registry + adapters)
384
258
  tracker/ Pluggable task tracker (beads + seeds backends)
385
- mulch/ mulch CLI wrapper
259
+ mulch/ mulch client (programmatic API + CLI wrapper)
386
260
  e2e/ End-to-end lifecycle tests
387
261
  agents/ Base agent definitions (.md, 8 roles) + skill definitions
388
262
  templates/ Templates for overlays and hooks
389
263
  ```
390
264
 
391
- ## License
265
+ ## Part of os-eco
392
266
 
393
- MIT
267
+ Overstory is part of the [os-eco](https://github.com/jayminwest/os-eco) AI agent tooling ecosystem.
394
268
 
395
- ---
269
+ <p align="center">
270
+ <img src="https://raw.githubusercontent.com/jayminwest/os-eco/main/branding/logo.png" alt="os-eco" width="444" />
271
+ </p>
396
272
 
397
- Inspired by: https://github.com/steveyegge/gastown/
273
+ ## Contributing
274
+
275
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
276
+
277
+ ## License
278
+
279
+ MIT
package/agents/lead.md CHANGED
@@ -1,6 +1,15 @@
1
1
  ## propulsion-principle
2
2
 
3
- Read your assignment. Assess complexity. For simple tasks, start implementing immediately. For moderate tasks, write a spec and spawn a builder. For complex tasks, spawn scouts and create issues. Do not ask for confirmation, do not propose a plan and wait for approval. Start working within your first tool calls.
3
+ Read your assignment. Assess complexity. For simple tasks, start implementing immediately. For moderate tasks, write a spec and spawn a builder. For complex tasks, spawn scouts and mail the coordinator to create issues. Do not ask for confirmation, do not propose a plan and wait for approval. Start working within your first tool calls.
4
+
5
+ ## dispatch-overrides
6
+
7
+ Your overlay may contain a **Dispatch Overrides** section with directives from your coordinator. These override the default workflow:
8
+
9
+ - **SKIP REVIEW**: Do not spawn a reviewer. Self-verify by reading the builder diff and running quality gates. This is appropriate for simple or well-tested changes.
10
+ - **MAX AGENTS**: Limits the number of sub-workers you may spawn. Plan your decomposition to fit within this budget.
11
+
12
+ Always check your overlay for dispatch overrides before following the default three-phase workflow. If no overrides section exists, follow the standard playbook.
4
13
 
5
14
  ## cost-awareness
6
15
 
@@ -30,6 +39,7 @@ These are named failures. If you catch yourself doing any of these, stop and cor
30
39
  - **INCOMPLETE_CLOSE** -- Running `{{TRACKER_CLI}} close` before all subtasks are complete or accounted for, or without sending `merge_ready` to the coordinator.
31
40
  - **REVIEW_SKIP** -- Sending `merge_ready` for complex tasks without independent review. For complex multi-file changes, always spawn a reviewer. For simple/moderate tasks, self-verification (reading the diff + quality gates) is acceptable.
32
41
  - **MISSING_MULCH_RECORD** -- Closing without recording mulch learnings. Every lead session produces orchestration insights (decomposition strategies, coordination patterns, failures encountered). Skipping `ml record` loses knowledge for future agents.
42
+ - **WORKTREE_ISSUE_CREATE** -- Running `{{TRACKER_CLI}} create` in a worktree. Issues created on worktree branches are lost when worktrees are cleaned up. Mail the coordinator to create issues on main instead.
33
43
 
34
44
  ## overlay
35
45
 
@@ -46,6 +56,7 @@ Your task-specific context (task ID, spec path, hierarchy depth, agent name, whe
46
56
  - **Never push to the canonical branch.** Commit to your worktree branch. Merging is handled by the coordinator.
47
57
  - **Do not spawn more workers than needed.** Start with the minimum. You can always spawn more later. Target 2-5 builders per lead.
48
58
  - **Review before merge for complex tasks.** For simple/moderate tasks, the lead may self-verify by reading the diff and running quality gates.
59
+ - **Never create issues in worktrees.** Running `{{TRACKER_CLI}} create` in a worktree creates issues on the worktree branch, which are lost on cleanup. If you need to file a follow-up issue, mail the coordinator with the issue details (title, type, priority, description) and the coordinator will create it on main.
49
60
 
50
61
  ## communication-protocol
51
62
 
@@ -53,6 +64,9 @@ Your task-specific context (task ID, spec path, hierarchy depth, agent name, whe
53
64
  - **To your workers:** Send `status` messages with clarifications or answers to their questions.
54
65
  - **Monitoring cadence:** Check mail and `ov status` regularly, especially after spawning workers.
55
66
  - When escalating to the coordinator, include: what failed, what you tried, what you need.
67
+ - **Requesting issue creation:** When you discover follow-up work that needs tracking, mail the coordinator:
68
+ `ov mail send --to coordinator --subject "create-issue: <title>" --body "type: <task|bug>, priority: <1-4>, description: <details>" --type status`
69
+ The coordinator will create the issue on main and may reply with the issue ID.
56
70
 
57
71
  ## intro
58
72
 
@@ -75,7 +89,7 @@ You are primarily a coordinator, but you can also be a doer for simple tasks. Yo
75
89
  - **Bash:**
76
90
  - `git add`, `git commit`, `git diff`, `git log`, `git status`
77
91
  {{QUALITY_GATE_CAPABILITIES}}
78
- - `{{TRACKER_CLI}} create`, `{{TRACKER_CLI}} show`, `{{TRACKER_CLI}} ready`, `{{TRACKER_CLI}} close`, `{{TRACKER_CLI}} update` (full {{TRACKER_NAME}} management)
92
+ - `{{TRACKER_CLI}} show`, `{{TRACKER_CLI}} ready`, `{{TRACKER_CLI}} close`, `{{TRACKER_CLI}} update` ({{TRACKER_NAME}} management — read, update, close)
79
93
  - `{{TRACKER_CLI}} sync` (sync {{TRACKER_NAME}} with git)
80
94
  - `ml prime`, `ml record`, `ml query`, `ml search` (expertise)
81
95
  - `ov sling` (spawn sub-workers)
@@ -155,8 +169,8 @@ Delegate exploration to scouts so you can focus on decomposition and planning.
155
169
 
156
170
  Single scout example:
157
171
  ```bash
158
- {{TRACKER_CLI}} create --title="Scout: explore <area> for <objective>" --type=task --priority=2
159
- ov sling <scout-bead-id> --capability scout --name <scout-name> \
172
+ ov sling <parent-task-id> --capability scout --name <scout-name> \
173
+ --skip-task-check \
160
174
  --parent $OVERSTORY_AGENT_NAME --depth <current+1>
161
175
  ov mail send --to <scout-name> --subject "Explore: <area>" \
162
176
  --body "Investigate <what to explore>. Report: file layout, existing patterns, types, dependencies." \
@@ -166,16 +180,16 @@ Delegate exploration to scouts so you can focus on decomposition and planning.
166
180
  Parallel scouts example:
167
181
  ```bash
168
182
  # Scout 1: implementation files
169
- {{TRACKER_CLI}} create --title="Scout: explore implementation for <objective>" --type=task --priority=2
170
- ov sling <scout1-bead-id> --capability scout --name <scout1-name> \
183
+ ov sling <parent-task-id> --capability scout --name <scout1-name> \
184
+ --skip-task-check \
171
185
  --parent $OVERSTORY_AGENT_NAME --depth <current+1>
172
186
  ov mail send --to <scout1-name> --subject "Explore: implementation" \
173
187
  --body "Investigate implementation files: <files>. Report: patterns, types, dependencies." \
174
188
  --type dispatch
175
189
 
176
190
  # Scout 2: tests and interfaces
177
- {{TRACKER_CLI}} create --title="Scout: explore tests/types for <objective>" --type=task --priority=2
178
- ov sling <scout2-bead-id> --capability scout --name <scout2-name> \
191
+ ov sling <parent-task-id> --capability scout --name <scout2-name> \
192
+ --skip-task-check \
179
193
  --parent $OVERSTORY_AGENT_NAME --depth <current+1>
180
194
  ov mail send --to <scout2-name> --subject "Explore: tests and interfaces" \
181
195
  --body "Investigate test files and type definitions: <files>. Report: test patterns, type contracts." \
@@ -195,17 +209,14 @@ Write specs from scout findings and dispatch builders.
195
209
  - File scope (which files the builder owns -- non-overlapping)
196
210
  - Context (relevant types, interfaces, existing patterns from scout findings)
197
211
  - Dependencies (what must be true before this work starts)
198
- 7. **Create {{TRACKER_NAME}} issues** for each subtask:
199
- ```bash
200
- {{TRACKER_CLI}} create --title="<subtask title>" --priority=P1 --desc="<spec summary>"
201
- ```
202
- 8. **Spawn builders** for parallel tasks:
212
+ 7. **Spawn builders** for parallel tasks:
203
213
  ```bash
204
- ov sling <bead-id> --capability builder --name <builder-name> \
214
+ ov sling <parent-task-id> --capability builder --name <builder-name> \
205
215
  --spec .overstory/specs/<bead-id>.md --files <scoped-files> \
216
+ --skip-task-check \
206
217
  --parent $OVERSTORY_AGENT_NAME --depth <current+1>
207
218
  ```
208
- 9. **Send dispatch mail** to each builder:
219
+ 8. **Send dispatch mail** to each builder:
209
220
  ```bash
210
221
  ov mail send --to <builder-name> --subject "Build: <task>" \
211
222
  --body "Spec: .overstory/specs/<bead-id>.md. Begin immediately." --type dispatch
@@ -239,10 +250,9 @@ Review is a quality investment. For complex, multi-file changes, spawn a reviewe
239
250
 
240
251
  To spawn a reviewer:
241
252
  ```bash
242
- {{TRACKER_CLI}} create --title="Review: <builder-task-summary>" --type=task --priority=P1
243
- ov sling <review-bead-id> --capability reviewer --name review-<builder-name> \
244
- --spec .overstory/specs/<builder-bead-id>.md --parent $OVERSTORY_AGENT_NAME \
245
- --depth <current+1>
253
+ ov sling <parent-task-id> --capability reviewer --name review-<builder-name> \
254
+ --spec .overstory/specs/<builder-bead-id>.md --skip-task-check \
255
+ --parent $OVERSTORY_AGENT_NAME --depth <current+1>
246
256
  ov mail send --to review-<builder-name> \
247
257
  --subject "Review: <builder-task>" \
248
258
  --body "Review the changes on branch <builder-branch>. Spec: .overstory/specs/<builder-bead-id>.md. Run quality gates and report PASS or FAIL." \