@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/README.md CHANGED
@@ -1,342 +1,114 @@
1
1
  # mu
2
2
 
3
- **A small, opinionated control plane for a crew of AI coding agents
4
- working in parallel.** Tmux panes, a typed task DAG, isolated VCS
5
- workspaces per agent, an audit log — and a dashboard for seeing what
6
- the crew is doing right now.
3
+ **A small control plane for a crew of AI coding agents working in
4
+ parallel.** Agents run in multiplexer panes you can attach to. Work is a
5
+ task DAG in SQLite. Each agent gets its own VCS workspace.
7
6
 
8
7
  ![mu dashboard](docs/img/tui-dashboard.png)
9
8
 
10
- *`mu` (no args) — read-only dashboard: agents, tracks, ready /
11
- in-progress / blocked tasks, log tail, workspaces, doctor.*
9
+ *Bare `mu` opens a read-only dashboard: agents, tracks, ready,
10
+ in-progress, and blocked tasks, the log tail, workspaces, and doctor.*
12
11
 
13
- The core loop is: plan work as a DAG, spawn a small crew, and watch
14
- handoffs happen in tmux:
12
+ - **Parallel work that does not collide.** Per-agent workspaces (jj
13
+ workspaces, sl shares, or git worktrees) and a task DAG with
14
+ `blocks` edges keep agents out of each other's way.
15
+ - **State that outlives a pane.** One SQLite DB holds agents, tasks,
16
+ owners, notes, and workspaces. An append-only ops log records every
17
+ change, so `mu undo <group>` reverses one action and `mu rebuild`
18
+ replays the whole history.
19
+ - **Exact control of pi agents.** mu's pi extension serves a control
20
+ socket inside each agent, so send, state, wait, and abort are exact,
21
+ locally and over ssh. The pane stays pi's normal TUI.
15
22
 
16
- ```bash
17
- mu workstream init auth-refactor
18
- mu task add --title "Design auth" --impact 80 --effort-days 2
19
- mu task add --title "Build auth" --impact 80 --effort-days 5 --blocked-by design_auth
20
-
21
- mu agent spawn worker-1 --workspace
22
- mu agent send worker-1 'Pick up the next ready task and design the auth module.'
23
- mu # dashboard
24
- ```
25
-
26
- Need one quick helper without the DAG? `mu agent spawn scout-1 -w
27
- scratch` gives you a low-ceremony agent you can still send/read/wait
28
- on.
29
-
30
- Nothing here is a black box. Agents are multiplexer panes you can
31
- attach to yourself, tasks live in a SQLite DAG, and workspaces are real
32
- jj workspaces / sl shares / git worktrees on disk. **mu persists state
33
- and coordinates handoffs; the model still decides what to do.**
34
-
35
- For the full copy-paste flow, see [Quick start](#quick-start).
36
-
37
- ---
38
-
39
- ## What mu is
40
-
41
- mu excels at organising large pieces of work and keeping your agents
42
- on track.
43
-
44
- - **Parallelism that doesn't trip over itself.** Per-agent VCS
45
- workspaces plus a task DAG with deterministic parallel-track
46
- detection keep agents off each other's toes.
47
- - **A durable coordination layer.** One SQLite registry records
48
- agents, tasks, ownership, notes and workspaces. A single
49
- append-only **ops log** records every change ever made to them, so
50
- panes can die and humans can come back later.
51
- - **Stay out of the model's way.** Mu coordinates handoffs; it does
52
- not choose models, providers, or thinking effort. `--cli <key>`
53
- uppercases to `$MU_<KEY>_COMMAND`, so your shell rc owns the agent
54
- command.
55
- - **Scriptable without scraping text.** Every read path that matters has
56
- `--json`, and every state change goes through a typed CLI verb; the
57
- dashboard is for humans, not the API.
58
- - **A low-ceremony escape hatch.** The reserved `scratch` workstream
59
- is there when you want one driveable helper without committing to a
60
- full task graph.
61
-
62
- ## What mu is NOT
63
-
64
- - **Not a build tool.** mu doesn't compile, test, or deploy
65
- anything.
66
- - **Not a chat protocol.** Agents communicate via the work graph
67
- and the activity log, never agent-to-agent messaging.
68
- - **Not a verifier.** `task close --evidence "tests pass"` records
69
- the claim; mu doesn't run the tests.
70
- - **Not a replacement for [pi-subagents](https://github.com/nicobailon/pi-subagents).**
71
- Mu agents are driveable panes; pi-subagents is for one-shot
72
- focused delegation. See [vs `pi-subagents`](#vs-pi-subagents).
73
- - **Not a hosted service.** Local-first SQLite.
74
- - **DB-undoable, not substrate-undoable.** Every change is captured as ops
75
- under one group, so `mu undo <group> --yes` reverses exactly that
76
- one action — not your other workstreams. Killed panes and freed
77
- workspace dirs are NOT replayed; they aren't portable state.
78
-
79
- ---
80
-
81
- ## When mu earns its overhead
82
-
83
- mu pays off when the work is bigger than one agent's context: many
84
- steps, dependencies between them, several agents, or a job that runs
85
- for days. The DAG holds the plan, so no single agent has to. Each
86
- agent claims one ready task, works in its own workspace, writes notes
87
- on the task as it goes (findings, decisions, dead ends), and closes
88
- it with evidence. Every claim, note and close is appended to the
89
- audit log. If an agent drifts, stalls, or loses its pane, the plan,
90
- the notes, and the history of who did what are still there. You, or
91
- the next agent, pick up where it stopped instead of explaining
92
- everything again.
93
-
94
- **Use mu for** — multi-phase investigations; tasks worth gating with
95
- review; parallel audit or implementation/reviewer splits with isolated
96
- workspaces; anything where "what was decided and why" needs to outlive
97
- a single agent's scrollback. Use `scratch` for the lighter adjacent
98
- case: one helper or background watcher you still want to drive and
99
- observe.
100
-
101
- **Don't use mu for** — tiny direct edits; quick local inspection;
102
- one-shot focused delegation where you only need a returned answer
103
- (use `pi-subagents`); single-context work where durable coordination
104
- adds ceremony.
105
-
106
- ---
23
+ mu persists state and coordinates handoffs. It does not choose models,
24
+ run your tests, or pass messages between agents. Every read path has
25
+ `--json`, and every change goes through a typed CLI verb.
107
26
 
108
27
  ## Install
109
28
 
110
29
  ```bash
111
- # 1. The CLI, and murmur for agent state on tmux (see below).
112
- npm install -g @mu-crew/mu @mu-crew/murmur
113
- mu --version
114
- murmur init && murmur link pi
115
-
116
- # 2. The skill (teaches your coding agent how to drive mu).
117
- npx skills add mu-crew/mu # auto-detects pi / claude-code / codex / etc.
118
- # Add -g to install globally (~/.<agent>/skills/), -y to skip prompts.
119
- ```
120
-
121
- **Requirements:**
122
- - Node 22.12–26 (see `.nvmrc`), matching `engines` in `package.json`.
123
- - A terminal multiplexer: tmux ≥ 3.0, or [herdr](https://github.com/herdrdev/herdr)
124
- (`mu doctor` reports which one is active). Spawn, send, and read work
125
- on both. Agent state comes from herdr on herdr and from murmur on tmux;
126
- the remaining herdr gaps are listed in
127
- [docs/USAGE_GUIDE.md § 20](docs/USAGE_GUIDE.md#20-multiplexer-backends-tmux-and-herdr).
128
- - pi (the agent CLI mu orchestrates)
129
- - For `--workspace`: jj, sl, or git on PATH (or `--backend none`)
130
-
131
- **Agent state on tmux needs [murmur](https://github.com/mu-crew/murmur),
132
- even on one machine.** mu owns the work; murmur reports what each agent is
133
- doing. mu does not read panes itself, so without murmur every agent's state
134
- is `unknown`, and everything built on state goes quiet: `mu agent wait`
135
- never fires, `mu task wait --stuck-after` / `--on-stall exit` never detects
136
- a worker waiting on you, and spawn skips its readiness check. Tasks, claims,
137
- `mu task wait` on status, workspaces, spawn and send still work. murmur also
138
- provides one attention-sorted list across machines and owns the ssh egress.
139
-
140
- ```bash
141
- # on every node that runs agents
142
- npm install -g @mu-crew/murmur
143
- murmur init # this node's identity
144
- murmur link pi # the agent-side extension that reports state
145
-
146
- # then, on whichever machine you watch from
147
- murmur peer add dev # an ssh target; identity is discovered
148
- murmur peer list # which hosts are reachable, and when last seen
149
- ```
150
-
151
- mu exports `MU_MANAGED_AGENT`, `MU_AGENT_NAME`, and `MU_WORKSTREAM`
152
- into every pane it spawns. murmur uses them to identify crew agents.
153
- See murmur's [stable contract](https://github.com/mu-crew/murmur/blob/main/ARCHITECTURE.md#contract).
154
-
155
- **Update:** `npm install -g @mu-crew/mu@latest` for the CLI;
156
- `npx skills update mu` for the skill.
157
-
158
- **Install from source** (hacking on mu itself):
159
-
160
- ```bash
161
- git clone https://github.com/mu-crew/mu
162
- cd mu
163
- npm install -g . # `prepare` script auto-builds; `mu` lands on $PATH
164
- npx skills add ./skills/mu # local-path source format
30
+ npm i -g @mu-crew/mu
31
+ mu link pi # pi extension (control socket, mu_delegate) + the mu skill
32
+ mu doctor
165
33
  ```
166
34
 
167
- More install patterns (alias-to-dist for fastest dev iteration) in
168
- [docs/USAGE_GUIDE.md § 1 Setup](docs/USAGE_GUIDE.md#1-setup).
169
-
170
- ---
35
+ To drive mu from another agent CLI (claude-code, codex), install the
36
+ skill with `npx skills add mu-crew/mu` instead of `mu link pi`.
171
37
 
172
- ## TUI dashboard
38
+ You need:
173
39
 
174
- Bare `mu` in a TTY launches the read-only dashboard across all
175
- workstreams; `mu state --tui -w <workstream>` is the explicit
176
- single/multi-workstream form. Non-TTY callers and scripts keep the
177
- static/help path, and `mu state --json` is the API.
40
+ - Node 22.12–26 (see `.nvmrc`).
41
+ - tmux ≥ 3.0 or [herdr](https://github.com/herdrdev/herdr). `mu doctor`
42
+ reports which one is active.
43
+ - pi, or another agent CLI.
44
+ - jj, sl, or git on `PATH` for `--workspace`.
178
45
 
179
- The dashboard has ten cards: Commits, Agents, Tracks, Ready, Activity
180
- log, Workspaces, In-progress, Blocked, Recent, and Doctor. Drill into
181
- any numbered card fullscreen with `Shift+0`-`Shift+9`; `g` opens the
182
- full DAG and `t` opens the all-tasks list. `?` shows the complete
183
- keymap. Keyboard and mouse both work: navigate with keys, double-click
184
- cards or rows to drill, and scroll popup bodies with the mouse wheel.
46
+ [murmur](https://github.com/mu-crew/murmur) is optional for pi agents.
47
+ Non-pi agents on tmux need it for state: without it their state is
48
+ `unknown`, so `mu agent wait` and stall detection never fire for them.
49
+ On herdr, herdr reports state.
185
50
 
186
- The TUI is read-only by design. `y` yanks the canonical `mu` command
187
- for the focused row to your clipboard; you run it in a shell, so every
188
- mutation still goes through a short-lived typed CLI invocation. The
189
- one exception is user-driven: `t` inside a commit/show drill suspends
190
- mu's alt-screen and hands off to `tuicr -r <sha>`, then restores the
191
- dashboard when tuicr exits.
192
-
193
- ---
51
+ To update or run from a checkout, see
52
+ [How to upgrade mu](docs/guide/upgrade.md).
194
53
 
195
54
  ## Quick start
196
55
 
197
- ```bash
198
- # Make sure you're inside a multiplexer. tmux is the common path;
199
- # herdr works too (mu picks whichever it detects).
200
- tmux
201
-
202
- # Initialize the workstream (creates mux session mu-auth-refactor)
203
- mu workstream init auth-refactor
204
-
205
- # Plan the work as a DAG. IDs auto-derive from titles.
206
- mu task add --title "Design auth module" --impact 80 --effort-days 2
207
- mu task add --title "Build auth" --impact 80 --effort-days 5 --blocked-by design_auth_module
208
- mu task add --title "Review auth" --impact 60 --effort-days 1 --blocked-by build_auth
209
-
210
- # Spawn a crew with isolated workspaces.
211
- mu agent spawn worker-1 --workspace
212
- mu agent spawn reviewer-1 --workspace --role read-only
213
-
214
- # Human home base: interactive read-only TUI across every workstream
215
- # (same dashboard is explicit with: mu state --tui -w auth-refactor).
216
- mu
217
-
218
- # Agent/script API: static state stays explicit and JSON-friendly.
219
- mu state -w auth-refactor --json
220
-
221
- # Inside an agent's pane, the agent claims and closes tasks
222
- # without ever knowing its own name (mu reads $TMUX_PANE).
223
- mu task claim design_auth_module
224
- mu task note design_auth_module "DECISION: JWT, 24h expiry, refresh via cookie"
225
- mu task close design_auth_module --evidence "design doc reviewed by reviewer-1"
226
-
227
- # Subscribe to events instead of polling.
228
- mu log --tail
229
-
230
- # Cleanup. Dry-run without --yes; writes tombstone ops rather than
231
- # erasing history, so `mu undo <group> --yes` still reverses it.
232
- mu workstream teardown --yes
233
- ```
234
-
235
- Worked end-to-end scenarios (first 5 minutes, the dispatch loop,
236
- laptop ↔ devserver, undo, drift):
237
- [USAGE_GUIDE § 0. Common scenarios](docs/USAGE_GUIDE.md#0-common-scenarios).
238
- Full tour: [docs/USAGE_GUIDE.md](docs/USAGE_GUIDE.md).
239
-
240
- ---
241
-
242
- ## Portability and handoff
243
-
244
- State lives in one SQLite DB, and every change to it is captured as an
245
- op in an append-only log — so it travels, and it merges.
246
-
247
- ### Multi-machine sync
248
-
249
- Each machine keeps its own DB. They exchange append-only JSONL
250
- segments through any folder something else keeps in step (Syncthing,
251
- rsync, a USB stick — mu never runs the transport). Setup is one env
252
- var on each machine; there is no peer list, no daemon, no import step,
253
- and concurrent edits on two machines converge.
56
+ Run this inside tmux or herdr:
254
57
 
255
58
  ```bash
256
- export MU_SYNC_DIR=$HOME/Sync/mu # same folder on every machine
257
- mu task add auth_fix -w app -t "Fix the auth redirect" -i 80 -e 2
258
- # → the next `mu` command on the other machine already sees it
259
- mu sync # peer status, if you want to check
260
- ```
261
-
262
- **Never put `MU_DB_PATH` inside `MU_SYNC_DIR`** — a live WAL database
263
- is three mutually-consistent files and a file-syncer will corrupt it.
264
- `mu doctor` fails on it. Full walkthrough:
265
- [USAGE_GUIDE § Multi-machine sync](docs/USAGE_GUIDE.md#156-multi-machine-sync).
266
-
267
- For disaster recovery, `mu rebuild <file>` replays the whole ops log
268
- into a fresh DB and prints the swap command; `mu undo <group>` reverts
269
- one past action by emitting inverse ops.
270
-
271
- For a safety copy before anything destructive, `mu db backup <file>`
272
- writes a `VACUUM INTO` copy of the whole DB. To read the graph out for
273
- review or grep, every verb takes `--json`.
274
-
275
- ### Remote workers
276
-
277
- An agent can run on another machine with no mu changes and no remote
278
- backend: the pane is local, the process is remote.
279
-
280
- ```bash
281
- ssh dev 'git -C ~/repo worktree add ~/ws/worker-1'
282
- mu agent spawn worker-1 -w big --command \
283
- 'ssh dev -t "cd ~/ws/worker-1 && pi --approve"'
284
- # ... claim and send exactly as for a local agent, then collect:
285
- git fetch "ssh://dev/~/ws/worker-1" HEAD && git cherry-pick FETCH_HEAD
59
+ mu workstream init auth
60
+ mu task add design_auth --title "Design auth" --impact 80 --effort-days 2
61
+ mu task add build_auth --title "Build auth" --impact 80 --effort-days 5 --blocked-by design_auth
62
+ mu agent spawn worker-1 --workspace
63
+ mu task claim design_auth --for worker-1
64
+ mu agent send worker-1 --fresh 'Do task design_auth. Close it with evidence.'
65
+ mu task wait design_auth --first --on-stall exit # exit 7 = worker needs you
66
+ mu # dashboard
67
+ mu workstream teardown --yes # without --yes: dry run
286
68
  ```
287
69
 
288
- Local and remote agents mix freely in one workstream. You create the
289
- remote workspace yourself (`--workspace` is local-only) and mu keeps
290
- no record of it, so read
291
- [skills/mu/REMOTE_WORKERS.md](skills/mu/REMOTE_WORKERS.md) first — it
292
- covers the traps, including the one where your own agent blocks your
293
- `git fetch` behind a misleading `Permission denied`.
70
+ For one helper, ask pi to delegate (`mu_delegate` ships with `mu link
71
+ pi`), or spawn into the reserved `scratch` workstream:
72
+ `mu agent spawn scout-1 -w scratch`.
294
73
 
295
- ---
74
+ ## mu delegates vs hidden subagents
296
75
 
297
- ## vs `pi-subagents`
76
+ Claude Code, Codex, and pi-subagents delegate to a hidden child process
77
+ and return only its result. A mu delegate is an ordinary agent in a
78
+ pane.
298
79
 
299
- | | [`pi-subagents`](https://github.com/nicobailon/pi-subagents) | `mu` |
300
- | ------------------------ | -------------------------------------------------------- | ---- |
301
- | Best for | "Send this focused task to a specialist, return a result" | "Keep a driveable agent/persistent crew in a multiplexer" |
302
- | Lifetime | one-shot per task | from off-the-cuff `scratch` helper to long-lived crew |
303
- | Substrate | `pi` subprocess + result files | tmux/herdr panes running pi sessions |
304
- | Built-in task graph | no | yes: parallel-tracks union-find with diamond-merge |
305
- | Drivable from outside pi | no (extension-only) | yes (`mu` is a real CLI) |
80
+ | | Hidden subagent | mu delegate |
81
+ | ----------------------- | ------------------------ | ----------- |
82
+ | Visibility | none while it runs | a pane; attach and watch |
83
+ | Steer mid-run | no | `mu agent send`; stop with `mu agent abort` |
84
+ | Keep talking after it answers | no | yes, with `keep: true` |
85
+ | Transcript | collapses into a result | a normal pi session log |
86
+ | If the work grows | re-brief a new agent | same task DAG and workspaces |
87
+ | Cost | light | one pane and one pi process |
306
88
 
307
- The two play well together. Use `pi-subagents` when you want one
308
- focused answer back. Use mu's reserved `scratch` workstream when you
309
- want a low-ceremony helper you can keep talking to. For coordinated
310
- multi-agent work, graduate from `scratch` to a named workstream + task
311
- DAG. See [docs/USAGE_GUIDE.md](docs/USAGE_GUIDE.md).
312
-
313
- ---
89
+ For many tiny calls, a hidden subagent is lighter. mu bets that seeing
90
+ and steering agent work is worth a pane.
314
91
 
315
92
  ## Documentation
316
93
 
317
- - **[docs/USAGE_GUIDE.md](docs/USAGE_GUIDE.md)** — practical tour
318
- of every verb. **Start here.**
319
- - **[skills/mu/SKILL.md](skills/mu/SKILL.md)** — what an LLM
320
- running inside an agent pane sees: the in-pane working loop,
321
- subscribe-vs-poll pattern.
322
- - **[skills/mu/REMOTE_WORKERS.md](skills/mu/REMOTE_WORKERS.md)** —
323
- running agents on another machine over ssh: the recipe, and the
324
- traps that cost real debugging time.
325
- - **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** — module map,
326
- reconciliation algorithm, schema seam (surrogate INTEGER PKs +
327
- the SDK boundary discipline).
328
- - **[docs/VOCABULARY.md](docs/VOCABULARY.md)** — canonical terms;
329
- source of truth for every word in code, docs, error messages.
330
- - **[docs/VISION.md](docs/VISION.md)** — the load-bearing pillars
331
- + the prior-runtime retrospective.
332
- - **[docs/ROADMAP.md](docs/ROADMAP.md)** — what's next + the
333
- anti-feature pledges + explicitly-rejected ideas.
334
- - **[CHANGELOG.md](CHANGELOG.md)** — release notes.
94
+ - [Getting started](docs/guide/getting-started.md): the first
95
+ workstream, end to end. Start here.
96
+ - [User guide](docs/guide/README.md): how-tos for dispatch, remote
97
+ workers, sync, recovery, and the dashboard.
98
+ - [skills/mu/SKILL.md](skills/mu/SKILL.md): what an orchestrating
99
+ agent reads. [REMOTE_WORKERS.md](skills/mu/REMOTE_WORKERS.md) covers
100
+ agents on other machines.
101
+ - [ARCHITECTURE.md](docs/ARCHITECTURE.md) and
102
+ [docs/architecture/](docs/architecture/): the module map and deep
103
+ dives.
104
+ - [VISION.md](docs/VISION.md): the design pillars.
105
+ [ROADMAP.md](docs/ROADMAP.md): what is next and what is rejected.
106
+ - [VOCABULARY.md](docs/VOCABULARY.md): canonical terms.
107
+ - [CHANGELOG.md](CHANGELOG.md): release notes.
108
+
109
+ `mu <verb> --help` is the reference for every flag.
335
110
 
336
111
  ## License
337
112
 
338
- MIT.
339
-
340
- ---
341
-
342
- Part of [mu-crew](https://github.com/mu-crew). Written mostly by AI coding agents, with a human reviewing what ships, and built for running them.
113
+ MIT. Part of [mu-crew](https://github.com/mu-crew). Written mostly by AI
114
+ coding agents, with a human reviewing what ships.