@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.
- package/AGENTS.md +203 -588
- package/README.md +80 -308
- package/dist/cli.js +6106 -4716
- package/dist/cli.js.map +1 -1
- package/dist/extension/mu-pi.js +786 -0
- package/dist/extension/mu-pi.js.map +1 -0
- package/dist/index.d.ts +738 -536
- package/dist/index.js +6617 -5785
- package/dist/index.js.map +1 -1
- package/docs/ARCHITECTURE.md +178 -1008
- package/docs/ROADMAP.md +88 -169
- package/docs/VISION.md +206 -407
- package/docs/VOCABULARY.md +202 -455
- package/docs/architecture/control-socket.md +119 -0
- package/docs/architecture/dag.md +113 -0
- package/docs/architecture/mux.md +163 -0
- package/docs/architecture/ops-log.md +140 -0
- package/docs/architecture/sdk.md +185 -0
- package/docs/architecture/sync.md +129 -0
- package/docs/architecture/tui.md +146 -0
- package/docs/guide/README.md +25 -0
- package/docs/guide/backends.md +61 -0
- package/docs/guide/cleanup.md +74 -0
- package/docs/guide/delegate.md +87 -0
- package/docs/guide/dispatch.md +137 -0
- package/docs/guide/getting-started.md +177 -0
- package/docs/guide/recovery.md +133 -0
- package/docs/guide/remote.md +74 -0
- package/docs/guide/sql.md +76 -0
- package/docs/guide/stop-a-worker.md +64 -0
- package/docs/guide/sync.md +78 -0
- package/docs/guide/tui.md +98 -0
- package/docs/guide/upgrade.md +76 -0
- package/docs/history/CHANGELOG-pre-3.md +4866 -0
- package/docs/reference/env.md +87 -0
- package/docs/reference/naming.md +82 -0
- package/docs/specs/2026-09-28-agent-state-from-murmur.md +1 -1
- package/docs/specs/2026-09-29-task-substates.md +1 -1
- package/package.json +4 -4
- package/skills/mu/REMOTE_WORKERS.md +186 -491
- package/skills/mu/SKILL.md +142 -217
- package/docs/HANDOVER.md +0 -486
- package/docs/USAGE_GUIDE.md +0 -2637
package/docs/USAGE_GUIDE.md
DELETED
|
@@ -1,2637 +0,0 @@
|
|
|
1
|
-
# mu — Usage Guide
|
|
2
|
-
|
|
3
|
-
A practical, copy-pasteable tour of mu. Terms are canonical — see
|
|
4
|
-
[VOCABULARY.md](VOCABULARY.md); the canonical verb list is
|
|
5
|
-
`mu --help`, with the gotchas in `## CLI overview` of
|
|
6
|
-
[skills/mu/SKILL.md](../skills/mu/SKILL.md).
|
|
7
|
-
|
|
8
|
-
> **Status:** 1.0 (pre-release). Typed verbs span 7 namespaces
|
|
9
|
-
> (`workstream`, `agent`, `task`, `workspace`, `log`, `me`, `db`) plus
|
|
10
|
-
> bare top-level verbs (`state`, `doctor`, `sql`, `undo`, `sync`,
|
|
11
|
-
> `rebuild`). Every verb accepts `--json`. Schema v11. See
|
|
12
|
-
> [CHANGELOG.md](../CHANGELOG.md).
|
|
13
|
-
|
|
14
|
-
**In a hurry? Start at [§ 0. Common scenarios](#0-common-scenarios).**
|
|
15
|
-
|
|
16
|
-
*If anything below disagrees with `mu --help`, trust `mu --help`.*
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Table of contents
|
|
21
|
-
|
|
22
|
-
0. [Common scenarios (start here)](#0-common-scenarios)
|
|
23
|
-
1. [Setup](#1-setup)
|
|
24
|
-
2. [Get oriented (`mu doctor`)](#2-get-oriented)
|
|
25
|
-
3. [Create a workstream (`mu workstream init`)](#3-create-a-workstream)
|
|
26
|
-
4. [Plan some work as a DAG (`mu task add`)](#4-plan-some-work-as-a-dag)
|
|
27
|
-
5. [See the graph (dashboard + state API)](#5-see-the-graph-dashboard--state-api)
|
|
28
|
-
5b. [The TUI dashboard (interactive)](#5b-the-tui-dashboard-interactive)
|
|
29
|
-
6. [Spawn a crew (`mu agent spawn`)](#6-spawn-a-crew)
|
|
30
|
-
7. [Watch the crew live (`tmux attach`)](#7-watch-the-crew-live)
|
|
31
|
-
8. [Send work to an agent (`mu agent send`)](#8-send-work-to-an-agent)
|
|
32
|
-
9. [Read what an agent did (`mu agent read`)](#9-read-what-an-agent-did)
|
|
33
|
-
10. [The claim protocol from inside a pane (`mu task claim`)](#10-the-claim-protocol--from-inside-an-agents-pane)
|
|
34
|
-
11. [Drop notes (durable context) (`mu task note`)](#11-drop-notes-durable-context)
|
|
35
|
-
12. [Close out a task](#12-close-out-a-task)
|
|
36
|
-
13. [The SQL escape hatch (`mu sql`)](#13-the-sql-escape-hatch-is-your-friend)
|
|
37
|
-
14. [Recovery scenarios](#14-recovery-scenarios)
|
|
38
|
-
15. [Cleanup](#15-cleanup)
|
|
39
|
-
15.6. [Multi-machine sync](#156-multi-machine-sync)
|
|
40
|
-
16. [One-shot demo script](#16-one-shot-demo-script)
|
|
41
|
-
17. [Mental model in three sentences](#mental-model-in-three-sentences)
|
|
42
|
-
18. [What's NOT in mu](#whats-not-in-mu-and-how-to-work-around-it)
|
|
43
|
-
19. [Where to go from here](#where-to-go-from-here)
|
|
44
|
-
20. [Multiplexer backends (tmux and herdr)](#20-multiplexer-backends-tmux-and-herdr)
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 0. Common scenarios
|
|
49
|
-
|
|
50
|
-
Six worked paths, every command run live. Output is verbatim (colour
|
|
51
|
-
stripped). Set `MU_DB_PATH=/tmp/mu-play.db` first if you want to try
|
|
52
|
-
them without touching your real registry.
|
|
53
|
-
|
|
54
|
-
### 0.1 First 5 minutes
|
|
55
|
-
|
|
56
|
-
Init a workstream, plan two tasks with a dependency, see what's ready.
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
mu workstream init auth
|
|
60
|
-
mu task add design -w auth --title "Design auth module" --impact 80 --effort-days 2
|
|
61
|
-
mu task add build -w auth --title "Build auth module" --impact 80 --effort-days 5 --blocked-by design
|
|
62
|
-
mu task next -w auth
|
|
63
|
-
mu task tree build -w auth
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
Created workstream auth (mux session mu-auth)
|
|
68
|
-
Next:
|
|
69
|
-
Attach the session : tmux attach -t mu-auth
|
|
70
|
-
Plan tasks : mu task add -w auth --title "..." --impact 50 --effort-days 1
|
|
71
|
-
Spawn an agent : mu agent spawn <name> -w auth
|
|
72
|
-
See state : mu state -w auth
|
|
73
|
-
|
|
74
|
-
Added task design (workstream=auth, impact=80, effort=2)
|
|
75
|
-
|
|
76
|
-
Added task build (workstream=auth, impact=80, effort=5)
|
|
77
|
-
blocked by: design
|
|
78
|
-
|
|
79
|
-
┌────────┬────────┬────────────────────┬────────┬────────┬──────┬───────┐
|
|
80
|
-
│ name │ status │ title │ impact │ effort │ ROI │ owner │
|
|
81
|
-
├────────┼────────┼────────────────────┼────────┼────────┼──────┼───────┤
|
|
82
|
-
│ design │ OPEN │ Design auth module │ 80 │ 2 │ 40.0 │ — │
|
|
83
|
-
└────────┴────────┴────────────────────┴────────┴────────┴──────┴───────┘
|
|
84
|
-
|
|
85
|
-
Tree of build (blockers below; --down for dependents)
|
|
86
|
-
build OPEN Build auth module
|
|
87
|
-
└── design OPEN Design auth module
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
`build` is absent from `mu task next` because `design` blocks it.
|
|
91
|
-
Close `design` and `build` becomes ready. Details: [§ 3](#3-create-a-workstream),
|
|
92
|
-
[§ 4](#4-plan-some-work-as-a-dag).
|
|
93
|
-
|
|
94
|
-
### 0.2 The dispatch loop: spawn, claim, send, wait, close
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
mu agent spawn worker-1 -w auth --cli sh # --cli pi for a real agent
|
|
98
|
-
mu task claim design -w auth --for worker-1
|
|
99
|
-
mu agent send worker-1 -w auth 'Design the auth module, then: mu task close design --evidence "..."'
|
|
100
|
-
mu task wait design -w auth --timeout 60 --on-stall exit # blocks until CLOSED
|
|
101
|
-
mu agent close worker-1 -w auth
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
Spawned worker-1 (sh) in window worker-1 of mu-auth, pane %88
|
|
106
|
-
|
|
107
|
-
Claimed design for worker-1 (OPEN → IN_PROGRESS)
|
|
108
|
-
Next:
|
|
109
|
-
Drop a note (single-quote to defer shell expansion) : mu task note design 'FILES: ...\nDECISION: ...' -w auth
|
|
110
|
-
Close with grounding : mu task close design --evidence "..." -w auth
|
|
111
|
-
Release if blocked : mu task release design -w auth
|
|
112
|
-
|
|
113
|
-
sent 23 bytes to worker-1
|
|
114
|
-
|
|
115
|
-
all-of 1 reached CLOSED in 4094ms
|
|
116
|
-
✓ design (CLOSED)
|
|
117
|
-
|
|
118
|
-
Closed worker-1
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Exit codes from `mu task wait`: `0` met, `5` timeout, `6` the owning
|
|
122
|
-
pane died, `7` stalled (with `--on-stall exit`). See
|
|
123
|
-
[§ Wait exit codes](#wait-exit-codes-mu-task-wait).
|
|
124
|
-
|
|
125
|
-
`mu agent send` verifies delivery. If it prints `warning: ... was NOT
|
|
126
|
-
submitted`, the text is sitting unsubmitted in the pane — the agent has
|
|
127
|
-
not seen it. That is the failure mode `exit 0` used to hide; check
|
|
128
|
-
before you wait on the task.
|
|
129
|
-
|
|
130
|
-
### 0.3 Laptop ↔ devserver
|
|
131
|
-
|
|
132
|
-
Same `MU_SYNC_DIR` on both machines. No export step, no import step, no
|
|
133
|
-
sync verb in the loop.
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
# both machines, in your shell rc
|
|
137
|
-
export MU_SYNC_DIR=$HOME/Sync/mu
|
|
138
|
-
|
|
139
|
-
# laptop
|
|
140
|
-
mu workstream init app
|
|
141
|
-
mu task add auth_fix -w app -t "Fix the auth redirect" -i 80 -e 2
|
|
142
|
-
|
|
143
|
-
# devserver — the ordinary command already ingested it
|
|
144
|
-
mu task list -w app
|
|
145
|
-
mu task close auth_fix -w app --evidence "shipped in #412"
|
|
146
|
-
|
|
147
|
-
# laptop
|
|
148
|
-
mu task show auth_fix -w app
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
┌──────────┬────────┬───────────────────────┬────────┬────────┬──────┬───────┐
|
|
153
|
-
│ name │ status │ title │ impact │ effort │ ROI │ owner │
|
|
154
|
-
├──────────┼────────┼───────────────────────┼────────┼────────┼──────┼───────┤
|
|
155
|
-
│ auth_fix │ OPEN │ Fix the auth redirect │ 80 │ 2 │ 40.0 │ — │
|
|
156
|
-
└──────────┴────────┴───────────────────────┴────────┴────────┴──────┴───────┘
|
|
157
|
-
|
|
158
|
-
Closed auth_fix (OPEN → CLOSED)
|
|
159
|
-
evidence: shipped in #412
|
|
160
|
-
|
|
161
|
-
auth_fix — Fix the auth redirect
|
|
162
|
-
workstream : app
|
|
163
|
-
status : CLOSED
|
|
164
|
-
...
|
|
165
|
-
Notes (1)
|
|
166
|
-
2026-08-02T05:49:15.361Z worker-2
|
|
167
|
-
CLOSE: shipped in #412
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Both machines edit at once.** Merges are per-FIELD, so different
|
|
171
|
-
fields of the same task both survive:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
# laptop # devserver
|
|
175
|
-
mu task update t1 -w app --impact 95 mu task close t1 -w app
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
# both machines, after both have synced:
|
|
180
|
-
t1 — Concurrent demo
|
|
181
|
-
status : CLOSED
|
|
182
|
-
impact : 95
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
Same field on both machines: the newer HLC wins, silently. Peer status
|
|
186
|
-
is `mu sync`; a torn transfer is `mu sync --repair <peer-prefix>`. Full
|
|
187
|
-
section: [§ 15.6](#156-multi-machine-sync).
|
|
188
|
-
|
|
189
|
-
### 0.4 I made a mistake
|
|
190
|
-
|
|
191
|
-
Every user-visible action is one **group** of ops. Find it, preview,
|
|
192
|
-
apply.
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
mu task update build -w auth --impact 5 # oops
|
|
196
|
-
mu undo # what can I undo?
|
|
197
|
-
mu undo 6380dd3d # preview (dry run)
|
|
198
|
-
mu undo 6380dd3d --yes # apply
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
mu undo — most recent undoable action:
|
|
203
|
-
6380dd3d task.update — 1 op
|
|
204
|
-
|
|
205
|
-
recent groups (newest first):
|
|
206
|
-
* 6380dd3d task.update — 1 op
|
|
207
|
-
1abb5038 task.add — 2 ops
|
|
208
|
-
4f93f1df task.add — 1 op
|
|
209
|
-
70af8fb8 workstream.init — 1 op
|
|
210
|
-
|
|
211
|
-
mu undo 6380dd3d — would revert task.update
|
|
212
|
-
restore task auth/build impact=80 updated_at=2026-08-02T05:49:34.545Z
|
|
213
|
-
|
|
214
|
-
(dry-run; rerun with --yes to apply)
|
|
215
|
-
|
|
216
|
-
Undid 6380dd3d (task.update)
|
|
217
|
-
task auth/build impact=80 updated_at=2026-08-02T05:49:34.545Z
|
|
218
|
-
1 row change(s), recorded as group 3814ed17
|
|
219
|
-
This undo is itself undoable: mu undo 3814ed17 --yes
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
The undo is itself a group — `mu undo 3814ed17 --yes` is redo. Any
|
|
223
|
-
unique prefix of a group id works. Undo reverts ROWS: killed panes and
|
|
224
|
-
freed workspace dirs do not come back. See
|
|
225
|
-
[§ Undoing one action](#undoing-one-action-mu-undo).
|
|
226
|
-
|
|
227
|
-
### 0.5 Something looks wrong
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
mu doctor # exit 0 healthy, 5 on drift
|
|
231
|
-
mu doctor --deep # full rebuild + field diff; slower
|
|
232
|
-
mu doctor --disk # + per-workspace byte usage (walks every checkout)
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
mu doctor
|
|
237
|
-
|
|
238
|
-
environment
|
|
239
|
-
tmux : ok (tmux 3.7b)
|
|
240
|
-
$TMUX : set
|
|
241
|
-
$TMUX_PANE : %21
|
|
242
|
-
$MU_SESSION : auth
|
|
243
|
-
agent state : ok agent state from murmur 1.0.0
|
|
244
|
-
|
|
245
|
-
db
|
|
246
|
-
path : /tmp/mu-play.db
|
|
247
|
-
schema : ok (10 tables)
|
|
248
|
-
schema_version : 10
|
|
249
|
-
journal_mode : wal
|
|
250
|
-
foreign_keys : on
|
|
251
|
-
|
|
252
|
-
workstream
|
|
253
|
-
current : auth
|
|
254
|
-
|
|
255
|
-
state (workstream=auth)
|
|
256
|
-
agents : 0
|
|
257
|
-
tasks : 2 (ready 1, blocked 1, in-progress 0)
|
|
258
|
-
ops rows : 1
|
|
259
|
-
ghosts : none
|
|
260
|
-
orphan panes : 0
|
|
261
|
-
|
|
262
|
-
fleet
|
|
263
|
-
db-vs-sync : ok MU_SYNC_DIR not set (no sync configured)
|
|
264
|
-
db-filesystem : ok DB is on local (0x1021994)
|
|
265
|
-
name-case : ok no case-colliding workstream names
|
|
266
|
-
|
|
267
|
-
housekeeping
|
|
268
|
-
ws-dormant : note 2 dormant workstream(s): 2 with open tasks
|
|
269
|
-
|
|
270
|
-
Idle 60+ days but still holding UNCLOSED tasks — look before tearing down:
|
|
271
|
-
infer-rs 95d idle, 19 of 202 unclosed
|
|
272
|
-
modelbridge 89d idle, 8 of 75 unclosed
|
|
273
|
-
|
|
274
|
-
Removes the task rows and notes — the plan, not the code (no checkout
|
|
275
|
-
is touched, and `mu undo <group>` puts the rows back). The risk is
|
|
276
|
-
losing sight of what was left to do, so read it first:
|
|
277
|
-
mu task list -w infer-rs --status OPEN
|
|
278
|
-
|
|
279
|
-
disk
|
|
280
|
-
ws-rows : ok every workspace row has its dir
|
|
281
|
-
ws-dirs : ok no orphan workspace dirs
|
|
282
|
-
ws-empty : ok no empty workstream dirs
|
|
283
|
-
db-copies : WARN 7 stray DB file(s), 49M — nothing reads these
|
|
284
|
-
exports : ok no leftover export dirs
|
|
285
|
-
locks : ok no stale lock dirs
|
|
286
|
-
(run `mu doctor --disk` for per-workspace byte usage — walks every checkout)
|
|
287
|
-
|
|
288
|
-
ops log
|
|
289
|
-
drift (shallow) : ok every live row has ops (1ms) — run `mu doctor --deep` for the full rebuild diff
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
The `disk` section is the only one that reads the filesystem, and it
|
|
293
|
-
reconciles **both directions** — the two can disagree either way:
|
|
294
|
-
|
|
295
|
-
| Row | Means | Why it matters |
|
|
296
|
-
| --- | --- | --- |
|
|
297
|
-
| `ws-rows` | a `vcs_workspaces` row whose path is gone | every read surface reports it as healthy; the next send fails inside the VCS backend instead of at the row that lied. Usually a hand-run `rm -rf` where `mu workspace free` was wanted |
|
|
298
|
-
| `ws-dirs` | a workspace dir with no row (**workspace orphan**) | blocks the next `--workspace` spawn for that agent name. `stranded` = the workstream row is gone too, so no workstream-scoped verb can reach it |
|
|
299
|
-
| `ws-empty` | a per-workstream dir holding no checkouts | `ok` severity — `workspace free` leaves the parent behind. Reported, not faulted |
|
|
300
|
-
| `db-copies` | `mu.db*` files that aren't the live WAL triple | hand-made copies and pre-upgrade saves. Nothing reads them, nothing prunes them, and they are usually the largest dead-byte category |
|
|
301
|
-
| `exports` | leftovers from the removed `mu workstream export` <!-- doc-cli-drift:skip --> | 1.0 deleted the verb, not its output directory |
|
|
302
|
-
| `locks` | advisory-lock dirs older than 1h | not a deadlock (`withFileLock` steals at 30s) but evidence of a spawn or flush that died mid-critical-section |
|
|
303
|
-
|
|
304
|
-
**Report-only, always.** Every row names its own cleanup command in the
|
|
305
|
-
remediation block and mu runs none of them. An orphan or stranded dir
|
|
306
|
-
may hold the only copy of uncommitted work, so the decision is yours (or
|
|
307
|
-
your agent's) — a diagnostic that deleted checkouts because a readdir
|
|
308
|
-
raced a spawn would be a worse bug than the residue.
|
|
309
|
-
|
|
310
|
-
### Which workstreams can I tear down? (`housekeeping`)
|
|
311
|
-
|
|
312
|
-
`mu workstream list` prints row counts and no dates, so the workstream
|
|
313
|
-
you finished in June looks exactly like the one you worked on an hour
|
|
314
|
-
ago. The `housekeeping` section answers "what can go" — and splits it
|
|
315
|
-
in two, because one list would give actively bad advice:
|
|
316
|
-
|
|
317
|
-
| Bucket | Test | Advice |
|
|
318
|
-
| --- | --- | --- |
|
|
319
|
-
| **finished** | every task `CLOSED`, idle ≥ 14 days | safe to tear down; the remediation is the `teardown` command |
|
|
320
|
-
| **abandoned** | idle ≥ 60 days *with* unclosed tasks | look first; the remediation lists the open tasks, because those are the record of what was left to do |
|
|
321
|
-
|
|
322
|
-
The thresholds differ on purpose. A fortnight away from a project is a
|
|
323
|
-
holiday, not abandonment, so anything still holding open tasks has to be
|
|
324
|
-
cold for two months before it is mentioned at all. A closed-out
|
|
325
|
-
workstream is not suspicious — that is the success state — so it earns
|
|
326
|
-
its row by the work also being cold.
|
|
327
|
-
|
|
328
|
-
Excluded: the workstream you are in right now, `scratch` (ephemeral by
|
|
329
|
-
design), anything with a live agent or a registered workspace, and
|
|
330
|
-
task-less workstreams (those are `mu workstream teardown --empty`'s job,
|
|
331
|
-
which sweeps test litter — zero tasks, agents and workspaces — and never
|
|
332
|
-
matches a workstream with real history).
|
|
333
|
-
|
|
334
|
-
Neither bucket is a data-loss warning. Teardown removes **task rows and
|
|
335
|
-
notes — the plan, not the code**: no commit, branch or checkout is
|
|
336
|
-
touched, and `mu undo <group>` puts the rows back. (That claim holds
|
|
337
|
-
because this list excludes anything with a registered workspace;
|
|
338
|
-
teardown *does* free real checkouts when they exist.) The reason to look
|
|
339
|
-
before tearing down an abandoned workstream is that its unclosed tasks
|
|
340
|
-
are the only record of what was still outstanding — lose sight of them
|
|
341
|
-
and you re-derive that context from scratch later.
|
|
342
|
-
|
|
343
|
-
Severity is always `ok`: a tidy-up opportunity is not a fault, so this
|
|
344
|
-
section never makes `mu doctor` claim something needs attention.
|
|
345
|
-
Teardown is reversible — tombstone ops are written, so `mu undo <group>`
|
|
346
|
-
puts the rows back and `mu workstream list --torn-down` finds the group
|
|
347
|
-
months later.
|
|
348
|
-
|
|
349
|
-
`--disk` adds recursive byte accounting per checkout, with the orphan
|
|
350
|
-
share called out as reclaimable:
|
|
351
|
-
|
|
352
|
-
```
|
|
353
|
-
workspace bytes : 758M across 4 checkout(s) — 212M in orphan dirs
|
|
354
|
-
212M auth-peers/worker-2
|
|
355
|
-
212M auth-peers/worker-1
|
|
356
|
-
167M leanhl-runner/worker-1
|
|
357
|
-
167M leanhl-runner/worker-2
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
It is a separate flag because its cost scales with the size of your
|
|
361
|
-
checkouts rather than with mu's own state (~2s for 758M here), and
|
|
362
|
-
`mu doctor` has to stay cheap enough to run reflexively. The
|
|
363
|
-
reconciliation rows above always run: they are `readdir` + `stat` only,
|
|
364
|
-
depth 2, ~1ms.
|
|
365
|
-
|
|
366
|
-
**On drift**, `--deep` names the exact table, key and field:
|
|
367
|
-
|
|
368
|
-
```
|
|
369
|
-
ops log
|
|
370
|
-
drift : FAIL 1 divergence(s) (16ms)
|
|
371
|
-
tasks auth/build.title: live=TAMPERED log=Build auth module
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
Do not rebuild reflexively — which side is right depends on the cause.
|
|
375
|
-
In order:
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
mu db backup /tmp/mu-drift-evidence.db # 1. preserve the evidence
|
|
379
|
-
mu rebuild /tmp/mu-rebuilt.db # 2. materialize what the log believes
|
|
380
|
-
MU_DB_PATH=/tmp/mu-rebuilt.db mu sql "SELECT local_id, title FROM tasks" # 3. compare
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
Then report it: drift is a capture/apply bug, and the named
|
|
384
|
-
table/key/field is the reproduction. See
|
|
385
|
-
[§ What to do when drift is reported](#what-to-do-when-drift-is-reported).
|
|
386
|
-
|
|
387
|
-
### 0.6 Upgrading an older DB
|
|
388
|
-
|
|
389
|
-
`mu` refuses to open a pre-v11 DB (`SchemaTooOldError`, exit 4) or a DB
|
|
390
|
-
newer than it understands (`SchemaTooNewError`, exit 4) and leaves the
|
|
391
|
-
file alone. The retained `scripts/migrate.ts` sidecar auto-detects v7,
|
|
392
|
-
v8, v9, v10, or v11 and writes a fresh v11 DB. It never migrates in place.
|
|
393
|
-
Legacy `REJECTED` tasks become `CLOSED/rejected` and `DEFERRED` tasks
|
|
394
|
-
become `OPEN/parked`; their original op payloads remain unchanged.
|
|
395
|
-
Pre-1.0 archives restore as live workstreams under their original
|
|
396
|
-
`source_workstream` names unless you pass `--drop-archives`.
|
|
397
|
-
|
|
398
|
-
Full backup, migration, verification, and swap recipe:
|
|
399
|
-
[scripts/README.md](../scripts/README.md).
|
|
400
|
-
|
|
401
|
-
---
|
|
402
|
-
|
|
403
|
-
## 1. Setup
|
|
404
|
-
|
|
405
|
-
From npm (the common path):
|
|
406
|
-
|
|
407
|
-
```bash
|
|
408
|
-
npm install -g @mu-crew/mu
|
|
409
|
-
mu --version # → the current version
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
Update later via `npm install -g @mu-crew/mu@latest`.
|
|
413
|
-
|
|
414
|
-
From a local checkout (when hacking on mu itself):
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
npm install -g . # `prepare` script auto-builds; `mu` lands on $PATH
|
|
418
|
-
mu --version # → the current version (see package.json)
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
To update the source-installed copy: pull from upstream, then
|
|
422
|
-
`npm install -g .` from inside the checkout. The `prepare` script
|
|
423
|
-
rebuilds before linking the new dist/.
|
|
424
|
-
|
|
425
|
-
### Install the bundled skill
|
|
426
|
-
|
|
427
|
-
Mu ships a skill at `skills/mu/SKILL.md` that teaches the LLM running
|
|
428
|
-
inside an agent pane how to use mu. The canonical install path is the
|
|
429
|
-
[skills CLI](https://github.com/vercel-labs/skills), which auto-detects
|
|
430
|
-
every supported agent (pi, claude-code, codex, opencode, cursor, ...)
|
|
431
|
-
and installs into the right per-agent location:
|
|
432
|
-
|
|
433
|
-
```bash
|
|
434
|
-
npx skills add mu-crew/mu # interactive: pick scope + agents
|
|
435
|
-
npx skills add mu-crew/mu -g -y # global, no prompts (pi: ~/.pi/agent/skills/mu/)
|
|
436
|
-
npx skills update mu # later, to refresh
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
Hacking on the skill itself? Point the skills CLI at your checkout so
|
|
440
|
-
edits flow straight through:
|
|
441
|
-
|
|
442
|
-
```bash
|
|
443
|
-
npx skills add ./skills/mu # local-path source format (symlinks)
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
Without the skills CLI, the skill is just a directory with a
|
|
447
|
-
`SKILL.md` — symlink or copy it into the agent's skills dir. For pi:
|
|
448
|
-
`~/.pi/agent/skills/mu/` (global) or `.pi/skills/mu/` (per-project).
|
|
449
|
-
The cross-tool `~/.agents/skills/mu/` is picked up by pi and several
|
|
450
|
-
others:
|
|
451
|
-
|
|
452
|
-
```bash
|
|
453
|
-
# From an npm-global install
|
|
454
|
-
mkdir -p ~/.agents/skills
|
|
455
|
-
ln -sf "$(npm root -g)/@mu-crew/mu/skills/mu" ~/.agents/skills/mu
|
|
456
|
-
|
|
457
|
-
# Or from a checkout
|
|
458
|
-
ln -sf "$PWD/skills/mu" ~/.agents/skills/mu
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### For mu hackers: alias to the build output
|
|
462
|
-
|
|
463
|
-
Fastest iteration when hacking on mu itself:
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
npm install # deps only
|
|
467
|
-
npm run build # produces dist/
|
|
468
|
-
alias mu="node $PWD/dist/cli.js"
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
See [README.md § Install](../README.md#install) for the full set of
|
|
472
|
-
install patterns.
|
|
473
|
-
|
|
474
|
-
mu requires a terminal multiplexer. tmux ≥ 3.0 is the backend the rest
|
|
475
|
-
of this guide assumes; herdr also supports spawn, send, and read (see
|
|
476
|
-
[§ 20](#20-multiplexer-backends-tmux-and-herdr)). On tmux, install
|
|
477
|
-
murmur for runtime agent state. Make sure you're inside a session before
|
|
478
|
-
proceeding:
|
|
479
|
-
|
|
480
|
-
```bash
|
|
481
|
-
tmux # if you're not already in one
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
---
|
|
485
|
-
|
|
486
|
-
## 2. Get oriented
|
|
487
|
-
|
|
488
|
-
For a human at a terminal, bare `mu` is the home base: it launches the
|
|
489
|
-
read-only TUI with every workstream on the machine loaded as tabs.
|
|
490
|
-
Initial tab focus ladder: `$MU_SESSION` naming a loaded workstream →
|
|
491
|
-
current tmux session named `mu-<workstream>` → cwd inside a registered
|
|
492
|
-
workspace → cwd at the VCS-derived project root of any loaded
|
|
493
|
-
workstream (newest activity wins ties) → tab 0. With no workstream yet
|
|
494
|
-
it prints help plus the start command:
|
|
495
|
-
|
|
496
|
-
```bash
|
|
497
|
-
mu
|
|
498
|
-
# Get started: mu workstream init <name>
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
For scripts, agents, CI, and pipes, bare `mu` does NOT enter the TUI:
|
|
502
|
-
when stdout is not a TTY it prints `mu --help`. Use explicit typed
|
|
503
|
-
verbs and `--json` for the API surface:
|
|
504
|
-
|
|
505
|
-
```bash
|
|
506
|
-
mu state -w <workstream> --json
|
|
507
|
-
MU_NO_TUI=1 mu # force the non-TTY/help path even in a terminal
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
Run `mu doctor` to check tmux + DB health — full annotated output in
|
|
511
|
-
[§ 0.5 Something looks wrong](#05-something-looks-wrong). Three families
|
|
512
|
-
of checks are the ones to know.
|
|
513
|
-
|
|
514
|
-
**Mixed-fleet hazards** (the `fleet` section) — cheap, and every one is
|
|
515
|
-
something you can fix before it costs you data:
|
|
516
|
-
|
|
517
|
-
| Row | Means |
|
|
518
|
-
| --- | --- |
|
|
519
|
-
| `db-vs-sync` | **FAIL** if `MU_DB_PATH` is inside `MU_SYNC_DIR`. Never do this: a live WAL-mode SQLite DB is three files (`mu.db`, `-wal`, `-shm`) whose mutual consistency IS its durability, and a file-syncer copying them out of order — or resurrecting a peer's stale `-wal` — silently corrupts the database. mu syncs append-only per-machine **segments** so the DB file never has to travel. |
|
|
520
|
-
| `db-filesystem` | **WARN** if the DB is on NFS/SMB/sshfs. WAL needs working advisory locks and a shared-memory file; network mounts provide neither reliably. Symptom is `database is locked` with no contention, or corruption with it. |
|
|
521
|
-
| `name-case` | **WARN** if two workstream names differ only by case. They coexist on Linux but collide on macOS (APFS) and Windows, and a workstream name IS a tmux session name and seeds workspace paths — so a Mac joining the fleet sees one session where Linux sees two. |
|
|
522
|
-
|
|
523
|
-
**Disk↔DB reconciliation** (the `disk` section) — the state dir and the
|
|
524
|
-
database can disagree in both directions, and mu had no surface for
|
|
525
|
-
either before. Row-by-row table in
|
|
526
|
-
[§ 0.5](#05-something-looks-wrong); the short version is `ws-rows` for a
|
|
527
|
-
row whose directory is gone, `ws-dirs` for a directory with no row, and
|
|
528
|
-
`db-copies` / `exports` / `locks` for bytes nothing references. Always
|
|
529
|
-
report-only — the remediation block names the command, you or your agent
|
|
530
|
-
run it. `--disk` adds per-checkout byte usage.
|
|
531
|
-
|
|
532
|
-
**Ops-log drift** (the `ops log` section) — is the projection still
|
|
533
|
-
faithful to the log? Undo, sync and history are all
|
|
534
|
-
projections of the ops log, so a capture bug breaks all four at once,
|
|
535
|
-
silently. Two tiers:
|
|
536
|
-
|
|
537
|
-
```bash
|
|
538
|
-
mu doctor # shallow: every live row must have >=1 op. ~3ms.
|
|
539
|
-
mu doctor --deep # full rebuild + field-level diff. ~0.6ms per op.
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
The default is shallow so `mu doctor` stays reflexive; the deep check
|
|
543
|
-
rebuilds the whole log (~2.3s on a 1000-task DB). Shallow catches an
|
|
544
|
-
uncaptured INSERT or DELETE and is blind to an uncaptured UPDATE (the
|
|
545
|
-
row's key still has ops). Run `--deep` when you suspect something, in
|
|
546
|
-
CI, or before a release. Either tier exits **5** on drift.
|
|
547
|
-
|
|
548
|
-
### What to do when drift is reported
|
|
549
|
-
|
|
550
|
-
Drift names the exact table, key and field, e.g.:
|
|
551
|
-
|
|
552
|
-
```
|
|
553
|
-
drift : FAIL 2 divergence(s) (12ms)
|
|
554
|
-
tasks demo/a.title: live=TAMPERED log=A
|
|
555
|
-
tasks demo/a.impact: live=7 log=60
|
|
556
|
-
```
|
|
557
|
-
|
|
558
|
-
**Do not rebuild reflexively.** Drift means the log and the tables
|
|
559
|
-
disagree, and which side is right depends on the cause:
|
|
560
|
-
|
|
561
|
-
- If **capture** missed a mutation, the LIVE tables hold real work the
|
|
562
|
-
log never recorded — rebuilding would discard it.
|
|
563
|
-
- If **apply** is lossy, the log is authoritative and a rebuild fixes it.
|
|
564
|
-
|
|
565
|
-
So, in order:
|
|
566
|
-
|
|
567
|
-
```bash
|
|
568
|
-
mu db backup /tmp/mu-drift-evidence.db # 1. preserve the evidence FIRST
|
|
569
|
-
mu rebuild /tmp/mu-rebuilt.db # 2. materialize what the log believes
|
|
570
|
-
# 3. compare the named keys in both files and decide which side is correct:
|
|
571
|
-
MU_DB_PATH=/tmp/mu-rebuilt.db mu sql "SELECT local_id, title, impact FROM tasks"
|
|
572
|
-
```
|
|
573
|
-
|
|
574
|
-
Then report it. Drift is a capture/apply **bug**, not operator error, and
|
|
575
|
-
the named table/key/field is the reproduction.
|
|
576
|
-
|
|
577
|
-
### Undoing one action (`mu undo`)
|
|
578
|
-
|
|
579
|
-
Undo emits **inverse ops** for one **group** (one user-visible action).
|
|
580
|
-
|
|
581
|
-
```bash
|
|
582
|
-
mu undo # what would I undo? lists recent groups + ids
|
|
583
|
-
mu undo 1a2a94eb # preview the inverse (dry run)
|
|
584
|
-
mu undo 1a2a94eb --yes # apply it
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
Three properties:
|
|
588
|
-
|
|
589
|
-
- **Granular.** Only the rows that action touched. A cascade close wrote
|
|
590
|
-
N task ops under one group, so undoing it reopens exactly those N.
|
|
591
|
-
- **Itself an op.** The undo lands in its own group, so it syncs to peers
|
|
592
|
-
and is **itself undoable** — that is redo:
|
|
593
|
-
`mu undo <the-undo-group> --yes`.
|
|
594
|
-
- **Refuses to clobber newer work.** If a later action changed the same
|
|
595
|
-
fields, undo exits 4 and names the conflict:
|
|
596
|
-
|
|
597
|
-
```
|
|
598
|
-
WARNING: this group has been SUPERSEDED by later work.
|
|
599
|
-
demo/a: impact was changed since by e04df0d5 (task.update)
|
|
600
|
-
Undoing would DISCARD that newer work. Pass --force with --yes to do it anyway.
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
`--force` is the override, and it says what it destroys.
|
|
604
|
-
|
|
605
|
-
Rows only: undo does not resurrect killed tmux panes or freed workspace
|
|
606
|
-
directories. For whole-DB recovery from the log, use `mu rebuild <file>`.
|
|
607
|
-
|
|
608
|
-
Get the full command list:
|
|
609
|
-
|
|
610
|
-
```bash
|
|
611
|
-
mu --help
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
Every verb's `--help` is exhaustive (flags, defaults,
|
|
615
|
-
interactions). Every successful invocation also prints a dim
|
|
616
|
-
`Next:` block of suggested follow-up commands at the bottom —
|
|
617
|
-
you never have to leave the terminal to learn what to do next.
|
|
618
|
-
|
|
619
|
-
Every verb accepts `--json` for machine-readable output. Errors
|
|
620
|
-
in `--json` mode emit a `{ error, message, nextSteps, exitCode }`
|
|
621
|
-
record to stderr; the `nextSteps` array carries resolutions you can
|
|
622
|
-
`eval` directly.
|
|
623
|
-
|
|
624
|
-
### CLI conventions: validation errors
|
|
625
|
-
|
|
626
|
-
Every operator-error path — missing required option, unknown option,
|
|
627
|
-
unknown subcommand, missing positional, type-coercion failure, mutex
|
|
628
|
-
flags, range checks — produces a uniform surface:
|
|
629
|
-
|
|
630
|
-
- **Human path**: red `error: <msg>` on stderr, then the failing
|
|
631
|
-
subcommand's `--help` block (same text as `mu <verb> --help`),
|
|
632
|
-
then exit **2**.
|
|
633
|
-
- **`--json` path**: a structured envelope on stderr:
|
|
634
|
-
|
|
635
|
-
```json
|
|
636
|
-
{
|
|
637
|
-
"error": "UsageError",
|
|
638
|
-
"message": "--self and --for are mutually exclusive",
|
|
639
|
-
"nextSteps": [],
|
|
640
|
-
"exitCode": 2,
|
|
641
|
-
"usage": {
|
|
642
|
-
"command": "mu task claim",
|
|
643
|
-
"synopsis": "mu task claim [options] <id>",
|
|
644
|
-
"description": "...",
|
|
645
|
-
"args": [{"name": "id", "required": true, "variadic": false, "description": ""}],
|
|
646
|
-
"options": [{"flags": "--self", "description": "...", "mandatory": false, "valueRequired": false}, ...]
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
```
|
|
650
|
-
|
|
651
|
-
`usage.options[].mandatory` is `true` when the operator MUST pass
|
|
652
|
-
the option (`.requiredOption()` in commander terms). `valueRequired`
|
|
653
|
-
is `true` when the option's argument can't be omitted if the flag
|
|
654
|
-
IS passed (`<value>` form vs bare flag). The two are independent.
|
|
655
|
-
|
|
656
|
-
Exit 2 is the consistent code for the whole operator-error class —
|
|
657
|
-
commander mistakes and handler-thrown `UsageError`s alike. Other
|
|
658
|
-
classes keep their own codes (3 = not found, 4 = conflict, 5 =
|
|
659
|
-
substrate, 6 = reaper, 7 = stall).
|
|
660
|
-
|
|
661
|
-
### CLI conventions: `--json` collection envelope
|
|
662
|
-
|
|
663
|
-
Collection-read verbs emit a canonical `{items: T[], count: number}`
|
|
664
|
-
shape on stdout:
|
|
665
|
-
|
|
666
|
-
```bash
|
|
667
|
-
$ mu task list -w foo --json
|
|
668
|
-
{"items":[{"name":"a",...},{"name":"b",...}],"count":2}
|
|
669
|
-
```
|
|
670
|
-
|
|
671
|
-
`count` is `items.length` pre-computed so `jq '.count'` is one less hop
|
|
672
|
-
than `jq '.items | length'`. `mu workspace commits --json` adds `vcs`,
|
|
673
|
-
`baseRef`, and `workspacePath` siblings.
|
|
674
|
-
|
|
675
|
-
Applies to: `mu task list / next / owned-by / notes`,
|
|
676
|
-
`mu workstream list`, `mu workstream teardown --empty` (dry-run),
|
|
677
|
-
`mu workspace list / orphans / commits`,
|
|
678
|
-
`mu undo` (group list), `mu log -n N` (read).
|
|
679
|
-
|
|
680
|
-
Two carve-outs:
|
|
681
|
-
- **`mu sql --json`** keeps bare-array rows. The verb is the typed-
|
|
682
|
-
escape hatch; row shape is per-query, not part of the typed
|
|
683
|
-
contract.
|
|
684
|
-
- **`mu log --tail --json`** emits NDJSON (one JSON object per line)
|
|
685
|
-
because it's a stream, not a collection. Stream consumers want one
|
|
686
|
-
envelope per row, not a single envelope that grows forever.
|
|
687
|
-
|
|
688
|
-
Singleton verbs (`mu task show`, `mu agent show`, `mu workstream init`,
|
|
689
|
-
`mu task close`, ...) use object envelopes with named top-level fields
|
|
690
|
-
(`{task, blockers, dependents, notes}`, `{taskName, ..., nextSteps}`).
|
|
691
|
-
`items + count` is for collection reads only.
|
|
692
|
-
|
|
693
|
-
### CLI conventions: multi-value flags
|
|
694
|
-
|
|
695
|
-
Multi-value flags accept repeated invocations
|
|
696
|
-
(`--blocked-by a --blocked-by b`), a comma-separated value
|
|
697
|
-
(`--blocked-by a,b`), or any mix. The signal is `<value...>` in the
|
|
698
|
-
help-text metavar. Variadic positionals (`mu task wait a b c`) stay
|
|
699
|
-
space-separated — operands are not commas, and single-valued flags
|
|
700
|
-
(`-w`, `--title`) stay single.
|
|
701
|
-
|
|
702
|
-
- `--by` on `mu task block` / `mu task unblock` is multi-value:
|
|
703
|
-
`mu task block c --by a,b` adds both edges in one call.
|
|
704
|
-
- `--status` on `mu task list` / `mu task next` is multi-value and
|
|
705
|
-
returns the union. Omitting it applies no filter.
|
|
706
|
-
- `mu task wait --status` stays single — "wait until reaches THIS
|
|
707
|
-
status".
|
|
708
|
-
|
|
709
|
-
**Empty vs blank fragments.** An *empty* fragment is dropped: a
|
|
710
|
-
trailing or doubled comma is a typing artifact, so `--status "OPEN,"`
|
|
711
|
-
means `[OPEN]`, and `mu task reparent --blocked-by ''` is the
|
|
712
|
-
documented "clear every blocker" sentinel. A *blank* fragment — one
|
|
713
|
-
that is entirely whitespace, like `--status " "` or the tail of
|
|
714
|
-
`--status "OPEN, "` — is a usage error (exit 2) naming the flag. Nobody
|
|
715
|
-
means "filter by the space character", and dropping it silently would
|
|
716
|
-
return a different answer than the one typed. Same rule for `-w`,
|
|
717
|
-
`--by`, and `--blocked-by`; see docs/VOCABULARY.md § Empty vs blank
|
|
718
|
-
flag fragments.
|
|
719
|
-
|
|
720
|
-
### CLI conventions: flag vs positional
|
|
721
|
-
|
|
722
|
-
The rule the CLI follows:
|
|
723
|
-
|
|
724
|
-
> **The primary entity a verb acts on is POSITIONAL. Everything
|
|
725
|
-
> else — scoping, modifiers, payload — is a flag.**
|
|
726
|
-
|
|
727
|
-
So `mu task close <id>`, `mu agent send <name> <text>`,
|
|
728
|
-
`mu workstream init <name>`. The workstream
|
|
729
|
-
is a *scope* for most verbs (`-w`) — but for `mu workstream <verb>` it
|
|
730
|
-
IS the primary entity, so it may be positional:
|
|
731
|
-
|
|
732
|
-
```bash
|
|
733
|
-
mu workstream init v2 # positional
|
|
734
|
-
mu workstream teardown v2 --yes # positional (aliases -w)
|
|
735
|
-
mu workstream teardown -w v2 --yes # -w still works
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
Passing both a positional and a disagreeing `-w` is a usage error
|
|
739
|
-
(exit 2), not a silent pick-one.
|
|
740
|
-
|
|
741
|
-
Where sibling verbs supply a payload two ways, the flag form is an
|
|
742
|
-
ADDITIVE alias so muscle memory carries across:
|
|
743
|
-
|
|
744
|
-
```bash
|
|
745
|
-
mu task add t -t T -i 5 -e 1 --note "context" # note as a flag
|
|
746
|
-
mu task note t "more context" # positional
|
|
747
|
-
mu task note t --text "more context" # --text alias
|
|
748
|
-
```
|
|
749
|
-
|
|
750
|
-
Supplying both shapes at once is a usage error (exit 2).
|
|
751
|
-
|
|
752
|
-
---
|
|
753
|
-
|
|
754
|
-
## 3. Create a workstream
|
|
755
|
-
|
|
756
|
-
A **workstream** is mu's unit of organization. One workstream = one
|
|
757
|
-
tmux session = one logical project. Multiple workstreams on the same
|
|
758
|
-
machine are isolated (partitioned in the SQLite registry by
|
|
759
|
-
`session_id`); they never see each other's agents.
|
|
760
|
-
|
|
761
|
-
```bash
|
|
762
|
-
mu workstream init auth-refactor
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
```
|
|
766
|
-
Created workstream auth-refactor (mux session mu-auth-refactor)
|
|
767
|
-
Next:
|
|
768
|
-
Attach the session : tmux attach -t mu-auth-refactor
|
|
769
|
-
Plan tasks : mu task add -w auth-refactor --title "..." --impact 50 --effort-days 1
|
|
770
|
-
Spawn an agent : mu agent spawn <name> -w auth-refactor
|
|
771
|
-
See state : mu state -w auth-refactor
|
|
772
|
-
```
|
|
773
|
-
|
|
774
|
-
Behind the scenes: `tmux new-session -d -s mu-auth-refactor` plus a
|
|
775
|
-
placeholder window so the session is non-empty. It sits detached,
|
|
776
|
-
waiting for agents.
|
|
777
|
-
|
|
778
|
-
To see what's already on the machine before picking a name:
|
|
779
|
-
|
|
780
|
-
```bash
|
|
781
|
-
mu workstream list
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
```
|
|
785
|
-
┌────────────────────────────────────────┬───────┬────────┬───────┬───────┬───────┐
|
|
786
|
-
│ name │ tmux │ agents │ tasks │ edges │ notes │
|
|
787
|
-
├────────────────────────────────────────┼───────┼────────┼───────┼───────┼───────┤
|
|
788
|
-
│ auth │ — │ 0 │ 2 │ 1 │ 0 │
|
|
789
|
-
├────────────────────────────────────────┼───────┼────────┼───────┼───────┼───────┤
|
|
790
|
-
│ mu │ alive │ 0 │ 0 │ 0 │ 0 │
|
|
791
|
-
└────────────────────────────────────────┴───────┴────────┴───────┴───────┴───────┘
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
The list is the **union** of three sources: distinct workstreams in
|
|
795
|
-
`agents`, in `tasks`, and tmux sessions matching `mu-*`. A freshly
|
|
796
|
-
`init`'d workstream with no tasks shows up via its session; one whose
|
|
797
|
-
session was killed externally shows up via its surviving DB rows, so
|
|
798
|
-
you can still `mu workstream teardown` it.
|
|
799
|
-
|
|
800
|
-
### How mu finds your active workstream
|
|
801
|
-
|
|
802
|
-
Every command after `init` needs to know which workstream you're in.
|
|
803
|
-
Resolution order, first match wins:
|
|
804
|
-
|
|
805
|
-
1. **`--workstream <name>` flag** explicitly
|
|
806
|
-
2. **`MU_SESSION` env var** (`export MU_SESSION=auth-refactor`)
|
|
807
|
-
3. **Current tmux session name** (mu reads `tmux display-message -p '#S'` and strips the `mu-` prefix)
|
|
808
|
-
4. Error if none of the above
|
|
809
|
-
|
|
810
|
-
The third option is the most ergonomic. Once you `tmux attach -t
|
|
811
|
-
mu-auth-refactor`, every command "just works" without flags.
|
|
812
|
-
|
|
813
|
-
### Off-the-cuff agents: the `scratch` workstream
|
|
814
|
-
|
|
815
|
-
When you just want one helper agent you can keep talking to — not a
|
|
816
|
-
crew, not a task DAG, not per-agent workspaces — skip the `init` step
|
|
817
|
-
entirely and spawn into the reserved `scratch` workstream:
|
|
818
|
-
|
|
819
|
-
```bash
|
|
820
|
-
mu agent spawn helper -w scratch # auto-creates mu-scratch
|
|
821
|
-
mu agent send helper 'Investigate the failing test in foo.spec.ts'
|
|
822
|
-
mu agent read helper -n 50 # check on it anytime
|
|
823
|
-
mu agent close helper -w scratch # done
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
`scratch` is a shared, ephemeral bucket: it auto-creates on first
|
|
827
|
-
spawn, tasks are optional, and idle scratch agents get a staleness
|
|
828
|
-
nudge in `mu state` and the TUI so they don't pile up. The name is
|
|
829
|
-
**reserved** — `mu workstream init scratch` is rejected;
|
|
830
|
-
`mu workstream teardown scratch` works normally.
|
|
831
|
-
|
|
832
|
-
```
|
|
833
|
-
$ mu workstream init scratch
|
|
834
|
-
error: workstream name "scratch" is reserved: it is the off-the-cuff bucket and auto-creates on first spawn. Don't 'init' it.
|
|
835
|
-
Next:
|
|
836
|
-
Just spawn into it (auto-creates) : mu agent spawn <name> -w scratch
|
|
837
|
-
Use a durable workstream instead : mu workstream init <name>
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
**When to use which:** `mu workstream init <name>` the moment
|
|
841
|
-
coordination *is* the work — multiple agents, dependencies, gated
|
|
842
|
-
review. `scratch` for a single driveable helper.
|
|
843
|
-
[`pi-subagents`](https://github.com/nicobailon/pi-subagents) when you
|
|
844
|
-
only need a one-shot result back.
|
|
845
|
-
|
|
846
|
-
### The log ledger: durable watcher dedupe + memory
|
|
847
|
-
|
|
848
|
-
A watcher loop reacting to external state — a PR's CI status, a queue
|
|
849
|
-
depth, a file's mtime — must remember *what it last saw* so it doesn't
|
|
850
|
-
act twice. Don't keep that in the agent's chat context: it evaporates
|
|
851
|
-
on compaction and dies with the loop. Use a custom `--kind` tag on the
|
|
852
|
-
activity log as an append-only **ledger**:
|
|
853
|
-
|
|
854
|
-
```bash
|
|
855
|
-
# Watcher tick: record what you saw and what you did about it.
|
|
856
|
-
mu log -w scratch --kind pr-state 'pr=1234 sha=abc ci=red -> spawned fixer-1'
|
|
857
|
-
|
|
858
|
-
# Next tick: reconstruct the last-seen state (latest entry of that kind).
|
|
859
|
-
mu log -w scratch --kind pr-state -n 1 --json
|
|
860
|
-
# {"items":[{"seq":8695,...,"kind":"pr-state",
|
|
861
|
-
# "payload":"pr=1234 sha=abc ci=red -> spawned fixer-1"}],"count":1}
|
|
862
|
-
```
|
|
863
|
-
|
|
864
|
-
The dedupe rule: read the latest `pr-state`, compare its `sha`/`ci` to
|
|
865
|
-
what you observed, act only on a difference. The ledger lives in the
|
|
866
|
-
`ops` log, so it survives loop death and context compaction.
|
|
867
|
-
|
|
868
|
-
- **Pick a stable `--kind`** per ledger (`pr-state`, `queue-depth`).
|
|
869
|
-
`mu log --kind <tag>` filters to it, so ledgers coexist in one
|
|
870
|
-
workstream.
|
|
871
|
-
- **One line per tick, latest wins.** `-n 1` for the most recent;
|
|
872
|
-
`--since <seq>` replays history a dead watcher missed.
|
|
873
|
-
- **Free-form payload.** mu doesn't parse it. Ledger lines have no
|
|
874
|
-
**intent**, so `mu log` prints them verbatim rather than rendering
|
|
875
|
-
them as a verb.
|
|
876
|
-
|
|
877
|
-
A *convention*, not a feature — `mu log` already has `--kind`,
|
|
878
|
-
`--since`, and `--json`. See **log ledger** in
|
|
879
|
-
[VOCABULARY.md](VOCABULARY.md).
|
|
880
|
-
|
|
881
|
-
`--kind` is the operator's channel tag; `--intent` filters on what *mu*
|
|
882
|
-
recorded (`--intent task.close`). Two axes, two flags.
|
|
883
|
-
|
|
884
|
-
---
|
|
885
|
-
|
|
886
|
-
## 4. Plan some work as a DAG
|
|
887
|
-
|
|
888
|
-
Tasks have **mandatory** `impact` (1–100) and `effort-days` (>0).
|
|
889
|
-
Edges are blocks-relationships, expressed as **`--blocked-by`** on
|
|
890
|
-
`mu task add` (and `mu task reparent`): `--blocked-by design` means
|
|
891
|
-
"can't start until `design` closes". Tasks are **scoped to a
|
|
892
|
-
workstream**.
|
|
893
|
-
|
|
894
|
-
```bash
|
|
895
|
-
# -w can be omitted inside the workstream's tmux session, or with
|
|
896
|
-
# $MU_SESSION exported.
|
|
897
|
-
mu task add design -w auth-refactor --title "Design auth module" --impact 80 --effort-days 2
|
|
898
|
-
mu task add build -w auth-refactor --title "Build auth module" --impact 80 --effort-days 5 --blocked-by design
|
|
899
|
-
mu task add review -w auth-refactor --title "Review auth module" --impact 60 --effort-days 1 --blocked-by build
|
|
900
|
-
```
|
|
901
|
-
|
|
902
|
-
See [§ 0.1](#01-first-5-minutes) for the output. Add initial context at
|
|
903
|
-
creation time with `--note` (shell escapes like `\n` are translated as
|
|
904
|
-
in `mu task note`); `--note-author <name>` overrides the actor label:
|
|
905
|
-
|
|
906
|
-
```bash
|
|
907
|
-
mu task add bugfix \
|
|
908
|
-
--workstream auth-refactor \
|
|
909
|
-
--title "Fix token refresh race" \
|
|
910
|
-
--impact 70 --effort-days 1 \
|
|
911
|
-
--note 'REPRO: login, wait 24h, refresh\nSCOPE: auth refresh only' \
|
|
912
|
-
--note-author orchestrator
|
|
913
|
-
```
|
|
914
|
-
|
|
915
|
-
Task creation + the initial note are one transaction: if either part
|
|
916
|
-
fails, neither lands.
|
|
917
|
-
|
|
918
|
-
Ids validate against `/^[a-z][a-z0-9_-]{0,63}$/` and reject duplicates.
|
|
919
|
-
`mu task add x --blocked-by y` when `y` already transitively depends on
|
|
920
|
-
`x` refuses with a `CycleError`.
|
|
921
|
-
|
|
922
|
-
**Task ids are per-workstream unique.** Cross-workstream references use
|
|
923
|
-
the qualified form `<workstream>/<id>`. Blocks-edges are always
|
|
924
|
-
same-workstream — a blocker outside the target workstream is a
|
|
925
|
-
`CrossWorkstreamEdgeError`.
|
|
926
|
-
|
|
927
|
-
### Modeling external dependencies
|
|
928
|
-
|
|
929
|
-
When a task is waiting on something outside this repo (an upstream PR
|
|
930
|
-
shipping, a vendor releasing v3 of an API, a coworker's review), don't
|
|
931
|
-
reach for a new status — add a **placeholder task** for the external
|
|
932
|
-
thing and `--blocked-by` it. The DAG already encodes "blocked":
|
|
933
|
-
|
|
934
|
-
```bash
|
|
935
|
-
mu task add upstream_react_19_lands -w gchatui-node \
|
|
936
|
-
--title "Wait for React 19 release (vendor)" \
|
|
937
|
-
--impact 30 --effort-days 0.1
|
|
938
|
-
mu task note upstream_react_19_lands -w gchatui-node \
|
|
939
|
-
"Tracking https://github.com/facebook/react/issues/...
|
|
940
|
-
Last checked: 2026-05-15.
|
|
941
|
-
When this lands: bump react in package.json + re-run upgrade tasks."
|
|
942
|
-
|
|
943
|
-
mu task add migrate_to_use_action -w gchatui-node \
|
|
944
|
-
--title "Migrate ChatInput to React 19 useActionState" \
|
|
945
|
-
--impact 60 --effort-days 1 \
|
|
946
|
-
--blocked-by upstream_react_19_lands
|
|
947
|
-
```
|
|
948
|
-
|
|
949
|
-
When the upstream lands, `mu task close upstream_react_19_lands
|
|
950
|
-
--evidence "shipped 2026-08-12"` — the dependent flips from blocked
|
|
951
|
-
to ready in the same render. If the upstream gets cancelled, close the
|
|
952
|
-
placeholder anyway (`mu task close upstream_react_19_lands --evidence
|
|
953
|
-
"cancelled, won't ship"`) and note the reason on each dependent, or
|
|
954
|
-
`mu task delete` the placeholder and its dependents' edges if the work
|
|
955
|
-
is truly abandoned.
|
|
956
|
-
|
|
957
|
-
Why this beats a `BLOCKED` status: the placeholder's notes are the
|
|
958
|
-
audit trail, one placeholder blocks N downstream tasks, and the
|
|
959
|
-
placeholder's own status carries the detail (`OPEN` = someone external
|
|
960
|
-
is on it, a note records a parked reason, `IN_PROGRESS` = you're
|
|
961
|
-
chasing it).
|
|
962
|
-
|
|
963
|
-
---
|
|
964
|
-
|
|
965
|
-
## 5. See the graph (dashboard + state API)
|
|
966
|
-
|
|
967
|
-
`mu` exposes one logical "what's going on?" view with two renderers:
|
|
968
|
-
|
|
969
|
-
| Surface | Use it for |
|
|
970
|
-
| -------------------- | --------------------------------------------------------------- |
|
|
971
|
-
| **bare `mu`** | A human at a terminal — launches the interactive TUI dashboard. |
|
|
972
|
-
| **`mu state --tui`** | Same TUI, explicitly opt-in. Useful in scripts / aliases. |
|
|
973
|
-
| **`mu state`** | Static text card. JSON-friendly; pipeable; `watch`-able. |
|
|
974
|
-
| **`mu state --json`** | The canonical full snapshot. Agents and scripts read this. |
|
|
975
|
-
|
|
976
|
-
The interactive surface has its own section:
|
|
977
|
-
[§ 5b. The TUI dashboard](#5b-the-tui-dashboard-interactive), below.
|
|
978
|
-
The rest of this section is the static / JSON contract.
|
|
979
|
-
|
|
980
|
-
### Static state card (`mu state`)
|
|
981
|
-
|
|
982
|
-
For an agent/script or a static capture, use explicit `mu state`:
|
|
983
|
-
|
|
984
|
-
```bash
|
|
985
|
-
mu state -w auth-refactor # human-readable card
|
|
986
|
-
mu state -w auth-refactor --json # full snapshot
|
|
987
|
-
mu state --all --json # every workstream on this machine
|
|
988
|
-
```
|
|
989
|
-
|
|
990
|
-
The static card carries every section the TUI cards summarize: agents +
|
|
991
|
-
orphans + tracks + ready / in-progress / blocked / recent-closed tasks
|
|
992
|
-
+ workspaces + recent events. It also lists **remote workers** recorded by
|
|
993
|
-
exact `REMOTE: <host>:<path>` task-note lines; malformed lines and prose that
|
|
994
|
-
merely mentions `REMOTE:` are ignored.
|
|
995
|
-
|
|
996
|
-
**JSON shapes**
|
|
997
|
-
|
|
998
|
-
- single-ws: flat `{ workstreamName, agents, orphans, tracks, ready,
|
|
999
|
-
blocked, inProgress, recentClosed, workspaces, remoteWorkers, recent }`.
|
|
1000
|
-
- multi-ws: wrapped `{ workstreams: [{...}, ...] }`.
|
|
1001
|
-
- bare `mu --json` prints `--help`; use `mu state --json`.
|
|
1002
|
-
- `--tui` is render-only and incompatible with `--json`.
|
|
1003
|
-
|
|
1004
|
-
**Multi-workstream**: repeat `-w`, or `--all`. In static mode N≥2
|
|
1005
|
-
stacks one card per workstream.
|
|
1006
|
-
|
|
1007
|
-
`tmux display-popup -E 'mu state -w X'` works for popup-card use.
|
|
1008
|
-
|
|
1009
|
-
---
|
|
1010
|
-
|
|
1011
|
-
## 5b. The TUI dashboard (interactive)
|
|
1012
|
-
|
|
1013
|
-
The interactive TUI is mu's human surface. It is **read-only** —
|
|
1014
|
-
every act-intent `y`anks the canonical `mu` command to
|
|
1015
|
-
your clipboard so you run mutations from your shell, with one
|
|
1016
|
-
documented escape (`t` in git-show drills runs `tuicr` in the project
|
|
1017
|
-
root, see below).
|
|
1018
|
-
|
|
1019
|
-
### Launch
|
|
1020
|
-
|
|
1021
|
-
```bash
|
|
1022
|
-
mu # bare; opens the TUI when stdout is a TTY
|
|
1023
|
-
mu state --tui # explicit; same surface
|
|
1024
|
-
mu state --tui -w a,b # restrict to specific workstreams
|
|
1025
|
-
mu state --tui --all # all workstreams (default for bare `mu`)
|
|
1026
|
-
MU_NO_TUI=1 mu # force the help path even in a TTY
|
|
1027
|
-
mu --json # also forces help; pipe `mu state --json`
|
|
1028
|
-
```
|
|
1029
|
-
|
|
1030
|
-
Quit with `q` or `Ctrl-C`. The dashboard restores your scrollback
|
|
1031
|
-
on exit (alt-screen).
|
|
1032
|
-
|
|
1033
|
-
**Initial active tab** is picked from this ladder:
|
|
1034
|
-
`$MU_SESSION` → current tmux session name (`mu-<ws>`) → cwd inside a
|
|
1035
|
-
registered workspace → cwd at the VCS-derived project root of any
|
|
1036
|
-
workstream (newest activity wins ties) → tab 0.
|
|
1037
|
-
|
|
1038
|
-
### Layout: 10 cards, responsive columns
|
|
1039
|
-
|
|
1040
|
-
The dashboard renders 10 toggleable cards with rounded borders and
|
|
1041
|
-
section headers inset into the top border line (lazygit / btop / k9s
|
|
1042
|
-
convention):
|
|
1043
|
-
|
|
1044
|
-
| Slot | Card | Toggle | Popup | Content |
|
|
1045
|
-
| ---- | ------------- | ------ | --------- | ---------------------------------------------------- |
|
|
1046
|
-
| 0 | Commits | `0` | `Shift+0` | Recent project-root commits (git / jj / sl) |
|
|
1047
|
-
| 1 | Agents | `1` | `Shift+1` | Active agents + runtime state + cli + role |
|
|
1048
|
-
| 2 | Tracks | `2` | `Shift+2` | Parallel tracks (union-find clusters) |
|
|
1049
|
-
| 3 | Ready (Tasks) | `3` | `Shift+3` | Ready-to-claim tasks (no open blockers) |
|
|
1050
|
-
| 4 | Activity log | `4` | `Shift+4` | Recent ops rendered as prose |
|
|
1051
|
-
| 5 | Workspaces | `5` | `Shift+5` | Per-agent VCS workspaces + behind/dirty status |
|
|
1052
|
-
| 6 | In-progress | `6` | `Shift+6` | IN_PROGRESS tasks owned by agents |
|
|
1053
|
-
| 7 | Blocked | `7` | `Shift+7` | Tasks with at least one open blocker |
|
|
1054
|
-
| 8 | Recent | `8` | `Shift+8` | Recently CLOSED tasks |
|
|
1055
|
-
| 9 | Doctor | `9` | `Shift+9` | Cheap health checks (schema, ghosts, orphans, …) |
|
|
1056
|
-
| — | DAG | — | `g` | Full task DAG forest (keybind-only) |
|
|
1057
|
-
| — | All tasks | — | `t` | Sortable / filterable list of every task |
|
|
1058
|
-
|
|
1059
|
-
Digit toggles HIDE / SHOW the card on the dashboard; `Shift+digit`
|
|
1060
|
-
opens the matching fullscreen popup. **Single-popup invariant**: only
|
|
1061
|
-
one popup is visible at a time; `Esc` / `q` returns to the dashboard
|
|
1062
|
-
with all toggles + tick rate preserved.
|
|
1063
|
-
|
|
1064
|
-
**Responsive layout**: cards stack below 120 cols, then reflow into
|
|
1065
|
-
pair-aware 2 / 3 / 4-column layouts at 120 / 180 / 240 cols. Each
|
|
1066
|
-
visible card gets a dynamic row budget so a noisy list cannot crowd
|
|
1067
|
-
out its siblings; overflow shows as `+N more · Shift+N` inset into
|
|
1068
|
-
the bottom border. On short panes the dashboard culls low-priority
|
|
1069
|
-
cards (Doctor → Recent → Workspaces → …) and shows
|
|
1070
|
-
`+N cards hidden · resize taller`.
|
|
1071
|
-
|
|
1072
|
-
Ordering is slot-stable: within each column, non-stream cards go by
|
|
1073
|
-
toggle digit ascending; stream cards (Commits, Activity log) trail,
|
|
1074
|
-
with slot 0 last.
|
|
1075
|
-
|
|
1076
|
-
### Multi-workstream tabs
|
|
1077
|
-
|
|
1078
|
-
With N≥2 workstreams (bare `mu` on a multi-workstream machine, or
|
|
1079
|
-
`mu state --tui -w a,b,c`), a tab strip renders above the cards:
|
|
1080
|
-
|
|
1081
|
-
```
|
|
1082
|
-
workstreams: ▸ auth-refactor · ui-rewrite · demo (Tab / Shift-Tab)
|
|
1083
|
-
```
|
|
1084
|
-
|
|
1085
|
-
- `Tab` cycles forward, `Shift-Tab` backward (suppressed inside popups
|
|
1086
|
-
that bind the key locally).
|
|
1087
|
-
- The active tab name shows in the status bar next to the tick rate.
|
|
1088
|
-
- Cards / popups operate on the active tab — no per-row workstream
|
|
1089
|
-
column. For N=1 the strip renders nothing.
|
|
1090
|
-
- Wider than the terminal: the strip windows around the active tab and
|
|
1091
|
-
shows `‹N` / `›N` counters for hidden workstreams.
|
|
1092
|
-
- `*` prefix (e.g. `*scratch`) marks the ephemeral `scratch` bucket.
|
|
1093
|
-
- If a loaded workstream is torn down while the TUI runs, its launch-time tab
|
|
1094
|
-
remains in place but appears dimmed with strikethrough. This also surfaces the
|
|
1095
|
-
otherwise hidden tab in a single-workstream TUI. Recreating the same name
|
|
1096
|
-
restores the tab on the next fast tick.
|
|
1097
|
-
|
|
1098
|
-
### Popup drills
|
|
1099
|
-
|
|
1100
|
-
`Enter` in any list popup drills into the focused row. Where the
|
|
1101
|
-
row is itself an entity (a task), a further `Enter` chains into the
|
|
1102
|
-
shared read-only task-detail leaf (notes timeline):
|
|
1103
|
-
|
|
1104
|
-
- **Tracks popup (`Shift+2`)**: list of tracks → `Enter` opens the
|
|
1105
|
-
track's task list → `Enter` opens that task's notes timeline.
|
|
1106
|
-
- **Ready / In-progress / Blocked / Recent / All-tasks**:
|
|
1107
|
-
list of tasks → `Enter` opens notes; `y` yanks `mu task show <id>`
|
|
1108
|
-
(or `mu task claim` / `mu task close` / `mu task tree` depending
|
|
1109
|
-
on popup).
|
|
1110
|
-
- **Activity log popup (`Shift+4`)**: list of events → `Enter`
|
|
1111
|
-
drills into the full untruncated payload of the focused event;
|
|
1112
|
-
`y` yanks `mu log --since <seq-1> -n 1 -w <ws>`.
|
|
1113
|
-
- **Workspaces popup (`Shift+5`)**: list of workspaces → `Enter`
|
|
1114
|
-
opens the commits-since-fork list → `Enter` on a commit opens
|
|
1115
|
-
the inline `git show <sha> --stat -p` view; `y` yanks `git show
|
|
1116
|
-
<sha>`; `t` launches `tuicr -r <sha>`.
|
|
1117
|
-
- **Commits popup (`Shift+0`)**: project-root recent commits →
|
|
1118
|
-
`Enter` opens the backend's show view; `y` yanks the show
|
|
1119
|
-
command; `t` launches `tuicr`.
|
|
1120
|
-
- **Doctor popup (`Shift+9`)**: list of checks → `Enter` opens
|
|
1121
|
-
the remediation paragraph for the focused check.
|
|
1122
|
-
- **DAG popup (`g`)**: keybind-only; renders the active workstream's
|
|
1123
|
-
full task DAG forest (one ASCII subtree per root, diamond-collapse
|
|
1124
|
-
marker on repeated nodes).
|
|
1125
|
-
|
|
1126
|
-
One `Esc` / `q` backs out per recursion level. Drills auto-refresh in
|
|
1127
|
-
step with the dashboard tick (fast 1s for SQL bodies like notes, slow
|
|
1128
|
-
10s for subprocess git-show / scrollback). Scroll position survives
|
|
1129
|
-
refreshes, and subprocess loaders keep the prior body visible until the
|
|
1130
|
-
new one arrives.
|
|
1131
|
-
|
|
1132
|
-
### Search / filter
|
|
1133
|
-
|
|
1134
|
-
`/` inside any list popup enters an incremental case-insensitive
|
|
1135
|
-
substring filter (lazygit / k9s convention). Printable characters
|
|
1136
|
-
append, `Backspace` pops, `Esc` cancels, `Enter` commits (keeps the
|
|
1137
|
-
filter, resumes `j/k` navigation), and `/` again refines. The filter
|
|
1138
|
-
blob is per-popup — agent name/status/cli/role; track head id + title;
|
|
1139
|
-
task name/title/status/owner; log verb/payload/source — and dies with
|
|
1140
|
-
the popup.
|
|
1141
|
-
|
|
1142
|
-
Task-list popups add **per-status toggles** (`o` / `i` / `c` for OPEN /
|
|
1143
|
-
IN_PROGRESS / CLOSED; default all-on). The All-tasks popup adds **sort
|
|
1144
|
-
cycle** on `s`: `roi` → `recency` → `age` → `id`.
|
|
1145
|
-
|
|
1146
|
-
### Mouse
|
|
1147
|
-
|
|
1148
|
-
Navigation-in only: double-click a dashboard card to open its popup,
|
|
1149
|
-
double-click a popup row to drill one level deeper, and scroll-wheel
|
|
1150
|
-
inside a popup list / drill body to move the cursor or scroll. There is
|
|
1151
|
-
**no mouse back binding** — use `Esc` / `q`.
|
|
1152
|
-
|
|
1153
|
-
### Yank contract (`y`) and the `tuicr` escape (`t`)
|
|
1154
|
-
|
|
1155
|
-
Every popup row exposes one canonical `mu` command via `y`, which goes
|
|
1156
|
-
to your system clipboard (pbcopy / wl-copy / xclip / xsel / clip.exe,
|
|
1157
|
-
OSC-52 fallback). You run it in your shell; the TUI never mutates.
|
|
1158
|
-
|
|
1159
|
-
The one escape is **`t`** inside a `git show` drill (Workspaces or
|
|
1160
|
-
Commits popup): mu suspends its alt-screen, runs `tuicr -r <sha>` in
|
|
1161
|
-
the project root / workspace cwd, and restores the dashboard when tuicr
|
|
1162
|
-
exits. The operator drives another TUI tool; mu still performs no
|
|
1163
|
-
mutation.
|
|
1164
|
-
|
|
1165
|
-
Status cells colour-code as in the static CLI tables: OPEN cyan,
|
|
1166
|
-
IN_PROGRESS yellow, CLOSED green.
|
|
1167
|
-
|
|
1168
|
-
### Polling tiers
|
|
1169
|
-
|
|
1170
|
-
The dashboard has two refresh tiers:
|
|
1171
|
-
|
|
1172
|
-
- **Fast tick** (default 1s, adjustable with `+` / `-` / `=` /
|
|
1173
|
-
`0`): SQL-only. Refreshes tasks, tracks, workspace registry rows,
|
|
1174
|
-
and the activity log.
|
|
1175
|
-
- **Slow tick** (10s, fixed): subprocess-backed. Refreshes
|
|
1176
|
-
tmux-derived agent liveness / orphans, workspace dirty flags,
|
|
1177
|
-
recent project commits, and the Doctor summary.
|
|
1178
|
-
|
|
1179
|
-
The last slow-tier result is merged into every fast render so cards
|
|
1180
|
-
do not flicker through a loading state. `r` / F5 refreshes both
|
|
1181
|
-
tiers immediately. Tab / Shift-Tab triggers an eager slow refresh
|
|
1182
|
-
for the newly active workstream.
|
|
1183
|
-
|
|
1184
|
-
### Keymap reference
|
|
1185
|
-
|
|
1186
|
-
| Mode | Keys | Action |
|
|
1187
|
-
| --------- | ---------------------------- | -------------------------------------------------------------- |
|
|
1188
|
-
| dashboard | `0`-`9` | toggle card visibility |
|
|
1189
|
-
| dashboard | `Shift+0`-`Shift+9` | open the matching popup |
|
|
1190
|
-
| dashboard | `g` | open DAG popup (keybind-only) |
|
|
1191
|
-
| dashboard | `t` | open All-tasks popup (keybind-only) |
|
|
1192
|
-
| dashboard | `Tab` / `Shift-Tab` | cycle workstream tabs (N≥2) |
|
|
1193
|
-
| dashboard | `+` / `-` / `=` / `0` | adjust fast tick rate (faster / slower / default / pause) |
|
|
1194
|
-
| dashboard | `r` / `F5` | force refresh both tiers |
|
|
1195
|
-
| dashboard | `c` | clear footer (last yank) |
|
|
1196
|
-
| dashboard | `?` / `F1` | open help overlay |
|
|
1197
|
-
| any | `q` / `Ctrl-C` | quit (or back out of popup; quits at dashboard) |
|
|
1198
|
-
| popup | `j` / `k` | move cursor / scroll |
|
|
1199
|
-
| popup | `g` / `G` | jump top / bottom |
|
|
1200
|
-
| popup | `Ctrl-D` / `Ctrl-U` | half-page down / up |
|
|
1201
|
-
| popup | `PgDn` / `PgUp` | full page |
|
|
1202
|
-
| popup | `Enter` | drill into focused row |
|
|
1203
|
-
| popup | `Esc` / `q` | back out one level |
|
|
1204
|
-
| popup | `y` | yank canonical `mu` command for focused row |
|
|
1205
|
-
| popup | `/` | enter filter mode |
|
|
1206
|
-
| popup | `a` | attach to focused agent's mux pane (Agents popup only) |
|
|
1207
|
-
| popup | `l` | launch lazygit in the project root (Commits popup only) |
|
|
1208
|
-
| filter | (printable) / `Backspace` | edit query |
|
|
1209
|
-
| filter | `Esc` | cancel (clear query) |
|
|
1210
|
-
| filter | `Enter` | commit (keep filter, return to nav) |
|
|
1211
|
-
| task popup| `o` / `i` / `c` | toggle OPEN / IN_PROGRESS / CLOSED |
|
|
1212
|
-
| task popup| `p` / `w` | toggle OPEN/parked / closed-not-done (DAG + All-tasks) |
|
|
1213
|
-
| All-tasks | `b` | blocked filter cycle (all → only → hide) |
|
|
1214
|
-
| All-tasks | `s` | cycle sort key (roi → recency → age → id) |
|
|
1215
|
-
| git-show | `t` | launch `tuicr -r <sha>` (alt-screen handoff) |
|
|
1216
|
-
|
|
1217
|
-
`?` shows the same table as a scrollable overlay (j/k/Ctrl-D/U/g/G
|
|
1218
|
-
also work inside the overlay).
|
|
1219
|
-
|
|
1220
|
-
### Read-only invariant
|
|
1221
|
-
|
|
1222
|
-
The TUI never executes a mutation — a load-bearing pledge in
|
|
1223
|
-
`docs/ROADMAP.md`, not an implementation detail. If a TUI gesture
|
|
1224
|
-
tempts you to mutate state from the SDK, file a roadmap entry first.
|
|
1225
|
-
Yank-and-run is the cost of keeping the TUI inspectable, scriptable
|
|
1226
|
-
and recoverable from any shell.
|
|
1227
|
-
|
|
1228
|
-
---
|
|
1229
|
-
|
|
1230
|
-
## 6. Spawn a crew
|
|
1231
|
-
|
|
1232
|
-
For a demo with live agent state, install and link murmur, then spawn pi agents:
|
|
1233
|
-
|
|
1234
|
-
```bash
|
|
1235
|
-
mu agent spawn worker-1 --workstream auth-refactor # default --cli is pi
|
|
1236
|
-
```
|
|
1237
|
-
|
|
1238
|
-
To play around without needing pi installed, use `--cli sh`:
|
|
1239
|
-
|
|
1240
|
-
```bash
|
|
1241
|
-
mu agent spawn worker-1 --workstream auth-refactor --cli sh
|
|
1242
|
-
mu agent spawn worker-2 --workstream auth-refactor --cli sh
|
|
1243
|
-
```
|
|
1244
|
-
|
|
1245
|
-
```
|
|
1246
|
-
Spawned worker-1 (sh) in window worker-1 of mu-auth-refactor, pane %15
|
|
1247
|
-
```
|
|
1248
|
-
|
|
1249
|
-
What just happened:
|
|
1250
|
-
|
|
1251
|
-
1. mu checked the agents table — no `worker-1` yet, OK to proceed
|
|
1252
|
-
2. mu created a tmux window named `worker-1` in the `mu-auth-refactor`
|
|
1253
|
-
session
|
|
1254
|
-
3. mu set the pane title to `worker-1` via `tmux select-pane -T worker-1`
|
|
1255
|
-
— **this is the claim protocol identity**
|
|
1256
|
-
4. mu inserted a row in `agents` with `pane_id=%15`; the deprecated `status` column remains `spawning`
|
|
1257
|
-
|
|
1258
|
-
If the DB insert fails after the pane was created, mu kills the pane
|
|
1259
|
-
to avoid leaking. If the same name was already taken, mu rejects
|
|
1260
|
-
**before** calling tmux.
|
|
1261
|
-
|
|
1262
|
-
### Naming convention (lint, not a rule)
|
|
1263
|
-
|
|
1264
|
-
mu accepts any name matching `/^[a-z][a-z0-9_-]{0,31}$/`, but the
|
|
1265
|
-
recommended shape is **`<role>-<n>`** — a lowercase role plus the
|
|
1266
|
-
smallest unused integer suffix (e.g. `worker-1`, `reviewer-2`,
|
|
1267
|
-
`scout-12`). Names that diverge (`worker-tests`, `alice`, `db-leader`,
|
|
1268
|
-
`x-y-1`) still spawn successfully but trigger a one-line stderr hint:
|
|
1269
|
-
|
|
1270
|
-
```
|
|
1271
|
-
hint: agent name "worker-tests" does not match the smallest-unused-suffix
|
|
1272
|
-
convention (<role>-<n>; e.g. worker-1, reviewer-2). Accepted; consider
|
|
1273
|
-
renaming if you spawn additional workers.
|
|
1274
|
-
```
|
|
1275
|
-
|
|
1276
|
-
The hint is suppressed under `--json` so script callers stay clean.
|
|
1277
|
-
|
|
1278
|
-
### Multiple agents in one window (split panes)
|
|
1279
|
-
|
|
1280
|
-
Give them a shared `--tab`:
|
|
1281
|
-
|
|
1282
|
-
```bash
|
|
1283
|
-
mu agent spawn reviewer-1 --workstream auth-refactor --cli sh --tab Review --role read-only
|
|
1284
|
-
mu agent spawn audit --workstream auth-refactor --cli sh --tab Review
|
|
1285
|
-
```
|
|
1286
|
-
|
|
1287
|
-
The `Review` window holds whichever agents share `--tab Review`.
|
|
1288
|
-
|
|
1289
|
-
### Spawn options
|
|
1290
|
-
|
|
1291
|
-
| Flag | Meaning |
|
|
1292
|
-
| ---------------------------- | ------------------------------------------------------- |
|
|
1293
|
-
| `--cli <name>` | Logical CLI family (effectively always `pi`; the flag exists as a key for `MU_<UPPER_CLI>_COMMAND` resolution) |
|
|
1294
|
-
| `--command <cmd>` | Executable launched in the pane. Defaults to `$MU_<UPPER_CLI>_COMMAND` (e.g. `MU_PI_COMMAND=pi-alt`) and finally to the `--cli` value |
|
|
1295
|
-
| `--tab <name>` | Group with other agents under this window name |
|
|
1296
|
-
| `--role <full-access\|read-only>` | Capability flag; stored but not yet enforced |
|
|
1297
|
-
| `--cwd <path>` | Initial working directory for the pane |
|
|
1298
|
-
| `-w, --workstream <name>` | Required if not auto-detectable |
|
|
1299
|
-
|
|
1300
|
-
If your `pi` binary lives under a different name, set
|
|
1301
|
-
`MU_PI_COMMAND=<name>` once in your shell rc: every
|
|
1302
|
-
`mu agent spawn --cli pi` execs it, and reconcile treats that binary's
|
|
1303
|
-
panes as agent-worthy when surfacing orphans. `MU_PI_COMMAND` (and
|
|
1304
|
-
`--command`) accept a multi-word string — tmux execs it via a shell, so
|
|
1305
|
-
`MU_PI_COMMAND="pi-alt --some-flag"` works. Same pattern for
|
|
1306
|
-
`MU_CLAUDE_COMMAND` / `MU_CODEX_COMMAND`.
|
|
1307
|
-
|
|
1308
|
-
**Project-trust prompt (gotcha).** pi asks whether to trust a project
|
|
1309
|
-
folder on interactive startup, before loading `AGENTS.md` and `.pi/`
|
|
1310
|
-
resources. A freshly-spawned agent stuck at `needs_input` is usually
|
|
1311
|
-
waiting on this. Spawn with `--command 'pi --approve'` (or
|
|
1312
|
-
`MU_PI_COMMAND="pi --approve"`) to auto-trust. Caveat: `--approve`
|
|
1313
|
-
trusts whatever directory the pane lands in — including `--workspace`
|
|
1314
|
-
forks — so use it for crews on your own code only. Otherwise the
|
|
1315
|
-
decision is saved per-directory in `~/.pi/agent/trust.json`, or run
|
|
1316
|
-
`/trust` in the pane once.
|
|
1317
|
-
|
|
1318
|
-
### Adopt an existing tmux pane
|
|
1319
|
-
|
|
1320
|
-
You launched a `pi` by hand and decided mid-flow it belongs in the
|
|
1321
|
-
graph, or `mu` crashed mid-spawn and left an orphan pane with no DB
|
|
1322
|
-
row. Either way:
|
|
1323
|
-
|
|
1324
|
-
```bash
|
|
1325
|
-
mu agent list -w auth-refactor # surfaces orphans at the bottom
|
|
1326
|
-
# Orphan panes (1)
|
|
1327
|
-
# %15 title=worker-2 cli=pi
|
|
1328
|
-
|
|
1329
|
-
mu agent adopt %15 -w auth-refactor # adopt by pane id
|
|
1330
|
-
mu agent adopt worker-2 -w auth-refactor # adopt by pane title (same effect)
|
|
1331
|
-
mu agent adopt %15 --name investigator -w auth-refactor # adopt and rename the pane
|
|
1332
|
-
```
|
|
1333
|
-
|
|
1334
|
-
The pane title becomes the agent name (the claim-protocol invariant),
|
|
1335
|
-
so a pane titled `worker-2` registers as agent `worker-2` with no
|
|
1336
|
-
further config. Use `--name` when the title isn't a valid agent name.
|
|
1337
|
-
|
|
1338
|
-
Adopt is **idempotent** (twice on the same pane is a no-op) and
|
|
1339
|
-
**scope-aware**: the pane must be in the `mu-<workstream>` tmux
|
|
1340
|
-
session, or the adopt is rejected — no silent cross-session moves.
|
|
1341
|
-
|
|
1342
|
-
---
|
|
1343
|
-
|
|
1344
|
-
## 7. Watch the crew live
|
|
1345
|
-
|
|
1346
|
-
Attach the workstream's tmux session and you see everything.
|
|
1347
|
-
|
|
1348
|
-
```bash
|
|
1349
|
-
tmux attach -t mu-auth-refactor
|
|
1350
|
-
```
|
|
1351
|
-
|
|
1352
|
-
You see one tmux window per agent (or a window with split panes if
|
|
1353
|
-
they share a `--tab`).
|
|
1354
|
-
|
|
1355
|
-
| Tmux key | What it does |
|
|
1356
|
-
| -------------- | --------------------------------------------- |
|
|
1357
|
-
| `Ctrl+b w` | Pick a window (interactive list) |
|
|
1358
|
-
| `Ctrl+b n`/`p` | Cycle next/previous window |
|
|
1359
|
-
| `Ctrl+b d` | Detach from the session (mu doesn't care) |
|
|
1360
|
-
|
|
1361
|
-
mu does not require you to be attached. Detach freely.
|
|
1362
|
-
|
|
1363
|
-
---
|
|
1364
|
-
|
|
1365
|
-
## 8. Send work to an agent
|
|
1366
|
-
|
|
1367
|
-
From any shell with mu on `$PATH`:
|
|
1368
|
-
|
|
1369
|
-
```bash
|
|
1370
|
-
mu agent send worker-1 "echo hello from outside"
|
|
1371
|
-
```
|
|
1372
|
-
|
|
1373
|
-
mu uses the **canonical bracketed-paste protocol** internally:
|
|
1374
|
-
|
|
1375
|
-
0. wait for the pane to stop being mid-modal (`MU_SEND_READINESS_MS`,
|
|
1376
|
-
default 15000; 0 disables)
|
|
1377
|
-
1. `tmux copy-mode -q` (silent if not in copy mode)
|
|
1378
|
-
2. `tmux set-buffer` (loads text into a uniquely-named buffer)
|
|
1379
|
-
3. `tmux paste-buffer -p -d -r` (`-p` = bracketed paste, `-d` = delete
|
|
1380
|
-
buffer after paste, `-r` = preserve LF)
|
|
1381
|
-
4. wait `MU_SEND_DELAY_MS` ms (default 500)
|
|
1382
|
-
5. `tmux send-keys Enter`
|
|
1383
|
-
6. confirm the Enter took; re-send it if the text is still sitting
|
|
1384
|
-
unsubmitted in the input box
|
|
1385
|
-
7. when the text is exactly `/new`, wait for the pane to visibly change and
|
|
1386
|
-
stabilize before returning, so a following send cannot race the delayed
|
|
1387
|
-
session replacement
|
|
1388
|
-
|
|
1389
|
-
Special characters (`/`, `?`, `!`, `$`, `&&`, `|`, `*`, …) therefore
|
|
1390
|
-
arrive at the agent's CLI **literally**. Naive `tmux send-keys` would
|
|
1391
|
-
let the agent's TUI hijack `/` for "search forward" and similar.
|
|
1392
|
-
|
|
1393
|
-
The send delay is configurable per call:
|
|
1394
|
-
|
|
1395
|
-
```bash
|
|
1396
|
-
MU_SEND_DELAY_MS=300 mu agent send worker-1 "..." # faster, less safe
|
|
1397
|
-
MU_SEND_DELAY_MS=1000 mu agent send worker-1 "..." # slow remote
|
|
1398
|
-
```
|
|
1399
|
-
|
|
1400
|
-
**Steps 0, 6, and 7 make `exit 0` mean "submitted" and safe for a
|
|
1401
|
-
following send.** A TUI rendering a modal accepts a bracketed paste but
|
|
1402
|
-
*swallows the Enter after it*,
|
|
1403
|
-
leaving the prompt typed-but-unsubmitted. The visible symptom is an
|
|
1404
|
-
agent idle at `needs_input` with 0.0% context on work it never
|
|
1405
|
-
received. No `sleep` between a clear and a prompt is needed.
|
|
1406
|
-
|
|
1407
|
-
If a send cannot be confirmed it prints `warning: ... was NOT
|
|
1408
|
-
submitted` to stderr (and `"delivered": false` under `--json`).
|
|
1409
|
-
**Check for that warning before you wait on the task.**
|
|
1410
|
-
|
|
1411
|
-
Sending to a **busy** agent is not delayed — that input queues
|
|
1412
|
-
normally; only a modal/re-init spinner is waited out.
|
|
1413
|
-
|
|
1414
|
-
A **stale** target workspace (≥10 commits behind main — the red bucket
|
|
1415
|
-
in `mu workspace list` and the TUI Workspaces card) warns on stderr but
|
|
1416
|
-
still sends:
|
|
1417
|
-
|
|
1418
|
-
```bash
|
|
1419
|
-
WARN: worker-1 workspace is 14 commits behind main (≥10 = stale)
|
|
1420
|
-
Next:
|
|
1421
|
-
Refresh first : mu workspace refresh worker-1 -w auth-refactor
|
|
1422
|
-
```
|
|
1423
|
-
|
|
1424
|
-
`--strict-staleness` refuses instead:
|
|
1425
|
-
|
|
1426
|
-
```bash
|
|
1427
|
-
mu agent send worker-1 "..." -w auth-refactor --strict-staleness
|
|
1428
|
-
```
|
|
1429
|
-
|
|
1430
|
-
Agents without workspaces are skipped (common for read-only roles).
|
|
1431
|
-
`--json` carries `staleness: null` or `{agentName, workstreamName,
|
|
1432
|
-
commitsBehindMain, isStale}`.
|
|
1433
|
-
|
|
1434
|
-
---
|
|
1435
|
-
|
|
1436
|
-
## 9. Read what an agent did
|
|
1437
|
-
|
|
1438
|
-
```bash
|
|
1439
|
-
mu agent read worker-1 # full scrollback
|
|
1440
|
-
mu agent read worker-1 -n 50 # last 50 lines
|
|
1441
|
-
```
|
|
1442
|
-
|
|
1443
|
-
Both go through `tmux capture-pane`. No state change.
|
|
1444
|
-
|
|
1445
|
-
---
|
|
1446
|
-
|
|
1447
|
-
## 10. The claim protocol — from inside an agent's pane
|
|
1448
|
-
|
|
1449
|
-
An agent (the LLM running in a pane) runs `mu task claim foo` **with no
|
|
1450
|
-
agent name argument** — mu derives "worker-1" from the pane title. In
|
|
1451
|
-
worker-1's pane:
|
|
1452
|
-
|
|
1453
|
-
```bash
|
|
1454
|
-
mu task claim design
|
|
1455
|
-
```
|
|
1456
|
-
|
|
1457
|
-
```
|
|
1458
|
-
Claimed design for worker-1 (OPEN → IN_PROGRESS)
|
|
1459
|
-
```
|
|
1460
|
-
|
|
1461
|
-
Behind the scenes: mu reads `$TMUX_PANE`, asks tmux for that pane's
|
|
1462
|
-
title (`tmux display-message -t %15 -p '#{pane_title}'`), and runs one
|
|
1463
|
-
atomic conditional UPDATE guarded on `owner IS NULL OR owner = <me>`.
|
|
1464
|
-
If 0 rows change, mu distinguishes "task doesn't exist" from "already
|
|
1465
|
-
owned by someone else" and throws the right typed error.
|
|
1466
|
-
|
|
1467
|
-
Two agents claiming the same task → the second fails with "already
|
|
1468
|
-
owned by worker-1". Re-claim by the same agent is idempotent.
|
|
1469
|
-
|
|
1470
|
-
You can also claim explicitly from outside any pane:
|
|
1471
|
-
|
|
1472
|
-
```bash
|
|
1473
|
-
mu task claim build --for worker-2
|
|
1474
|
-
```
|
|
1475
|
-
|
|
1476
|
-
`--for` accepts either a bare worker name (`worker-2`, resolved in
|
|
1477
|
-
the task's workstream) or a qualified ref `<workstream>/<name>` for
|
|
1478
|
-
**cross-workstream dispatch**:
|
|
1479
|
-
|
|
1480
|
-
```bash
|
|
1481
|
-
# Task lives in mufeedback-v03; worker-1 lives in roadmap-v0-3.
|
|
1482
|
-
mu task claim some-task -w mufeedback-v03 --for roadmap-v0-3/worker-1
|
|
1483
|
-
```
|
|
1484
|
-
|
|
1485
|
-
The agent stays in its own workstream — only `tasks.owner_id` points
|
|
1486
|
-
across the boundary (an INTEGER FK to `agents.id`). A bad qualifier
|
|
1487
|
-
surfaces typed errors and writes nothing:
|
|
1488
|
-
`WorkstreamNotFoundError` (exit 3) on a missing prefix,
|
|
1489
|
-
`AgentNotFoundError` (exit 3) when the worker doesn't live there.
|
|
1490
|
-
|
|
1491
|
-
When `--for` targets an agent with a **stale** workspace (≥10 commits
|
|
1492
|
-
behind main), the claim warns on stderr and succeeds:
|
|
1493
|
-
|
|
1494
|
-
```bash
|
|
1495
|
-
mu task claim build -w auth-refactor --for worker-2
|
|
1496
|
-
# stderr: WARN: worker-2 workspace is 14 commits behind main (≥10 = stale)
|
|
1497
|
-
# Next: Refresh first : mu workspace refresh worker-2 -w auth-refactor
|
|
1498
|
-
```
|
|
1499
|
-
|
|
1500
|
-
`--strict-staleness` refuses instead with `TaskClaimStaleWorkspaceError`
|
|
1501
|
-
(exit 4) — for scripts that must never dispatch onto a stale parent.
|
|
1502
|
-
`--json` carries `staleness: null` or `{agentName, workstreamName,
|
|
1503
|
-
commitsBehindMain, isStale}`. Bare in-pane and `--self` claims skip the
|
|
1504
|
-
check; they don't assign work to a named agent.
|
|
1505
|
-
|
|
1506
|
-
### The orchestrator pattern: `--self`
|
|
1507
|
-
|
|
1508
|
-
Not every action comes from a registered worker pane. An
|
|
1509
|
-
*orchestrator* (a top-level pi session, a human at a shell, a deploy
|
|
1510
|
-
script) often does small work directly. Two roles:
|
|
1511
|
-
|
|
1512
|
-
- **Worker** — a pane mu spawned (or you adopted). Has a row in the
|
|
1513
|
-
`agents` table. Identity = pane title. Claims with bare
|
|
1514
|
-
`mu task claim <id>`. `tasks.owner_id` points at the worker row.
|
|
1515
|
-
|
|
1516
|
-
- **Actor** — anything that *causes* a state change, including the
|
|
1517
|
-
orchestrator. May or may not have a row in `agents`. Always recorded
|
|
1518
|
-
on the op (`ops.actor`).
|
|
1519
|
-
|
|
1520
|
-
If the orchestrator tries `mu task claim some-task` directly:
|
|
1521
|
-
|
|
1522
|
-
```
|
|
1523
|
-
conflict: claimer 'pi-mu' (pane %6441) is not a registered mu agent.
|
|
1524
|
-
Working directly? Pass --self to attribute via log instead.
|
|
1525
|
-
Dispatching to a worker? Pass --for <worker> to assign.
|
|
1526
|
-
Want full registration? Run: mu agent adopt %6441
|
|
1527
|
-
```
|
|
1528
|
-
|
|
1529
|
-
Pick one based on intent:
|
|
1530
|
-
|
|
1531
|
-
```bash
|
|
1532
|
-
# Orchestrator does the work itself (most common):
|
|
1533
|
-
mu task claim some-task --self --evidence "trivial 5-line fix"
|
|
1534
|
-
# -> tasks.owner_id stays NULL
|
|
1535
|
-
# -> the task.claim op records actor='pi-mu' (anonymous claim)
|
|
1536
|
-
# -> mu task show surfaces it as 'owner: (self: pi-mu)'
|
|
1537
|
-
|
|
1538
|
-
# Orchestrator dispatches to a worker:
|
|
1539
|
-
mu task claim some-task --for worker-1
|
|
1540
|
-
# -> tasks.owner_id points at worker-1
|
|
1541
|
-
|
|
1542
|
-
# Orchestrator wants to BE a registered worker (rare):
|
|
1543
|
-
mu agent adopt %6441 -w <ws> # only if pane is in mu-<ws> session
|
|
1544
|
-
mu task claim some-task # now works as a normal worker claim
|
|
1545
|
-
```
|
|
1546
|
-
|
|
1547
|
-
`--self` is **only** for unregistered actors. Workers continue to
|
|
1548
|
-
claim with bare `mu task claim` — nothing changes for them. The
|
|
1549
|
-
`--actor <name>` flag overrides the auto-detected actor name (defaults
|
|
1550
|
-
to pane title, or `$USER`, or `unknown`):
|
|
1551
|
-
|
|
1552
|
-
```bash
|
|
1553
|
-
mu task claim deploy --self --actor deploy-bot --evidence "prod release"
|
|
1554
|
-
```
|
|
1555
|
-
|
|
1556
|
-
When `tasks.owner_id IS NULL` because of `--self`, `mu task show` looks
|
|
1557
|
-
up the most recent `task claim` event for that task and surfaces it:
|
|
1558
|
-
|
|
1559
|
-
```
|
|
1560
|
-
owner : (self: pi-mu)
|
|
1561
|
-
```
|
|
1562
|
-
|
|
1563
|
-
So provenance is preserved — it just lives in `ops.actor` rather
|
|
1564
|
-
than being conflated with the FK that points at registered workers.
|
|
1565
|
-
|
|
1566
|
-
---
|
|
1567
|
-
|
|
1568
|
-
## 11. Drop notes (durable context)
|
|
1569
|
-
|
|
1570
|
-
Notes are append-only and survive sessions and agent restarts — the
|
|
1571
|
-
cure for LLM context loss: the next agent reads the full history.
|
|
1572
|
-
|
|
1573
|
-
```bash
|
|
1574
|
-
mu task note design "DECISION: JWT, 24h expiry, refresh via cookie"
|
|
1575
|
-
mu task note design "FILES: src/auth.rs:45-120"
|
|
1576
|
-
```
|
|
1577
|
-
|
|
1578
|
-
Read them via the typed verb:
|
|
1579
|
-
|
|
1580
|
-
```bash
|
|
1581
|
-
mu task notes design # all notes, oldest first
|
|
1582
|
-
mu task notes design --tail 3 # only the last 3 (alias --last)
|
|
1583
|
-
mu task notes design --since 2026-01-01 # only notes after an ISO 8601 cutoff
|
|
1584
|
-
mu task notes design --since-claim # only notes since the most recent
|
|
1585
|
-
# 'task claim' event for this task
|
|
1586
|
-
# (auto-resolved from the ops log)
|
|
1587
|
-
mu task notes design --tail 5 --json # collection envelope {items, count}
|
|
1588
|
-
```
|
|
1589
|
-
|
|
1590
|
-
Filters compose: `--tail` slices the last N of whatever survived
|
|
1591
|
-
the timestamp filter. `--since` and `--since-claim` are mutually
|
|
1592
|
-
exclusive (both define a cutoff) — pick one. With no filters you get
|
|
1593
|
-
every note, oldest-first.
|
|
1594
|
-
|
|
1595
|
-
`--since-claim` is the orchestrator form: dispatch flows drop a
|
|
1596
|
-
multi-screen SPEC note BEFORE claiming, then the worker appends
|
|
1597
|
-
progress notes AFTER. `--since-claim` slices off the SPEC so you see
|
|
1598
|
-
only the worker's reports. With no claim event it degrades to no
|
|
1599
|
-
filter.
|
|
1600
|
-
|
|
1601
|
-
For ad-hoc shape, the SQL escape hatch:
|
|
1602
|
-
|
|
1603
|
-
```bash
|
|
1604
|
-
mu sql "SELECT n.author, n.content, n.created_at
|
|
1605
|
-
FROM task_notes n
|
|
1606
|
-
JOIN tasks t ON t.id = n.task_id
|
|
1607
|
-
JOIN workstreams w ON w.id = t.workstream_id
|
|
1608
|
-
WHERE t.local_id='design' AND w.name='auth-refactor'
|
|
1609
|
-
ORDER BY n.id"
|
|
1610
|
-
```
|
|
1611
|
-
|
|
1612
|
-
Convention for note content: `KEY: value` lines. Common keys are
|
|
1613
|
-
`FILES`, `DECISION`, `VERIFIED`, `BLOCKED`, `NEXT`. Mu doesn't
|
|
1614
|
-
enforce these — they're for the agents reading them.
|
|
1615
|
-
|
|
1616
|
-
---
|
|
1617
|
-
|
|
1618
|
-
## 12. Close out a task
|
|
1619
|
-
|
|
1620
|
-
```bash
|
|
1621
|
-
mu task close design # OPEN/IN_PROGRESS → CLOSED/done
|
|
1622
|
-
mu task close umbrella --if-ready # close ONLY if every blocker
|
|
1623
|
-
# is CLOSED; else no-op + list
|
|
1624
|
-
# the still-blocking ids
|
|
1625
|
-
mu task close spike --as wontfix --why "superseded by the v2 design"
|
|
1626
|
-
mu task open design # CLOSED → OPEN (e.g. closed by mistake)
|
|
1627
|
-
mu task park polish --why "after the release" # OPEN → OPEN/parked
|
|
1628
|
-
mu task unpark polish # OPEN/parked → OPEN/todo
|
|
1629
|
-
```
|
|
1630
|
-
|
|
1631
|
-
Every task carries a **substate** next to its status, rendered as a pair.
|
|
1632
|
-
`OPEN` is `todo` or `parked`; `IN_PROGRESS` is `active`; `CLOSED` is
|
|
1633
|
-
`done`, `rejected`, `wontfix`, `duplicate`, or `superseded`. `--as` picks
|
|
1634
|
-
the closed substate: `rejected` when the proposal itself was declined,
|
|
1635
|
-
`wontfix` when it is valid but not worth doing. Anything but `done` requires `--why`, stored as a note in the
|
|
1636
|
-
same transaction. Any `CLOSED/*` satisfies a blocker, so a non-`done`
|
|
1637
|
-
close prints the dependents it unblocked.
|
|
1638
|
-
|
|
1639
|
-
To keep dependents waiting, park the task instead of closing it. A
|
|
1640
|
-
parked task leaves `mu task next` and the ready set, and `mu task claim`
|
|
1641
|
-
refuses it without `--force`. It stays in goals, and a track whose non-closed
|
|
1642
|
-
tasks are all parked is marked `(parked)`. Park refuses `IN_PROGRESS`
|
|
1643
|
-
(release first) and `CLOSED` (open first). Filter with
|
|
1644
|
-
`mu task list --substate parked`.
|
|
1645
|
-
|
|
1646
|
-
Both are idempotent (closing an already-CLOSED task prints a no-op and
|
|
1647
|
-
exits 0). Owner is left intact — use `mu task release <id>` to clear
|
|
1648
|
-
ownership when an agent bails mid-flight. `IN_PROGRESS` flips back to
|
|
1649
|
-
`OPEN` so the task re-enters the ready set. `--reopen` forces `OPEN`
|
|
1650
|
-
from `CLOSED`.
|
|
1651
|
-
|
|
1652
|
-
When the closing actor has a per-agent workspace and that workspace
|
|
1653
|
-
has uncommitted edits, a successful close adds one extra `Next:` hint
|
|
1654
|
-
reminding the actor to commit before the next wave:
|
|
1655
|
-
|
|
1656
|
-
```bash
|
|
1657
|
-
cd $(mu workspace path worker-1 -w auth-refactor) && git commit -am 'Design auth module'
|
|
1658
|
-
```
|
|
1659
|
-
|
|
1660
|
-
The hint is best-effort: no workspace, a clean workspace, the `none`
|
|
1661
|
-
backend, or a failed VCS dirty check simply omit it. The same
|
|
1662
|
-
`nextSteps` entry is present in `--json` output.
|
|
1663
|
-
|
|
1664
|
-
`--if-ready` is the umbrella-on-wave-done shape: fire
|
|
1665
|
-
`mu task close <umbrella> --if-ready` after each wave-task finishes.
|
|
1666
|
-
It's a no-op while any blocker is OPEN / IN_PROGRESS, printing the
|
|
1667
|
-
still-blocking ids + a `mu task wait` hint; once the last blocker is
|
|
1668
|
-
CLOSED, the same command closes the umbrella. JSON on the no-op path:
|
|
1669
|
-
`{ skipped: "not_ready", changed: false, blockingIds: ["..."], ... }`.
|
|
1670
|
-
Exit 0 either way — the no-op is success.
|
|
1671
|
-
|
|
1672
|
-
```bash
|
|
1673
|
-
mu task release design # clear owner; IN_PROGRESS → OPEN
|
|
1674
|
-
# (CLOSED preserved)
|
|
1675
|
-
mu task release design --reopen # clear owner AND force status to OPEN
|
|
1676
|
-
# (un-close + release in one verb)
|
|
1677
|
-
```
|
|
1678
|
-
|
|
1679
|
-
With `design` closed, `build` is ready:
|
|
1680
|
-
|
|
1681
|
-
```
|
|
1682
|
-
$ mu task next -w auth-refactor
|
|
1683
|
-
┌───────┬────────┬───────────────────┬────────┬────────┬──────┬───────┐
|
|
1684
|
-
│ name │ status │ title │ impact │ effort │ ROI │ owner │
|
|
1685
|
-
├───────┼────────┼───────────────────┼────────┼────────┼──────┼───────┤
|
|
1686
|
-
│ build │ OPEN │ Build auth module │ 80 │ 5 │ 16.0 │ — │
|
|
1687
|
-
└───────┴────────┴───────────────────┴────────┴────────┴──────┴───────┘
|
|
1688
|
-
```
|
|
1689
|
-
|
|
1690
|
-
---
|
|
1691
|
-
|
|
1692
|
-
## 13. The SQL escape hatch is your friend
|
|
1693
|
-
|
|
1694
|
-
Most routine operations have a typed verb — prefer those, with `--json`
|
|
1695
|
-
for scripting. `mu sql` covers ad-hoc joins, manual recovery, and
|
|
1696
|
-
schema exploration. The schema is 10 tables — 4 **portable**
|
|
1697
|
-
(`workstreams`, `tasks`, `task_edges`, `task_notes`: what crosses
|
|
1698
|
-
machines) and 6 **machine-local** (`agents`, `vcs_workspaces`,
|
|
1699
|
-
`machine_identity`, `sync_peers`, `schema_version`, and the `ops` log,
|
|
1700
|
-
which is carrier not cargo) — plus three views (`ready`, `blocked`,
|
|
1701
|
-
`goals`):
|
|
1702
|
-
|
|
1703
|
-
```bash
|
|
1704
|
-
mu sql "SELECT name FROM sqlite_master WHERE type IN ('table','view') ORDER BY type, name"
|
|
1705
|
-
```
|
|
1706
|
-
|
|
1707
|
-
### Prefer the typed verb where one exists
|
|
1708
|
-
|
|
1709
|
-
| Want | Typed verb |
|
|
1710
|
-
| ----------------------------------------------------- | --------------------------------------- |
|
|
1711
|
-
| Tasks owned by an agent (current workstream) | `mu task owned-by <agent> [--json]` |
|
|
1712
|
-
| Tasks owned by ANY same-named worker (all workstreams)| `mu task owned-by <agent> --all [--json]`|
|
|
1713
|
-
| Highest-ROI ready task | `mu task next [-w] [-n K] [--json]` |
|
|
1714
|
-
| What did I touch most recently / what's stale | `mu task list --sort recency` / `--sort age` |
|
|
1715
|
-
| Visualise what blocks what | `mu task tree <id> [--json]` |
|
|
1716
|
-
| Show row + edges + notes | `mu task show <id> [--json]` |
|
|
1717
|
-
| Delete + cascade edges/notes (two-phase: bare = dry-run; `--yes` commits) | `mu task delete <id>` / `mu task delete <id> --yes` |
|
|
1718
|
-
| Add / remove a single edge | `mu task block` / `mu task unblock` |
|
|
1719
|
-
| Replace all blockers atomically | `mu task reparent <id> --blocked-by ...` |
|
|
1720
|
-
| Modify scalar fields | `mu task update <id> [--title ...]` |
|
|
1721
|
-
| Read the activity log / subscribe to events | `mu log [--tail] [--intent task.close]` |
|
|
1722
|
-
| Block until tasks reach a status (orchestrator wait) | `mu task wait <ref> [<ref>...] [--first|--any] [--timeout S] --on-stall exit` |
|
|
1723
|
-
| Block until agents finish working (task-less wait) | `mu agent wait <name> [<name>...] [--first|--any] [--timeout S]` |
|
|
1724
|
-
### `mu agent wait`: the task-less counterpart to `mu task wait`
|
|
1725
|
-
|
|
1726
|
-
Scratch helpers usually own no task, so `mu task wait` has nothing to
|
|
1727
|
-
watch. `mu agent wait` blocks on the agent's runtime state: an agent
|
|
1728
|
-
**fires** when it goes **busy → any other state**. It must be observed
|
|
1729
|
-
busy first, so an already-idle agent does NOT fire instantly — you're
|
|
1730
|
-
waiting for *this* work to finish. Replaces `sleep` polling loops.
|
|
1731
|
-
|
|
1732
|
-
```bash
|
|
1733
|
-
mu agent spawn helper-1 -w scratch
|
|
1734
|
-
mu agent send helper-1 'Investigate X. Report findings.'
|
|
1735
|
-
mu agent wait helper-1 -w scratch --first # blocks until pi finishes
|
|
1736
|
-
mu agent read helper-1 -w scratch -n 80 # now read the result
|
|
1737
|
-
```
|
|
1738
|
-
|
|
1739
|
-
Mirrors `mu task wait`'s shape: `--any`/`--first` fire on the first
|
|
1740
|
-
agent (default: all must finish); `--first` prints the firing agent's
|
|
1741
|
-
ref; `--json` carries `nextSteps`; refs may be qualified
|
|
1742
|
-
`<workstream>/<name>`. Exit codes: `0` met, `5` timeout, `6` a watched
|
|
1743
|
-
agent's pane died. On tmux, murmur supplies the state. `unknown` never
|
|
1744
|
-
fires the wait; run `mu doctor` for the missing-source reason.
|
|
1745
|
-
|
|
1746
|
-
**Don't reach for this verb to catch a worker that asked a question.**
|
|
1747
|
-
It fires on `busy → needs_input`, so it does detect the case — but it
|
|
1748
|
-
keys on **agents**, which means a task-DAG orchestrator would have to
|
|
1749
|
-
track the task→agent mapping itself and run two waits concurrently to
|
|
1750
|
-
catch both "task closed" and "worker asked something". `mu task wait
|
|
1751
|
-
--stuck-after` / `--on-stall` covers that from the task side; see
|
|
1752
|
-
[attention detection](#mu-task-wait-attention-detection---stuck-after----on-stall).
|
|
1753
|
-
|
|
1754
|
-
### `mu task wait`: cross-workstream refs + `--first` returns WHICH
|
|
1755
|
-
|
|
1756
|
-
Each `<ref>` is either a bare task name (resolves via `-w` /
|
|
1757
|
-
`$MU_SESSION` / tmux session) or a qualified `<workstream>/<name>`
|
|
1758
|
-
ref. When all refs are qualified, `-w` is not required; mixed lists
|
|
1759
|
-
are allowed (bare uses `-w`, qualified uses its prefix).
|
|
1760
|
-
|
|
1761
|
-
```bash
|
|
1762
|
-
# All-bare with -w
|
|
1763
|
-
mu task wait build_a build_b -w mufeedback-v03 --timeout 1200 --on-stall exit
|
|
1764
|
-
|
|
1765
|
-
# All-qualified — cross-workstream wait, no -w needed
|
|
1766
|
-
mu task wait roadmap-v0-3/archive_phase2 mufeedback-v03/cli_audit --timeout 1800 --on-stall exit
|
|
1767
|
-
|
|
1768
|
-
# Mixed — bare uses -w; qualified ignores it
|
|
1769
|
-
mu task wait cli_audit roadmap-v0-3/archive_phase2 -w mufeedback-v03 --on-stall exit
|
|
1770
|
-
```
|
|
1771
|
-
|
|
1772
|
-
`--first` is an alias for `--any` that ALSO prints the firing ref's
|
|
1773
|
-
qualified id to stdout (and populates the `firing` field in `--json`,
|
|
1774
|
-
which `--any` leaves null). Use
|
|
1775
|
-
it to drive a single-shot dispatch loop — one wait, one cherry-pick,
|
|
1776
|
-
one verify, one workspace recycle:
|
|
1777
|
-
|
|
1778
|
-
```bash
|
|
1779
|
-
# The dispatch-pipeline recipe: cycle until in_flight is empty.
|
|
1780
|
-
in_flight=( mufeedback-v03/foo mufeedback-v03/bar roadmap-v0-3/baz )
|
|
1781
|
-
while (( ${#in_flight[@]} > 0 )); do
|
|
1782
|
-
res=$(mu task wait "${in_flight[@]}" --first --timeout 90 --on-stall exit --json)
|
|
1783
|
-
closed=$(jq -r '.firing.qualifiedId // empty' <<<"$res")
|
|
1784
|
-
if [[ -z "$closed" ]]; then break; fi # timeout or exit 6 — see below
|
|
1785
|
-
|
|
1786
|
-
worker=$(jq -r '.firing.owner // empty' <<<"$res")
|
|
1787
|
-
ws=${closed%%/*}
|
|
1788
|
-
|
|
1789
|
-
# 1. Inspect, then run, the sha-pinned apply hint from nextSteps.
|
|
1790
|
-
# When the worker has commits since its fork point, the command is
|
|
1791
|
-
# `git cherry-pick <sha>` (or `<first>^..<last>` for multiple
|
|
1792
|
-
# commits). When the worker closed without committing, nextSteps
|
|
1793
|
-
# says so and points at manual `git diff` / `git apply` rescue.
|
|
1794
|
-
apply=$(jq -r '.nextSteps[0].command' <<<"$res")
|
|
1795
|
-
printf 'apply hint: %s\n' "$apply"
|
|
1796
|
-
if [[ "$apply" == git\ cherry-pick* ]]; then
|
|
1797
|
-
eval "$apply"
|
|
1798
|
-
else
|
|
1799
|
-
echo "manual rescue required; inspect the worker workspace before continuing"
|
|
1800
|
-
break
|
|
1801
|
-
fi
|
|
1802
|
-
|
|
1803
|
-
# 2. Verify
|
|
1804
|
-
npm run typecheck && npm run lint && npm run test:fast && npm run test && npm run build
|
|
1805
|
-
|
|
1806
|
-
# 3. Refresh the workspace for the next dispatch (rebases onto
|
|
1807
|
-
# fresh main WITHOUT killing the worker's LLM context). Default
|
|
1808
|
-
# base = origin/HEAD (git) / trunk() (jj/sl); --from <ref>
|
|
1809
|
-
# overrides. Refuses on dirty WC; conflicts exit 5 with a `cd`
|
|
1810
|
-
# hint to resolve in-place.
|
|
1811
|
-
mu workspace refresh "$worker" -w "$ws"
|
|
1812
|
-
# Alt: `mu workspace free "$worker" -w "$ws"` throws the workspace
|
|
1813
|
-
# away entirely (the lossy escape). The next
|
|
1814
|
-
# `mu agent spawn --workspace` allocates a fresh one. Use when
|
|
1815
|
-
# you don't care about replaying the worker's commits.
|
|
1816
|
-
|
|
1817
|
-
# 4. Drop $closed from in_flight, dispatch the next task, repeat.
|
|
1818
|
-
in_flight=( "${in_flight[@]/$closed}" )
|
|
1819
|
-
done
|
|
1820
|
-
```
|
|
1821
|
-
|
|
1822
|
-
The `--json` shape on success is `{ firing, all, timedOut, nextSteps,
|
|
1823
|
-
... }`:
|
|
1824
|
-
|
|
1825
|
-
* `firing` — `{ workstreamName, name, qualifiedId, status, owner }`
|
|
1826
|
-
on **`--first`** success. `null` in every other case: on `--any`
|
|
1827
|
-
success, on `--all` success, and on timeout. `--any` exits `0` with
|
|
1828
|
-
`firing: null`, so a script that reads `.firing.qualifiedId` after
|
|
1829
|
-
`--any` dereferences null on a **successful** wait. Pass `--first`
|
|
1830
|
-
when you need to know WHICH ref fired; `--any` only tells you that
|
|
1831
|
-
one did.
|
|
1832
|
-
* `all` — array of refs that REACHED the target (with
|
|
1833
|
-
`qualifiedId` + `reachedAt`).
|
|
1834
|
-
* `timedOut` — array of refs that did NOT reach the target. Empty on
|
|
1835
|
-
clean success; populated on partial-progress timeout.
|
|
1836
|
-
* `nextSteps`— the same hint list printed to stdout (cherry-pick,
|
|
1837
|
-
verify, refresh, or `mu task show` for unmet refs — except a
|
|
1838
|
-
`stuck` ref, which gets `mu agent read <owner>` because its pane,
|
|
1839
|
-
not its task row, holds the reason it stopped).
|
|
1840
|
-
|
|
1841
|
-
### Wait exit codes (`mu task wait`)
|
|
1842
|
-
|
|
1843
|
-
`mu task wait` polls the watched tasks every second (cheap indexed
|
|
1844
|
-
SELECT + a per-poll reconcile of every workstream in the wait set)
|
|
1845
|
-
and exits with one of:
|
|
1846
|
-
|
|
1847
|
-
| Exit | Meaning |
|
|
1848
|
-
|------|-------------------------------------------------------------------------|
|
|
1849
|
-
| `0` | The wait condition was met (`--all` reached, or `--any` / `--first` saw at least one). |
|
|
1850
|
-
| `5` | `--timeout` expired before the condition was met. `--json` payload still includes `all` (refs that did reach) and `timedOut` (refs that didn't). |
|
|
1851
|
-
| `6` | **REAPER_DETECTED.** A WATCHED task transitioned `IN_PROGRESS → OPEN` between polls because the reconciler detected the owning pane was dead and the reaper flipped the task back. Scoped to the wait set: a reaper-flip in some other workstream (or some other task in the same workstream) does NOT trigger exit 6. Fires only when the wait target is `CLOSED` (the default) — with `--status OPEN` a reaper-flip TO open IS the success and the wait returns `0`. Re-dispatch a worker (`mu agent spawn ... && mu task claim --for ...`) and re-run the wait. (`task_wait_reconcile_dead_panes` + `task_wait_cross_workstream`) |
|
|
1852
|
-
| `7` | **STALL_DETECTED.** Only with `--on-stall exit`. The existing `--stuck-after` predicate fired on a watched task (IN_PROGRESS, owner alive but in `needs_input` for `>= --stuck-after` seconds) and the wait threw instead of polling forward. Same target=CLOSED carve-out as exit 6 (with `--status OPEN`/etc the worker reaching `needs_input` might BE the success path; `--on-stall exit` is downgraded to warn-only). Stderr names the task + owner + age. Exit 7 is the **ambiguous** sibling of exit 6: dead pane (6) is unambiguous (re-dispatch); idle agent (7) might be transient, or be waiting on an answer — read the pane before deciding. If both fire in the same poll, exit 6 wins (reaper-flip moves status off `IN_PROGRESS`, so the stuck-check's predicate naturally fails). (`task_wait_stall_action_flag`) |
|
|
1853
|
-
|
|
1854
|
-
The per-poll reconcile means a worker pane that died **before** you
|
|
1855
|
-
ran `mu task wait` is also reaped on the first tick — you'll see exit
|
|
1856
|
-
`6` in well under a second instead of running out the `--timeout`.
|
|
1857
|
-
For cross-workstream waits the reconcile loops over every workstream
|
|
1858
|
-
in the wait set (so a dead pane in workstream B is reaped while you
|
|
1859
|
-
wait on its task there too).
|
|
1860
|
-
|
|
1861
|
-
### `mu task wait`: attention detection (`--stuck-after` + `--on-stall`)
|
|
1862
|
-
|
|
1863
|
-
For unattended waits, always pass `--on-stall exit`; otherwise the default
|
|
1864
|
-
warning leaves the wait polling. Two orthogonal flags govern the behaviour:
|
|
1865
|
-
|
|
1866
|
-
* `--stuck-after <seconds>` — the **trigger**. An IN_PROGRESS task
|
|
1867
|
-
whose owner has been in `needs_input` for `>= N` seconds according
|
|
1868
|
-
to the state source is marked as needing attention. `unknown` never
|
|
1869
|
-
counts. Default `300` (5 min); pass `0` to disable detection entirely
|
|
1870
|
-
(no warn AND no exit).
|
|
1871
|
-
* `--on-stall <action>` — the **action** when the trigger fires.
|
|
1872
|
-
Two values:
|
|
1873
|
-
* `warn` (default) — yellow attention warning to stderr (deduped per
|
|
1874
|
-
task per wait call), corroborating `agent stalled <name> owns
|
|
1875
|
-
<task> for <secs>s` event in the ops log, and `wait` keeps
|
|
1876
|
-
polling.
|
|
1877
|
-
|
|
1878
|
-
**`needs_input` has at least three causes, and the trigger cannot tell
|
|
1879
|
-
them apart:**
|
|
1880
|
-
|
|
1881
|
-
| Cause | Response |
|
|
1882
|
-
| --- | --- |
|
|
1883
|
-
| Worker finished and committed, skipped `mu task close` | close it, merge the work |
|
|
1884
|
-
| Worker asked a question and is waiting on an answer | read the pane, answer it |
|
|
1885
|
-
| Worker hit an approval prompt or a wedged tool call | intervene or `mu agent kick` |
|
|
1886
|
-
|
|
1887
|
-
So the warning states the observation and points at `mu agent read
|
|
1888
|
-
<owner>`, which is the next move in all three cases — the evidence is
|
|
1889
|
-
in the pane, not in the task row. `--json` carries `"stuck": true` per
|
|
1890
|
-
task, and a stuck ref's `nextSteps` entry reads the owner's pane
|
|
1891
|
-
instead of offering `mu task show`.
|
|
1892
|
-
|
|
1893
|
-
A worker stopping to ask is **desirable behaviour**, not negligence:
|
|
1894
|
-
the questions that get asked are usually the ones that prevent
|
|
1895
|
-
rework. Treat an attention warning as "go look", not "the worker
|
|
1896
|
-
misbehaved".
|
|
1897
|
-
* `exit` — same emit + persist, then **exit 7**
|
|
1898
|
-
(`STALL_DETECTED`). The unattended-orchestrator escape: a
|
|
1899
|
-
wrapping policy can branch on 7 (idle, ambiguous — poke vs
|
|
1900
|
-
release) vs 6 (dead pane, unambiguous — re-dispatch). Suppressed
|
|
1901
|
-
when `--status` is anything other than `CLOSED` (mirrors
|
|
1902
|
-
exit-6's carve-out: with `--status OPEN` reaching `needs_input`
|
|
1903
|
-
might BE the success path).
|
|
1904
|
-
|
|
1905
|
-
```bash
|
|
1906
|
-
# Default: warn at 5 min, keep polling.
|
|
1907
|
-
mu task wait build_a build_b -w mufeedback-v03 --timeout 1800
|
|
1908
|
-
|
|
1909
|
-
# Tune the trigger; same warn-only action.
|
|
1910
|
-
mu task wait build_a -w mufeedback-v03 --stuck-after 60
|
|
1911
|
-
|
|
1912
|
-
# Exit on stall (cron-driven wrapper):
|
|
1913
|
-
mu task wait build_a -w mufeedback-v03 --on-stall exit
|
|
1914
|
-
# exit 0 → closed
|
|
1915
|
-
# exit 5 → timeout
|
|
1916
|
-
# exit 6 → dead pane (re-dispatch)
|
|
1917
|
-
# exit 7 → idle agent (poke or release — inspect first)
|
|
1918
|
-
|
|
1919
|
-
# Tune both. Exit at 60s of needs_input:
|
|
1920
|
-
mu task wait build_a -w mufeedback-v03 --stuck-after 60 --on-stall exit
|
|
1921
|
-
|
|
1922
|
-
# Disable both warn AND exit (--stuck-after 0 wins):
|
|
1923
|
-
mu task wait build_a -w mufeedback-v03 --stuck-after 0 --on-stall exit
|
|
1924
|
-
```
|
|
1925
|
-
|
|
1926
|
-
### Common ad-hoc queries
|
|
1927
|
-
|
|
1928
|
-
```bash
|
|
1929
|
-
# Set task to IN_PROGRESS without claiming (claim does this automatically;
|
|
1930
|
-
# this covers the rare manual case). local_id is per-workstream unique,
|
|
1931
|
-
# so always scope by workstream_id to avoid hitting a same-named task in
|
|
1932
|
-
# another workstream.
|
|
1933
|
-
mu sql "UPDATE tasks SET status='IN_PROGRESS'
|
|
1934
|
-
WHERE local_id='build'
|
|
1935
|
-
AND workstream_id=(SELECT id FROM workstreams WHERE name='mufeedback-v03')"
|
|
1936
|
-
|
|
1937
|
-
# What's blocking what (open tasks only) — same data as `mu task tree`
|
|
1938
|
-
# but as a flat join when you want a wider report. task_edges is keyed
|
|
1939
|
-
# by tasks.id, not local_id; join workstreams to scope the report.
|
|
1940
|
-
mu sql "SELECT b.local_id AS blocked, t.local_id AS by_task
|
|
1941
|
-
FROM tasks b
|
|
1942
|
-
JOIN workstreams w ON w.id = b.workstream_id
|
|
1943
|
-
JOIN task_edges e ON e.to_task_id = b.id
|
|
1944
|
-
JOIN tasks t ON t.id = e.from_task_id
|
|
1945
|
-
WHERE w.name='mufeedback-v03'
|
|
1946
|
-
AND t.status != 'CLOSED' AND b.status = 'OPEN'"
|
|
1947
|
-
|
|
1948
|
-
# Recursive CTE: every task that transitively blocks `launch` in a
|
|
1949
|
-
# given workstream (or use `mu task tree launch --json` for the same
|
|
1950
|
-
# data structured). local_id is per-workstream, so resolve the seed
|
|
1951
|
-
# under a workstream filter.
|
|
1952
|
-
mu sql "WITH RECURSIVE prereqs(id) AS (
|
|
1953
|
-
SELECT t.id FROM tasks t
|
|
1954
|
-
JOIN workstreams w ON w.id = t.workstream_id
|
|
1955
|
-
WHERE t.local_id='launch' AND w.name='mufeedback-v03'
|
|
1956
|
-
UNION
|
|
1957
|
-
SELECT e.from_task_id FROM task_edges e, prereqs
|
|
1958
|
-
WHERE e.to_task_id = prereqs.id
|
|
1959
|
-
)
|
|
1960
|
-
SELECT t.local_id, t.title, t.status
|
|
1961
|
-
FROM prereqs JOIN tasks t ON t.id = prereqs.id"
|
|
1962
|
-
```
|
|
1963
|
-
|
|
1964
|
-
`mu sql` accepts both reads and writes. Reads are pretty-printed as a
|
|
1965
|
-
table; writes report `<n> rows affected`.
|
|
1966
|
-
|
|
1967
|
-
---
|
|
1968
|
-
|
|
1969
|
-
## 14. Recovery scenarios
|
|
1970
|
-
|
|
1971
|
-
### An agent's pane dies externally
|
|
1972
|
-
|
|
1973
|
-
You killed it from another tmux client, or its CLI crashed:
|
|
1974
|
-
|
|
1975
|
-
```bash
|
|
1976
|
-
mu agent list # worker-1's row prunes itself (ghost detected)
|
|
1977
|
-
```
|
|
1978
|
-
|
|
1979
|
-
Reconciliation runs on every `mu agent list` / `mu`. Two steps:
|
|
1980
|
-
|
|
1981
|
-
1. **Prune ghost rows** — DB row whose `pane_id` no longer exists in
|
|
1982
|
-
the mux gets deleted
|
|
1983
|
-
2. **Surface orphan panes** — panes in the workstream's session whose
|
|
1984
|
-
`pane.command` looks like an agent CLI but that aren't in the
|
|
1985
|
-
registry. **Not** auto-adopted; mu lists them under "Orphan panes"
|
|
1986
|
-
with the `mu agent adopt <pane-id>` hint
|
|
1987
|
-
|
|
1988
|
-
### A worker is wedged on an unbounded tool subprocess
|
|
1989
|
-
|
|
1990
|
-
A worker ran `find / -maxdepth 6 ...` (30-60 minutes on a populated
|
|
1991
|
-
home directory) or a busy-wait loop. `mu agent send` queues steering
|
|
1992
|
-
messages until the tool returns; `tmux send-keys C-c` against the
|
|
1993
|
-
pane doesn't propagate (the wrapping pi/claude/codex CLI catches it
|
|
1994
|
-
as TUI input). The escape hatch:
|
|
1995
|
-
|
|
1996
|
-
```bash
|
|
1997
|
-
mu agent kick worker-1 # SIGINT (graceful, default)
|
|
1998
|
-
mu agent kick worker-1 --signal SIGTERM # polite escalation
|
|
1999
|
-
mu agent kick worker-1 --signal SIGKILL # hammer
|
|
2000
|
-
```
|
|
2001
|
-
|
|
2002
|
-
`mu agent kick` looks up the pane's TTY (`tmux display-message -p
|
|
2003
|
-
'#{pane_tty}'`), asks `ps -t <tty>` for the foreground process group
|
|
2004
|
-
(the row whose `stat` contains `+`), and signals the whole pgrp.
|
|
2005
|
-
Refuses with `NoForegroundProcessError` when the foreground IS the
|
|
2006
|
-
wrapping CLI — use `mu agent close` then.
|
|
2007
|
-
|
|
2008
|
-
Prevention: don't prompt workers to run filesystem-wide `find`, broad
|
|
2009
|
-
`grep -r /`, or unbounded busy-wait loops. Scope to `$WORKSPACE`.
|
|
2010
|
-
|
|
2011
|
-
### You closed your terminal session
|
|
2012
|
-
|
|
2013
|
-
The workstream's tmux session keeps running detached. Reconnect with
|
|
2014
|
-
`tmux a -t mu-auth-refactor`. Agents are alive; the DB has the
|
|
2015
|
-
registry; everything resumes. mu is daemon-free — every `mu`
|
|
2016
|
-
invocation is a short-lived process that re-reads from
|
|
2017
|
-
`~/.local/state/mu/mu.db`.
|
|
2018
|
-
|
|
2019
|
-
### The mu DB seems wrong
|
|
2020
|
-
|
|
2021
|
-
```bash
|
|
2022
|
-
mu doctor # quick health check (exit 5 = drift)
|
|
2023
|
-
mu doctor --deep # rebuild + field-level diff
|
|
2024
|
-
mu doctor --disk # + per-workspace byte usage
|
|
2025
|
-
sqlite3 ~/.local/state/mu/mu.db .schema # inspect
|
|
2026
|
-
rm ~/.local/state/mu/mu.db # nuke (last resort; loses task graph and registry)
|
|
2027
|
-
```
|
|
2028
|
-
|
|
2029
|
-
### You ran a destructive verb and want to undo it
|
|
2030
|
-
|
|
2031
|
-
Every change any verb makes is captured as **ops** under one
|
|
2032
|
-
**group**, so undo is per-action rather than per-file.
|
|
2033
|
-
|
|
2034
|
-
```bash
|
|
2035
|
-
mu undo # list recent undoable groups (newest first)
|
|
2036
|
-
mu undo 4a1a6305 # preview the inverse of one group (dry run)
|
|
2037
|
-
mu undo 4a1a6305 --yes # apply it
|
|
2038
|
-
mu undo -n 20 # list more groups
|
|
2039
|
-
```
|
|
2040
|
-
|
|
2041
|
-
A group id may be given as any unique prefix. Full semantics —
|
|
2042
|
-
granularity, undo-as-an-op (which is also "redo"), and the
|
|
2043
|
-
superseded-work refusal plus its `--force` override — are in
|
|
2044
|
-
[§ Undoing one action](#undoing-one-action-mu-undo).
|
|
2045
|
-
|
|
2046
|
-
Two important caveats:
|
|
2047
|
-
|
|
2048
|
-
- **Only rows are reverted.** Undo emits inverse ops against the
|
|
2049
|
-
portable tables. It does not resurrect a killed tmux pane, an
|
|
2050
|
-
agent registry row, or a workspace directory `mu workspace free`
|
|
2051
|
-
removed — none of those are portable state, so none of them are
|
|
2052
|
-
in the log.
|
|
2053
|
-
- **For whole-DB recovery, use `mu rebuild <file>`**, which replays
|
|
2054
|
-
the entire ops log into a NEW file. It never writes in place.
|
|
2055
|
-
|
|
2056
|
-
### Workspace orphans (dirs on disk with no DB row)
|
|
2057
|
-
|
|
2058
|
-
A `--workspace` spawn that aborted partway, or a manual `rm` of
|
|
2059
|
-
`vcs_workspaces` rows, can leave dirs in
|
|
2060
|
-
`<state-dir>/workspaces/<workstream>/<agent>/` with no DB row. They're
|
|
2061
|
-
invisible to `mu workspace list` but they BLOCK subsequent
|
|
2062
|
-
`--workspace` spawns under the same name.
|
|
2063
|
-
|
|
2064
|
-
```bash
|
|
2065
|
-
mu state -w <workstream> # 'Workspace orphans' section in yellow
|
|
2066
|
-
mu workspace orphans -w <workstream> # focused list + cleanup recipe
|
|
2067
|
-
```
|
|
2068
|
-
|
|
2069
|
-
For each orphan, the cleanup is one of:
|
|
2070
|
-
|
|
2071
|
-
```bash
|
|
2072
|
-
# git-backed workspace: also prunes the worktree registry
|
|
2073
|
-
(cd <project-root> && git worktree remove --force <orphan-path>)
|
|
2074
|
-
|
|
2075
|
-
# any backend (last resort)
|
|
2076
|
-
rm -rf <orphan-path>
|
|
2077
|
-
```
|
|
2078
|
-
|
|
2079
|
-
The `Next:` block from `mu workspace orphans` interpolates the
|
|
2080
|
-
actual paths so you can copy-paste.
|
|
2081
|
-
|
|
2082
|
-
### You typo'd a workstream name and want to rename it
|
|
2083
|
-
|
|
2084
|
-
The `workstreams.name` column has `ON UPDATE CASCADE` on every
|
|
2085
|
-
child-table foreign key, so renaming a workstream is a single SQL
|
|
2086
|
-
statement that propagates atomically through `agents`, `tasks`,
|
|
2087
|
-
`task_notes`, and `vcs_workspaces`:
|
|
2088
|
-
|
|
2089
|
-
```bash
|
|
2090
|
-
# 1. Validate the new name fits the rules (or mu will reject it on
|
|
2091
|
-
# next use). Lowercase alpha first, then alnum/_/-, ≤32 chars,
|
|
2092
|
-
# no '.' or ':' (tmux mangles them), no 'mu-' prefix.
|
|
2093
|
-
# 2. Rename in the DB. Single statement; cascades to every child.
|
|
2094
|
-
mu sql "UPDATE workstreams SET name='auth-refactor' WHERE name='auth-refator'"
|
|
2095
|
-
|
|
2096
|
-
# 3. Rename the tmux session too (only if it's currently alive).
|
|
2097
|
-
tmux rename-session -t mu-auth-refator mu-auth-refactor
|
|
2098
|
-
```
|
|
2099
|
-
|
|
2100
|
-
There is no typed `mu workstream rename` verb <!-- doc-cli-drift:skip -->: the
|
|
2101
|
-
schema does the work, and wrapping one safe statement buys nothing (no
|
|
2102
|
-
atomicity to preserve, no validation to add). The recipe above is the
|
|
2103
|
-
canonical answer, and the same `ON UPDATE CASCADE` makes `mu sql`
|
|
2104
|
-
renames safe for `tasks.local_id` and `agents.name` too.
|
|
2105
|
-
|
|
2106
|
-
---
|
|
2107
|
-
|
|
2108
|
-
## 15. Cleanup
|
|
2109
|
-
|
|
2110
|
-
### Close individual agents
|
|
2111
|
-
|
|
2112
|
-
```bash
|
|
2113
|
-
mu agent close worker-1 # kills pane + drops registry row
|
|
2114
|
-
```
|
|
2115
|
-
|
|
2116
|
-
Idempotent: a missing pane and a missing row are both fine.
|
|
2117
|
-
|
|
2118
|
-
If the agent has a workspace:
|
|
2119
|
-
|
|
2120
|
-
- **Clean** (no uncommitted changes AND no commits since fork) —
|
|
2121
|
-
auto-freed alongside the close.
|
|
2122
|
-
- **Dirty** — close refuses with `WorkspacePreservedError` (exit 4).
|
|
2123
|
-
Either `mu workspace free <agent>` first (optionally `--commit` to
|
|
2124
|
-
capture pending changes) then close, or
|
|
2125
|
-
`mu agent close <agent> --discard-workspace` to do both (lossy).
|
|
2126
|
-
|
|
2127
|
-
### Tear down the whole workstream
|
|
2128
|
-
|
|
2129
|
-
`mu workstream teardown` is the counterpart of `mu workstream init`: it
|
|
2130
|
-
kills the workstream's tmux session AND deletes every DB row tagged
|
|
2131
|
-
with the workstream name (edges and notes go via FK cascade on tasks).
|
|
2132
|
-
The workstream resolves as everywhere else: `--workstream <name>` >
|
|
2133
|
-
`$MU_SESSION` > current tmux session (`mu-` prefix stripped).
|
|
2134
|
-
|
|
2135
|
-
Two-phase by default: a bare `mu workstream teardown` prints a dry-run
|
|
2136
|
-
summary and exits without touching anything. Pass `-y` / `--yes` to
|
|
2137
|
-
tear it down.
|
|
2138
|
-
|
|
2139
|
-
```bash
|
|
2140
|
-
mu workstream teardown --workstream auth-refactor # dry-run: shows counts, exits
|
|
2141
|
-
mu workstream teardown --workstream auth-refactor --yes # actually does it
|
|
2142
|
-
|
|
2143
|
-
# Or, from inside the workstream's tmux session:
|
|
2144
|
-
mu workstream teardown --yes # workstream auto-detected
|
|
2145
|
-
|
|
2146
|
-
# Sweep every empty workstream (zero tasks, agents, vcs_workspaces)
|
|
2147
|
-
# in one call. Tmux session presence and audit-only log entries do NOT
|
|
2148
|
-
# disqualify. Also surfaces unregistered `mu-*` tmux sessions (test
|
|
2149
|
-
# litter, or a partial teardown that dropped the DB row but left the
|
|
2150
|
-
# session). ONLY `mu-`-prefixed sessions are touched. Mutually
|
|
2151
|
-
# exclusive with -w. Dry-run lists what WOULD go
|
|
2152
|
-
# (created_at renders `—` for mux-only entries); --yes tears them down.
|
|
2153
|
-
mu workstream teardown --empty # dry-run: table of empties
|
|
2154
|
-
mu workstream teardown --empty --yes # tear them all down
|
|
2155
|
-
```
|
|
2156
|
-
|
|
2157
|
-
```
|
|
2158
|
-
Workstream auth-refactor (mux session mu-auth-refactor)
|
|
2159
|
-
mux session : alive (will be killed)
|
|
2160
|
-
agents : 1
|
|
2161
|
-
tasks : 1 (edges: 0, notes: 0)
|
|
2162
|
-
workspaces : 0
|
|
2163
|
-
|
|
2164
|
-
Destroyed auth-refactor: killed mux=true, agents=1, tasks=1, edges=0, notes=0, workspaces=0/0
|
|
2165
|
-
```
|
|
2166
|
-
|
|
2167
|
-
Idempotent on every leg: a missing tmux session is fine, zero DB rows
|
|
2168
|
-
is fine, and a repeat teardown prints "nothing to tear down" and exits 0.
|
|
2169
|
-
|
|
2170
|
-
Destroy writes TOMBSTONE ops rather than erasing history, so the work
|
|
2171
|
-
stays in the ops log. `mu undo <group> --yes` reverses the row
|
|
2172
|
-
deletions — but not the killed tmux session or freed workspace dirs.
|
|
2173
|
-
See
|
|
2174
|
-
[§ 14: You ran a destructive verb and want to undo it](#you-ran-a-destructive-verb-and-want-to-undo-it).
|
|
2175
|
-
|
|
2176
|
-
The tmux session is killed BEFORE the DB rows so an unexpected tmux
|
|
2177
|
-
failure leaves the registry intact (you can retry); if you only want
|
|
2178
|
-
the DB cleared, use `mu sql` directly:
|
|
2179
|
-
|
|
2180
|
-
```bash
|
|
2181
|
-
mu sql "DELETE FROM tasks
|
|
2182
|
-
WHERE workstream_id=(SELECT id FROM workstreams WHERE name='auth-refactor')" # cascades
|
|
2183
|
-
mu sql "DELETE FROM agents
|
|
2184
|
-
WHERE workstream_id=(SELECT id FROM workstreams WHERE name='auth-refactor')"
|
|
2185
|
-
```
|
|
2186
|
-
|
|
2187
|
-
Or nuke the entire DB:
|
|
2188
|
-
|
|
2189
|
-
```bash
|
|
2190
|
-
rm ~/.local/state/mu/mu.db # next mu invocation re-creates an empty schema
|
|
2191
|
-
```
|
|
2192
|
-
|
|
2193
|
-
### Before tearing down a workstream
|
|
2194
|
-
|
|
2195
|
-
A workstream's task graph + notes IS the project memory.
|
|
2196
|
-
`mu workstream teardown` removes the live rows; the ops log keeps them,
|
|
2197
|
-
and `mu undo <group> --yes` reverses the row deletions. **A pre-flight
|
|
2198
|
-
`mu db backup` is not warranted for a teardown** — the log already is
|
|
2199
|
-
the backup.
|
|
2200
|
-
|
|
2201
|
-
Finding the group id later is what `--torn-down` is for:
|
|
2202
|
-
|
|
2203
|
-
```bash
|
|
2204
|
-
mu workstream list --torn-down
|
|
2205
|
-
# name group torn down tasks edges notes
|
|
2206
|
-
# gchatui-node 7a40e6cc 52m ago 220 103 714
|
|
2207
|
-
# surface-audit 98007873 3d ago 51 51 201 ← recreated since
|
|
2208
|
-
|
|
2209
|
-
mu undo 7a40e6cc # preview
|
|
2210
|
-
mu undo 7a40e6cc --yes # restore the rows
|
|
2211
|
-
```
|
|
2212
|
-
|
|
2213
|
-
One entry per teardown, newest first, read straight from the ops log —
|
|
2214
|
-
so a name torn down twice lists twice (the group is the identity, not
|
|
2215
|
-
the name) and teardowns from before the 1.2.0 rename are included.
|
|
2216
|
-
`← recreated since` means a later op put that name back, so undoing it
|
|
2217
|
-
would be a no-op; the printed `Next:` hint always names the newest
|
|
2218
|
-
entry that is still restorable. What does NOT come back is what was
|
|
2219
|
-
never in the DB: killed panes and freed workspace dirs.
|
|
2220
|
-
|
|
2221
|
-
There is no markdown export. Use the typed surfaces instead:
|
|
2222
|
-
|
|
2223
|
-
| Need | Verb |
|
|
2224
|
-
| ---- | ---- |
|
|
2225
|
-
| A safety copy before a destructive change | `mu db backup <file>` (`VACUUM INTO`; never overwrites) |
|
|
2226
|
-
| Find a past teardown's group id | `mu workstream list --torn-down` |
|
|
2227
|
-
| Reverse a teardown you regret | `mu undo <group> --yes` |
|
|
2228
|
-
| Laptop ↔ devserver handoff | Ambient **sync** — set `MU_SYNC_DIR` and every command carries it (§ 15.6) |
|
|
2229
|
-
| Peer status / a torn segment | `mu sync`, `mu sync --repair <peer>` |
|
|
2230
|
-
| Disaster recovery from the ops log | `mu rebuild <file>` |
|
|
2231
|
-
|
|
2232
|
-
Anything else — reading the graph out for grep, review or a git-checked-in
|
|
2233
|
-
artifact — goes through `--json` and whatever renderer you prefer:
|
|
2234
|
-
|
|
2235
|
-
```bash
|
|
2236
|
-
mu task list -w auth-refactor --json
|
|
2237
|
-
mu task notes <id> -w auth-refactor --json
|
|
2238
|
-
```
|
|
2239
|
-
|
|
2240
|
-
---
|
|
2241
|
-
|
|
2242
|
-
## 15.6 Multi-machine sync
|
|
2243
|
-
|
|
2244
|
-
**One env var, on every machine.** That is the whole configuration:
|
|
2245
|
-
|
|
2246
|
-
```bash
|
|
2247
|
-
export MU_SYNC_DIR=$HOME/Sync/mu # a folder something else keeps in step
|
|
2248
|
-
```
|
|
2249
|
-
|
|
2250
|
-
Now every `mu` invocation flushes your ops into
|
|
2251
|
-
`$MU_SYNC_DIR/<machine_id>.jsonl` and reads every OTHER `.jsonl` in that
|
|
2252
|
-
folder. Nothing else to set up: no peer list, no host names, no daemon.
|
|
2253
|
-
Drop a third machine in and it appears.
|
|
2254
|
-
|
|
2255
|
-
The end-to-end walkthrough with real output is
|
|
2256
|
-
[§ 0.3 Laptop ↔ devserver](#03-laptop--devserver). There is no export
|
|
2257
|
-
step, no import step, and no "which side is authoritative" decision.
|
|
2258
|
-
|
|
2259
|
-
### `mu sync` — the status report
|
|
2260
|
-
|
|
2261
|
-
Sync already happened on your last command, so `mu sync`'s job is to
|
|
2262
|
-
tell you *who your peers are and whether transport is working*:
|
|
2263
|
-
|
|
2264
|
-
```console
|
|
2265
|
-
$ mu sync
|
|
2266
|
-
flushed 14 ops · ingested 22 from 1 peer
|
|
2267
|
-
┌──────────┬───────────┬────────┬─────────┐
|
|
2268
|
-
│ machine │ last seen │ behind │ │
|
|
2269
|
-
├──────────┼───────────┼────────┼─────────┤
|
|
2270
|
-
│ 7f3a91c2 │ 2m ago │ 0 │ │
|
|
2271
|
-
├──────────┼───────────┼────────┼─────────┤
|
|
2272
|
-
│ c8ec0feb │ 3d ago │ 47 │ ← stale │
|
|
2273
|
-
└──────────┴───────────┴────────┴─────────┘
|
|
2274
|
-
Next:
|
|
2275
|
-
Pull fresh segments (1 stale peer) : rsync -av <host>:/home/me/Sync/mu/ /home/me/Sync/mu/
|
|
2276
|
-
Or stop doing it by hand : # share /home/me/Sync/mu with Syncthing
|
|
2277
|
-
```
|
|
2278
|
-
|
|
2279
|
-
Machines are named by `machine_id` prefix, not hostname — a hostname is
|
|
2280
|
-
machine-local and never travels. `behind` is how many lines of that
|
|
2281
|
-
peer's segment you *hold but have not applied*; non-zero means either a
|
|
2282
|
-
transfer caught mid-flight (it resolves itself) or a defect that
|
|
2283
|
-
stopped the read (see `--repair`).
|
|
2284
|
-
|
|
2285
|
-
Two flags, and only two:
|
|
2286
|
-
|
|
2287
|
-
```bash
|
|
2288
|
-
# Read a peer's DB directly — an sshfs mount, or a file you scp'd.
|
|
2289
|
-
# A different READER: its SQLite ops table, not a JSONL segment.
|
|
2290
|
-
mu sync --from /mnt/devserver/.local/state/mu/mu.db
|
|
2291
|
-
|
|
2292
|
-
# Re-read a peer's segment from zero, after a torn transfer.
|
|
2293
|
-
# Safe to run any time: ingest is idempotent.
|
|
2294
|
-
mu sync --repair c8ec
|
|
2295
|
-
```
|
|
2296
|
-
|
|
2297
|
-
A one-off directory needs no flag at all — the env var already does it:
|
|
2298
|
-
|
|
2299
|
-
```bash
|
|
2300
|
-
MU_SYNC_DIR=/media/usb-stick mu state # ingest from a USB stick
|
|
2301
|
-
```
|
|
2302
|
-
|
|
2303
|
-
### Transport is yours
|
|
2304
|
-
|
|
2305
|
-
mu reads and writes files. It never runs `ssh`, `scp`, or `rsync` for
|
|
2306
|
-
you — that would mean owning ssh config, jump hosts, `ProxyCommand`,
|
|
2307
|
-
non-standard ports, identity files, and password prompts. When a peer
|
|
2308
|
-
looks stale, mu prints the command and you paste it.
|
|
2309
|
-
|
|
2310
|
-
Pick any file-mover; segments are **append-only and
|
|
2311
|
-
single-writer-per-file**, so anything works:
|
|
2312
|
-
|
|
2313
|
-
| Tier | How | Notes |
|
|
2314
|
-
| ---- | --- | ----- |
|
|
2315
|
-
| **Recommended: Syncthing** | Share `$MU_SYNC_DIR` on every machine | Continuous, peer-to-peer, no server, no cloud account. Its `*.sync-conflict-*` copies are ingested rather than ignored — they are still valid op logs, and dedupe makes reading them free. |
|
|
2316
|
-
| `rsync` in a loop or cron | `rsync -av host:$MU_SYNC_DIR/ $MU_SYNC_DIR/` | Fine. Run it in both directions, or one way from each box. |
|
|
2317
|
-
| sshfs / NFS mount of the FOLDER | Point `MU_SYNC_DIR` at the mount | OK for segments. **Never** for `MU_DB_PATH`. |
|
|
2318
|
-
| Fully manual (`scp`, USB stick) | Copy the `.jsonl` files whenever | Still converges, just less often. |
|
|
2319
|
-
|
|
2320
|
-
Manual copying is a first-class tier, not a fallback:
|
|
2321
|
-
|
|
2322
|
-
1. **Direction-free.** No source-vs-target decision. Copy either way,
|
|
2323
|
-
or both ways. You converge.
|
|
2324
|
-
2. **Idempotent.** Copying the same file ten times equals copying it
|
|
2325
|
-
once, so re-copy freely when unsure.
|
|
2326
|
-
3. **Interruption-safe.** A killed `scp` leaves a truncated last line
|
|
2327
|
-
that the parser skips; the next copy completes it.
|
|
2328
|
-
|
|
2329
|
-
### Two things not to do
|
|
2330
|
-
|
|
2331
|
-
**Never put `MU_DB_PATH` inside `MU_SYNC_DIR`.** THE footgun of the
|
|
2332
|
-
design. `mu doctor` reports it, with the full remediation paragraph:
|
|
2333
|
-
|
|
2334
|
-
```console
|
|
2335
|
-
$ mu doctor
|
|
2336
|
-
fleet
|
|
2337
|
-
db-vs-sync : FAIL DB is INSIDE MU_SYNC_DIR — this WILL corrupt it (/tmp/mu-sync-demo/mu.db)
|
|
2338
|
-
```
|
|
2339
|
-
|
|
2340
|
-
A live WAL-mode SQLite database is three files (`mu.db`, `-wal`,
|
|
2341
|
-
`-shm`) whose mutual consistency *is* its durability. A file-syncer
|
|
2342
|
-
copies them whole-file and out of order, and will resurrect a peer's
|
|
2343
|
-
stale `-wal` — yielding a database that opens fine and is silently
|
|
2344
|
-
corrupt. Two machines writing the same synced file is worse:
|
|
2345
|
-
last-writer-wins on the whole FILE, so one machine's entire history
|
|
2346
|
-
disappears. Keep the DB on local disk; only the regenerable segments
|
|
2347
|
-
travel.
|
|
2348
|
-
|
|
2349
|
-
**Avoid iCloud Drive and Dropbox for `MU_SYNC_DIR` on macOS.** Both do
|
|
2350
|
-
*dataless-placeholder eviction*: an untouched file becomes a stub, and
|
|
2351
|
-
the `stat()` that materialises it blocks on the network. mu stats the
|
|
2352
|
-
sync dir at the top of *every* command, so `mu task add` becomes a
|
|
2353
|
-
multi-second hang — or a failure when offline. Syncthing keeps real
|
|
2354
|
-
bytes on disk. (Google Drive File Stream and OneDrive Files On-Demand
|
|
2355
|
-
have the same problem.)
|
|
2356
|
-
|
|
2357
|
-
### What does and does not travel
|
|
2358
|
-
|
|
2359
|
-
Only **portable** state syncs: workstreams, tasks, edges, notes. Ops
|
|
2360
|
-
about **agents** and **workspaces** are recorded locally — `mu log`
|
|
2361
|
-
still shows them — but never leave the machine, because a `pane_id`
|
|
2362
|
-
like `%17` and a path like `/home/me/...` are meaningless (and often
|
|
2363
|
-
actively wrong) on another box.
|
|
2364
|
-
|
|
2365
|
-
One consequence: **task ownership does not sync.**
|
|
2366
|
-
`tasks.owner_id` points into the machine-local `agents` table, so a
|
|
2367
|
-
task claimed by `worker-2` on the devserver shows as unowned on your
|
|
2368
|
-
laptop. That is correct — `worker-2` is a tmux pane that does not exist
|
|
2369
|
-
there.
|
|
2370
|
-
|
|
2371
|
-
### Concurrent editing
|
|
2372
|
-
|
|
2373
|
-
Edit one workstream on two machines at once. Ops are semantic partial
|
|
2374
|
-
updates merged by **per-field last-writer-wins**, so a devserver crew
|
|
2375
|
-
closing a task while you re-prioritise it on the laptop keeps *both*
|
|
2376
|
-
edits:
|
|
2377
|
-
|
|
2378
|
-
```bash
|
|
2379
|
-
# laptop # devserver
|
|
2380
|
-
mu task update t1 --impact 95 -w app mu task close t1 -w app
|
|
2381
|
-
# after both sync: impact=95 AND status=CLOSED, on both machines
|
|
2382
|
-
```
|
|
2383
|
-
|
|
2384
|
-
Only the same *field* of the same row edited on two machines needs a
|
|
2385
|
-
winner, and the newer HLC takes it.
|
|
2386
|
-
|
|
2387
|
-
---
|
|
2388
|
-
|
|
2389
|
-
## 15.7 Upgrading a v7, v8, v9, or v10 DB
|
|
2390
|
-
|
|
2391
|
-
`mu` refuses to write a pre-v11 DB and leaves it untouched. Use the
|
|
2392
|
-
single retained sidecar against a backup:
|
|
2393
|
-
|
|
2394
|
-
```bash
|
|
2395
|
-
DB=${MU_DB_PATH:-$HOME/.local/state/mu/mu.db}
|
|
2396
|
-
BACKUP="$HOME/mu-old-backup-$(date +%Y%m%d-%H%M%S).db"
|
|
2397
|
-
sqlite3 "$DB" ".backup '$BACKUP'"
|
|
2398
|
-
npx tsx scripts/migrate.ts "$BACKUP" --out "${DB}.v11"
|
|
2399
|
-
MU_DB_PATH="${DB}.v11" mu doctor --deep
|
|
2400
|
-
mv "$DB" "${DB}.old-kept" && mv "${DB}.v11" "$DB"
|
|
2401
|
-
mu doctor
|
|
2402
|
-
```
|
|
2403
|
-
|
|
2404
|
-
The script auto-detects v7, v8, v9, v10, or v11, opens it read-only, compares
|
|
2405
|
-
its SHA-256 before and after, and never overwrites a target unless
|
|
2406
|
-
`--force` is explicit. v9/v10 history is retained unchanged; legacy
|
|
2407
|
-
statuses map onto substates (`REJECTED` → `CLOSED/rejected`, `DEFERRED` →
|
|
2408
|
-
`OPEN/parked`) while projecting into v11, and no migration notes are
|
|
2409
|
-
written. Where an undo or a note hid the legacy status, the script
|
|
2410
|
-
records a `migrate.substate` op; `--recover <db>` reruns that recovery
|
|
2411
|
-
on an already-migrated DB. Valid v9 agents, workspaces, owners, peer
|
|
2412
|
-
watermarks, and machine identity carry across, but pane ids and absolute
|
|
2413
|
-
workspace paths cannot be proven live until `mu doctor` reconciles them.
|
|
2414
|
-
The v7/v8 path keeps the older conservative omissions for agents and
|
|
2415
|
-
workspaces, and restores pre-1.0 `archived_*` rows as live workstreams
|
|
2416
|
-
by default (`--drop-archives` to skip).
|
|
2417
|
-
|
|
2418
|
-
**Full recipe, every flag, and the precise carry/omit rules:
|
|
2419
|
-
[scripts/README.md](../scripts/README.md).**
|
|
2420
|
-
|
|
2421
|
-
---
|
|
2422
|
-
|
|
2423
|
-
## 16. One-shot demo script
|
|
2424
|
-
|
|
2425
|
-
End-to-end against a throwaway DB, so your real registry is untouched.
|
|
2426
|
-
|
|
2427
|
-
```bash
|
|
2428
|
-
export MU_DB_PATH=/tmp/mu-demo.db
|
|
2429
|
-
tmux kill-session -t mu-demo 2>/dev/null
|
|
2430
|
-
|
|
2431
|
-
# Plan
|
|
2432
|
-
mu workstream init demo
|
|
2433
|
-
mu task add design --title "Design" -w demo --impact 80 --effort-days 2
|
|
2434
|
-
mu task add build --title "Build" -w demo --impact 80 --effort-days 5 --blocked-by design
|
|
2435
|
-
mu task add ship --title "Ship" -w demo --impact 90 --effort-days 1 --blocked-by build
|
|
2436
|
-
|
|
2437
|
-
# Crew
|
|
2438
|
-
mu agent spawn worker-1 --workstream demo --cli sh
|
|
2439
|
-
mu agent spawn worker-2 --workstream demo --cli sh
|
|
2440
|
-
|
|
2441
|
-
# Assign + observe
|
|
2442
|
-
mu task claim design -w demo --for worker-1 --evidence "demo assignment"
|
|
2443
|
-
mu state -w demo
|
|
2444
|
-
|
|
2445
|
-
# Watch live (Ctrl+b d to detach)
|
|
2446
|
-
tmux attach -t mu-demo
|
|
2447
|
-
|
|
2448
|
-
# Cleanup
|
|
2449
|
-
mu workstream teardown --workstream demo --yes
|
|
2450
|
-
rm -f /tmp/mu-demo.db
|
|
2451
|
-
```
|
|
2452
|
-
|
|
2453
|
-
---
|
|
2454
|
-
|
|
2455
|
-
## Mental model in three sentences
|
|
2456
|
-
|
|
2457
|
-
1. **One workstream is one tmux session full of agent panes.** Mu
|
|
2458
|
-
manages the lifecycle; tmux is the substrate. Workstreams on the
|
|
2459
|
-
same machine are isolated by `session_id` in the SQLite registry.
|
|
2460
|
-
|
|
2461
|
-
2. **The task DAG decides what can be worked on.** The `Ready` table +
|
|
2462
|
-
parallel-tracks union-find answer "what's next?" and "what can I
|
|
2463
|
-
parallelize?" deterministically. Diamond patterns (two goals sharing
|
|
2464
|
-
a prerequisite) collapse into one merged track so two agents never
|
|
2465
|
-
collide on shared deps.
|
|
2466
|
-
|
|
2467
|
-
3. **Agents claim tasks via their pane title — zero config.**
|
|
2468
|
-
`mu task claim foo` from inside `worker-1`'s pane sets the task's
|
|
2469
|
-
`owner_id` to the `worker-1` agent row atomically. mu reads the pane
|
|
2470
|
-
title via `tmux display-message -t $TMUX_PANE -p '#{pane_title}'`,
|
|
2471
|
-
set on spawn. Two agents cannot claim the same task.
|
|
2472
|
-
|
|
2473
|
-
Everything else (`mu sql`, send/read, the bracketed-paste protocol,
|
|
2474
|
-
agent-state sources, ghost reconciliation) is plumbing in service of those three.
|
|
2475
|
-
|
|
2476
|
-
---
|
|
2477
|
-
|
|
2478
|
-
## What's NOT in mu (and how to work around it)
|
|
2479
|
-
|
|
2480
|
-
The full roadmap with promotion criteria lives in
|
|
2481
|
-
[ROADMAP.md](ROADMAP.md). The short list of gaps you might hit
|
|
2482
|
-
in real use:
|
|
2483
|
-
|
|
2484
|
-
| Want | Workaround | Status |
|
|
2485
|
-
| --------------------------------------------- | ----------------------------------------------------------------------- | ------------- |
|
|
2486
|
-
| Pi extension (typed tools, HUD, wakeups) | `mu state --tui` (interactive) covers the dashboard use-case; plain `mu state` (static) is the `watch` / `tmux display-popup` / `status-right` substrate. Other extension tools deferred. | partially shipped |
|
|
2487
|
-
| Markdown agent-definition discovery | Spawn accepts `--cli` and `--command` directly; no template registry | dropped |
|
|
2488
|
-
<!-- doc-cli-drift:skip-start -->
|
|
2489
|
-
| `mu run script.ts` (JS DSL) | Use `--json` + bash + jq | rejected |
|
|
2490
|
-
| Sync to GitHub Issues / Linear / Asana | Not in scope; explicitly rejected | — |
|
|
2491
|
-
| ~~`mu task blocked`~~ (removed; the `blocked` SQL view is the abstraction) | `mu sql "SELECT b.local_id, b.status, b.title FROM blocked b JOIN workstreams w ON w.id=b.workstream_id WHERE w.name='X'"` | removed-with-recipe |
|
|
2492
|
-
| ~~`mu task goals`~~ (removed; same shape as `blocked` — view is the abstraction) | `mu sql "SELECT g.local_id, g.status, g.title FROM goals g JOIN workstreams w ON w.id=g.workstream_id WHERE w.name='X'"` | removed-with-recipe |
|
|
2493
|
-
| ~~`mu task search <pat>`~~ (removed; case-insensitive LIKE is one SQL line) | `mu sql "SELECT t.local_id, t.status, t.title FROM tasks t JOIN workstreams w ON w.id=t.workstream_id WHERE w.name='X' AND LOWER(t.title) LIKE '%pat%'"` (add `LEFT JOIN task_notes` for the old `--in-notes`; drop the workstream join/filter for the old `--all`) | removed-with-recipe |
|
|
2494
|
-
<!-- doc-cli-drift:skip-end -->
|
|
2495
|
-
|
|
2496
|
-
Anything in this table that bites you in real use is a candidate
|
|
2497
|
-
for **promotion**. Criteria: proven friction in ≥2 real workflows +
|
|
2498
|
-
fits in <300 LOC + no major refactor of the load-bearing pillars.
|
|
2499
|
-
The most useful feedback is "I tried to do X and had to fall back
|
|
2500
|
-
to `mu sql`, twice in one session". File it in [ROADMAP.md](ROADMAP.md).
|
|
2501
|
-
|
|
2502
|
-
---
|
|
2503
|
-
|
|
2504
|
-
## Where to go from here
|
|
2505
|
-
|
|
2506
|
-
| Doc | What's in it |
|
|
2507
|
-
| -------------------------------------------- | ------------------------------------------------------- |
|
|
2508
|
-
| [README.md](../README.md) | Project overview, install, comparison vs `pi-subagents` |
|
|
2509
|
-
| [CHANGELOG.md](../CHANGELOG.md) | Release notes |
|
|
2510
|
-
| [ROADMAP.md](ROADMAP.md) | What's next, with promotion criteria + rejected ideas |
|
|
2511
|
-
| [VOCABULARY.md](VOCABULARY.md) | Canonical terms — source of truth for every word |
|
|
2512
|
-
| [VISION.md](VISION.md) | The eight load-bearing pillars + design principles |
|
|
2513
|
-
| [ARCHITECTURE.md](ARCHITECTURE.md) | Module map, reconciliation algorithm, layered design |
|
|
2514
|
-
| [skills/mu/SKILL.md](../skills/mu/SKILL.md) | What an LLM running inside an agent pane sees |
|
|
2515
|
-
|
|
2516
|
-
If you're trying mu and something doesn't work as documented, file an
|
|
2517
|
-
issue with: the exact `mu` command, the full output (set
|
|
2518
|
-
`MU_DB_PATH=/tmp/mu-debug.db` to isolate from your real registry),
|
|
2519
|
-
your multiplexer version (the `environment` block of `mu doctor`), and
|
|
2520
|
-
your platform.
|
|
2521
|
-
|
|
2522
|
-
---
|
|
2523
|
-
|
|
2524
|
-
## 20. Multiplexer backends (tmux and herdr)
|
|
2525
|
-
|
|
2526
|
-
mu drives exactly one multiplexer per invocation. tmux is the
|
|
2527
|
-
incumbent; [herdr](https://github.com/herdrdev/herdr) is the second
|
|
2528
|
-
backend. Spawn, send, and read work on both; agent state comes from herdr
|
|
2529
|
-
on herdr and from murmur on tmux. The
|
|
2530
|
-
remaining gaps are narrow and listed under
|
|
2531
|
-
[Known limits on herdr](#known-limits-on-herdr) — the notable one is
|
|
2532
|
-
that `mu agent kick` is Linux-only there.
|
|
2533
|
-
|
|
2534
|
-
### Which backend am I on?
|
|
2535
|
-
|
|
2536
|
-
```bash
|
|
2537
|
-
mu doctor # the `environment` block names the active backend
|
|
2538
|
-
mu doctor --json # .environment.mux = { name, ok, version, env, remediation }
|
|
2539
|
-
```
|
|
2540
|
-
|
|
2541
|
-
`.environment.tmux` is kept in `--json` as an alias reporting the
|
|
2542
|
-
*active* backend, so existing scripts keep working. Read
|
|
2543
|
-
`.environment.mux.name` if you care which one it is.
|
|
2544
|
-
|
|
2545
|
-
### The detection ladder
|
|
2546
|
-
|
|
2547
|
-
1. `MU_MUX=<name>` — explicit override, wins over everything. An
|
|
2548
|
-
unknown value fails the invocation (`error: unknown mux backend:
|
|
2549
|
-
nope`, exit 1) rather than quietly running on tmux.
|
|
2550
|
-
2. `HERDR_ENV=1` → herdr. Compared literally against `1`, as herdr
|
|
2551
|
-
documents.
|
|
2552
|
-
3. `$TMUX` or `$TMUX_PANE` set → tmux. Either one proves the caller is
|
|
2553
|
-
in a tmux pane; some setups (`sudo -E`, ssh with a restrictive
|
|
2554
|
-
`SendEnv`) pass one and not the other.
|
|
2555
|
-
4. Availability — whichever binary actually runs, tmux first.
|
|
2556
|
-
5. `NoMultiplexerError`, exit 5.
|
|
2557
|
-
|
|
2558
|
-
Rung 2 outranks rung 3 because it is the narrower claim: herdr panes
|
|
2559
|
-
routinely host a tmux server, so both signals can be live at once, and
|
|
2560
|
-
only `HERDR_ENV` says "herdr manages *this* pane". Rungs 2–3 answer
|
|
2561
|
-
"which mux is the caller in", rung 4 answers "which mux works here" —
|
|
2562
|
-
mu can create a detached session from a plain shell, so rung 4 alone
|
|
2563
|
-
is enough to operate.
|
|
2564
|
-
|
|
2565
|
-
The backend is resolved once per process and cached.
|
|
2566
|
-
|
|
2567
|
-
### What differs between the two
|
|
2568
|
-
|
|
2569
|
-
| | tmux | herdr |
|
|
2570
|
-
| --- | --- | --- |
|
|
2571
|
-
| Mux session (holds one workstream) | tmux session `mu-<ws>` | herdr *workspace* labelled `mu-<ws>`. herdr's own "session" is server-level and is NOT the workstream unit. |
|
|
2572
|
-
| Window | tmux window | herdr tab |
|
|
2573
|
-
| Agent | pane | pane |
|
|
2574
|
-
| Pane id | `%15` | `w1:p1` (workspace-qualified, so a pane moved between workspaces gets a new id) |
|
|
2575
|
-
| Pane title | `select-pane -T` | `herdr pane rename` writes the pane *label* |
|
|
2576
|
-
| Attach hint | `tmux a -t mu-<ws>` | `herdr session attach mu-<ws>` |
|
|
2577
|
-
| Pane borders | 4-side border showing agent name + status glyph | no-op — herdr owns its pane chrome; mu-managed panes carry the label instead |
|
|
2578
|
-
| Layout | `select-layout` | no-op — herdr splits are explicit, geometry is yours |
|
|
2579
|
-
| Agent state | murmur pane options for local agents; `murmur status --json` for remote agents | herdr reports state via `paneStatus()` |
|
|
2580
|
-
| Focus | mu creates detached | `--no-focus` on every mutating call, always. `detached: false` still gets you a detached workspace; run `herdr workspace focus` yourself. |
|
|
2581
|
-
| Isolation seam | `MU_TMUX_SOCKET` (`-L <name>`) | `MU_HERDR_SESSION` (`--session <name>`, its own socket) |
|
|
2582
|
-
| `mu agent send` / `read` | six-step paste/Enter protocol | one atomic `agent prompt --wait` |
|
|
2583
|
-
| `mu agent spawn` | one `new-window`/`split-window` carrying the command | create-then-start: bare pane, then `agent start` |
|
|
2584
|
-
|
|
2585
|
-
`MU_TMUX_SOCKET` is tmux-only and ignored under herdr;
|
|
2586
|
-
`MU_HERDR_SESSION` is its herdr analogue. Both exist so a test run can
|
|
2587
|
-
never observe or destroy your real panes.
|
|
2588
|
-
|
|
2589
|
-
### Known limits on herdr
|
|
2590
|
-
|
|
2591
|
-
- **Spawn is two steps, not one.** herdr has no create-and-run form, so
|
|
2592
|
-
mu creates a bare pane and then calls `agent start` in it. The
|
|
2593
|
-
creation verbs refuse a command rather than silently dropping it —
|
|
2594
|
-
dropping would leave an empty shell that mu records as an agent,
|
|
2595
|
-
which is the worst available failure. If step two fails, mu closes
|
|
2596
|
-
the pane and writes no agent row.
|
|
2597
|
-
- **`--lines` cannot recover scrolled-off rows from an
|
|
2598
|
-
alternate-screen pane.** A pane on the alternate screen does not
|
|
2599
|
-
spill into host scrollback, so there is nothing behind the viewport
|
|
2600
|
-
to read.
|
|
2601
|
-
- **`mu agent kick` is Linux-only on herdr.** herdr reports a shell
|
|
2602
|
-
pid, not a tty, so `paneTTY` resolves `/proc/<pid>/fd/0`. On macOS
|
|
2603
|
-
that path does not exist and the call fails with a `HerdrError`
|
|
2604
|
-
naming the limitation rather than lying about the tty.
|
|
2605
|
-
- **`herdr pane list` has no foreground-command field**, so a pane's
|
|
2606
|
-
command reads as empty from a listing. The authoritative answer
|
|
2607
|
-
costs one `herdr pane process-info` round trip per pane. mu does not
|
|
2608
|
-
fake it.
|
|
2609
|
-
- **`MU_<UPPER_CLI>_COMMAND` has no herdr equivalent.** herdr resolves
|
|
2610
|
-
the agent binary itself by kind. The override is honoured on tmux
|
|
2611
|
-
only; on herdr it stays moot while spawn is unimplemented, and the
|
|
2612
|
-
spawn work has to either pass it through or refuse it explicitly.
|
|
2613
|
-
|
|
2614
|
-
### A degraded backend reports, it does not crash
|
|
2615
|
-
|
|
2616
|
-
With no herdr server running, `mu doctor` still prints a full report
|
|
2617
|
-
(exit 0) and any verb that genuinely needs the mux fails with exit 5
|
|
2618
|
-
and herdr's own message plus remediation steps:
|
|
2619
|
-
|
|
2620
|
-
```bash
|
|
2621
|
-
MU_MUX=herdr mu doctor # exit 0; `herdr: ok (0.9.0)` from the client
|
|
2622
|
-
MU_MUX=herdr mu agent list -w foo # exit 5: no herdr server is running at ...
|
|
2623
|
-
MU_MUX=herdr mu task claim t1 -w foo --self # exit 0 — identity is best-effort
|
|
2624
|
-
```
|
|
2625
|
-
|
|
2626
|
-
That last line is the load-bearing / best-effort split. Verbs that ARE
|
|
2627
|
-
the mux (spawn, send, kill, reconcile, session create/destroy) fail
|
|
2628
|
-
loudly. Verbs where the mux is decoration (identity fallback, pane
|
|
2629
|
-
titles, banners, `mu workstream list`) degrade and carry on. Reconcile
|
|
2630
|
-
is pointedly in the first group: treating an unreachable mux as "zero
|
|
2631
|
-
panes" would prune every agent as a ghost.
|
|
2632
|
-
|
|
2633
|
-
One error is deliberately outside that scheme. herdr returns argument
|
|
2634
|
-
errors with exit 2, which mu raises as `HerdrSyntaxError` — not a
|
|
2635
|
-
`MuxError`. That is CLI drift after a herdr upgrade, i.e. a bug in mu,
|
|
2636
|
-
and bucketing it as "herdr is down" would send you chasing a healthy
|
|
2637
|
-
server.
|