@mu-crew/mu 1.6.0

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