@mu-crew/mu 3.1.0 → 3.2.1

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 (43) hide show
  1. package/AGENTS.md +203 -588
  2. package/README.md +80 -308
  3. package/dist/cli.js +6106 -4716
  4. package/dist/cli.js.map +1 -1
  5. package/dist/extension/mu-pi.js +786 -0
  6. package/dist/extension/mu-pi.js.map +1 -0
  7. package/dist/index.d.ts +738 -536
  8. package/dist/index.js +6617 -5785
  9. package/dist/index.js.map +1 -1
  10. package/docs/ARCHITECTURE.md +178 -1008
  11. package/docs/ROADMAP.md +88 -169
  12. package/docs/VISION.md +206 -407
  13. package/docs/VOCABULARY.md +202 -455
  14. package/docs/architecture/control-socket.md +119 -0
  15. package/docs/architecture/dag.md +113 -0
  16. package/docs/architecture/mux.md +163 -0
  17. package/docs/architecture/ops-log.md +140 -0
  18. package/docs/architecture/sdk.md +185 -0
  19. package/docs/architecture/sync.md +129 -0
  20. package/docs/architecture/tui.md +146 -0
  21. package/docs/guide/README.md +25 -0
  22. package/docs/guide/backends.md +61 -0
  23. package/docs/guide/cleanup.md +74 -0
  24. package/docs/guide/delegate.md +87 -0
  25. package/docs/guide/dispatch.md +137 -0
  26. package/docs/guide/getting-started.md +177 -0
  27. package/docs/guide/recovery.md +133 -0
  28. package/docs/guide/remote.md +74 -0
  29. package/docs/guide/sql.md +76 -0
  30. package/docs/guide/stop-a-worker.md +64 -0
  31. package/docs/guide/sync.md +78 -0
  32. package/docs/guide/tui.md +98 -0
  33. package/docs/guide/upgrade.md +76 -0
  34. package/docs/history/CHANGELOG-pre-3.md +4866 -0
  35. package/docs/reference/env.md +87 -0
  36. package/docs/reference/naming.md +82 -0
  37. package/docs/specs/2026-09-28-agent-state-from-murmur.md +1 -1
  38. package/docs/specs/2026-09-29-task-substates.md +1 -1
  39. package/package.json +4 -4
  40. package/skills/mu/REMOTE_WORKERS.md +186 -491
  41. package/skills/mu/SKILL.md +142 -217
  42. package/docs/HANDOVER.md +0 -486
  43. package/docs/USAGE_GUIDE.md +0 -2637
package/docs/VISION.md CHANGED
@@ -1,18 +1,14 @@
1
1
  # VISION: A persistent crew of agents
2
2
 
3
- > Terminology used in this doc is canonical. See
4
- > [VOCABULARY.md](VOCABULARY.md) for definitions of *workstream*,
5
- > *agent*, *task DAG*, *crew*, *track*, *claim*, *free*, *workspace*,
6
- > and the rest.
3
+ Terms are defined in [VOCABULARY.md](VOCABULARY.md).
7
4
 
8
- ## What This Is
5
+ ## What mu is
9
6
 
10
- mu is a small, durable **control plane** for a persistent crew of AI
11
- agents in multiplexer panes. Agents have names, roles, and status; they live
12
- across sessions; they work on a built-in task graph with VCS
13
- workspace isolation; humans and other agents drive them through one
14
- CLI. State lives in one SQLite file; every mu feature is a typed verb
15
- over that state or a reconciled view of reality.
7
+ mu is a small, durable control plane for a persistent crew of AI agents
8
+ in multiplexer panes. Agents have names and roles, outlive sessions, and
9
+ work on a built-in task graph, each in its own VCS workspace. Humans and
10
+ agents drive them through one CLI. State lives in one SQLite file. Every
11
+ feature is a typed verb over that state or a reconciled view of reality.
16
12
 
17
13
  ```bash
18
14
  mu agent spawn worker-1 --tab Backend --workspace
@@ -24,228 +20,178 @@ mu state # canonical state card
24
20
  mu log --tail # subscribe to every state change
25
21
  ```
26
22
 
27
- That's the whole product. Everything else makes those few lines work,
28
- recover from failure, and scale to dozens of agents and hundreds of
29
- tasks.
23
+ Everything else makes those lines recover from failure and scale to
24
+ dozens of agents and hundreds of tasks.
30
25
 
31
- ---
32
-
33
- ## Why It Exists
26
+ ## Why it exists
34
27
 
35
28
  Existing tools force a choice:
36
29
 
37
- - **Pi-subagents** is great for one-shot focused delegation but the
38
- children it spawns are short-lived, pi-only, and not driveable from
39
- outside their parent pi session.
40
- - **Tmux-orchestration tools** spawn agents in panes but leave
30
+ - **Hidden subagents** (pi-subagents, the Claude Code and Codex task
31
+ tools) hand one-shot work to a child you cannot see, steer, or keep
32
+ talking to. Its transcript collapses into a result.
33
+ - **tmux orchestration tools** spawn agents in panes but leave
41
34
  coordination to chat transcripts or filesystem conventions.
42
- - **Task trackers** (GitHub Issues, Linear, even tg) model the work but
43
- don't run the agents.
44
- - **Bigger orchestration platforms** carry the coordination state but
45
- have accumulated breadth that costs more in maintenance than it
46
- pays for. See
47
- [§ What looking at a prior multi-agent runtime taught us](#what-looking-at-a-prior-multi-agent-runtime-taught-us).
35
+ - **Task trackers** (GitHub Issues, Linear) model the work but do not
36
+ run the agents.
37
+ - **Large orchestration platforms** hold the coordination state but
38
+ carry breadth that costs more to maintain than it returns. See
39
+ [What a prior runtime taught us](#what-a-prior-runtime-taught-us).
48
40
 
49
- mu unifies the first three without becoming the fourth: persistent
50
- pi agents, a structured work graph, per-agent VCS isolation, one
51
- CLI, one SQLite file. "What should this agent do next?" becomes:
41
+ mu joins the first three without becoming the fourth.
52
42
 
53
- ```bash
54
- mu task next # top ready task by ROI
55
- mu state # full picture as a JSON state card
56
- ```
43
+ ## Design principles
57
44
 
58
- ---
45
+ ### 1. The CLI is the product
59
46
 
60
- ## Design Principles
47
+ Everything mu does works from a shell with no pi extension loaded. A
48
+ feature that needs the extension does not ship. The pi extension
49
+ (`mu link pi`) serves the control socket and the `mu_delegate` tool, and
50
+ three rules keep it thin:
61
51
 
62
- ### 1. The CLI is the product
52
+ 1. **The DB is canonical.** The extension reads and writes through the
53
+ same modules as the CLI. It keeps no state of its own.
54
+ 2. **Every operation works from the CLI.** No extension tool has logic
55
+ the CLI lacks.
56
+ 3. **The skill teaches the CLI.** A pi session without the extension
57
+ still gets a working mu from [skills/mu/SKILL.md](../skills/mu/SKILL.md).
63
58
 
64
- The pi extension is a UX skin. Everything mu does must work from a
65
- shell with no pi anywhere. A feature that requires the extension
66
- doesn't ship.
59
+ Delegation is CLI: `mu agent spawn -w scratch`, `mu agent send`, and
60
+ `mu agent wait --json`. `mu_delegate` only adds the callback that puts
61
+ the answer into the parent conversation.
67
62
 
68
63
  ### 2. One DB is canonical
69
64
 
70
- All state lives in `~/.local/state/mu/mu.db`. SQLite WAL; multiple
71
- processes share it safely. The DB is the source of truth; in-memory
72
- state is a cache. The extension and the CLI go through the same DB,
73
- so they never diverge.
65
+ All state lives in `~/.local/state/mu/mu.db` (SQLite WAL, safe for
66
+ concurrent processes). In-memory state is a cache. The extension and the
67
+ CLI share the DB, so they cannot diverge.
74
68
 
75
69
  ### 2b. One log records every change
76
70
 
77
- There is exactly **one** record of change: the `ops` table, written by
78
- SQLite triggers inside the same transaction as the mutation they
79
- record. Same file, same transaction — so capture cannot be forgotten
80
- and cannot drift from the data, even on power loss.
81
-
82
- **Sync, undo, rebuild, and history are all queries or replays over
83
- that one log.**
71
+ The `ops` table is the only change record. SQLite triggers write it in
72
+ the same transaction as the mutation, so capture cannot be forgotten or
73
+ drift from the data. Sync, undo, rebuild, and history are queries or
74
+ replays over that log.
84
75
 
85
- The tables stay canonical for **reads** — this is not an event-sourced
86
- system that replays to answer a query. Ops are the durable change
87
- record; the tables are the materialized view; triggers keep them in
88
- lockstep. `mu doctor` rebuilds into a temp DB and diffs, so the
89
- lockstep is verified rather than assumed.
90
-
91
- The cost: a capture bug is not "sync is broken", it is "undo and
92
- rebuild are also broken". The drift check is load-bearing.
76
+ Reads still go to the tables. mu is not event-sourced: the tables are
77
+ the materialized view and triggers keep them in step with the ops.
78
+ `mu doctor` rebuilds into a temp DB and diffs, so that is verified, not
79
+ assumed. A capture bug therefore breaks sync, undo, and rebuild at once,
80
+ which is why the drift check is load-bearing.
93
81
 
94
82
  ### 2c. Local-first, transport-agnostic
95
83
 
96
- Every machine keeps its own complete DB. Machines exchange
97
- append-only JSONL **segments** — one per machine, single-writer, so no
98
- file is ever contended and any file-mover (Syncthing, rsync, scp,
99
- git, a USB stick) is adequate transport. mu reads and writes files;
100
- **the user owns transport**. mu has no network code, no daemon, and
101
- no membership config — peers are discovered from the segment files
102
- present.
84
+ Every machine keeps a complete DB. Machines exchange append-only JSONL
85
+ segments, one per machine with a single writer, so no file is contended
86
+ and any file mover works (Syncthing, rsync, scp, git, a USB stick). mu
87
+ reads and writes files. The user owns transport. mu has no network
88
+ code, no daemon, and no membership config: peers are found from the
89
+ segment files present.
103
90
 
104
91
  ### 3. Reality wins reconciliation
105
92
 
106
- `mu agent list` queries the mux, prunes ghosts, surfaces orphans. The DB
107
- records what we last observed, not what we wish were true. If
108
- worker-1's pane crashed, the next `mu agent list` notices.
93
+ `mu agent list` queries the mux, prunes ghosts, and surfaces orphans.
94
+ The DB records what mu last observed.
109
95
 
110
96
  ### 4. Agents are dumb workers; the task graph is the brain
111
97
 
112
- The **task DAG is the central organizing primitive**, not a sidecar
113
- feature. Tasks have mandatory `impact` and `effort_days`; edges are
114
- `blocks` relationships; `ready`/`blocked`/`goals` are SQL views; the
115
- parallel-track detector runs union-find with automatic diamond-merge
116
- so two agents never collide on a shared dependency.
98
+ The task DAG is the center of mu, not a sidecar. Tasks require `impact`
99
+ and `effort_days`. Edges are `blocks` relations. `ready`, `blocked`, and
100
+ `goals` are SQL views. The parallel-track detector runs union-find and
101
+ merges diamonds, so two agents never collide on a shared dependency.
117
102
 
118
- "What should this agent do next?" and "can we parallelize?" are
119
- deterministic queries against the graph, not LLM judgment calls. The
120
- LLM decides *what to type to the agent*; the graph decides *which
121
- agent gets which task*.
103
+ "What next?" and "can we parallelize?" are deterministic queries. The
104
+ LLM decides what to type to an agent. The graph decides which agent gets
105
+ which task.
122
106
 
123
107
  ### 5. One workstream per mux session
124
108
 
125
- A mu workstream is a **mux session** — a tmux session on the tmux
126
- backend, a herdr workspace on the herdr backend. All its agents are
127
- panes/windows inside that session. `tmux a -t mu-<workstream>` shows
128
- the whole crew live. Multiple workstreams on one machine are multiple
129
- isolated mux sessions, partitioned in the DB by `session_id`. Detach
130
- and reattach as you would any tmux session — the crew survives.
131
-
132
- The multiplexer is a **backend**, chosen by detection
133
- (`MU_MUX` → `HERDR_ENV` → `$TMUX` → `PATH`), the same shape as the
134
- VCS backend. Everything backend-specific — topology, the send
135
- protocol, scrollback capture, pane-id validation, identity fallback —
136
- lives behind `MuxBackend` in `src/mux/`. Two implementations, not an
137
- anticipatory abstraction: a third earns its way in on its own
138
- friction evidence.
109
+ A workstream is a mux session: a tmux session on tmux, a herdr workspace
110
+ on herdr. Its agents are panes in that session, so
111
+ `tmux a -t mu-<workstream>` shows the whole crew. Workstreams on one
112
+ machine are separate sessions, partitioned in the DB by `session_id`.
113
+ The crew survives detach and reattach.
114
+
115
+ The multiplexer is a backend chosen by detection
116
+ (`MU_MUX` → `HERDR_ENV` → `$TMUX` → `PATH`), like the VCS backend.
117
+ Topology, the paste protocol, scrollback capture, pane-id validation,
118
+ and identity fallback live behind `MuxBackend` in `src/mux/`. There are
119
+ two implementations. A third needs its own friction evidence.
139
120
 
140
121
  ### 6. Pi-first, with reported agent state
141
122
 
142
- mu does not infer agent state from pane text. The herdr backend reports
143
- state through the mux. On tmux, murmur's pi extension reports state from
144
- inside the agent process; without murmur, state is `unknown` with a reason.
123
+ mu never infers agent state from pane text. Each state source reports it:
145
124
 
146
- `--cli` and `MU_<UPPER_CLI>_COMMAND` stay useful for swapping the pi
147
- binary: set `MU_PI_COMMAND=<name>` once and every spawn picks it up.
148
- Multi-word commands work: `MU_PI_COMMAND="pi-alt --some-flag"`.
125
+ | Agent | Send, abort, wait | State |
126
+ | --- | --- | --- |
127
+ | pi (any backend, local or remote over `ssh -L`) | control socket, exact | control socket |
128
+ | other CLI on herdr | mux | herdr |
129
+ | other CLI on tmux | mux (bracketed paste) | murmur |
149
130
 
150
- Multi-CLI support (claude / codex with real detection) is not
151
- planned. The substrate is ready if it earns promotion per the
152
- [ROADMAP](ROADMAP.md) criteria: spawn accepts arbitrary commands and
153
- the schema's `cli` column is TEXT.
131
+ With no source, state is `unknown` with a reason. A pi agent whose
132
+ socket does not answer fails loudly; mu never falls back to pasting.
133
+ murmur is optional for pi agents.
134
+
135
+ `MU_PI_COMMAND="pi-alt --some-flag"` swaps the pi command for every
136
+ spawn. First-class support for other CLIs is not planned. It can earn promotion
137
+ under the [ROADMAP](ROADMAP.md) criteria: spawn accepts any command and
138
+ `agents.cli` is TEXT.
154
139
 
155
140
  ### 7. TypeScript on Node
156
141
 
157
- Mu is TypeScript on Node, with a small set of well-established
158
- npm deps (`commander`, `better-sqlite3`, `cli-table3`, `picocolors`,
159
- `execa`). No native code we maintain, no build matrix. Anyone
160
- reading `package.json` should recognize every name.
161
-
162
- The choice earns its keep on four axes:
163
-
164
- - **The type system pays.** The `AgentNotFoundError` /
165
- `TaskNotFoundError` / `TaskNotInWorkstreamError` / `CycleError`
166
- hierarchy maps to exit codes via `handle()`; the
167
- `assertXInWorkstream` family stays type-safe across every
168
- namespace; `noUncheckedIndexedAccess` has caught real bugs. Go
169
- loses the discriminated unions, Python's checker is too weak,
170
- Rust costs 2–3× the LOC.
171
- - **JSON-first surface fits TS.** Every read verb's `--json` output
172
- is `JSON.stringify(value)` straight from a typed shape.
173
- - **`better-sqlite3` fits the shape.** Synchronous
174
- request/response matches the CLI invocation model; WAL correct out
175
- of the box; `db.transaction()` is the right shape.
176
- - **Iteration speed.** ~60 typed verbs / 10 tables / ~2900 tests
177
- (`npm run test`) in ~95k LOC src+tests (`wc -l` over `src/` and
178
- `test/`), with multiple substantive changes per day. That cadence
179
- in an equivalent Rust codebase would be 2–3× slower.
180
-
181
- **Where it's weak: cold start.** Node's V8 init is ~30–50ms even
182
- after tsup bundles (Rust ~5ms, Go ~10–15ms). That would matter if
183
- mu were called in tight loops, but the docs steer operators away
184
- from polling toward `mu log --tail`. If that stops being true, Rust
185
- is the natural port target.
186
-
187
- **Native dep:** `better-sqlite3` requires prebuilds or a C++
188
- toolchain. Prebuilds cover darwin-arm64/x64, linux-x64/arm64,
189
- win32-x64 — every dev workstation we care about. Acceptable.
190
-
191
- ### 8. Schema-first; typed verbs over read views; SQL as escape hatch
192
-
193
- The product surface is:
194
-
195
- - **Read views** (the `ready` / `blocked` / `goals` SQL views; `mu
196
- state` as the curated state card) for inspection.
197
- - **Typed verbs** that map cleanly to resource transitions for action
198
- (`task add`, `task claim`, `task close`, `agent spawn --workspace`,
199
- `workstream init`, `workstream destroy`, ...).
200
- - **`--json` on every read verb** so scripts pipe through `jq`
201
- instead of parsing tables.
202
- - **`mu sql`** as the explicit escape hatch underneath.
203
-
204
- There is no DSL, no plugin system, no workflow engine, no
205
- `defineOperation` registry generating verbs from declarations. The
206
- commander wiring in `src/cli.ts` is the single source of truth for
207
- the verb surface. Adding a new verb is one SDK function plus one
208
- commander block.
142
+ mu uses a few well-known npm dependencies (`commander`,
143
+ `better-sqlite3`, `cli-table3`, `picocolors`, `execa`, and `ink` for the
144
+ TUI). There is no native code to maintain and no build matrix.
145
+
146
+ - **Types pay.** The typed error classes map to exit codes in
147
+ `handle()`. The `assertXInWorkstream` family stays type-safe across
148
+ namespaces. `noUncheckedIndexedAccess` has caught real bugs.
149
+ - **`better-sqlite3` fits.** Synchronous calls match a short-lived CLI,
150
+ and `db.transaction()` is the right shape.
151
+ - **Iteration is fast.** Several substantive changes a day land in
152
+ about 99k lines of `src/` and `test/`.
153
+
154
+ The weak spot is cold start: Node takes 30–50 ms to boot, which matters
155
+ only in tight loops. If that changes, Rust is the port target.
156
+ `better-sqlite3` needs prebuilds (darwin-arm64/x64, linux-x64/arm64,
157
+ win32-x64) or a C++ toolchain.
158
+
159
+ ### 8. Schema-first: typed verbs over read views, SQL as escape hatch
160
+
161
+ - **Read views**: the `ready`, `blocked`, and `goals` views, and
162
+ `mu state` as the state card.
163
+ - **Typed verbs** that map to resource transitions (`task claim`,
164
+ `task close`, `agent spawn --workspace`, `workstream destroy`).
165
+ - **`--json` on every read verb**, so scripts use `jq`, not table parsing.
166
+ - **`mu sql`** underneath, as the explicit escape hatch.
167
+
168
+ There is no DSL, no plugin system, no workflow engine, and no verb
169
+ registry. The commander wiring in `src/cli.ts` is the verb surface. A new
170
+ verb is one SDK function plus one commander block.
209
171
 
210
172
  ### 9. Observed vs claimed
211
173
 
212
- When a verb mutates state, the audit trail records what the caller
213
- said it relied on. `mu task close design --evidence "tests pass:
214
- npm test exit 0"` lands in the ops log as
215
- `task status design (IN_PROGRESS → CLOSED) evidence="..."`. The verb
216
- still trusts the caller — mu doesn't run tests for you — but the
217
- grounding for every state change is searchable via `mu log`.
174
+ A mutating verb records what the caller said it relied on.
175
+ `mu task close design --evidence "npm test exit 0"` lands in the ops log
176
+ with the evidence. mu does not run the tests, but `mu log` can search
177
+ the grounding for every change.
218
178
 
219
179
  ### 10. Get out of the model's way
220
180
 
221
- Mu coordinates agents; it does not reason about them. Specifically,
222
- mu does not own:
223
-
224
- - **Model selection.** No tier abstraction, no provider matrix, no
225
- vendor-name mapping. Pi already speaks `--model sonnet:high` and
226
- `--provider openai`. Inventing tier names would mean owning a
227
- vendor matrix that goes stale every quarter.
228
- - **Effort / thinking levels.** Pi has
229
- `--thinking off|minimal|low|medium|high|xhigh`. Mu doesn't wrap
230
- it, doesn't normalise it, doesn't second-guess it. Pass-through
231
- via `--command` or the `MU_<UPPER_CLI>_COMMAND` env var, full stop.
232
- - **Prompt engineering.** Mu has no system-prompt templating, no
233
- role injection beyond the agent name and `--role`, no "agent
234
- template" registry. The system prompt is whatever you put in the
235
- spawn command and the first message you send.
236
- - **Tool routing decisions.** Pi (and any other CLI you spawn) owns
237
- tool allowlists, MCP servers, extensions. Mu doesn't proxy or
238
- inspect them.
239
- - **Output interpretation.** Mu does not parse pane contents for agent
240
- state, facts, claims, or tool calls. murmur or herdr reports runtime
241
- agent state.
242
- The `--evidence` payload is whatever the agent says it is; mu
243
- records it without interpretation.
244
-
245
- The full mechanism is one function: `--cli <key>` uppercases the
246
- key and looks up `$MU_<KEY>_COMMAND`. That's mu's entire vendor
247
- surface. The operator pattern when you want different models per
248
- role is just convention on top:
181
+ mu coordinates agents and does not reason about them. It does not own:
182
+
183
+ - **Model selection or thinking levels.** No tiers, no provider matrix.
184
+ pi already takes `--model` and `--thinking`. Pass them through the
185
+ spawn command.
186
+ - **Prompts.** No system-prompt templates and no role registry. The
187
+ prompt is the spawn command plus the first message.
188
+ - **Tool routing.** The agent CLI owns tool allowlists, MCP servers, and
189
+ extensions.
190
+ - **Output interpretation.** mu does not parse panes for state, facts,
191
+ or tool calls. `--evidence` is recorded as given.
192
+
193
+ The whole vendor surface is one lookup: `--cli <key>` reads
194
+ `$MU_<KEY>_COMMAND`. Per-role models are a convention in your shell rc:
249
195
 
250
196
  ```bash
251
197
  export MU_PI_MINI_COMMAND="pi --model haiku:off" # → --cli pi_mini
@@ -255,223 +201,76 @@ mu agent spawn worker-1 --cli pi_mini
255
201
  mu agent spawn reviewer-1 --cli pi_big
256
202
  ```
257
203
 
258
- Your shell rc owns the mapping. The names `pi_mini` / `pi_big` are
259
- operator convention — mu doesn't know about "tiers," it just looks
260
- up whatever env var the uppercased key produces. Swap the whole
261
- matrix in one line; per-machine, per-workstream, per project —
262
- wherever you set the env. The substrate stays small; the
263
- orchestrator stays in charge.
264
-
265
- ---
266
-
267
- ## What It Enables
268
-
269
- - **Persistent crews in one place** — Spawn worker-1/worker-2/reviewer-1
270
- once, send them work all day. `tmux a -t mu-<workstream>` shows
271
- the whole crew: each agent in its own pane, observable, detachable.
272
- - **Graph-driven coordination** — The task DAG answers "what's ready?",
273
- "what blocks what?", "what can be parallelized?" with SQL queries
274
- and union-find, not LLM guesses. Task notes accumulate durable
275
- context that outlives any single agent or session.
276
- - **Deterministic parallelization** — Diamond patterns (shared
277
- prerequisites) get merged automatically so two agents never collide
278
- on a shared dependency. The orchestrator follows the algorithm; it
279
- doesn't have to be smart enough to spot the trap.
280
- - **VCS workspace isolation** — Each agent gets its own jj workspace,
281
- sl clone, git worktree, or `cp -a` snapshot, auto-detected.
282
- `mu agent spawn --workspace` creates and mounts; `mu agent close`
283
- auto-frees. Two parallel agents in the same project never trample
284
- each other's working tree.
285
- - **Async coordination via `mu log`** — Every state-changing verb
286
- writes an op. Subscribers `mu log --tail` instead of polling.
287
- Wakeups without a daemon.
288
- - **Audit trail with grounding** — `--evidence` on lifecycle verbs
289
- records what the caller observed, searchable via `mu log`.
290
- - **Crash recovery** — Reconciliation prunes ghost agents; the reaper
291
- reverts their IN_PROGRESS tasks to OPEN with an explanatory note;
292
- no manual cleanup.
293
- - **Human-driveable** — Anything mu can do, you can do from a shell.
294
- Debug, recover, script, cron.
295
-
296
- ---
297
-
298
- ## What It Is NOT
299
-
300
- - **Not an orchestrator.** mu provides primitives. The orchestration
301
- *policy* (when to spawn, what to assign, when to free) is yours —
302
- expressed as bash scripts, jq pipelines over `--json` output, or
303
- driven by an LLM through the bundled skill. There is no JS DSL,
304
- no workflow engine, no `mu run script.ts`. <!-- doc-cli-drift:skip --> (See
305
- [§ What looking at a prior multi-agent runtime taught us](#what-looking-at-a-prior-multi-agent-runtime-taught-us).)
306
- - **Not a build tool.** mu doesn't compile, test, or deploy your code.
307
- It runs agents that do those things.
308
- - **Not a chat protocol.** Agents communicate through the work graph
309
- (notes, claim, status) and the **ops log** read through `mu log`.
310
- - **Not a replacement for pi-subagents.** Different problem (persistent
311
- crew vs one-shot focused delegation). Install both; they share the
312
- agent-frontmatter format.
313
- - **Not a hosted service.** Local-first SQLite. Zero ops, no accounts.
314
- Your machine is the deployment.
315
- - **Not a verifier.** The verbs trust the caller. `task close
316
- --evidence "tests pass"` records the claim; mu doesn't run the
317
- tests. Verification is the caller's job. (mu may grow optional
318
- verifying-runners later if friction surfaces; today it's an
319
- audit-trail discipline, not enforcement.)
204
+ ## What it enables
205
+
206
+ - **Visible crews.** Spawn agents once and send them work all day. Each
207
+ sits in a pane you can attach to.
208
+ - **Isolation.** Each agent gets a jj workspace, sl clone, git worktree,
209
+ or `cp -a` copy, detected automatically and freed by `mu agent close`.
210
+ - **Wakeups without a daemon.** `mu log --tail` and event-driven
211
+ `mu agent wait` replace polling.
212
+ - **Crash recovery.** The reaper reopens a dead agent's IN_PROGRESS
213
+ tasks with a note.
214
+
215
+ ## What it is not
216
+
217
+ - **Not an orchestrator.** mu provides primitives. The policy (when to
218
+ spawn, what to assign, when to free) is yours: bash, `jq` over
219
+ `--json`, or an LLM following the bundled skill. There is no workflow
220
+ engine and no `mu run script.ts`. <!-- doc-cli-drift:skip -->
221
+ - **Not a chat protocol.** Agents communicate through notes, claims, and
222
+ the ops log.
223
+ - **Not a hidden-subagent runner.** A delegate is an ordinary agent in a
224
+ visible pane: attach, steer, abort, or keep talking to it. It costs one
225
+ pane and one pi process. A hidden subagent is lighter for many tiny
226
+ calls. mu bets that visibility and steering are worth the cost. There
227
+ are no agent types: the brief is plain text.
320
228
  - **DB-undoable, not substrate-undoable.** `mu undo <group> --yes`
321
- emits inverse ops for one action and restores the rows. It does not
322
- replay killed mux panes or recreate freed workspace directories;
323
- after an undo, reconciliation reports ghosts/orphans and the caller
324
- decides what to re-spawn or adopt.
325
-
326
- ---
327
-
328
- ## Key Constraints
329
-
330
- 1. **A multiplexer is required.** The substrate is mux panes — tmux or
331
- herdr. No multiplexer, no agents. `mu doctor` reports the resolved
332
- backend and its version; verbs that touch the agent layer fail with
333
- exit 5 when none is reachable.
334
-
335
- 2. **Local-first persistence.** SQLite file at
336
- `~/.local/state/mu/mu.db`. Cross-machine state moves as
337
- append-only JSONL segments in a shared folder; you own transport.
338
-
339
- 3. **Pi-first.** `--cli pi` is the meaningful default; `--cli` accepts
340
- other strings as a key for the `MU_<UPPER_CLI>_COMMAND` env var
341
- resolver. Agent state comes from murmur on tmux and herdr on herdr;
342
- absence is `unknown` rather than an inferred value.
343
-
344
- 4. **Send is delivered, not acknowledged.** `mu agent send` gets the
345
- text into the pane and warns loudly when it cannot confirm
346
- submission, but the AGENT never acknowledges receipt.
347
- Orchestrators poll status or subscribe to
348
- `mu log --tail` for confirmation. This is by design — the
349
- alternative requires a protocol every CLI would have to speak.
350
-
351
- 5. **Recursion is opt-in.** Default `maxSubagentDepth: 0`. Children
352
- get the `mu` binary on PATH but the bundled skill says "you are
353
- not the orchestrator."
354
-
355
- 6. **Subscriptions are polling-based.** `mu log --tail` polls
356
- SQLite once per second. SQLite handles the concurrency; latency
357
- is bounded by the poll interval. Real subscription mechanisms
358
- (SQLite hooks, fs.watch) are a future ask if anyone hits the
359
- latency cliff.
360
-
361
- 7. **Every invocation is short-lived — except for two named
362
- interactive readers.** mu is a CLI: each verb starts, mutates
363
- or reads, prints, and exits. There is no daemon, no resident
364
- state outside SQLite, no background process. Two verbs are
365
- exempt, narrowly, because they are interactive *readers* rather
366
- than background workers:
367
-
368
- - `mu log --tail` — polls SQLite once per second; emits NDJSON
369
- until SIGINT or the parent closes stdin.
370
- - the TUI dashboard — rendered by `mu state --tui` explicitly or
371
- by bare `mu` when stdout is attached to a TTY, until the user
372
- quits with `q`/`Ctrl-C`. Plain `mu state` keeps the static-card
373
- behaviour; non-TTY bare `mu` prints help instead of entering Ink.
374
-
375
- Both share the same shape, and the shape is the predicate that
376
- bounds the exception:
377
-
378
- - **Interactive, not a daemon.** The process is owned by a
379
- human (or a parent script) and dies the moment that owner
380
- ends it. Nothing keeps it alive across sessions; nothing
381
- restarts it.
382
- - **Read-only against SQLite.** Neither verb writes. The TUI's
383
- act-intents (claim, close, send, ...) yank the canonical
384
- `mu <verb>` command into the clipboard and exit the
385
- dashboard; every mutation still lands through a fresh
386
- short-lived CLI invocation.
387
- - **No resources beyond stdout, stdin, and a poll timer.** No
388
- sockets, no file watches, no subscriptions to external
389
- services, no spawned subprocesses, no inter-process state
390
- beyond the SQLite reads any other CLI invocation already
391
- does.
392
- - **Human-TTY gated, with static/script fallbacks.** The TUI mode
393
- activates when `--tui` is passed to `mu state` or when bare `mu`
394
- sees `process.stdout.isTTY === true`. Default `mu state` prints
395
- the static card. Non-interactive callers (pipes, CI, `--json`, or
396
- `MU_NO_TUI=1`) never enter the TUI.
397
-
398
- This is not a precedent for any other long-lived process. The
399
- anti-feature pledges in [ROADMAP.md](ROADMAP.md) remain in force;
400
- a third member of this exception class needs its own promotion.
401
-
402
- ---
403
-
404
- ## What looking at a prior multi-agent runtime taught us
405
-
406
- A five-role council critique of a prior internal multi-agent runtime
407
- — mu's design ancestor — converged on a sharp central claim:
408
-
409
- > [The runtime] is not justified as a better general coding harness.
410
- > [The runtime] is justified only when it becomes a durable
411
- > coordination/control plane for work that outgrows a thin harness
412
- > plus manually managed tmux.
413
-
414
- And a sharper recommendation for what such a control plane should
415
- look like:
416
-
417
- > A minimal defensible core would be: durable sessions/transcripts;
418
- > agent registry; task records / task graph; workspace and checkout
419
- > ownership/leases; event log; wakeups/timers; human approvals/input;
420
- > typed control API; read-only views/state cards; recovery/orphan
421
- > detection.
422
- >
423
- > Everything else — chat, docs, IDE assist, incident-triage,
424
- > mobile-agent, end-to-end workflows, memory policy, rich
425
- > dashboards, workflow DSLs — should be optional layers that prove
426
- > they strengthen the supervision loop.
427
-
428
- Nine of the ten items in that minimal core ship in mu; almost every
429
- item the council criticised is something mu does not have.
430
-
431
- ### The council's criticisms → mu's design choices
432
-
433
- | Council critique of the prior runtime | mu's stance |
434
- | ------------------------------------------------------------- | -------------------------------------------------------------------------- |
435
- | "Sprawling product identities (TUI + web + Thrift + plugin host + workflow engine + chat + docs + memory + ...)" | One CLI, one SQLite file, no plugins, no web UI, no Thrift, no chat/docs integrations. |
436
- | "Workflow DSL is mostly liability" | Rejected outright. No `mu run`/`eval`/`repl`. <!-- doc-cli-drift:skip --> `--json` + bash + jq cover the scripting story. |
437
- | "defineOperation/verb-registry adds entropy without consumers" | Rejected. The commander wiring in `src/cli.ts` is the verb surface; one place. |
438
- | "Plugin sprawl with hidden state and lifecycle bugs" | No plugins. Adding behaviour is a typed verb in `src/cli.ts`. |
439
- | "CLI verbs as a primary model surface vs. typed mutations" | mu's verbs *are* the typed mutations. CLI is a thin wrapper over a typed SDK with idempotency, validation, exit-code-mapped errors. |
440
- | "Raw SQL as the only inspection surface is too low-level" | `mu state` is the canonical state card. `--json` everywhere. `mu sql` is the escape hatch beneath, not the cockpit. |
441
- | "Distinguish observed from claimed state" | `--evidence` on lifecycle verbs (first inch). The verb still trusts the caller; the audit trail records grounding. |
442
- | "Approval primitives belong in the core" | Not in mu: dogfood across 200+ tasks produced zero calls for them. Anti-anticipatory pruning per "no traits with zero implementors". May earn promotion when a real implementor surfaces (e.g. an unattended pi-orchestrator running mu). |
443
- | "Reads must distinguish provenance (process telemetry vs agent self-report)" | event `source` field attributes events to actor (claiming agent / decider / 'system'). |
444
- | "State must be authoritative and recoverable, not just durable" | Reconciliation runs on read paths; reaper recovers stuck IN_PROGRESS automatically. |
445
-
446
- ### What this validates
447
-
448
- 1. **The anti-feature pledges hold.** No DSL, no plugins,
449
- no daemon, no config file, no web UI. Each is a failure mode the
450
- prior runtime exhibited and mu chose not to inherit.
451
-
452
- 2. **"Pi+tmux is the benchmark" is the right comparison.** mu only
453
- earns its complexity above the threshold where coordination
454
- itself is the work — multiple agents, multiple checkouts, delayed
455
- wakeups, recovery, approvals. Below that, a thin harness with
456
- manual tmux is more transparent.
457
-
458
- 3. **Schema-first + typed verbs + state cards is the right model UX
459
- shape** — independent reasoning from operators, engineers,
460
- architects, and model-UX specialists converges on it.
461
-
462
- ### What this still flags as gaps
463
-
464
- The critique cuts mu too:
465
-
466
- - **Wakeups are polling-based.** `mu log --tail` polls every 1s.
467
- Real subscriptions (SQLite update hooks) are deferred.
468
- - **`--evidence` is grounding, not verification.** mu doesn't run the
469
- tests. A future `--verify-by` mode that runs a command and records
470
- its exit could deepen this; not built yet.
471
- - **No idempotency keys on mutations.** Most ops are idempotent by
472
- happenstance; not declared as part of the API contract.
473
- - **No dry-run on most mutations.** `workstream destroy`, `task delete`, and `undo` have it; most other mutating verbs apply immediately.
474
- - **No capability model.** The `role` field is stored on agent rows
475
- but unused. No "reviewer-1 cannot delete tasks" enforcement.
476
-
477
- Each is a known gap with a clear shape; none has earned promotion.
229
+ restores rows. It does not revive killed panes or freed workspace
230
+ directories. Reconciliation then reports ghosts and orphans.
231
+
232
+ ## Key constraints
233
+
234
+ 1. **A multiplexer is required** (tmux or herdr). `mu doctor` reports
235
+ the backend. Agent verbs exit 5 when none is reachable.
236
+ 2. **The agent never acknowledges a send.** For pi, the control socket
237
+ confirms that pi accepted the message. On the mux path, mu confirms
238
+ only that the text reached the pane and warns when it cannot confirm
239
+ submission. Use `mu agent wait` or `mu log --tail` to see the effect.
240
+ 3. **Recursion is opt-in.** `mu_delegate` is hidden in agents mu spawned
241
+ (`MU_MANAGED_AGENT`). Agents have `mu` on PATH, but the skill tells
242
+ them they are not the orchestrator.
243
+ 4. **Every invocation is short-lived, except two interactive readers.**
244
+ No daemon, no resident state outside SQLite, no background process.
245
+ The exceptions are `mu log --tail` and the TUI (`mu state --tui`, or
246
+ bare `mu` on a TTY). Both are:
247
+ - owned by a human or parent script and gone when it ends;
248
+ - read-only: TUI actions copy the `mu <verb>` command to the
249
+ clipboard and exit, so every write is a fresh CLI call;
250
+ - limited to stdin, stdout, and a poll timer: no sockets, watches, or
251
+ subprocesses;
252
+ - TTY-gated: pipes, CI, `--json`, and `MU_NO_TUI=1` never enter the
253
+ TUI, and plain `mu state` prints the static card.
254
+
255
+ The control socket is not a third exception. The pi process serves it
256
+ and it dies with that process. Any other long-lived process needs its
257
+ own promotion; the [anti-feature pledges](ROADMAP.md#anti-feature-pledges)
258
+ stand.
259
+
260
+ ## What a prior runtime taught us
261
+
262
+ A council review of mu's design ancestor, a larger internal multi-agent
263
+ runtime, found it justified only as a durable coordination control
264
+ plane. Its minimal core: sessions, an agent registry, a task graph,
265
+ workspace ownership, an event log, wakeups, human approvals, a typed
266
+ control API, read-only state cards, and orphan recovery. Everything else
267
+ (chat, workflow DSLs, memory, dashboards) had to prove its worth.
268
+
269
+ mu ships nine of the ten. Approvals are missing because 200+ dogfooded
270
+ tasks never needed them. Below the point where coordination is itself
271
+ the work, pi plus manual tmux is more transparent than mu.
272
+
273
+ Known gaps, none promoted yet: `--evidence` grounds but does not verify,
274
+ mutations have no declared idempotency keys, most mutations have no dry
275
+ run (`workstream destroy`, `task delete`, and `undo` do), and the `role`
276
+ field is stored but not enforced.