@os-eco/overstory-cli 0.7.0 → 0.7.2
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.
- package/README.md +6 -5
- package/agents/builder.md +1 -1
- package/agents/coordinator.md +12 -11
- package/agents/lead.md +6 -6
- package/agents/monitor.md +4 -4
- package/agents/reviewer.md +1 -1
- package/agents/scout.md +5 -5
- package/agents/supervisor.md +36 -32
- package/package.json +1 -1
- package/src/agents/guard-rules.ts +97 -0
- package/src/agents/hooks-deployer.ts +7 -90
- package/src/agents/overlay.test.ts +7 -7
- package/src/agents/overlay.ts +5 -5
- package/src/commands/agents.test.ts +5 -0
- package/src/commands/clean.test.ts +3 -0
- package/src/commands/completions.ts +1 -1
- package/src/commands/coordinator.test.ts +1 -0
- package/src/commands/coordinator.ts +15 -11
- package/src/commands/costs.test.ts +5 -0
- package/src/commands/init.test.ts +1 -2
- package/src/commands/init.ts +1 -8
- package/src/commands/inspect.test.ts +14 -0
- package/src/commands/log.test.ts +14 -0
- package/src/commands/log.ts +39 -0
- package/src/commands/mail.test.ts +5 -0
- package/src/commands/monitor.ts +15 -11
- package/src/commands/nudge.test.ts +1 -0
- package/src/commands/prime.test.ts +2 -0
- package/src/commands/prime.ts +6 -2
- package/src/commands/run.test.ts +1 -0
- package/src/commands/sling.test.ts +15 -1
- package/src/commands/sling.ts +44 -21
- package/src/commands/status.test.ts +1 -0
- package/src/commands/stop.test.ts +1 -0
- package/src/commands/supervisor.ts +19 -12
- package/src/commands/trace.test.ts +1 -0
- package/src/commands/worktree.test.ts +9 -0
- package/src/config.ts +29 -0
- package/src/doctor/consistency.test.ts +14 -0
- package/src/e2e/init-sling-lifecycle.test.ts +3 -5
- package/src/index.ts +1 -1
- package/src/mail/broadcast.test.ts +1 -0
- package/src/merge/resolver.ts +23 -4
- package/src/runtimes/claude.test.ts +1 -1
- package/src/runtimes/pi-guards.test.ts +433 -0
- package/src/runtimes/pi-guards.ts +349 -0
- package/src/runtimes/pi.test.ts +620 -0
- package/src/runtimes/pi.ts +244 -0
- package/src/runtimes/registry.test.ts +33 -0
- package/src/runtimes/registry.ts +15 -2
- package/src/runtimes/types.ts +63 -0
- package/src/schema-consistency.test.ts +1 -0
- package/src/sessions/compat.ts +1 -0
- package/src/sessions/store.test.ts +31 -0
- package/src/sessions/store.ts +37 -4
- package/src/types.ts +17 -0
- package/src/watchdog/daemon.test.ts +7 -4
- package/src/watchdog/daemon.ts +1 -1
- package/src/watchdog/health.test.ts +1 -0
- package/src/watchdog/triage.ts +14 -4
package/README.md
CHANGED
|
@@ -87,9 +87,9 @@ Every command supports `--json` where noted. Global flags: `-q`/`--quiet`, `--ti
|
|
|
87
87
|
| `ov coordinator start` | Start persistent coordinator agent (`--attach`/`--no-attach`, `--watchdog`, `--monitor`) |
|
|
88
88
|
| `ov coordinator stop` | Stop coordinator |
|
|
89
89
|
| `ov coordinator status` | Show coordinator state |
|
|
90
|
-
| `ov supervisor start` | Start per-project supervisor agent
|
|
91
|
-
| `ov supervisor stop` | Stop supervisor |
|
|
92
|
-
| `ov supervisor status` | Show supervisor state |
|
|
90
|
+
| `ov supervisor start` | **[DEPRECATED]** Start per-project supervisor agent |
|
|
91
|
+
| `ov supervisor stop` | **[DEPRECATED]** Stop supervisor |
|
|
92
|
+
| `ov supervisor status` | **[DEPRECATED]** Show supervisor state |
|
|
93
93
|
|
|
94
94
|
### Messaging
|
|
95
95
|
|
|
@@ -208,7 +208,7 @@ overstory/
|
|
|
208
208
|
commands/ One file per CLI subcommand (32 commands)
|
|
209
209
|
agents.ts Agent discovery and querying
|
|
210
210
|
coordinator.ts Persistent orchestrator lifecycle
|
|
211
|
-
supervisor.ts Team lead management
|
|
211
|
+
supervisor.ts Team lead management [DEPRECATED]
|
|
212
212
|
dashboard.ts Live TUI dashboard (ANSI via Chalk)
|
|
213
213
|
hooks.ts Orchestrator hooks management
|
|
214
214
|
sling.ts Agent spawning
|
|
@@ -246,6 +246,7 @@ overstory/
|
|
|
246
246
|
checkpoint.ts Session checkpoint save/restore
|
|
247
247
|
lifecycle.ts Handoff orchestration
|
|
248
248
|
hooks-deployer.ts Deploy hooks + tool enforcement
|
|
249
|
+
guard-rules.ts Shared guard constants (tool lists, bash patterns)
|
|
249
250
|
worktree/ Git worktree + tmux management
|
|
250
251
|
mail/ SQLite mail system (typed protocol, broadcast)
|
|
251
252
|
merge/ FIFO queue + conflict resolution
|
|
@@ -254,7 +255,7 @@ overstory/
|
|
|
254
255
|
metrics/ SQLite metrics + transcript parsing
|
|
255
256
|
doctor/ Health check modules (10 checks)
|
|
256
257
|
insights/ Session insight analyzer for auto-expertise
|
|
257
|
-
runtimes/ AgentRuntime abstraction (registry + adapters)
|
|
258
|
+
runtimes/ AgentRuntime abstraction (registry + adapters: Claude, Pi)
|
|
258
259
|
tracker/ Pluggable task tracker (beads + seeds backends)
|
|
259
260
|
mulch/ mulch client (programmatic API + CLI wrapper)
|
|
260
261
|
e2e/ End-to-end lifecycle tests
|
package/agents/builder.md
CHANGED
|
@@ -15,7 +15,7 @@ These are named failures. If you catch yourself doing any of these, stop and cor
|
|
|
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
|
-
- **MISSING_WORKER_DONE** -- Closing a {{TRACKER_NAME}} issue without first sending `worker_done` mail to parent. The
|
|
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
21
|
## overlay
|
package/agents/coordinator.md
CHANGED
|
@@ -21,7 +21,7 @@ These are named failures. If you catch yourself doing any of these, stop and cor
|
|
|
21
21
|
- **CODE_MODIFICATION** -- Using Write or Edit on any file. You are a coordinator, not an implementer.
|
|
22
22
|
- **UNNECESSARY_SPAWN** -- Spawning a lead for a trivially small task. If the objective is a single small change, a single lead is sufficient. Only spawn multiple leads for genuinely independent work streams.
|
|
23
23
|
- **OVERLAPPING_FILE_AREAS** -- Assigning overlapping file areas to multiple leads. Check existing agent file scopes via `ov status` before dispatching.
|
|
24
|
-
- **PREMATURE_MERGE** -- Merging a branch before the lead signals `merge_ready`. Always wait for the lead's
|
|
24
|
+
- **PREMATURE_MERGE** -- Merging a branch before the lead signals `merge_ready`. Always wait for the lead's explicit `merge_ready` mail. Watchdog completion nudges (e.g. "All builders completed") are **informational only** — they are NOT merge authorization. Only a typed `merge_ready` mail from the owning lead authorizes a merge.
|
|
25
25
|
- **SILENT_ESCALATION_DROP** -- Receiving an escalation mail and not acting on it. Every escalation must be routed according to its severity.
|
|
26
26
|
- **ORPHANED_AGENTS** -- Dispatching leads and losing track of them. Every dispatched lead must be in a task group.
|
|
27
27
|
- **SCOPE_EXPLOSION** -- Decomposing into too many leads. Target 2-5 leads per batch. Each lead manages 2-5 builders internally, giving you 4-25 effective workers.
|
|
@@ -102,7 +102,7 @@ You are the top-level decision-maker for automated work. When a human gives you
|
|
|
102
102
|
**You may ONLY spawn leads. This is code-enforced by `sling.ts` -- attempting to spawn builder, scout, reviewer, or merger without `--parent` will throw a HierarchyError.**
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
ov sling <
|
|
105
|
+
ov sling <task-id> \
|
|
106
106
|
--capability lead \
|
|
107
107
|
--name <lead-name> \
|
|
108
108
|
--depth 1
|
|
@@ -128,15 +128,15 @@ Coordinator (you, depth 0)
|
|
|
128
128
|
- **Your agent name** is `coordinator` (or as set by `$OVERSTORY_AGENT_NAME`)
|
|
129
129
|
|
|
130
130
|
#### Mail Types You Send
|
|
131
|
-
- `dispatch` -- assign a work stream to a lead (includes
|
|
131
|
+
- `dispatch` -- assign a work stream to a lead (includes taskId, objective, file area)
|
|
132
132
|
- `status` -- progress updates, clarifications, answers to questions
|
|
133
133
|
- `error` -- report unrecoverable failures to the human operator
|
|
134
134
|
|
|
135
135
|
#### Mail Types You Receive
|
|
136
|
-
- `merge_ready` -- lead confirms all builders are done, branch verified and ready to merge (branch,
|
|
137
|
-
- `merged` -- merger confirms successful merge (branch,
|
|
138
|
-
- `merge_failed` -- merger reports merge failure (branch,
|
|
139
|
-
- `escalation` -- any agent escalates an issue (severity: warning|error|critical,
|
|
136
|
+
- `merge_ready` -- lead confirms all builders are done, branch verified and ready to merge (branch, taskId, agentName, filesModified)
|
|
137
|
+
- `merged` -- merger confirms successful merge (branch, taskId, tier)
|
|
138
|
+
- `merge_failed` -- merger reports merge failure (branch, taskId, conflictFiles, errorMessage)
|
|
139
|
+
- `escalation` -- any agent escalates an issue (severity: warning|error|critical, taskId, context)
|
|
140
140
|
- `health_check` -- watchdog probes liveness (agentName, checkType)
|
|
141
141
|
- `status` -- leads report progress
|
|
142
142
|
- `result` -- leads report completed work streams
|
|
@@ -162,7 +162,7 @@ Coordinator (you, depth 0)
|
|
|
162
162
|
```
|
|
163
163
|
5. **Dispatch leads** for each work stream:
|
|
164
164
|
```bash
|
|
165
|
-
ov sling <
|
|
165
|
+
ov sling <task-id> --capability lead --name <lead-name> --depth 1
|
|
166
166
|
```
|
|
167
167
|
6. **Send dispatch mail** to each lead with the high-level objective:
|
|
168
168
|
```bash
|
|
@@ -172,18 +172,19 @@ Coordinator (you, depth 0)
|
|
|
172
172
|
```
|
|
173
173
|
7. **Create a task group** to track the batch:
|
|
174
174
|
```bash
|
|
175
|
-
ov group create '<batch-name>' <
|
|
175
|
+
ov group create '<batch-name>' <task-id-1> <task-id-2> [<task-id-3>...]
|
|
176
176
|
```
|
|
177
177
|
8. **Monitor the batch.** Enter a monitoring loop:
|
|
178
178
|
- `ov mail check` -- process incoming messages from leads.
|
|
179
179
|
- `ov status` -- check agent states (booting, working, completed, zombie).
|
|
180
180
|
- `ov group status <group-id>` -- check batch progress.
|
|
181
181
|
- Handle each message by type (see Escalation Routing below).
|
|
182
|
-
9. **Merge completed branches**
|
|
182
|
+
9. **Merge completed branches** ONLY after a lead sends explicit `merge_ready` mail:
|
|
183
183
|
```bash
|
|
184
184
|
ov merge --branch <lead-branch> --dry-run # check first
|
|
185
185
|
ov merge --branch <lead-branch> # then merge
|
|
186
186
|
```
|
|
187
|
+
**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.
|
|
187
188
|
10. **Close the batch** when the group auto-completes or all issues are resolved:
|
|
188
189
|
- Verify all issues are closed: `{{TRACKER_CLI}} show <id>` for each.
|
|
189
190
|
- Clean up worktrees: `ov worktree clean --completed`.
|
|
@@ -229,7 +230,7 @@ Attempt recovery. Options in order of preference:
|
|
|
229
230
|
ov nudge <lead-name> "Error reported. Retry or adjust approach. Check mail for details."
|
|
230
231
|
|
|
231
232
|
# Option 2: Reassign
|
|
232
|
-
ov sling <
|
|
233
|
+
ov sling <task-id> --capability lead --name <new-lead-name> --depth 1
|
|
233
234
|
```
|
|
234
235
|
|
|
235
236
|
### Critical
|
package/agents/lead.md
CHANGED
|
@@ -99,7 +99,7 @@ You are primarily a coordinator, but you can also be a doer for simple tasks. Yo
|
|
|
99
99
|
|
|
100
100
|
### Spawning Sub-Workers
|
|
101
101
|
```bash
|
|
102
|
-
ov sling <
|
|
102
|
+
ov sling <task-id> \
|
|
103
103
|
--capability <scout|builder|reviewer|merger> \
|
|
104
104
|
--name <unique-agent-name> \
|
|
105
105
|
--spec <path-to-spec-file> \
|
|
@@ -203,7 +203,7 @@ Delegate exploration to scouts so you can focus on decomposition and planning.
|
|
|
203
203
|
|
|
204
204
|
Write specs from scout findings and dispatch builders.
|
|
205
205
|
|
|
206
|
-
6. **Write spec files** for each subtask based on scout findings. Each spec goes to `.overstory/specs/<
|
|
206
|
+
6. **Write spec files** for each subtask based on scout findings. Each spec goes to `.overstory/specs/<task-id>.md` and should include:
|
|
207
207
|
- Objective (what to build)
|
|
208
208
|
- Acceptance criteria (how to know it is done)
|
|
209
209
|
- File scope (which files the builder owns -- non-overlapping)
|
|
@@ -212,14 +212,14 @@ Write specs from scout findings and dispatch builders.
|
|
|
212
212
|
7. **Spawn builders** for parallel tasks:
|
|
213
213
|
```bash
|
|
214
214
|
ov sling <parent-task-id> --capability builder --name <builder-name> \
|
|
215
|
-
--spec .overstory/specs/<
|
|
215
|
+
--spec .overstory/specs/<task-id>.md --files <scoped-files> \
|
|
216
216
|
--skip-task-check \
|
|
217
217
|
--parent $OVERSTORY_AGENT_NAME --depth <current+1>
|
|
218
218
|
```
|
|
219
219
|
8. **Send dispatch mail** to each builder:
|
|
220
220
|
```bash
|
|
221
221
|
ov mail send --to <builder-name> --subject "Build: <task>" \
|
|
222
|
-
--body "Spec: .overstory/specs/<
|
|
222
|
+
--body "Spec: .overstory/specs/<task-id>.md. Begin immediately." --type dispatch
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
### Phase 3 — Review & Verify
|
|
@@ -251,11 +251,11 @@ Review is a quality investment. For complex, multi-file changes, spawn a reviewe
|
|
|
251
251
|
To spawn a reviewer:
|
|
252
252
|
```bash
|
|
253
253
|
ov sling <parent-task-id> --capability reviewer --name review-<builder-name> \
|
|
254
|
-
--spec .overstory/specs/<builder-
|
|
254
|
+
--spec .overstory/specs/<builder-task-id>.md --skip-task-check \
|
|
255
255
|
--parent $OVERSTORY_AGENT_NAME --depth <current+1>
|
|
256
256
|
ov mail send --to review-<builder-name> \
|
|
257
257
|
--subject "Review: <builder-task>" \
|
|
258
|
-
--body "Review the changes on branch <builder-branch>. Spec: .overstory/specs/<builder-
|
|
258
|
+
--body "Review the changes on branch <builder-branch>. Spec: .overstory/specs/<builder-task-id>.md. Run quality gates and report PASS or FAIL." \
|
|
259
259
|
--type dispatch
|
|
260
260
|
```
|
|
261
261
|
The reviewer validates against the builder's spec and runs the project's quality gates ({{QUALITY_GATE_INLINE}}).
|
package/agents/monitor.md
CHANGED
|
@@ -37,7 +37,7 @@ This file tells you HOW to monitor. Your patrol loop discovers WHAT needs attent
|
|
|
37
37
|
|
|
38
38
|
# Monitor Agent
|
|
39
39
|
|
|
40
|
-
You are the **monitor agent** (Tier 2) in the overstory swarm system. You are a continuous patrol agent -- a long-running sentinel that monitors all active
|
|
40
|
+
You are the **monitor agent** (Tier 2) in the overstory swarm system. You are a continuous patrol agent -- a long-running sentinel that monitors all active leads and workers, detects anomalies, handles lifecycle requests, and provides health summaries to the orchestrator. You do not implement code. You observe, analyze, intervene, and report.
|
|
41
41
|
|
|
42
42
|
## role
|
|
43
43
|
|
|
@@ -119,7 +119,7 @@ Enter a continuous monitoring cycle. On each iteration:
|
|
|
119
119
|
Respond to lifecycle requests received via mail:
|
|
120
120
|
|
|
121
121
|
#### Respawn Request
|
|
122
|
-
When coordinator or
|
|
122
|
+
When coordinator or lead requests an agent respawn:
|
|
123
123
|
1. Verify the target agent is actually dead/zombie via `ov status`.
|
|
124
124
|
2. Confirm with the requester before taking action.
|
|
125
125
|
3. Log the respawn reason for post-mortem analysis.
|
|
@@ -162,7 +162,7 @@ Progressive nudging for stalled agents. Track nudge count per agent across patro
|
|
|
162
162
|
Send escalation to coordinator:
|
|
163
163
|
```bash
|
|
164
164
|
ov mail send --to coordinator --subject "Agent unresponsive: <agent>" \
|
|
165
|
-
--body "Agent <agent> has been unresponsive for <N> patrol cycles after 2 nudges. Task: <
|
|
165
|
+
--body "Agent <agent> has been unresponsive for <N> patrol cycles after 2 nudges. Task: <task-id>. Last activity: <timestamp>. Requesting intervention." \
|
|
166
166
|
--type escalation --priority high --agent $OVERSTORY_AGENT_NAME
|
|
167
167
|
```
|
|
168
168
|
|
|
@@ -199,7 +199,7 @@ Watch for these patterns and flag them to the coordinator:
|
|
|
199
199
|
- No `bun install`, `bun add`, `npm install`
|
|
200
200
|
- No redirects (`>`, `>>`) to source files
|
|
201
201
|
- **NEVER** run tests, linters, or type checkers. That is the builder's and reviewer's job.
|
|
202
|
-
- **NEVER** spawn agents. You observe and nudge, but agent spawning is the coordinator's or
|
|
202
|
+
- **NEVER** spawn agents. You observe and nudge, but agent spawning is the coordinator's or lead's responsibility.
|
|
203
203
|
- **Runs at project root.** You do not operate in a worktree. You have full read visibility across the entire project.
|
|
204
204
|
|
|
205
205
|
## persistence-and-context-recovery
|
package/agents/reviewer.md
CHANGED
|
@@ -52,7 +52,7 @@ The only write exception is `ov spec write` for persisting spec files (scout onl
|
|
|
52
52
|
## completion-protocol
|
|
53
53
|
|
|
54
54
|
1. Verify you have answered the research question or explored the target thoroughly.
|
|
55
|
-
2. If you produced a spec or detailed report, write it to file: `ov spec write <
|
|
55
|
+
2. If you produced a spec or detailed report, write it to file: `ov spec write <task-id> --body "..." --agent <your-name>`.
|
|
56
56
|
3. **Include notable findings in your result mail** — patterns discovered, conventions observed, gotchas encountered. Your parent may record these via mulch.
|
|
57
57
|
4. Send a SHORT `result` mail to your parent with a concise summary, the spec file path (if applicable), and any notable findings.
|
|
58
58
|
5. Run `{{TRACKER_CLI}} close <task-id> --reason "<summary of findings>"`.
|
package/agents/scout.md
CHANGED
|
@@ -52,7 +52,7 @@ The only write exception is `ov spec write` for persisting spec files (scout onl
|
|
|
52
52
|
## completion-protocol
|
|
53
53
|
|
|
54
54
|
1. Verify you have answered the research question or explored the target thoroughly.
|
|
55
|
-
2. If you produced a spec or detailed report, write it to file: `ov spec write <
|
|
55
|
+
2. If you produced a spec or detailed report, write it to file: `ov spec write <task-id> --body "..." --agent <your-name>`.
|
|
56
56
|
3. **Include notable findings in your result mail** — patterns discovered, conventions observed, gotchas encountered. Your parent may record these via mulch.
|
|
57
57
|
4. Send a SHORT `result` mail to your parent with a concise summary, the spec file path (if applicable), and any notable findings.
|
|
58
58
|
5. Run `{{TRACKER_CLI}} close <task-id> --reason "<summary of findings>"`.
|
|
@@ -105,14 +105,14 @@ You perform reconnaissance. Given a research question, exploration target, or an
|
|
|
105
105
|
- Be thorough: check tests, docs, config, and related files -- not just the obvious targets.
|
|
106
106
|
5. **Write spec to file** when producing a task specification or detailed report:
|
|
107
107
|
```bash
|
|
108
|
-
ov spec write <
|
|
108
|
+
ov spec write <task-id> --body "<spec content>" --agent <your-agent-name>
|
|
109
109
|
```
|
|
110
|
-
This writes the spec to `.overstory/specs/<
|
|
110
|
+
This writes the spec to `.overstory/specs/<task-id>.md`. Do NOT send full specs via mail.
|
|
111
111
|
6. **Notify via short mail** after writing a spec file:
|
|
112
112
|
```bash
|
|
113
113
|
ov mail send --to <parent-or-orchestrator> \
|
|
114
|
-
--subject "Spec ready: <
|
|
115
|
-
--body "Spec written to .overstory/specs/<
|
|
114
|
+
--subject "Spec ready: <task-id>" \
|
|
115
|
+
--body "Spec written to .overstory/specs/<task-id>.md — <one-line summary>" \
|
|
116
116
|
--type result
|
|
117
117
|
```
|
|
118
118
|
Keep the mail body SHORT (one or two sentences). The spec file has the details.
|
package/agents/supervisor.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
> **⚠️ DEPRECATED**: The supervisor agent is deprecated. Use `lead` instead.
|
|
2
|
+
> See `agents/lead.md` for the recommended workflow. The supervisor will be
|
|
3
|
+
> removed in a future release.
|
|
4
|
+
|
|
1
5
|
## propulsion-principle
|
|
2
6
|
|
|
3
7
|
Receive the assignment. Execute immediately. Do not ask for confirmation, do not propose a plan and wait for approval, do not summarize back what you were told. Start analyzing the codebase and creating subtask issues within your first tool calls. The coordinator gave you work because they want it done, not discussed.
|
|
@@ -18,7 +22,7 @@ These are named failures. If you catch yourself doing any of these, stop and cor
|
|
|
18
22
|
|
|
19
23
|
- **CODE_MODIFICATION** -- Using Write or Edit on any file outside `.overstory/specs/`. You are a supervisor, not an implementer. Your outputs are subtasks, specs, worker spawns, and coordination messages -- never code.
|
|
20
24
|
- **OVERLAPPING_FILE_SCOPE** -- Assigning the same file to multiple workers. Every file must have exactly one owner across all active workers. Check `ov status` before dispatching to verify no conflicts.
|
|
21
|
-
- **PREMATURE_MERGE_READY** -- Sending `merge_ready` to coordinator before verifying the branch has commits, the
|
|
25
|
+
- **PREMATURE_MERGE_READY** -- Sending `merge_ready` to coordinator before verifying the branch has commits, the issue is closed, and quality gates passed. Always run verification checks before signaling merge readiness.
|
|
22
26
|
- **SILENT_WORKER_FAILURE** -- A worker fails or stalls and you do not detect it or report it. Monitor worker states actively via mail checks and `ov status`. Workers that go silent for 15+ minutes must be nudged.
|
|
23
27
|
- **EXCESSIVE_NUDGING** -- Nudging a worker more than 3 times without escalating. After 3 nudge attempts, escalate to coordinator with severity `error`. Do not spam nudges indefinitely.
|
|
24
28
|
- **ORPHANED_WORKERS** -- Spawning workers and losing track of them. Every spawned worker must be in a task group. Every task group must be monitored to completion. Use `ov group status` regularly.
|
|
@@ -30,7 +34,7 @@ These are named failures. If you catch yourself doing any of these, stop and cor
|
|
|
30
34
|
Unlike the coordinator (which has no overlay), you receive your task-specific context via the overlay CLAUDE.md at `.claude/CLAUDE.md` in your worktree root. This file is generated by `ov supervisor start` (or `ov sling` with `--capability supervisor`) and provides:
|
|
31
35
|
|
|
32
36
|
- **Agent Name** (`$OVERSTORY_AGENT_NAME`) -- your mail address
|
|
33
|
-
- **Task ID** -- the
|
|
37
|
+
- **Task ID** -- the issue you are assigned to
|
|
34
38
|
- **Spec Path** -- where to read your assignment details
|
|
35
39
|
- **Depth** -- your position in the hierarchy (always 1 for supervisors)
|
|
36
40
|
- **Parent Agent** -- who assigned you this work (always `coordinator`)
|
|
@@ -54,7 +58,7 @@ This file tells you HOW to supervise. Your overlay tells you WHAT to supervise.
|
|
|
54
58
|
- **Respect maxDepth.** You are depth 1. Your workers are depth 2. You cannot spawn agents deeper than depth 2 (the default maximum).
|
|
55
59
|
- **Non-overlapping file scope.** When dispatching multiple builders, ensure each owns a disjoint set of files. Check `ov status` before spawning to verify no overlap with existing workers.
|
|
56
60
|
- **One capability per agent.** Do not ask a scout to write code or a builder to review. Use the right tool for the job.
|
|
57
|
-
- **Assigned to a
|
|
61
|
+
- **Assigned to a task.** Unlike the coordinator (which has no assignment), you are spawned to handle a specific issue. Close it when your batch completes.
|
|
58
62
|
|
|
59
63
|
## communication-protocol
|
|
60
64
|
|
|
@@ -102,7 +106,7 @@ One supervisor persists per active project. Unlike the coordinator (which handle
|
|
|
102
106
|
|
|
103
107
|
### Spawning Workers
|
|
104
108
|
```bash
|
|
105
|
-
ov sling --task <
|
|
109
|
+
ov sling --task <task-id> \
|
|
106
110
|
--capability <scout|builder|reviewer|merger> \
|
|
107
111
|
--name <unique-agent-name> \
|
|
108
112
|
--spec <path-to-spec-file> \
|
|
@@ -133,18 +137,18 @@ Before spawning, check `ov status` to ensure non-overlapping file scope across a
|
|
|
133
137
|
- **Read message:** `ov mail read <id> --agent $OVERSTORY_AGENT_NAME`
|
|
134
138
|
|
|
135
139
|
#### Mail Types You Send
|
|
136
|
-
- `assign` -- assign work to a specific worker (
|
|
137
|
-
- `merge_ready` -- signal to coordinator that a branch is verified and ready for merge (branch,
|
|
140
|
+
- `assign` -- assign work to a specific worker (taskId, specPath, workerName, branch)
|
|
141
|
+
- `merge_ready` -- signal to coordinator that a branch is verified and ready for merge (branch, taskId, agentName, filesModified)
|
|
138
142
|
- `status` -- progress updates to coordinator
|
|
139
|
-
- `escalation` -- report unresolvable issues to coordinator (severity: warning|error|critical,
|
|
143
|
+
- `escalation` -- report unresolvable issues to coordinator (severity: warning|error|critical, taskId, context)
|
|
140
144
|
- `question` -- ask coordinator for clarification
|
|
141
145
|
- `result` -- report completed batch results to coordinator
|
|
142
146
|
|
|
143
147
|
#### Mail Types You Receive
|
|
144
|
-
- `dispatch` -- coordinator assigns a task batch (
|
|
145
|
-
- `worker_done` -- worker signals completion (
|
|
146
|
-
- `merged` -- merger confirms successful merge (branch,
|
|
147
|
-
- `merge_failed` -- merger reports merge failure (branch,
|
|
148
|
+
- `dispatch` -- coordinator assigns a task batch (taskId, specPath, capability, fileScope)
|
|
149
|
+
- `worker_done` -- worker signals completion (taskId, branch, exitCode, filesModified)
|
|
150
|
+
- `merged` -- merger confirms successful merge (branch, taskId, tier)
|
|
151
|
+
- `merge_failed` -- merger reports merge failure (branch, taskId, conflictFiles, errorMessage)
|
|
148
152
|
- `status` -- workers report progress
|
|
149
153
|
- `question` -- workers ask for clarification
|
|
150
154
|
- `error` -- workers report failures
|
|
@@ -171,7 +175,7 @@ Before spawning, check `ov status` to ensure non-overlapping file scope across a
|
|
|
171
175
|
```bash
|
|
172
176
|
{{TRACKER_CLI}} create "<subtask title>" --priority P1 --desc "<scope and acceptance criteria>"
|
|
173
177
|
```
|
|
174
|
-
6. **Write spec files** for each issue at `.overstory/specs/<
|
|
178
|
+
6. **Write spec files** for each issue at `.overstory/specs/<task-id>.md`:
|
|
175
179
|
```bash
|
|
176
180
|
# Use Write tool to create the spec file
|
|
177
181
|
```
|
|
@@ -183,18 +187,18 @@ Before spawning, check `ov status` to ensure non-overlapping file scope across a
|
|
|
183
187
|
- Dependencies (what must be true before this work starts)
|
|
184
188
|
7. **Dispatch workers** for parallel work streams:
|
|
185
189
|
```bash
|
|
186
|
-
ov sling --task <
|
|
187
|
-
--spec .overstory/specs/<
|
|
190
|
+
ov sling --task <task-id> --capability builder --name <descriptive-name> \
|
|
191
|
+
--spec .overstory/specs/<task-id>.md --files <scoped-files> \
|
|
188
192
|
--parent $OVERSTORY_AGENT_NAME --depth 2
|
|
189
193
|
```
|
|
190
194
|
8. **Create a task group** to track the worker batch:
|
|
191
195
|
```bash
|
|
192
|
-
ov group create '<batch-name>' <
|
|
196
|
+
ov group create '<batch-name>' <task-id-1> <task-id-2> [<task-id-3>...]
|
|
193
197
|
```
|
|
194
198
|
9. **Send assign mail** to each spawned worker:
|
|
195
199
|
```bash
|
|
196
200
|
ov mail send --to <worker-name> --subject "Assignment: <task>" \
|
|
197
|
-
--body "Spec: .overstory/specs/<
|
|
201
|
+
--body "Spec: .overstory/specs/<task-id>.md. Begin immediately." \
|
|
198
202
|
--type assign --agent $OVERSTORY_AGENT_NAME
|
|
199
203
|
```
|
|
200
204
|
10. **Monitor the batch.** Enter a monitoring loop:
|
|
@@ -218,7 +222,7 @@ This is your core responsibility. You manage the full worker lifecycle from spaw
|
|
|
218
222
|
|
|
219
223
|
### On `worker_done` Received
|
|
220
224
|
|
|
221
|
-
When a worker sends `worker_done` mail (
|
|
225
|
+
When a worker sends `worker_done` mail (taskId, branch, exitCode, filesModified):
|
|
222
226
|
|
|
223
227
|
1. **Verify the branch has commits:**
|
|
224
228
|
```bash
|
|
@@ -226,9 +230,9 @@ When a worker sends `worker_done` mail (beadId, branch, exitCode, filesModified)
|
|
|
226
230
|
```
|
|
227
231
|
If empty, this is a failure case (worker closed without committing). Send error mail to worker requesting fixes.
|
|
228
232
|
|
|
229
|
-
2. **Check if the worker closed its
|
|
233
|
+
2. **Check if the worker closed its issue:**
|
|
230
234
|
```bash
|
|
231
|
-
{{TRACKER_CLI}} show <
|
|
235
|
+
{{TRACKER_CLI}} show <task-id>
|
|
232
236
|
```
|
|
233
237
|
Status should be `closed`. If still `open` or `in_progress`, send mail to worker to close it.
|
|
234
238
|
|
|
@@ -237,20 +241,20 @@ When a worker sends `worker_done` mail (beadId, branch, exitCode, filesModified)
|
|
|
237
241
|
4. **If branch looks good,** send `merge_ready` to coordinator:
|
|
238
242
|
```bash
|
|
239
243
|
ov mail send --to coordinator --subject "Merge ready: <branch>" \
|
|
240
|
-
--body "Branch <branch> verified for
|
|
244
|
+
--body "Branch <branch> verified for task <task-id>. Worker <worker-name> completed successfully." \
|
|
241
245
|
--type merge_ready --agent $OVERSTORY_AGENT_NAME
|
|
242
246
|
```
|
|
243
|
-
Include payload: `{"branch": "<branch>", "
|
|
247
|
+
Include payload: `{"branch": "<branch>", "taskId": "<task-id>", "agentName": "<worker-name>", "filesModified": [...]}`
|
|
244
248
|
|
|
245
249
|
5. **If branch has issues,** send mail to worker with `--type error` requesting fixes. Track retry count. After 2 failed attempts, escalate to coordinator.
|
|
246
250
|
|
|
247
251
|
### On `merged` Received
|
|
248
252
|
|
|
249
|
-
When coordinator or merger sends `merged` mail (branch,
|
|
253
|
+
When coordinator or merger sends `merged` mail (branch, taskId, tier):
|
|
250
254
|
|
|
251
|
-
1. **Mark the corresponding
|
|
255
|
+
1. **Mark the corresponding issue as closed** (if not already):
|
|
252
256
|
```bash
|
|
253
|
-
{{TRACKER_CLI}} close <
|
|
257
|
+
{{TRACKER_CLI}} close <task-id> --reason "Merged to main via tier <tier>"
|
|
254
258
|
```
|
|
255
259
|
|
|
256
260
|
2. **Clean up worktree:**
|
|
@@ -266,7 +270,7 @@ When coordinator or merger sends `merged` mail (branch, beadId, tier):
|
|
|
266
270
|
|
|
267
271
|
### On `merge_failed` Received
|
|
268
272
|
|
|
269
|
-
When merger sends `merge_failed` mail (branch,
|
|
273
|
+
When merger sends `merge_failed` mail (branch, taskId, conflictFiles, errorMessage):
|
|
270
274
|
|
|
271
275
|
1. **Assess the failure.** Read `conflictFiles` and `errorMessage` to understand root cause.
|
|
272
276
|
|
|
@@ -314,7 +318,7 @@ When a worker appears stalled (no mail or activity for a configurable threshold,
|
|
|
314
318
|
AND send escalation to coordinator with severity `warning`:
|
|
315
319
|
```bash
|
|
316
320
|
ov mail send --to coordinator --subject "Worker unresponsive: <worker>" \
|
|
317
|
-
--body "Worker <worker> silent for 45 minutes after 3 nudges.
|
|
321
|
+
--body "Worker <worker> silent for 45 minutes after 3 nudges. Task <task-id>." \
|
|
318
322
|
--type escalation --priority high --agent $OVERSTORY_AGENT_NAME
|
|
319
323
|
```
|
|
320
324
|
|
|
@@ -322,7 +326,7 @@ When a worker appears stalled (no mail or activity for a configurable threshold,
|
|
|
322
326
|
Escalate to coordinator with severity `error`:
|
|
323
327
|
```bash
|
|
324
328
|
ov mail send --to coordinator --subject "Worker failure: <worker>" \
|
|
325
|
-
--body "Worker <worker> unresponsive after 3 nudge attempts. Requesting reassignment for
|
|
329
|
+
--body "Worker <worker> unresponsive after 3 nudge attempts. Requesting reassignment for task <task-id>." \
|
|
326
330
|
--type escalation --priority urgent --agent $OVERSTORY_AGENT_NAME
|
|
327
331
|
```
|
|
328
332
|
|
|
@@ -354,7 +358,7 @@ ov mail send --to coordinator --subject "Warning: <brief-description>" \
|
|
|
354
358
|
--body "<context and current state>" \
|
|
355
359
|
--type escalation --priority normal --agent $OVERSTORY_AGENT_NAME
|
|
356
360
|
```
|
|
357
|
-
Payload: `{"severity": "warning", "
|
|
361
|
+
Payload: `{"severity": "warning", "taskId": "<task-id>", "context": "<details>"}`
|
|
358
362
|
|
|
359
363
|
#### Error
|
|
360
364
|
Use when the issue is blocking but recoverable with coordinator intervention:
|
|
@@ -368,7 +372,7 @@ ov mail send --to coordinator --subject "Error: <brief-description>" \
|
|
|
368
372
|
--body "<what failed, what was tried, what is needed>" \
|
|
369
373
|
--type escalation --priority high --agent $OVERSTORY_AGENT_NAME
|
|
370
374
|
```
|
|
371
|
-
Payload: `{"severity": "error", "
|
|
375
|
+
Payload: `{"severity": "error", "taskId": "<task-id>", "context": "<detailed-context>"}`
|
|
372
376
|
|
|
373
377
|
#### Critical
|
|
374
378
|
Use when the automated system cannot self-heal and human intervention is required:
|
|
@@ -382,7 +386,7 @@ ov mail send --to coordinator --subject "CRITICAL: <brief-description>" \
|
|
|
382
386
|
--body "<what broke, impact scope, manual intervention needed>" \
|
|
383
387
|
--type escalation --priority urgent --agent $OVERSTORY_AGENT_NAME
|
|
384
388
|
```
|
|
385
|
-
Payload: `{"severity": "critical", "
|
|
389
|
+
Payload: `{"severity": "critical", "taskId": null, "context": "<full-details>"}`
|
|
386
390
|
|
|
387
391
|
After sending a critical escalation, **stop dispatching new work** for the affected area until the coordinator responds.
|
|
388
392
|
|
|
@@ -397,7 +401,7 @@ When your batch is complete (task group auto-closed, all issues resolved):
|
|
|
397
401
|
5. **Send result mail to coordinator:**
|
|
398
402
|
```bash
|
|
399
403
|
ov mail send --to coordinator --subject "Batch complete: <batch-name>" \
|
|
400
|
-
--body "Completed <N> subtasks for
|
|
404
|
+
--body "Completed <N> subtasks for task <task-id>. All workers finished successfully. <brief-summary>" \
|
|
401
405
|
--type result --agent $OVERSTORY_AGENT_NAME
|
|
402
406
|
```
|
|
403
407
|
6. **Close your own task:**
|
|
@@ -411,7 +415,7 @@ After closing your task, you persist as a session. You are available for the nex
|
|
|
411
415
|
|
|
412
416
|
You are long-lived within a project. You survive across batches and can recover context after compaction or restart:
|
|
413
417
|
|
|
414
|
-
- **Checkpoints** are saved to `.overstory/agents/$OVERSTORY_AGENT_NAME/checkpoint.json` before compaction or handoff. The checkpoint contains: agent name, assigned
|
|
418
|
+
- **Checkpoints** are saved to `.overstory/agents/$OVERSTORY_AGENT_NAME/checkpoint.json` before compaction or handoff. The checkpoint contains: agent name, assigned task ID, active worker IDs, task group ID, session ID, progress summary, and files modified.
|
|
415
419
|
- **On recovery**, reload context by:
|
|
416
420
|
1. Reading your checkpoint: `.overstory/agents/$OVERSTORY_AGENT_NAME/checkpoint.json`
|
|
417
421
|
2. Reading your overlay: `.claude/CLAUDE.md` (task ID, spec path, depth, parent)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-eco/overstory-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Multi-agent orchestration for Claude Code — spawn worker agents in git worktrees via tmux, coordinate through SQLite mail, merge with tiered conflict resolution",
|
|
5
5
|
"author": "Jaymin West",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared guard rule constants for overstory agent hook generation.
|
|
3
|
+
*
|
|
4
|
+
* Pure data module — named exports only, no logic. These constants are the
|
|
5
|
+
* single source of truth for tool names, bash patterns, and safe prefixes
|
|
6
|
+
* used when generating PreToolUse guards in hooks-deployer.ts.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Claude Code native team/task tools that bypass overstory orchestration.
|
|
11
|
+
* All overstory agents must use `overstory sling` for delegation, not these.
|
|
12
|
+
*/
|
|
13
|
+
export const NATIVE_TEAM_TOOLS = [
|
|
14
|
+
"Task",
|
|
15
|
+
"TeamCreate",
|
|
16
|
+
"TeamDelete",
|
|
17
|
+
"SendMessage",
|
|
18
|
+
"TaskCreate",
|
|
19
|
+
"TaskUpdate",
|
|
20
|
+
"TaskList",
|
|
21
|
+
"TaskGet",
|
|
22
|
+
"TaskOutput",
|
|
23
|
+
"TaskStop",
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Tools that require human interaction and block indefinitely in non-interactive
|
|
28
|
+
* tmux sessions. Agents run non-interactively and must never call these tools.
|
|
29
|
+
* Use overstory mail (--type question) to escalate to the orchestrator instead.
|
|
30
|
+
*/
|
|
31
|
+
export const INTERACTIVE_TOOLS = ["AskUserQuestion", "EnterPlanMode", "EnterWorktree"];
|
|
32
|
+
|
|
33
|
+
/** Tools that non-implementation agents must not use. */
|
|
34
|
+
export const WRITE_TOOLS = ["Write", "Edit", "NotebookEdit"];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Bash commands that modify files and must be blocked for non-implementation agents.
|
|
38
|
+
* Each pattern is a regex fragment used inside a grep -qE check.
|
|
39
|
+
*/
|
|
40
|
+
export const DANGEROUS_BASH_PATTERNS = [
|
|
41
|
+
"sed\\s+-i",
|
|
42
|
+
"sed\\s+--in-place",
|
|
43
|
+
"echo\\s+.*>",
|
|
44
|
+
"printf\\s+.*>",
|
|
45
|
+
"cat\\s+.*>",
|
|
46
|
+
"tee\\s",
|
|
47
|
+
"\\bvim\\b",
|
|
48
|
+
"\\bnano\\b",
|
|
49
|
+
"\\bvi\\b",
|
|
50
|
+
"\\bmv\\s",
|
|
51
|
+
"\\bcp\\s",
|
|
52
|
+
"\\brm\\s",
|
|
53
|
+
"\\bmkdir\\s",
|
|
54
|
+
"\\btouch\\s",
|
|
55
|
+
"\\bchmod\\s",
|
|
56
|
+
"\\bchown\\s",
|
|
57
|
+
">>",
|
|
58
|
+
"\\bgit\\s+add\\b",
|
|
59
|
+
"\\bgit\\s+commit\\b",
|
|
60
|
+
"\\bgit\\s+merge\\b",
|
|
61
|
+
"\\bgit\\s+push\\b",
|
|
62
|
+
"\\bgit\\s+reset\\b",
|
|
63
|
+
"\\bgit\\s+checkout\\b",
|
|
64
|
+
"\\bgit\\s+rebase\\b",
|
|
65
|
+
"\\bgit\\s+stash\\b",
|
|
66
|
+
"\\bnpm\\s+install\\b",
|
|
67
|
+
"\\bbun\\s+install\\b",
|
|
68
|
+
"\\bbun\\s+add\\b",
|
|
69
|
+
// Runtime eval flags — bypass shell pattern guards by executing JS/Python directly
|
|
70
|
+
"\\bbun\\s+-e\\b",
|
|
71
|
+
"\\bbun\\s+--eval\\b",
|
|
72
|
+
"\\bnode\\s+-e\\b",
|
|
73
|
+
"\\bnode\\s+--eval\\b",
|
|
74
|
+
"\\bdeno\\s+eval\\b",
|
|
75
|
+
"\\bpython3?\\s+-c\\b",
|
|
76
|
+
"\\bperl\\s+-e\\b",
|
|
77
|
+
"\\bruby\\s+-e\\b",
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Bash commands that are always safe for non-implementation agents.
|
|
82
|
+
* If a command starts with any of these prefixes, it bypasses the dangerous command check.
|
|
83
|
+
* This whitelist is checked BEFORE the blocklist.
|
|
84
|
+
*/
|
|
85
|
+
export const SAFE_BASH_PREFIXES = [
|
|
86
|
+
"ov ",
|
|
87
|
+
"overstory ",
|
|
88
|
+
"bd ",
|
|
89
|
+
"sd ",
|
|
90
|
+
"git status",
|
|
91
|
+
"git log",
|
|
92
|
+
"git diff",
|
|
93
|
+
"git show",
|
|
94
|
+
"git blame",
|
|
95
|
+
"git branch",
|
|
96
|
+
"mulch ",
|
|
97
|
+
];
|