@martintrojer/mu 0.3.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 +343 -0
- package/README.md +189 -0
- package/dist/cli.js +11260 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +3130 -0
- package/dist/index.js +6312 -0
- package/dist/index.js.map +1 -0
- package/docs/ARCHITECTURE.md +481 -0
- package/docs/ROADMAP.md +542 -0
- package/docs/USAGE_GUIDE.md +1631 -0
- package/docs/VISION.md +440 -0
- package/docs/VOCABULARY.md +349 -0
- package/package.json +76 -0
- package/skills/mu/SKILL.md +523 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mu
|
|
3
|
+
description: Manage a persistent crew of pi agents in tmux panes coordinated through a built-in task graph. Use when the user asks to spawn, send work to, observe, or coordinate multiple sub-agents — especially long-lived ones, or work that benefits from a dependency graph and parallel-track detection.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mu — Multi-agent orchestration
|
|
7
|
+
|
|
8
|
+
`mu` is a CLI for managing a persistent crew of AI agents in tmux
|
|
9
|
+
panes coordinated through a task graph. State lives at
|
|
10
|
+
`<XDG_STATE_HOME or ~/.local/state>/mu/mu.db` (SQLite).
|
|
11
|
+
|
|
12
|
+
**Output:**
|
|
13
|
+
- Default: every verb prints a textual card on stdout AND a `Next:`
|
|
14
|
+
block of suggested follow-up commands. Read both.
|
|
15
|
+
- `--json` (every verb): success → one object on stdout. Collection
|
|
16
|
+
reads (`task list`, `workspace commits`, `archive search`, ...)
|
|
17
|
+
emit `{items: T[], count: number}`; singletons keep named fields.
|
|
18
|
+
Carve-outs: `mu sql --json` is bare-array rows; `mu log --tail`
|
|
19
|
+
is NDJSON (one object per line). Errors →
|
|
20
|
+
`{error,message,nextSteps,exitCode}` on stderr; validation errors
|
|
21
|
+
ALSO carry `usage` (structured `--help`). **`nextSteps` survives
|
|
22
|
+
in JSON** — `mu task wait --first --json` literally puts the
|
|
23
|
+
cherry-pick command in `.nextSteps[0].command`.
|
|
24
|
+
|
|
25
|
+
**Trust `mu --help` and `mu <verb> --help` over this skill** if they
|
|
26
|
+
disagree. Verbs not in `--help` do not exist.
|
|
27
|
+
|
|
28
|
+
## Vocabulary
|
|
29
|
+
|
|
30
|
+
- **workstream** — unit of organization; one tmux session
|
|
31
|
+
(`mu-<name>`).
|
|
32
|
+
- **agent** — a named worker in a tmux pane (you may be one).
|
|
33
|
+
- **task** — a node in the DAG; mandatory `impact` (1–100) and
|
|
34
|
+
`effort_days`. Status: `OPEN`, `IN_PROGRESS`, `CLOSED` (the only
|
|
35
|
+
state that satisfies a `--blocked-by` edge), `REJECTED` (terminal
|
|
36
|
+
won't-do; still blocks downstream), `DEFERRED` (parked; still
|
|
37
|
+
blocks downstream).
|
|
38
|
+
- **claim / release** — atomic CAS take/clear of `tasks.owner`.
|
|
39
|
+
- **free** — mark the *agent* available (`mu agent free`); pane
|
|
40
|
+
untouched. Different from release: free is about the agent,
|
|
41
|
+
release is about the task.
|
|
42
|
+
- **note** — append-only context attached to a task; survives
|
|
43
|
+
across sessions.
|
|
44
|
+
- **track** — an independent subtree of the DAG (parallel-track
|
|
45
|
+
detection; visible in mission control).
|
|
46
|
+
- **workspace** — per-agent isolated VCS working copy under
|
|
47
|
+
`<state-dir>/workspaces/<workstream>/<agent>/`.
|
|
48
|
+
|
|
49
|
+
## When to reach for mu
|
|
50
|
+
|
|
51
|
+
**Use mu for:**
|
|
52
|
+
- Multi-phase investigations where context loss across the session
|
|
53
|
+
would hurt (benchmark + profile + fix + review + parity).
|
|
54
|
+
- Tasks worth gating with review (DAG enforces
|
|
55
|
+
`implement → review → address → ship`).
|
|
56
|
+
- Parallel read-only/audit work alongside heavier tasks.
|
|
57
|
+
- Implementation + reviewer/tester splits with isolated workspaces.
|
|
58
|
+
- Work likely to survive context compaction — durable task notes
|
|
59
|
+
are the project memory the next agent inherits.
|
|
60
|
+
|
|
61
|
+
**Do NOT use mu for:**
|
|
62
|
+
- Tiny direct edits (5-minute one-file changes).
|
|
63
|
+
- One-off local inspection / single shell commands.
|
|
64
|
+
- Single-context work where no durable coordination is needed.
|
|
65
|
+
|
|
66
|
+
The orchestrator's first decision is whether to reach for mu at all.
|
|
67
|
+
|
|
68
|
+
## Mental model
|
|
69
|
+
|
|
70
|
+
### One workstream = one tmux session
|
|
71
|
+
|
|
72
|
+
Named `mu-<workstream>`. Every agent is a pane in that session.
|
|
73
|
+
Multiple workstreams = multiple tmux sessions, partitioned in the
|
|
74
|
+
DB by `workstream`.
|
|
75
|
+
|
|
76
|
+
### The task DAG drives coordination
|
|
77
|
+
|
|
78
|
+
One edge type: `blocks`. `mu task block A --by B` means **B blocks
|
|
79
|
+
A** (B must close first). Built-in views: `ready`, `blocked`,
|
|
80
|
+
`goals`. Bare `mu` shows **parallel tracks** with **automatic
|
|
81
|
+
diamond-merge**: goals sharing a prerequisite collapse into one
|
|
82
|
+
track. Don't spawn more agents than there are tracks.
|
|
83
|
+
|
|
84
|
+
### Per-agent workspaces stop trampling
|
|
85
|
+
|
|
86
|
+
For two agents editing the same project, use `--workspace` on spawn.
|
|
87
|
+
Each gets an isolated working copy under
|
|
88
|
+
`<state-dir>/workspaces/<workstream>/<agent>/`. Auto-detects
|
|
89
|
+
jj/sl/git; `cp -a` for non-VCS. Workspaces are NOT freed when you
|
|
90
|
+
close an agent — run `mu workspace free <agent>` explicitly. Between
|
|
91
|
+
waves, `mu workspace refresh <agent>` rebases the dir onto fresh
|
|
92
|
+
main without killing the agent's LLM context; `mu workspace commits
|
|
93
|
+
<agent>` lists since-fork commits for cherry-picking.
|
|
94
|
+
|
|
95
|
+
**Default rule:** if an agent may edit/build/test/generate
|
|
96
|
+
artifacts while another agent is active in the same repo, spawn
|
|
97
|
+
with `--workspace`. Reserve the main checkout for orchestration.
|
|
98
|
+
Two builds in the same checkout corrupt each other's artifacts.
|
|
99
|
+
|
|
100
|
+
### Name agents by role, not by person
|
|
101
|
+
|
|
102
|
+
Use `worker-1`, `worker-2`, `reviewer-1`, `scout-1`, `auditor-1`,
|
|
103
|
+
`planner-1`. Smallest unused suffix. Avoid human names —
|
|
104
|
+
anthropomorphizing makes coordination prompts ambiguous ("send
|
|
105
|
+
follow-up to alice" vs "send to worker-1").
|
|
106
|
+
|
|
107
|
+
### Task note contract
|
|
108
|
+
|
|
109
|
+
Every delegated task should end with a note containing six fields
|
|
110
|
+
(omit only the ones genuinely N/A):
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
FILES: paths inspected/changed (with line ranges if precise)
|
|
114
|
+
COMMANDS: shell commands run + exit codes
|
|
115
|
+
FINDINGS: what you observed
|
|
116
|
+
DECISION: what you chose, and why
|
|
117
|
+
NEXT: follow-on tasks the next agent should know about
|
|
118
|
+
VERIFIED: how you confirmed it works (test names, command output)
|
|
119
|
+
ODDITIES: anything weird you saw but didn't act on
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Then close with grounding:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
mu task close <id> -w <ws> --evidence "tests pass: cargo test exit 0"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This turns the DAG from a coordination tool into a durable project
|
|
129
|
+
log. Future agents can `mu task notes <id>` to reconstruct the why
|
|
130
|
+
without reading the diff.
|
|
131
|
+
|
|
132
|
+
## Orchestrator loop
|
|
133
|
+
|
|
134
|
+
Every turn:
|
|
135
|
+
|
|
136
|
+
1. `mu state -w <ws>` — read the card. Agents, IN_PROGRESS, ready,
|
|
137
|
+
parallel tracks.
|
|
138
|
+
2. Don't spawn more agents than independent ready tracks.
|
|
139
|
+
3. **Claim before sending — even for one-shot reviewers / scouts.**
|
|
140
|
+
`mu task claim <id> -w <ws> --for <agent> --evidence "..."`. No
|
|
141
|
+
task = nothing for `mu task wait` to wait on; agent status flips
|
|
142
|
+
are too noisy. If the dispatch has no task, `mu task add` first.
|
|
143
|
+
4. Send task-specific instructions: task ID, files/notes to read,
|
|
144
|
+
scope guards, the task note contract. End with the loud
|
|
145
|
+
`⚠️ FINAL ACTION` block (see lessons below).
|
|
146
|
+
5. Wait for *one* task to close (`--first`), cherry-pick, return
|
|
147
|
+
control. Do NOT loop in your own shell — see lessons.
|
|
148
|
+
6. On close, repeat from 1.
|
|
149
|
+
|
|
150
|
+
## Hard-earned dispatch lessons
|
|
151
|
+
|
|
152
|
+
Every one of these came from real failure modes. Re-read before
|
|
153
|
+
running a wave.
|
|
154
|
+
|
|
155
|
+
- **Pipeline cherry-picks; DON'T BARRIER.** This is the single most
|
|
156
|
+
important rule. One wait, one cherry-pick, one verify, return
|
|
157
|
+
control. Do NOT `mu task wait umbrella_wave_X` and block until
|
|
158
|
+
everything in the wave finishes — you give up the ability to
|
|
159
|
+
react per-finish, and you can't surface partial progress.
|
|
160
|
+
Don't loop in a shell script either; that's a barrier with extra
|
|
161
|
+
steps.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# YES — pipeline (returns the moment one task closes)
|
|
165
|
+
closed=$(mu task wait t1 t2 t3 -w ws --any --first --json \
|
|
166
|
+
--on-stall exit | jq -r .firing.qualifiedId)
|
|
167
|
+
# cherry-pick that worker's commit, verify, return control.
|
|
168
|
+
# Next turn: same wait on the smaller set.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The recipe is also in `mu task wait`'s `nextSteps` — `jq` it out.
|
|
172
|
+
|
|
173
|
+
- **Refresh workspaces between waves.** `mu workspace refresh
|
|
174
|
+
<agent>` rebases the agent's dir onto fresh main without killing
|
|
175
|
+
the LLM context. The `behind` column in `mu workspace list` shows
|
|
176
|
+
the cost of skipping it. Worker ships clean code against a stale
|
|
177
|
+
parent otherwise; you find out at cherry-pick time.
|
|
178
|
+
|
|
179
|
+
- **Cherry-pick worker commits onto main, don't merge.** Stale-parent
|
|
180
|
+
worker branches drag in re-reverts of everything they missed.
|
|
181
|
+
|
|
182
|
+
- **Bucket fix waves by file cluster, not by severity.** Two workers
|
|
183
|
+
editing the same file = cherry-pick conflicts at merge time. mu
|
|
184
|
+
doesn't help you here; you have to know the codebase.
|
|
185
|
+
|
|
186
|
+
- **End every dispatch prompt with a loud `⚠️ FINAL ACTION: git
|
|
187
|
+
commit -am '...' THEN mu task close <id> --evidence '...'`.**
|
|
188
|
+
Without the literal reminder, agents commit + report success in
|
|
189
|
+
chat without running the typed close, and `mu task wait` hangs.
|
|
190
|
+
|
|
191
|
+
- **`--on-stall exit` is the unattended-orchestrator escape.**
|
|
192
|
+
Default `mu task wait` warns on a stuck worker and KEEPS POLLING.
|
|
193
|
+
In any non-interactive flow (wrapping policies, cron, long
|
|
194
|
+
pipelines, multi-step orchestration), pass `--on-stall exit`:
|
|
195
|
+
exits 7 (`STALL_DETECTED`) the moment the predicate fires.
|
|
196
|
+
Distinct from exit 6 (`REAPER_DETECTED`, dead pane —
|
|
197
|
+
re-dispatch); exit 7 is the ambiguous sibling (alive but idle —
|
|
198
|
+
decide whether to poke, release, or roll over). If both fire in
|
|
199
|
+
the same poll, exit 6 wins.
|
|
200
|
+
|
|
201
|
+
- **Cross-workstream `mu task wait` is built in.** Pass qualified
|
|
202
|
+
refs `<workstream>/<name>` directly; `-w` is dropped when every
|
|
203
|
+
ref is qualified, and the per-poll reconcile loops over every
|
|
204
|
+
workstream in the set.
|
|
205
|
+
|
|
206
|
+
- **Cross-workstream `mu task claim --for` is built in.** When
|
|
207
|
+
per-workstream worker pools leave a free worker in workstream A
|
|
208
|
+
and a queued task in workstream B, dispatch with `mu task claim X
|
|
209
|
+
-w B --for A/worker-1`. The agent stays in A; only the task's
|
|
210
|
+
`owner_id` crosses. No need to close + re-spawn (which loses LLM
|
|
211
|
+
context) or reach for `mu sql`.
|
|
212
|
+
|
|
213
|
+
- **Keep dispatch prompts terse.** Workers have the same skills as
|
|
214
|
+
the orchestrator and can `mu task notes <id>` for the full spec.
|
|
215
|
+
The prompt only needs: who they are, the task id, the workspace
|
|
216
|
+
path, the validate command, and the loud final-action block.
|
|
217
|
+
|
|
218
|
+
- **Idle agent (⚠ glyph; alive but assigned, no recent progress)** —
|
|
219
|
+
see scrollback via `mu agent show <name> -n N`; recover via
|
|
220
|
+
`mu agent send <name> '<retry>'` OR `mu task release <id>` (bare
|
|
221
|
+
release auto-flips IN_PROGRESS → OPEN; `--reopen` is only for
|
|
222
|
+
un-closing CLOSED/REJECTED/DEFERRED). Tunable via
|
|
223
|
+
`MU_IDLE_THRESHOLD_MS` (default 5 min).
|
|
224
|
+
|
|
225
|
+
## Parallelisation decision table
|
|
226
|
+
|
|
227
|
+
| Situation | Action |
|
|
228
|
+
|-----------|--------|
|
|
229
|
+
| One ready task / one track | Reuse one existing agent |
|
|
230
|
+
| Multiple independent ready tasks | Spawn one agent per ready track; cherry-pick each as it closes (don't barrier) |
|
|
231
|
+
| CPU-heavy benchmark in progress | Only parallelise read-only / audit tasks |
|
|
232
|
+
| Two agents editing/building/testing same repo | Use `--workspace` |
|
|
233
|
+
| Agent only reading docs/source | `--cli pi` (or operator alias) without `--workspace` is OK |
|
|
234
|
+
| Agent making code changes | `--workspace` strongly preferred |
|
|
235
|
+
| Agent reviewing/testing another agent's patch | Separate `--workspace` (or wait for the patch to merge) |
|
|
236
|
+
|
|
237
|
+
## Universal flags (worth knowing without `--help`)
|
|
238
|
+
|
|
239
|
+
- **`-w, --workstream <name>`** — explicit > `$MU_SESSION` > current
|
|
240
|
+
tmux session minus `mu-` prefix > error. On verbs that take an
|
|
241
|
+
entity by id, `-w` is a SCOPE check; on picker verbs (`mu task
|
|
242
|
+
next`, `mu agent list`), it picks WHICH.
|
|
243
|
+
- **Qualified entity refs** — every verb accepts
|
|
244
|
+
`<workstream>/<name>` in addition to bare `<name>`. The qualified
|
|
245
|
+
form skips `-w` resolution: `mu task show ws/foo` works from any
|
|
246
|
+
shell. Mixing a qualified ref with a non-matching `-w` errors out
|
|
247
|
+
(exit 2). When a bare name appears AND no `-w` resolves AND ≥2
|
|
248
|
+
workstreams contain that name, mu raises `NameAmbiguousError`
|
|
249
|
+
(exit 4) and lists every candidate as a one-paste fix.
|
|
250
|
+
- **`--evidence "<text>"`** — on `task close / open / claim /
|
|
251
|
+
release`. Recorded verbatim in the auto-emitted event payload.
|
|
252
|
+
Use it for grounding ("tests pass: cargo test exit 0").
|
|
253
|
+
- **`--json`** — on every verb. Use it whenever you compose mu
|
|
254
|
+
output into another command. `nextSteps` survives in JSON.
|
|
255
|
+
|
|
256
|
+
## CLI overview (one line each; trust `mu <verb> --help`)
|
|
257
|
+
|
|
258
|
+
- **Workstream**: `init`, `list`, `destroy` (auto-snapshots and
|
|
259
|
+
`--archive <label>` to preserve graph atomically), `export`,
|
|
260
|
+
`import`.
|
|
261
|
+
- **Agents**: `spawn` (`--workspace`, `--role read-only`,
|
|
262
|
+
`--command`), `send`, `read`, `show`, `list`, `close`, `free`.
|
|
263
|
+
**`mu adopt <pane-id|title>`** registers an orphan pane as a
|
|
264
|
+
managed agent.
|
|
265
|
+
- **Tasks**: `add`, `list`, `next`, `show`, `tree`, `notes`, `note`,
|
|
266
|
+
`claim` (`--for | --self`), `release` (`--reopen` to un-close),
|
|
267
|
+
`close` (`--if-ready` = no-op unless every blocker terminal),
|
|
268
|
+
`open`, `reject`, `defer`, `block`, `unblock`, `update`,
|
|
269
|
+
`reparent`, `wait`, `delete` (two-phase; `--yes` commits).
|
|
270
|
+
Edge direction: `block <blocked> --by <blocker>`.
|
|
271
|
+
- **Self (in-pane)**: `mu me`, `mu me tasks`, `mu me next`.
|
|
272
|
+
- **Workspace**: `create`, `list` (`behind` column), `refresh`
|
|
273
|
+
(rebase onto fresh base, agent stays alive), `commits` (since-fork
|
|
274
|
+
`<sha> <subject>`; `--json` for piping), `free`, `path`
|
|
275
|
+
(`cd $(mu workspace path X)`), `orphans`.
|
|
276
|
+
- **Activity log**: `mu log "text"` (write), `mu log -n N` (read),
|
|
277
|
+
`mu log --tail` (subscribe). Don't pipe `--tail` for waits — use
|
|
278
|
+
`mu task wait`.
|
|
279
|
+
- **Snapshots/undo**: every destructive verb auto-snapshots first.
|
|
280
|
+
`mu undo --yes` restores the latest (DB only, NOT tmux/workspace
|
|
281
|
+
dirs). `mu snapshot list/show/prune/delete`.
|
|
282
|
+
- **Archives**: `create <label>`, `list`, `show`, `add <label> -w
|
|
283
|
+
<ws> [--destroy]` (idempotent; preserves task graph atomically),
|
|
284
|
+
`remove`, `delete`, `search`, `export`. Labels globally unique.
|
|
285
|
+
- **Escape hatch + state**: `mu sql "<query>"` for anything not yet
|
|
286
|
+
typed. `mu` alone = `mu state --mission`. `mu state` has `--hud`,
|
|
287
|
+
`--mission`, `--all`, `--json`. `mu doctor` for health.
|
|
288
|
+
|
|
289
|
+
## `mu task wait` exits
|
|
290
|
+
|
|
291
|
+
Default target: CLOSED. `--first` = `--any` + prints firing
|
|
292
|
+
qualified id and emits `firing` in JSON.
|
|
293
|
+
|
|
294
|
+
| Code | Meaning |
|
|
295
|
+
|------|---------|
|
|
296
|
+
| 0 | All targets met (or `--any` and one met) |
|
|
297
|
+
| 3 | Missing task id |
|
|
298
|
+
| 5 | Timeout |
|
|
299
|
+
| 6 | Reaper flipped a watched task back to OPEN (target=CLOSED only) |
|
|
300
|
+
| 7 | Stall (`--on-stall exit`) |
|
|
301
|
+
|
|
302
|
+
## Picking model + thinking effort per agent
|
|
303
|
+
|
|
304
|
+
mu doesn't reason about models. Pi speaks `--model sonnet:high` and
|
|
305
|
+
`--thinking off|minimal|low|medium|high|xhigh`.
|
|
306
|
+
|
|
307
|
+
Three controls, smallest first:
|
|
308
|
+
- **Per-spawn**: `mu agent spawn r --command "pi --model opus:high"`
|
|
309
|
+
- **Shell default**: `export MU_PI_COMMAND="pi --model sonnet:medium"`
|
|
310
|
+
- **Operator aliases**: any `--cli <key>` uppercases to
|
|
311
|
+
`$MU_<KEY>_COMMAND` (use underscores). Convention: `pi_mini` /
|
|
312
|
+
`pi` / `pi_big`. mu doesn't enforce these.
|
|
313
|
+
|
|
314
|
+
Rubric: mini for probing/fan-out; modest for build/edit/refactor;
|
|
315
|
+
big for design/review/incident/gnarly debugging. Discover valid
|
|
316
|
+
model strings: `pi --list-models [fuzzy-search]`.
|
|
317
|
+
|
|
318
|
+
## The reaper
|
|
319
|
+
|
|
320
|
+
When an agent's pane dies (or you `mu agent close` mid-task), any
|
|
321
|
+
IN_PROGRESS task it owned auto-reverts to OPEN with a `[reaper]`
|
|
322
|
+
note plus a `task reap` event in `agent_logs`. You don't have to
|
|
323
|
+
manually `task release` after a crash.
|
|
324
|
+
|
|
325
|
+
## Known limitations
|
|
326
|
+
|
|
327
|
+
- **Status detection lags with custom `--command` wrappers.**
|
|
328
|
+
Agents may show `needs_input` while running commands. Trust
|
|
329
|
+
scrollback, task notes, and event log over the status emoji for
|
|
330
|
+
monitoring decisions.
|
|
331
|
+
- **Workspace patch flow needs explicit apply.** Worker writes in
|
|
332
|
+
isolated workspace → review → parity tests in workspace → manual
|
|
333
|
+
cherry-pick to main → sanity test. Worth it for any patch that
|
|
334
|
+
benefits from review; overkill for a one-line typo fix.
|
|
335
|
+
- **Orchestration overhead is real for tiny tasks.** Task create +
|
|
336
|
+
claim + send + monitor + notes + close is ~6 verbs of ceremony.
|
|
337
|
+
See "When to reach for mu" above.
|
|
338
|
+
|
|
339
|
+
## Common patterns
|
|
340
|
+
|
|
341
|
+
The `Next:` block on every verb covers the single-step follow-ups.
|
|
342
|
+
These are the **multi-verb composites** that no hint can show.
|
|
343
|
+
|
|
344
|
+
### Plan + spawn a crew
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
mu workstream init <ws>
|
|
348
|
+
mu task add -w <ws> --title "Design X" --impact 70 --effort-days 1
|
|
349
|
+
mu task add -w <ws> --title "Build X" --impact 70 --effort-days 5 --blocked-by design_x
|
|
350
|
+
mu task add -w <ws> --title "Review X" --impact 60 --effort-days 1 --blocked-by build_x
|
|
351
|
+
mu agent spawn worker-1 -w <ws> --workspace
|
|
352
|
+
mu agent spawn reviewer-1 -w <ws> --workspace --role read-only
|
|
353
|
+
mu -w <ws> # mission control
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
IDs auto-derive from titles via slugify.
|
|
357
|
+
|
|
358
|
+
### Pipeline cherry-pick (the canonical fix-wave loop)
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Wait for any-of N to close, cherry-pick that one, return.
|
|
362
|
+
res=$(mu task wait t1 t2 t3 -w ws --any --first --json \
|
|
363
|
+
--timeout 600 --on-stall exit)
|
|
364
|
+
firing=$(jq -r .firing.qualifiedId <<<"$res")
|
|
365
|
+
sha=$(mu workspace commits $worker -w ws --json \
|
|
366
|
+
| jq -r --arg id "${firing#*/}" \
|
|
367
|
+
'.items[] | select(.subject | startswith($id+":")) | .sha' | head -1)
|
|
368
|
+
git cherry-pick $sha && cargo test --lib
|
|
369
|
+
# Next turn: same wait on the smaller set.
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Umbrella-on-wave-done
|
|
373
|
+
|
|
374
|
+
Fire `mu task close umbrella_wave_X --if-ready -w <ws>` after every
|
|
375
|
+
cherry-pick in the pipeline loop. No-op while any blocker is
|
|
376
|
+
OPEN/IN_PROGRESS; closes when the last terminates. JSON no-op shape
|
|
377
|
+
carries `skipped: "not_ready"` + `blockingIds: [...]`.
|
|
378
|
+
|
|
379
|
+
### Quote command-rich prompts (avoid `$VAR` expanding in YOUR shell)
|
|
380
|
+
|
|
381
|
+
`$VAR`, `$(...)`, backticks, and `!history` in a double-quoted
|
|
382
|
+
prompt expand in YOUR shell before mu sees them. Single-quote (or
|
|
383
|
+
use a quoted heredoc) to defer expansion to the agent.
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
# Bad: $HOME and $(date) expand in YOUR shell.
|
|
387
|
+
mu agent send worker-1 "OUT=\"$HOME/foo-$(date)\" run_me"
|
|
388
|
+
|
|
389
|
+
# Good: single quotes — expansion deferred.
|
|
390
|
+
mu agent send worker-1 'OUT="$HOME/foo-$(date)" run_me'
|
|
391
|
+
|
|
392
|
+
# Good: quoted heredoc for multi-line + literal.
|
|
393
|
+
mu agent send worker-1 "$(cat <<'EOF'
|
|
394
|
+
for f in src/*.rs; do cargo check --manifest-path "$f"; done
|
|
395
|
+
EOF
|
|
396
|
+
)"
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
When in doubt, single-quote.
|
|
400
|
+
|
|
401
|
+
### Status is approximate; scrollback + log are authoritative
|
|
402
|
+
|
|
403
|
+
The status emoji is a 4-state heuristic from prompt shape. For
|
|
404
|
+
high-stakes calls, combine:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
mu agent read worker-1 -n 100 # pane scrollback
|
|
408
|
+
mu log -w <ws> --kind event --tail # state-change stream
|
|
409
|
+
mu task notes <id> # decisions + grounding
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Sending follow-on work to an existing agent
|
|
413
|
+
|
|
414
|
+
A new prompt is appended to whatever context the agent had. For
|
|
415
|
+
**unrelated** work, send `/new` first (pi / claude-code; codex uses
|
|
416
|
+
`/clear`) to wipe the LLM's working set — pane scrollback is preserved:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
mu agent send worker-1 '/new'
|
|
420
|
+
sleep 1 # let the CLI swallow the slash command
|
|
421
|
+
mu agent send worker-1 "$(cat <<'EOF_PROMPT'
|
|
422
|
+
Claim and work on $TASK. Read the task notes before starting...
|
|
423
|
+
EOF_PROMPT
|
|
424
|
+
)"
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Recover from a destructive verb
|
|
428
|
+
|
|
429
|
+
`mu snapshot list` then `mu undo --yes` (dry-run by default; add
|
|
430
|
+
`--to <id>` to pick one). DB only — killed tmux panes and freed
|
|
431
|
+
workspace dirs do NOT come back. There is no `mu redo`; each
|
|
432
|
+
restore takes a pre-restore snapshot, so a second `mu undo --yes`
|
|
433
|
+
rolls forward.
|
|
434
|
+
|
|
435
|
+
## If you ARE the agent (in-pane patterns)
|
|
436
|
+
|
|
437
|
+
Verbs auto-resolve via `$TMUX_PANE` — `mu me`, `mu me next`,
|
|
438
|
+
`mu task claim` all work without a name argument. The pane title
|
|
439
|
+
(set at spawn) IS the agent identity.
|
|
440
|
+
|
|
441
|
+
- **Worker**: pane was created by `mu agent spawn` (or promoted via
|
|
442
|
+
`mu adopt`). Bare `mu task claim <id>` works.
|
|
443
|
+
- **Orchestrator**: a top-level pi session NOT in `agents`. Bare
|
|
444
|
+
`mu task claim` errors with `ClaimerNotRegisteredError` whose
|
|
445
|
+
`errorNextSteps()` lists three options: `--self` (work directly,
|
|
446
|
+
owner=NULL), `--for <worker>` (dispatch), or `mu adopt <pane>`.
|
|
447
|
+
|
|
448
|
+
Working loop:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
mu me # orient
|
|
452
|
+
mu me next # find work
|
|
453
|
+
mu task show <id>; mu task notes <id> # read context
|
|
454
|
+
mu task claim <id> --evidence "..." # claim
|
|
455
|
+
mu task note <id> "FILES: ...\nDECISION: ..." # work; drop notes
|
|
456
|
+
mu task close <id> --evidence "tests pass: ..." # close — LAST action
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Close as the LAST action.** Skipping `mu task close` makes the
|
|
460
|
+
orchestrator's `mu task wait` hang.
|
|
461
|
+
|
|
462
|
+
## DOs
|
|
463
|
+
|
|
464
|
+
- **`mu state -w <ws>` before every action.** State card is the
|
|
465
|
+
source of truth.
|
|
466
|
+
- **Add a task before assigning work.** "What is worker-1 doing?"
|
|
467
|
+
is a graph query, not a memory test.
|
|
468
|
+
- **Claim BEFORE sending.** Otherwise ownership is murky.
|
|
469
|
+
- **Read existing notes before claiming.**
|
|
470
|
+
- **Pass `--evidence` on claim AND close.** Audit trail is only as
|
|
471
|
+
useful as what's recorded.
|
|
472
|
+
- **Drop notes per the task note contract.**
|
|
473
|
+
- **Set `impact` and `effort_days` honestly.** They drive ROI.
|
|
474
|
+
- **Don't spawn more agents than independent ready tracks.**
|
|
475
|
+
- **Send `/new` before unrelated follow-on work** to a still-spawned
|
|
476
|
+
agent.
|
|
477
|
+
- **`--workspace` whenever the agent might edit/build/test.**
|
|
478
|
+
Default-on.
|
|
479
|
+
- **Single-quote prompts with `$VAR`, `$(...)`, backticks.**
|
|
480
|
+
- **`mu task wait --first --json` for waits; never `mu log --tail
|
|
481
|
+
| awk` and never a shell `while` loop polling status.**
|
|
482
|
+
- **`--json` for scripting; `mu sql` for what's not yet typed.**
|
|
483
|
+
- **`mu doctor` if anything looks off.**
|
|
484
|
+
|
|
485
|
+
## DON'Ts
|
|
486
|
+
|
|
487
|
+
- **Don't barrier on a wave umbrella.** Use `--first --any` and
|
|
488
|
+
cherry-pick per-finish. Returning control between picks is the
|
|
489
|
+
point.
|
|
490
|
+
- **Don't loop in your own shell waiting for "everything to be
|
|
491
|
+
done."** That's a barrier with extra steps. Single wait, single
|
|
492
|
+
cherry-pick, return.
|
|
493
|
+
- **Don't fire-and-forget** after `mu agent send`.
|
|
494
|
+
- **Don't trust the status emoji alone for high-stakes calls.**
|
|
495
|
+
- **Don't double-quote a `$VAR`-laden prompt** — your shell expands
|
|
496
|
+
it. Single-quote or quoted-heredoc.
|
|
497
|
+
- **Don't bypass mu with `sqlite3`.** Use `mu sql`.
|
|
498
|
+
- **Don't spawn an agent without a workstream.**
|
|
499
|
+
- **Don't anthropomorphize agent names.** `worker-1`, not `alice`.
|
|
500
|
+
- **Don't poll `mu agent read` in tight loops.** Use `mu log
|
|
501
|
+
--tail` for streaming, `mu task wait` for waits.
|
|
502
|
+
- **Don't add cross-workstream edges.** Model as one workstream.
|
|
503
|
+
- **Don't `mu workstream destroy --yes` without the dry-run.**
|
|
504
|
+
- **Don't use the `mu_` task-id prefix.** Reserved.
|
|
505
|
+
- **Don't message agents directly.** Coordinate via task notes and
|
|
506
|
+
the activity log.
|
|
507
|
+
|
|
508
|
+
## What mu is NOT
|
|
509
|
+
|
|
510
|
+
- Not a build tool. mu doesn't compile, test, or deploy code.
|
|
511
|
+
- Not a chat protocol — agent-to-agent comms is via task notes
|
|
512
|
+
(durable, per-task) and the `mu log` activity channel (timeline).
|
|
513
|
+
- Not a replacement for `pi-subagents` — for one-shot focused
|
|
514
|
+
delegation with synthesis, use `pi-subagents`. mu is for
|
|
515
|
+
long-lived crews you keep talking to.
|
|
516
|
+
|
|
517
|
+
## See also
|
|
518
|
+
|
|
519
|
+
- `mu --help` and `mu <verb> --help` — canonical CLI reference
|
|
520
|
+
(always trust `--help` over this skill if they disagree).
|
|
521
|
+
- `docs/USAGE_GUIDE.md` — worked examples for every verb.
|
|
522
|
+
- `CHANGELOG.md` — release notes.
|
|
523
|
+
- `docs/VOCABULARY.md` — canonical terms.
|