@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
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mu
3
- description: Manage AI agents in terminal-multiplexer panes (tmux or herdr) — from a single off-the-cuff helper to a persistent crew coordinated through a built-in task graph. Use when the user asks to "create/spin up a subagent to X", "run X in the background", "do this in parallel", "use one subagent per X to do Y", "kick off a helper to watch/investigate/draft X", or to spawn, send work to, observe, or coordinate one or many agents — especially work you'll keep talking to, long-lived agents, background tasks, or anything that benefits from a dependency graph and parallel-track detection. For zero-ceremony single helpers use the reserved `scratch` workstream; for one-shot "fire and get a result back" prefer pi-subagents.
3
+ description: Manage AI agents in terminal-multiplexer panes (tmux or herdr) — from a single off-the-cuff helper to a persistent crew coordinated through a built-in task graph. Use when the user asks to "create/spin up a subagent to X", "run X in the background", "do this in parallel", "use one subagent per X to do Y", "kick off a helper to watch/investigate/draft X", or to spawn, send work to, observe, or coordinate one or many agents — especially work you'll keep talking to, long-lived or background agents, or anything needing a dependency graph. For zero-ceremony helpers use the reserved `scratch` workstream; for one-shot "fire and get a result back" use the `mu_delegate` tool — its pane stays attachable.
4
4
  ---
5
5
 
6
6
  # mu — Multi-agent orchestration
@@ -14,121 +14,102 @@ not in `--help` do not exist.
14
14
 
15
15
  ## Output + JSON shapes
16
16
 
17
- Default output: textual card on stdout plus a `Next:` block. Read
18
- both. `--json` exists on every verb:
19
- - Success: one stdout object.
20
- - Collection reads (`task list`, `workspace commits`, ...): `{items: T[], count: number}`.
21
- - Singletons keep named fields.
22
- - `mu sql --json`: bare array rows.
23
- - `mu log --tail`: NDJSON (one object per line).
24
- - Errors: `{error,message,nextSteps,exitCode}` on stderr.
25
- - Validation errors also include structured `usage`.
26
- - **`nextSteps` survives in JSON.**
17
+ Default output is a card on stdout plus a `Next:` block. Read both.
18
+ Every verb takes `--json`: one stdout object; collections are
19
+ `{items, count}`; `mu sql --json` is bare rows; `mu log --tail` is
20
+ NDJSON. Errors are `{error,message,nextSteps,exitCode}` on stderr
21
+ (validation errors add `usage`). **`nextSteps` survives in JSON.**
27
22
 
28
23
  ## Vocabulary
29
24
 
30
- - **workstream** — unit of organization; one **mux session** named
31
- `mu-<name>` (a tmux session, or a herdr workspace).
25
+ - **workstream** — one **mux session** `mu-<name>` (tmux session or
26
+ herdr workspace) and one DB partition.
32
27
  - **agent** — named worker in a pane (you may be one).
33
- - **mux** — the multiplexer mu drives: tmux, or herdr. One per
34
- invocation. `mu doctor` names the active one; `MU_MUX` forces it.
35
- Spawn, send, and read work on both. Agent state comes from murmur
36
- on tmux and from herdr on herdr; `mu agent kick` is Linux-only on herdr.
28
+ - **mux** — tmux or herdr, one per invocation. `mu doctor` names it;
29
+ `MU_MUX` forces it. `mu agent kick` is Linux-only on herdr.
30
+ - **control socket (ctl)** — how mu drives a pi agent: the mu pi
31
+ extension (`mu link pi`) serves exact send, state, wait and abort
32
+ inside pi's own TUI. `ctl missing|refused` means it does not answer.
37
33
  - **task** — DAG node with mandatory `impact` (1–100) and
38
34
  `effort_days`. Shown as status/substate: `OPEN/todo|parked`,
39
35
  `IN_PROGRESS/active`, `CLOSED/done|rejected|wontfix|duplicate|superseded`.
40
36
  Any `CLOSED/*` satisfies `--blocked-by`.
41
37
  - **claim / release** — atomic take/clear of `tasks.owner`.
42
38
  - **note** — append-only task context; survives sessions.
43
- - **track** — independent DAG subtree; don't spawn more agents than
44
- ready tracks.
39
+ - **track** — independent DAG subtree; spawn at most one agent per
40
+ ready track.
45
41
  - **workspace** — per-agent VCS copy under
46
42
  `<state-dir>/workspaces/<workstream>/<agent>/`.
47
43
 
48
44
  ## When to use mu
49
45
 
50
46
  Use mu for persistent helpers, parallel work, dependencies, gated review, or
51
- work that must survive context compaction. Use `pi-subagents` for one focused
52
- answer and no follow-up; stay in one context for tiny edits or inspection.
47
+ work that must survive context compaction. Stay in one context for tiny edits
48
+ or inspection.
53
49
 
54
50
  ### Off-the-cuff helpers (`scratch`)
55
51
 
56
- Use the reserved `scratch` workstream for a helper you will keep driving but
57
- that needs no task DAG. It auto-creates on spawn.
52
+ For one-shot work inside pi, call `mu_delegate` (installed by `mu link pi`).
53
+ Outside pi: spawn into the reserved `scratch` workstream (no task DAG,
54
+ auto-created), `send --fresh`, then `mu agent wait --json` (`lastText`).
58
55
 
59
- - For task-less work, `mu agent wait <name> --first` waits for busy → idle;
60
- exit 0 means met, 5 timeout, 6 pane died.
56
+ - `mu agent wait <names...> --first` waits for busy → idle instead of a
57
+ `sleep` loop; exit 0 met, 5 timeout, 6 pane died.
61
58
  - For a watcher, persist last-seen state in a log ledger: write `mu log -w
62
59
  scratch --kind pr-state 'pr=1234 sha=abc ci=red'`, then read `mu log -w
63
- scratch --kind pr-state -n 1 --json`. Act only on change; chat context is not
64
- durable.
65
- - Use one agent per independent unit and `--workspace` for any helper that may
66
- edit, build, or test the shared repo.
60
+ scratch --kind pr-state -n 1 --json`. Act only on change.
61
+ - One agent per independent unit; `--workspace` for any helper that may edit,
62
+ build, or test the shared repo.
67
63
 
68
- A helper stuck at `needs_input` immediately after spawn likely hit pi's project
69
- trust prompt. Add `--approve` to the existing `MU_<CLI>_COMMAND`; use
70
- `--command` only to replace that configured command deliberately.
71
-
72
- Move off `scratch` when work gains dependencies or review gates.
64
+ A helper stuck at `needs_input` right after spawn likely hit pi's
65
+ project trust prompt: add `--approve` to `MU_<CLI>_COMMAND`. Move off
66
+ `scratch` when work gains dependencies or review gates.
73
67
 
74
68
  ## Mental model
75
69
 
76
70
  ### Workstreams, DAGs, tracks
77
71
 
78
- One workstream is one mux session and DB partition. Its task DAG has one edge:
79
- `mu task block A --by B` means **B blocks A**. Parallel tracks sharing a
80
- prerequisite collapse, preventing two agents from taking the same dependency.
72
+ The DAG has one edge: `mu task block A --by B` means **B blocks A**.
73
+ Tracks sharing a prerequisite collapse into one, so two agents never
74
+ take the same dependency.
81
75
 
82
76
  ### Workspaces prevent trampling
83
77
 
84
- If an agent may edit/build/test while another agent is active in the
85
- same repo, spawn with `--workspace`. Keep the main checkout for
86
- orchestration: two builds in one checkout corrupt each other.
87
-
88
- Workspaces auto-detect jj/sl/git; non-VCS uses `cp -a`. They are
89
- auto-freed on `mu agent close` **iff clean**: no uncommitted changes
90
- and no commits since fork. Non-clean close fails with
91
- `WorkspacePreservedError`; then use `mu workspace free <agent>` or
92
- `mu agent close <agent> --discard-workspace` (lossy).
78
+ If an agent may edit, build, or test while another is active in the same
79
+ repo, spawn with `--workspace`. Two builds in one checkout corrupt each
80
+ other; keep the main checkout for orchestration.
93
81
 
94
- Between waves, `mu workspace refresh <agent>` rebases onto fresh main without
95
- killing LLM context. Claim/send warn at ≥10 commits behind; scripts can make
96
- that a refusal with `--strict-staleness`.
82
+ Workspaces auto-detect jj, sl, or git (else `cp -a`). `mu agent close`
83
+ frees one **only if clean** (no uncommitted changes, no commits since
84
+ fork); otherwise it fails with `WorkspacePreservedError`. Then use
85
+ `mu workspace free <agent>` or `--discard-workspace` (lossy).
86
+ Between waves, `mu workspace refresh <agent>` rebases onto main and
87
+ keeps LLM context. Claim and send warn at ≥10 commits behind
88
+ (`--strict-staleness` refuses).
97
89
 
98
90
  ### Remote agents
99
91
 
100
- Agents can run on another machine: the PANE is local, the PROCESS is
101
- remote (`--command 'ssh <host> -t "..."'`), so `send`, `read`, and the
102
- reaper keep working unchanged. murmur reports the remote agent's state.
103
- **One orchestrator
104
- DB; panes may be remote** — never run a second mu on the host, since
105
- `tasks.owner_id` is an FK into the machine-local `agents` table and a
106
- remote mu could not claim your tasks anyway. You create the remote
107
- workspace yourself (`--workspace` is local-only).
92
+ The PANE is local, the PROCESS is remote (`--command 'ssh <host> -t
93
+ "..."'`); `mu agent remote-env` forwards a pi agent's control socket.
94
+ **One orchestrator DB**: never run a second mu on the host. You create
95
+ the remote workspace yourself (`--workspace` is local-only).
108
96
 
109
97
  **Read [REMOTE_WORKERS.md](REMOTE_WORKERS.md) before spawning your first
110
- remote agent, and again before waiting on one; poll once per turn and run
111
- the claim's one-shot `Next:` command.** These are the other three traps
112
- that cost real time when learned late:
113
- - **On a session-capped host, route long commands and silent-failure
114
- polls through [mule](https://github.com/mu-crew/mule).** A refused
115
- bare `rev-parse` can return an empty sha that looks like progress;
116
- batch all workers in one `--max-secs`-bounded mule job.
117
- - **`mule` exit 3 is a HANDBACK** — no ssh master, and opening one can
118
- need a human to touch a hardware key. Ask the operator; never retry,
119
- never run `ssh -MNf` yourself, never fall back to `ssh <host> <cmd>`.
120
- - **Exit 4 and 6 mean wait again; 5 means never.** Neither says the work
121
- failed.
98
+ remote agent, and again before waiting on one.** Poll once per turn with
99
+ the claim's one-shot `Next:` command. On a session-capped host, route
100
+ long commands and polls through [mule](https://github.com/mu-crew/mule):
101
+ a refused bare ssh returns an empty sha that looks like progress.
102
+ **`mule` exit 3 is a HANDBACK** to the operator (hardware-key touch):
103
+ never retry or open `ssh -MNf` yourself.
122
104
 
123
105
  ### Agent names
124
106
 
125
- Use roles: `worker-1`, `worker-2`, `reviewer-1`, `scout-1`,
126
- `auditor-1`, `planner-1`. Smallest unused suffix. Avoid human names.
107
+ Use roles with the smallest unused suffix: `worker-1`, `reviewer-1`,
108
+ `scout-1`, `auditor-1`, `planner-1`. No human names.
127
109
 
128
110
  ### Task note contract
129
111
 
130
- End every delegated task with a note containing the applicable
131
- fields:
112
+ End every delegated task with a note holding the applicable fields:
132
113
 
133
114
  ```text
134
115
  FILES: paths inspected/changed (line ranges if precise)
@@ -141,12 +122,7 @@ ODDITIES: weird things not acted on
141
122
  ```
142
123
 
143
124
  Then close with grounding:
144
-
145
- ```bash
146
- mu task close <id> -w <ws> --evidence "tests pass: cargo test exit 0"
147
- ```
148
-
149
- Future agents can reconstruct context via `mu task notes <id>`.
125
+ `mu task close <id> -w <ws> --evidence "tests pass: cargo test exit 0"`.
150
126
 
151
127
  ## Orchestrator loop
152
128
 
@@ -157,12 +133,14 @@ Every turn:
157
133
  2. Spawn at most one agent per independent ready track.
158
134
  3. **Claim before sending — even one-shot reviewers/scouts.**
159
135
  `mu task claim <id> -w <ws> --for <agent> --evidence "..."`.
160
- If no task exists, `mu task add` first; include initial context with
161
- `--note 'REPRO: ...\nSCOPE: ...'` when the title alone is not
162
- enough. Agent state is runtime observation; task ownership is durable and
163
- waitable.
164
- 4. Send terse instructions: task id, files/notes to read, workspace
165
- path, validation command, scope guards, task note contract.
136
+ If no task exists, `mu task add` first (`--note 'REPRO: ...'` when
137
+ the title is not enough). Ownership is durable and waitable; agent
138
+ state is not.
139
+ 4. Send each new task with `mu agent send <w> --fresh '...'` (new
140
+ session + prompt in one step; refuses while busy): task id,
141
+ files/notes to read, workspace path, validation command, scope
142
+ guards, task note contract. Follow the `Next:` block; it picks
143
+ `--fresh` vs `--steer` for you.
166
144
  5. End with a loud final-action block:
167
145
 
168
146
  ```text
@@ -179,58 +157,45 @@ Every turn:
179
157
 
180
158
  ## Dispatch rules that prevent real failures
181
159
 
182
- - **Pipeline; don't barrier.** Wait for one task, cherry-pick only its new
183
- commits onto main, verify the combined tree, then return control. Waiting on an
184
- umbrella task hides partial progress; merging stale branches can restore
185
- reverted code.
186
- - **Verify the merge, not the worker's rerun.** The worker tested against its
187
- fork point; only the combination with moved main is new. This found three
188
- integration breaks where rerunning worker suites found none. For remote work,
189
- run the merged gate on the host with warm dependencies: 500s × 30 integrations
190
- is four laptop-hours. Keep platform-sensitive checks and the final release gate
191
- local; macOS `ps` once exposed a bug Linux could not.
192
- - **Push only from a green gate.** Script the gate so `git push` is its last
193
- line under `set -e`; a chain that printed a failure and pushed anyway put a red
194
- commit on main. Check the gate runs what it claims: a randomized test gated on
195
- an env var passed with zero cases.
196
- - **Dispatch from current main.** Reset the worker's worktree to main before each
197
- task. Stale bases caused four merges that conflicted or broke tests after
198
- passing in the worker.
199
- - **Accept evidence, not close notes.** Re-run the key measurement from a clean
200
- checkout. Close notes have claimed unpushed commits and reported numbers from
201
- a half-edited clone.
202
- - **Freeze only what conflicts.** While one task owns shared files, give idle
203
- workers tasks that avoid them; a blanket freeze idled four of five workers for
204
- a day.
205
- - **Fix done before a long run.** Put the completion criterion in the task note
206
- first: which checks, how many agreeing runs, what may differ. Without it the
207
- target moves with every run.
208
- - **Split long proofs into independent units**, sharded and in parallel, so a
209
- unit that passes stays passed and one flake restarts only its own unit.
210
- Workers poll background jobs every few minutes, not hourly.
160
+ - **Pipeline; don't barrier.** Wait for one task, cherry-pick only its
161
+ new commits, verify, return control. An umbrella wait hides progress;
162
+ merging stale branches can restore reverted code.
163
+ - **Verify the merge, not the worker's rerun.** Only the combination
164
+ with moved main is new; that found three breaks rerunning found none
165
+ of. Run a remote merge gate on the host (see REMOTE_WORKERS.md).
166
+ - **Push only from a green gate.** Make `git push` the last line under
167
+ `set -e`. Check the gate runs what it claims: an env-gated randomized
168
+ test once passed with zero cases.
169
+ - **Dispatch from current main.** Reset the worker's worktree to main
170
+ before each task.
171
+ - **Accept evidence, not close notes.** Re-run the key measurement from
172
+ a clean checkout; close notes have claimed unpushed commits.
173
+ - **Freeze only what conflicts.** Give idle workers tasks that avoid
174
+ shared files; a blanket freeze idled four of five workers for a day.
175
+ - **Fix done before a long run.** Put the completion criterion (checks,
176
+ agreeing runs, allowed variance) in the task note first.
177
+ - **Split long proofs into independent units**, sharded and parallel,
178
+ so one flake restarts only its unit.
211
179
  - Bucket waves by file cluster, not severity; two agents editing one file
212
180
  conflict. Refresh workspaces between waves.
213
- - Cross-workstream wait/claim uses qualified refs. The owner stays in its own
214
- workstream; only task ownership crosses.
215
- - For an idle worker, read the pane to learn why it stopped, then answer,
216
- retry, or release its task. `MU_IDLE_THRESHOLD_MS` defaults to 5m.
217
- - `mu agent kick` targets a wedged foreground subprocess. It refuses to signal
218
- the wrapping CLI; close the agent if that is what must stop.
219
- - Use `mu agent send`, not raw mux input: mu preserves literal text and confirms
220
- submission. Single-quote prompts containing shell expansions, or use a quoted
221
- heredoc.
181
+ - Cross-workstream wait and claim use qualified refs; only task
182
+ ownership crosses.
183
+ - For an idle worker, read the pane, then answer, retry, or release its
184
+ task. `MU_IDLE_THRESHOLD_MS` defaults to 5m.
185
+ - **Never chain `/new` and a prompt as two sends to a pi agent:** the prompt
186
+ can land mid-reset and vanish (it did, twice). `--fresh` does both inside pi.
187
+ - **Stop a worker:** `mu agent abort <w>` first for pi (exact, local or
188
+ remote, keeps context, waits for idle; exit 5 = still busy; queued
189
+ follow-ups return to the editor unsent). Then `mu agent kick` (pi
190
+ unresponsive, or non-pi; local panes only), then `mu agent close`.
191
+ - Use `mu agent send`, not raw mux input. Single-quote prompts containing shell
192
+ expansions, or use a quoted heredoc.
222
193
 
223
194
  ## CLI gotchas
224
195
 
225
- - **`workstream teardown`** is dry-run by default; `--yes` commits. It writes
226
- TOMBSTONE ops, so history survives and `mu undo <group> --yes` reverses the
227
- deletions — do NOT `mu db backup` first, the log IS the backup.
228
- `workstream list --torn-down` replays past teardowns with the group id to
229
- undo, newest first, marking ones already recreated.
230
- - **`agent wait <names...> --first`** blocks until an agent stops working
231
- (busy → anything else) — the task-less counterpart to `mu task wait`, for
232
- helpers that own no task. Use it instead of a `sleep` loop. Exit 0 met,
233
- 5 timeout, 6 pane died.
196
+ - **`workstream teardown`** is dry-run without `--yes`. It writes
197
+ TOMBSTONE ops, so `mu undo <group> --yes` reverses it; the log is the
198
+ backup. `workstream list --torn-down` lists group ids to undo.
234
199
  - **`task close --if-ready`** no-ops until every blocker is CLOSED; bare
235
200
  `task release` reopens IN_PROGRESS.
236
201
  - **`task close --as rejected|wontfix --why ...`** (declined | valid, not worth it) unblocks dependents (listed in
@@ -239,49 +204,32 @@ Every turn:
239
204
  IN_PROGRESS — `task release` first.
240
205
  - **For waits use `task wait`, not `log --tail`.** `--kind` is the operator's
241
206
  log-ledger channel; `--intent` is what mu recorded.
242
- - **`mu undo`** bare lists undoable actions with group ids; `<group>` previews;
243
- `<group> --yes` applies. It emits INVERSE ops for that one group, so it
244
- touches nothing else, and the undo is itself an op — REDO is
245
- `mu undo <that group> --yes`. Refuses with exit 4 if a later action changed
246
- the same fields (`--force` discards that newer work). Rows only: killed panes
247
- and freed workspace dirs do not come back. No snapshots, no `--to`.
248
- - **`mu rebuild <file>`** writes a NEW DB from the ops log. Agents and
249
- workspaces are absent because they have no captured ops; re-spawn after swap.
250
- - **`mu sql`** alone skips ambient sync, preserving no-surprise mutations.
251
- - **`mu db backup`** is a convenient copy; real recovery is `mu rebuild`.
252
- - **Sync (laptop ↔ devserver):** `export MU_SYNC_DIR=$HOME/Sync/mu` on each
253
- machine pointing at a shared folder (Syncthing recommended). Every command
254
- then flushes your ops and ingests peers' — ambient, no daemon — so a bare
255
- `mu task list` on the other box already shows what you added here. Merge is
256
- per-FIELD, so two machines editing different fields of one task both keep
257
- their edit. `mu sync` bare reports peer status plus a copy-pasteable rsync
258
- line; mu never runs ssh/scp/rsync itself. `--from <peer-mu.db>` reads a
259
- peer's ops directly; `--repair <peer>` re-reads from zero and is always safe
260
- (ingest is idempotent).
261
- **NEVER put `MU_DB_PATH` inside `MU_SYNC_DIR`** — it corrupts the DB and
262
- `mu doctor` hard-fails. Agent/workspace state and task OWNERSHIP are
263
- machine-local and never travel.
264
- - **`mu doctor`** runs fast checks; `--deep` rebuilds the log into a temp DB and
265
- diffs it field-by-field. DRIFT means the log and the tables disagree, which
266
- breaks undo and sync at once (exit 5, naming table, key and field). It is a
267
- capture bug, not operator error: back up and report it, do NOT reflexively
268
- rebuild — if capture missed a mutation, the live rows hold the real work.
269
- The `disk` section reconciles state-dir against DB both ways and is
270
- **report-only**: `ws-rows` is a row whose directory is gone (nothing else
271
- reports it), `ws-dirs` blocks the next `--workspace` spawn, and an orphan dir
272
- may hold the only copy of uncommitted work — which is why mu prints the
273
- cleanup command and runs none of them. `--disk` adds per-checkout byte usage.
207
+ - **`mu undo`** bare lists groups; `<group>` previews; `<group> --yes`
208
+ emits inverse ops for that group only (redo = undo the undo). Exit 4
209
+ if a later action changed the same fields (`--force` discards it).
210
+ Rows only: killed panes and freed workspace dirs do not come back.
211
+ - **`mu rebuild <file>`** writes a new DB from the ops log, without
212
+ agents or workspaces; re-spawn after the swap. Recovery is
213
+ `mu rebuild`, not `mu db backup`.
214
+ - **`mu sql`** skips ambient sync.
215
+ - **Sync:** set `MU_SYNC_DIR` on each machine to a shared folder
216
+ (Syncthing). Every command flushes and ingests ops, merged per field.
217
+ mu never runs ssh or rsync; `mu sync` prints the line.
218
+ `--repair <peer>` is always safe. **Never put `MU_DB_PATH` inside
219
+ `MU_SYNC_DIR`**: it corrupts the DB. Agents, workspaces, and task
220
+ ownership never travel.
221
+ - **`mu doctor --deep` DRIFT** (exit 5) is a capture bug: back up and
222
+ report it. Do not rebuild; the live rows may hold work the log missed.
223
+ The `disk` section is report-only: an orphan dir may hold the only copy
224
+ of uncommitted work, so mu prints cleanup commands and runs none.
274
225
 
275
226
  ## `mu task wait`
276
227
 
277
228
  Use `--first --on-stall exit`: `--first` populates `.firing`, and
278
- `--on-stall exit` prevents unattended waits from polling forever when a worker
279
- needs attention. Exit 6 means a dead pane; exit 7 means the owner sat in
280
- `needs_input`. Read that pane (`mu agent read <owner>`) before acting: the
281
- worker may be waiting on an answer from you, not merely forgetting to close.
282
- Answer it — questions are cheaper than rework. For remote workers, see
283
- [REMOTE_WORKERS.md](REMOTE_WORKERS.md) before choosing timeout or stall
284
- handling.
229
+ `--on-stall exit` stops an unattended wait when a worker needs attention.
230
+ Exit 6 is a dead pane; exit 7 is an owner in `needs_input`. Read that
231
+ pane (`mu agent read <owner>`) and answer: the worker may be waiting on
232
+ you. Questions are cheaper than rework.
285
233
 
286
234
  ## Models and thinking effort
287
235
 
@@ -293,40 +241,29 @@ export MU_PI_COMMAND="pi --model sonnet:medium"
293
241
  mu agent spawn a --cli pi_big # uses $MU_PI_BIG_COMMAND
294
242
  ```
295
243
 
296
- Convention: `pi_mini` / `pi` / `pi_big`. Use mini for probing,
297
- modest for build/edit/refactor, big for design/review/incidents.
298
- Discover model strings with `pi --list-models [fuzzy-search]`.
244
+ Convention: `pi_mini` for probing, `pi` for build and refactor,
245
+ `pi_big` for design, review, and incidents. List models with
246
+ `pi --list-models [search]`.
299
247
 
300
248
  ## Reaper and agent state
301
249
 
302
- If an agent pane dies, or `mu agent close` kills it mid-task, owned
303
- IN_PROGRESS tasks revert to OPEN with a `[reaper]` note and `task
304
- reap` op. No manual release after crashes.
305
-
306
- Agent state comes from [murmur](https://github.com/mu-crew/murmur) on
307
- tmux and from herdr on herdr. `unknown` means no state source; run
308
- `mu doctor` for the reason. mu needs murmur only for agent state:
309
- tasks, claims, workspaces, spawn, send, read, and task completion waits
310
- work without it. **mu owns the work; murmur reports what an agent is
311
- doing.** See [REMOTE_WORKERS.md](REMOTE_WORKERS.md) § mu and murmur.
312
-
313
- For high-stakes decisions:
250
+ If an agent pane dies, or `mu agent close` kills it mid-task, its
251
+ IN_PROGRESS tasks revert to OPEN with a `[reaper]` note. No manual
252
+ release after crashes.
314
253
 
315
- ```bash
316
- mu agent read worker-1 -n 100
317
- mu log -w <ws> --tail
318
- mu task notes <id>
319
- ```
254
+ pi agents report state through the control socket and need no murmur.
255
+ Other CLIs report through [murmur](https://github.com/mu-crew/murmur) on
256
+ tmux, or herdr on herdr. `unknown` means no state source; `mu doctor`
257
+ says why. Before a high-stakes decision, read the pane
258
+ (`mu agent read worker-1 -n 100`), `mu log -w <ws> --tail`, and
259
+ `mu task notes <id>`.
320
260
 
321
261
  ## In-pane worker loop
322
262
 
323
- `$MU_AGENT_NAME`, injected at spawn, resolves identity; the pane title
324
- is the fallback that adopted panes need. Env-first means this loop is
325
- identical whichever multiplexer you are in — you never need to know.
326
-
327
- - Worker pane: spawned/adopted by mu; bare `mu task claim <id>` works.
328
- - Orchestrator pane: not registered; bare `claim` errors with next
329
- steps: `--self`, `--for <worker>`, or `mu agent adopt <pane>`.
263
+ `$MU_AGENT_NAME` (injected at spawn) resolves identity; adopted panes
264
+ fall back to the pane title. In a worker pane, bare `mu task claim <id>`
265
+ works. In the unregistered orchestrator pane it errors; use `--self`,
266
+ `--for <worker>`, or `mu agent adopt <pane>`.
330
267
 
331
268
  ```bash
332
269
  mu me
@@ -342,28 +279,16 @@ Skipping close makes the orchestrator's wait hang. Won't do it:
342
279
 
343
280
  ## Follow-on prompts
344
281
 
345
- A new `mu agent send` appends to prior LLM context. For unrelated
346
- work, clear first (`/new` for pi/claude-code; `/clear` for codex):
347
-
348
- ```bash
349
- mu agent send worker-1 '/new'
350
- mu agent send worker-1 'Claim and work on task_x. Read notes first...'
351
- ```
352
-
353
- No `sleep` needed. `mu agent send` waits for the pane to finish any
354
- re-initialisation before pasting, and re-submits if the TUI swallowed
355
- the Enter. If a send cannot be confirmed it prints a `warning:` to
356
- stderr naming the pane; exit 0 with no warning means submitted.
357
-
358
- Budget is `MU_SEND_READINESS_MS` (default 15000; 0 = fire-and-forget).
359
- Sending to a BUSY agent is not delayed — that input queues normally.
282
+ A plain `mu agent send` appends to prior context; use it to steer or
283
+ answer. Unrelated work to pi: `mu agent send worker-1 --fresh 'Claim
284
+ task_x...'`. claude-code/codex: send `/new` (codex: `/clear`), then the
285
+ prompt; a send it cannot confirm prints a `warning:` on stderr.
360
286
 
361
287
  ## Guardrails
362
288
 
363
- Task ownership outranks runtime agent state. Coordinate through task notes and the
364
- activity log. Keep edges within one workstream, role-name agents, and reserve
365
- the `mu_` task-id prefix. Give workers bounded paths and commands; use `mu
366
- agent kick` if a subprocess wedges.
289
+ Task ownership outranks agent state. Coordinate through task notes and
290
+ the activity log. Keep edges within one workstream and reserve the `mu_`
291
+ task-id prefix. Give workers bounded paths and commands.
367
292
 
368
293
  ## See also
369
294