@mu-crew/mu 3.13.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/AGENTS.md +73 -35
  2. package/README.md +71 -57
  3. package/dist/chunk-5HECDBK3.js +4482 -0
  4. package/dist/chunk-5HECDBK3.js.map +1 -0
  5. package/dist/chunk-AW2NONYU.js +301 -0
  6. package/dist/chunk-AW2NONYU.js.map +1 -0
  7. package/dist/chunk-GQNHIPJN.js +4060 -0
  8. package/dist/chunk-GQNHIPJN.js.map +1 -0
  9. package/dist/{chunk-3BARPJLY.js → chunk-PZ5GOCWH.js} +16 -2
  10. package/dist/chunk-PZ5GOCWH.js.map +1 -0
  11. package/dist/chunk-S424D5EP.js +13766 -0
  12. package/dist/chunk-S424D5EP.js.map +1 -0
  13. package/dist/{cli-CKOMHBXV.js → cli-GB2CAVVW.js} +6776 -4350
  14. package/dist/cli-GB2CAVVW.js.map +1 -0
  15. package/dist/cli.js +2 -3
  16. package/dist/cli.js.map +1 -1
  17. package/dist/errors-KHOYKD7D.js +65 -0
  18. package/dist/extension/mu-pi.js +1617 -836
  19. package/dist/extension/mu-pi.js.map +1 -1
  20. package/dist/index.d.ts +4015 -2561
  21. package/dist/index.js +614 -297
  22. package/dist/index.js.map +1 -1
  23. package/dist/tui-ALPHYTA2.js +1773 -0
  24. package/dist/tui-ALPHYTA2.js.map +1 -0
  25. package/docs/ARCHITECTURE.md +117 -66
  26. package/docs/VOCABULARY.md +112 -49
  27. package/docs/guide/README.md +3 -3
  28. package/docs/guide/backends.md +8 -4
  29. package/docs/guide/cleanup.md +61 -33
  30. package/docs/guide/delegate.md +141 -66
  31. package/docs/guide/dispatch.md +148 -53
  32. package/docs/guide/getting-started.md +37 -44
  33. package/docs/guide/other-agent-clis.md +102 -0
  34. package/docs/guide/recovery.md +31 -50
  35. package/docs/guide/remote.md +115 -45
  36. package/docs/guide/sql.md +104 -24
  37. package/docs/guide/stop-a-worker.md +30 -37
  38. package/docs/guide/sync.md +11 -3
  39. package/docs/guide/upgrade.md +93 -43
  40. package/docs/reference/env.md +23 -32
  41. package/docs/reference/naming.md +12 -7
  42. package/docs/reference/surface-contract.md +153 -0
  43. package/package.json +33 -11
  44. package/prompts/mu-debug.md +3 -1
  45. package/prompts/mu-refute.md +2 -1
  46. package/prompts/mu-research.md +3 -1
  47. package/prompts/mu-review.md +2 -1
  48. package/prompts/mu-rules-audit.md +5 -4
  49. package/prompts/mu-sweep.md +2 -1
  50. package/prompts/mu-tournament.md +4 -2
  51. package/prompts/mu-until.md +3 -1
  52. package/prompts/ultrathink.md +1 -1
  53. package/skills/mu/SKILL.md +60 -291
  54. package/skills/mu/recipes/adversarial-review.md +12 -103
  55. package/skills/mu/recipes/brief.md +14 -61
  56. package/skills/mu/recipes/course-correct.md +23 -0
  57. package/skills/mu/recipes/findings.md +17 -111
  58. package/skills/mu/recipes/models.md +17 -92
  59. package/skills/mu/recipes/move.md +14 -0
  60. package/skills/mu/recipes/orchestrator-loop.md +20 -119
  61. package/skills/mu/recipes/recovery.md +8 -29
  62. package/skills/mu/recipes/remote-workers.md +16 -318
  63. package/skills/mu/recipes/tasks-or-calls.md +15 -78
  64. package/skills/mu/recipes/test-health.md +19 -69
  65. package/skills/mu/recipes/worker.md +17 -24
  66. package/dist/chunk-45KQLMEL.js +0 -2908
  67. package/dist/chunk-45KQLMEL.js.map +0 -1
  68. package/dist/chunk-G434JKV2.js +0 -641
  69. package/dist/chunk-G434JKV2.js.map +0 -1
  70. package/dist/chunk-KUGUFBWH.js +0 -12527
  71. package/dist/chunk-KUGUFBWH.js.map +0 -1
  72. package/dist/chunk-QITLNZEM.js +0 -87
  73. package/dist/chunk-QITLNZEM.js.map +0 -1
  74. package/dist/chunk-VIEYQMQA.js +0 -393
  75. package/dist/chunk-VIEYQMQA.js.map +0 -1
  76. package/dist/chunk-WI6AWCMK.js +0 -19
  77. package/dist/chunk-WI6AWCMK.js.map +0 -1
  78. package/dist/cli-CKOMHBXV.js.map +0 -1
  79. package/dist/devtools-LS4ZEPWM.js +0 -3772
  80. package/dist/devtools-LS4ZEPWM.js.map +0 -1
  81. package/dist/tui-LFJ5P4Y2.js +0 -40956
  82. package/dist/tui-LFJ5P4Y2.js.map +0 -1
  83. package/dist/tui-sync-worker.js +0 -17
  84. package/dist/tui-sync-worker.js.map +0 -1
  85. package/dist/yank-XDOONQSL.js +0 -13
  86. package/dist/yank-XDOONQSL.js.map +0 -1
  87. package/docs/ROADMAP.md +0 -123
  88. package/docs/VISION.md +0 -298
  89. package/docs/architecture/control-socket.md +0 -142
  90. package/docs/architecture/dag.md +0 -117
  91. package/docs/architecture/mux.md +0 -167
  92. package/docs/architecture/ops-log.md +0 -160
  93. package/docs/architecture/sdk.md +0 -187
  94. package/docs/architecture/sync.md +0 -159
  95. package/docs/architecture/tui.md +0 -165
  96. package/docs/guide/tui.md +0 -98
  97. package/docs/history/CHANGELOG-pre-3.md +0 -4866
  98. package/docs/img/tui-dashboard.png +0 -0
  99. package/docs/specs/2026-09-28-agent-state-from-murmur.md +0 -333
  100. package/docs/specs/2026-09-29-task-substates.md +0 -247
  101. package/docs/specs/2026-10-03-keep-driving-nudge.md +0 -163
  102. package/docs/specs/2026-10-21-fast-and-slow-gates.md +0 -229
  103. package/skills/mu/recipes/backlog-triage.md +0 -45
  104. package/skills/mu/recipes/codemode-driver.md +0 -118
  105. package/skills/mu/recipes/deep-research.md +0 -69
  106. package/skills/mu/recipes/drift-audit.md +0 -75
  107. package/skills/mu/recipes/fan-out.md +0 -42
  108. package/skills/mu/recipes/hypothesis-panel.md +0 -48
  109. package/skills/mu/recipes/long-run.md +0 -32
  110. package/skills/mu/recipes/loop-until-done.md +0 -45
  111. package/skills/mu/recipes/plan.md +0 -67
  112. package/skills/mu/recipes/refute.md +0 -55
  113. package/skills/mu/recipes/review-panel.md +0 -65
  114. package/skills/mu/recipes/rules-audit.md +0 -89
  115. package/skills/mu/recipes/tournament.md +0 -44
  116. package/skills/mu/recipes/ultrathink.md +0 -86
  117. package/skills/mu/recipes/watcher.md +0 -28
  118. package/skills/mu/recipes/waves.md +0 -21
  119. /package/dist/{chunk-3BARPJLY.js.map → errors-KHOYKD7D.js.map} +0 -0
@@ -1,310 +1,79 @@
1
1
  ---
2
2
  name: mu
3
3
  description: >-
4
- Fresh-context delegates (mu's counterpart to hidden subagents) and crews
5
- in tmux/herdr panes. Check before you
6
- commit: before acting on a claim, root cause, plan, fix or brief, have a
7
- `mu_delegate` call refute it. Also for a fresh delegate's second look at
8
- your own work or diff; parallel read-only research, investigation or fan-out
9
- over files; background helpers (watchers, soak runs, agents you keep talking
10
- to); persistent crews with a task graph, review gates and merges. Outside
11
- pi, delegate through the reserved `scratch` workstream.
4
+ Fresh-context delegates and crews in tmux/herdr panes. Check before you
5
+ commit: have a `mu_delegate` call refute a claim, root cause, plan, fix or
6
+ brief before you act on it. Also parallel read-only research, fan-out,
7
+ background helpers, and persistent crews with a task DAG, review gates and
8
+ merges. Outside pi, delegate through the `scratch` workstream. Never write
9
+ mu's DB (no `sqlite3`, no raw SQL writes): read it with `mu sql "<SELECT>"`,
10
+ change it with a verb.
12
11
  ---
13
12
 
14
- # mu — Multi-agent orchestration
13
+ # mu
15
14
 
16
- `mu` manages long-lived AI agents in multiplexer panes (tmux or
17
- herdr), coordinated by a SQLite task DAG at
18
- `<XDG_STATE_HOME or ~/.local/state>/mu/mu.db`.
15
+ Agents in tmux/herdr panes, coordinated by a SQLite task DAG. **`mu --help` and
16
+ `mu <verb> --help` outrank this skill**; a verb they omit does not exist. A verb takes
17
+ `-w <workstream>` only if its `--help` lists it (`doctor`, `sync`, `delegates
18
+ show` do not); workers get it.
19
19
 
20
- **Trust `mu --help` / `mu <verb> --help` over this skill.** Verbs
21
- not in `--help` do not exist.
22
-
23
- ## Output + JSON shapes
24
-
25
- Default output is a card on stdout plus a `Next:` block. Read both.
26
- Every verb takes `--json`: one stdout object; collections are
27
- `{items, count}`, except `mu agent list` (`{agents, orphans}`); `mu sql --json` is bare rows; `mu log --tail` is
28
- NDJSON; `mu log` writes print text even with `--json`. Errors are `{error,message,nextSteps,exitCode}` on stderr
29
- (validation errors add `usage`). **`nextSteps` survives in JSON.**
30
-
31
- ## Vocabulary
32
-
33
- - **workstream** — one **mux session** `mu-<name>` (tmux session or
34
- herdr workspace) and one DB partition.
35
- - **agent** — named process in a pane (you may be one); a **worker** is an agent claiming tasks.
36
- - **mux** — tmux or herdr, one per invocation. `mu doctor` names it;
37
- `MU_MUX` forces it. `mu agent kick` is Linux-only on herdr.
38
- - **control socket (ctl)** — how mu drives a pi agent: the mu pi
39
- extension (`mu link pi`) serves exact send, state, wait and abort
40
- inside pi's own TUI. `ctl missing|refused` means it does not answer.
41
- - **task** — DAG node with mandatory `impact` (1–100) and
42
- `effort_days`. Shown as status/substate: `OPEN/todo|parked|triage`,
43
- `IN_PROGRESS/active`, `CLOSED/done|rejected|wontfix|duplicate|superseded`.
44
- Any `CLOSED/*` satisfies `--blocked-by`.
45
- - **claim / release** — atomic take/clear of `tasks.owner`.
46
- - **note** — append-only task context; survives sessions.
47
- - **track** — tasks connected by `block` edges (`mu task block B --by A`
48
- puts B on A's track). Spawn one agent per ready task, not per track:
49
- an umbrella puts all its units on one track.
50
- - **workspace** — per-agent VCS copy under
51
- `<state-dir>/workspaces/<workstream>/<agent>/`.
52
-
53
- Recipe words, the same in every recipe:
54
-
55
- - **umbrella** — the parent task of one job, blocked by every unit,
56
- finding and round; holds the brief, criteria and stop rule; closes
57
- with `mu task close <umbrella> --if-ready`.
58
- - **unit** — one piece of the job, one task (a file, a call site, a fix).
59
- - **fast gate / slow gate / gate budget / gate record / test upkeep** —
60
- repo-defined verification and its upkeep ([test-health](recipes/test-health.md#gate-contract));
61
- a **review gate** (`review_x` blocked by `x`) decides whether `x` counts.
62
- - **wave** — the units dispatched from one main revision; refresh
63
- workspaces before the next.
64
- - **finding** — one reported problem, recorded as an `OPEN/triage` task.
65
- - **verdict** — a check's answer: `VERDICT: <id> CONFIRMED | REFUTED |
66
- UNVERIFIED <one line>` plus `EVIDENCE:` lines (or ACCEPT | REJECT for
67
- a review gate). REFUTED on a brief means it holds a false claim: rewrite it.
68
- - **stop rule** — the command and condition that end a loop, written on
69
- the umbrella first ([loop-until-done](recipes/loop-until-done.md)).
70
-
71
- ## When to use mu
72
-
73
- Use mu for persistent helpers, parallel work, dependencies, gated review, or
74
- work that must survive context compaction. Stay in one context for tiny edits
75
- or inspection.
76
-
77
- ### Quick checks and off-the-cuff helpers (`scratch`)
78
-
79
- Before you act on a claim, root cause, plan, fix or brief, or to get a second
80
- look at your own work or diff, make a [delegate call](recipes/tasks-or-calls.md#delegate-call)
81
- that tries to refute it, on another model family ([models](recipes/models.md#checkers); briefs: see
82
- Orchestrator rules; many claims: [refute](recipes/refute.md)).
83
-
84
- For one-shot work inside pi, call `mu_delegate` (installed by `mu link pi`). Outside pi: spawn
85
- into the reserved `scratch` workstream (no task DAG, auto-created), as in
86
- [delegate call](recipes/tasks-or-calls.md#delegate-call). Recipes call either form a **delegate call**. A check judging a mu
87
- task lands its verdict there: `record: { task: "<ws>/<id>" }` on `mu_delegate`, a hand-written
88
- `REFUTER` note on the spawn path; with no task, skip both.
89
-
90
- - `mu agent wait <names...> --first` waits for busy → idle instead of a
91
- `sleep` loop; exit 0 met, 5 timeout, 6 pane died.
92
- - For a watcher (PR, CI, a log), follow [recipes/watcher.md](recipes/watcher.md).
93
- - One agent per independent unit; `--workspace` for any helper that may edit,
94
- build, or test the shared repo.
95
-
96
- A pi helper showing `unknown (ctl missing)` right after spawn (spawn
97
- warns after 30 s) likely sits at pi's project trust prompt (through a
98
- wrapper whose argv0 is not `pi`/`pi-meta` it shows `needs_input`): add
99
- `--approve` to `MU_<CLI>_COMMAND`. Move off
100
- `scratch` when work gains dependencies or review gates.
101
-
102
- ## Mental model
103
-
104
- ### Workstreams, DAGs, tracks
105
-
106
- The DAG has one edge: `mu task block A --by B` means **B blocks A**.
107
- Tracks sharing a prerequisite collapse into one, so an umbrella every
108
- unit blocks makes the whole job one track. Parallelism is the ready
109
- set: tasks that edit the same files get a `block` edge between them,
110
- so only one is ready at a time.
111
-
112
- ### Workspaces prevent trampling
113
-
114
- If an agent may edit, build, or test while another is active in the same
115
- repo, spawn with `--workspace` (`workspace: true` on `mu_delegate`).
116
- Two builds in one checkout corrupt each other; keep the main checkout
117
- for orchestration. Never make your own `git worktree`, `jj workspace`
118
- or copy for a local agent: mu cannot refresh, list, diff or free what
119
- it did not create, so it leaks. Remote agents are the exception
120
- ([remote-workers](recipes/remote-workers.md)).
121
-
122
- Workspaces auto-detect jj, sl, or git (else `cp -a`). `mu agent close`
123
- frees one **only if clean**; otherwise it fails with
124
- `WorkspacePreservedError`. A `cp -a` copy is never clean. Cherry-pick what
125
- to keep, and pass `--discard-workspace` only to throw the rest away.
126
- Before each `--fresh` send, `mu workspace refresh <agent>` rebases onto
127
- main and keeps LLM context ([waves](recipes/waves.md) when workers share
128
- files). Claim and send warn at ≥10 commits behind
129
- (`--strict-staleness` refuses).
130
-
131
- ### Remote agents
132
-
133
- The PANE is local, the PROCESS is remote. **One orchestrator DB**: never
134
- run a second mu on the host. **Read
135
- [recipes/remote-workers.md](recipes/remote-workers.md) before spawning
136
- your first remote agent, and again before waiting on one.**
137
- [mule](https://github.com/mu-crew/mule) runs remote commands without
138
- holding an ssh channel; **`mule` exit 3 is a HANDBACK** to the operator
139
- (hardware-key touch): never retry or open `ssh -MNf` yourself.
140
-
141
- ### Workstream names
142
-
143
- `<project>-<purpose>` (`hail-auth`), one per effort, torn down when it
144
- ships. Reviews nobody will track run as `scratch` delegates.
145
-
146
- ### Agent names
147
-
148
- Use roles with the smallest unused suffix: `worker-1`, `reviewer-1`,
149
- `scout-1`, `auditor-1`, `planner-1`. No human names.
150
-
151
- ### Task note contract
152
-
153
- End every delegated task with a note holding the applicable fields
154
- (write the brief that asks for it per [brief](recipes/brief.md)):
155
-
156
- ```text
157
- FILES: paths inspected/changed (line ranges if precise)
158
- COMMANDS: commands run + exit codes
159
- FINDINGS: what you observed
160
- DECISION: what you chose, and why
161
- NEXT: follow-on tasks
162
- VERIFIED: tests/checks/output
163
- ODDITIES: weird things not acted on
164
- ```
165
-
166
- Then close with grounding:
167
- `mu task close <id> -w <ws> --evidence "tests pass: cargo test exit 0"`.
20
+ - **umbrella**: a job's parent task, blocked by every unit; holds brief, criteria, stop rule.
21
+ - **finding**: an `OPEN/triage` task. **verdict**: `VERDICT: <id>
22
+ CONFIRMED|REFUTED|UNVERIFIED <line>` plus `EVIDENCE:`.
23
+ - `mu task block A --by B`: B blocks A. Chain tasks sharing files.
168
24
 
169
25
  ## Orchestrator rules
170
26
 
171
27
  <!-- mu:keep-driving -->
172
- **While workers run, keep driving.** Your turn ends only when every
173
- task is closed, or when a decision only a human can make blocks all
174
- progress (scope, spend, irreversible or external actions, a hardware-key
175
- handback). A status summary is a log line, not a stopping point: write
176
- it with `mu log`, then go straight back to `mu task wait`. Ending a
177
- turn to report progress while workers are busy stalls the whole crew.
28
+ **While workers run, keep driving.** Your turn ends only when everything you own
29
+ is closed, or only a human can decide (scope, spend, irreversible or external
30
+ action, hardware-key handback): record it with `mu human-needed -w <ws>
31
+ "<reason>"`, then stop. A status summary is a `mu log` line, not a stopping
32
+ point: one per wave, then back to waiting. An error never means a
33
+ human is needed. Ending a turn mid-run stalls the crew.
178
34
  <!-- /mu:keep-driving -->
179
35
 
180
- Before you dispatch, read [recipes/orchestrator-loop.md](recipes/orchestrator-loop.md):
181
- the every-turn loop, waiting, merging, and stopping workers. These
182
- rules hold even when you skip it:
183
-
184
- - **Claim before sending**, even one-shot reviewers. Ownership is
185
- durable and waitable; agent state is not.
186
- - **Pipeline; don't barrier.** Merge accepted tasks as they close; verify
187
- one pinned merge batch without pausing independent workers.
188
- - **Verify the merge, not the worker's rerun.** Only `CLOSED/done` ships.
189
- - **Push after merged-tree gates pass.** Run full slow once per batch, plus
190
- fast if needed; queue [test upkeep](recipes/test-health.md#upkeep-loop) at milestones or budget crossings.
191
- - **Define done before a long run**: the completion criterion goes in
192
- the task note first ([long-run](recipes/long-run.md)).
193
- - **New work to pi is `mu agent send --fresh`.** Never chain `/new` and
194
- a prompt as two sends: the prompt can land mid-reset and vanish.
195
- - **`mu task wait --first --on-stall exit`**; exit 7 means read the
196
- owner's pane and answer it.
197
- - **Stop a worker gently**: `mu agent abort`, then `kick`, then `close`.
198
- To redirect a busy pi now: `send --interrupt` (`--steer` waits for
199
- the running tool).
200
- - **Send, don't note, a running worker**: it never sees new notes. The note is the durable copy
201
- ([how to send](recipes/orchestrator-loop.md#sending)).
202
- - **Refute a brief claiming a cause, fix, threshold or code fact** before dispatch:
203
- one `record`ed refuter call; rewrite on REFUTED. Others get a `REFUTE-EXEMPT: <why>` note.
204
- - **Checks are calls, not tasks.** Refuters, claim checkers, judges and
205
- skeptics are [delegate calls](recipes/tasks-or-calls.md#delegate-call)
206
- (`mu_delegate`, or a `scratch` spawn without it), all issued in one
207
- turn. Refuters and claim checkers pass `record` (or hand-write the
208
- `REFUTER` note) to land the verdict on the task; judges report
209
- `WINNER:`. `MU_DELEGATE_MAX` (16) run at once; the rest queue.
210
- - **Leave no scratch files.** With tasks, briefs and answers live in
211
- mu (task notes, `mu log`); for pure delegate calls, pass them through
212
- stdin (`-` plus a quoted heredoc). A job that needs files
213
- (diffs, a brief shared by a panel, reviewer outputs) keeps them in
214
- one `mktemp -d` directory and `rm -rf`s it once the results are in
215
- notes or your answer, before the turn ends.
216
- - **Findings are tasks.** A reviewer's or auditor's findings become
217
- `mu task add --triage` tasks blocking the review, decided with
218
- `mu task accept` or `close --as rejected|duplicate`. A review nobody
219
- will track (someone's PR, a doc) runs as delegates instead. Rules:
220
- [recipes/findings.md](recipes/findings.md).
221
-
222
- ## CLI gotchas
223
-
224
- - **`task close --as rejected|wontfix --why ...`** unblocks dependents
225
- (listed in the output). `rejected` = the claim is false; `wontfix` =
226
- true, not worth doing. To keep dependents waiting, `task park --why` instead.
227
- - **For waits use `task wait`, not `log --tail`.** `mu log --kind <k>`
228
- entries are your own durable state (a ledger); `--intent` filters what
229
- mu recorded.
230
- - **Prose in notes, prompts, `--why` or `--evidence`**: an apostrophe
231
- ends `'...'`; use a quoted heredoc ([brief](recipes/brief.md#quoting)).
232
- - **`mu sql`** does not pull synced ops; run any other mu command first.
233
- - **Never put `MU_DB_PATH` inside `MU_SYNC_DIR`**: it corrupts the DB.
234
- - Before undo, rebuild, teardown (dry-run without `--yes`), sync setup,
235
- a `doctor --deep` DRIFT, or `doctor` cleanup output, read
236
- [recipes/recovery.md](recipes/recovery.md).
237
-
238
- ## Models and thinking effort
239
-
240
- mu passes the model through; you pick it. Before you choose one for a
241
- spawn or a delegate call, read [recipes/models.md](recipes/models.md):
242
- tiers, which roles need which, and local models as a last resort.
243
-
244
- - `mu_delegate` takes `model`; a spawn takes `--command "pi --model <id>"`.
245
- - A checker (reviewer, refuter, judge, auditor) runs at the author's tier
246
- or higher, from another family when one exists. A delegate with no
247
- `model` runs the cli's default model; pass `model` when it matters.
248
-
249
- ## Reaper and agent state
250
-
251
- If an agent pane dies, or `mu agent close` kills it mid-task, its
252
- IN_PROGRESS tasks revert to OPEN with a `[reaper]` note. No manual
253
- release after crashes.
254
-
255
- pi agents report state through the control socket and need no murmur.
256
- Other CLIs report through [murmur](https://github.com/mu-crew/murmur) on
257
- tmux, or herdr on herdr. `unknown` means no state source; `mu doctor`
258
- says why. Before you merge, close `--as rejected`, abort, or tear down, read the pane
259
- (`mu agent read worker-1 -n 100`), `mu log -w <ws> --tail`, and
260
- `mu task notes <id>`.
261
-
262
- ## You are a worker
263
-
264
- If a task was claimed for you, follow [recipes/worker.md](recipes/worker.md).
265
- Close the task as your last action, or the orchestrator's wait hangs.
266
-
267
- ## Guardrails
268
-
269
- Task ownership outranks agent state. Coordinate through task notes and
270
- the ops log (`mu log`). Keep edges within one workstream. Give workers
271
- bounded paths and commands.
36
+ Read [orchestrator-loop](recipes/orchestrator-loop.md) before you dispatch. Always:
37
+
38
+ - **Claim before work is sent.** `agent spawn --task <id> --send ...` does both.
39
+ - **Wait with `mu wait`, never `sleep` loops** (exits:
40
+ [orchestrator-loop](recipes/orchestrator-loop.md)).
41
+ - **A send that timed out is unknown, never resent**: `mu agent check <a> <msgId>`.
42
+ - **New work to pi: `send --fresh`.** A running worker never sees a note: send
43
+ ([modes](recipes/orchestrator-loop.md#sending)).
44
+ - **`unknown` is not dead.** Read the pane and `mu doctor` first.
45
+ - **Only `CLOSED/done` ships.** Verify the merge.
46
+ - **Checks are calls, not tasks** ([tasks-or-calls](recipes/tasks-or-calls.md)).
47
+ Before you act on a claim, cause, plan, fix or brief, have a recorded call
48
+ refute it; rewrite on REFUTED.
49
+ - **Findings are tasks** ([findings](recipes/findings.md)); each shipping unit gets a
50
+ [review gate](recipes/adversarial-review.md).
51
+ - **Stop rule on the umbrella first.**
52
+ - **`course check due` stops dispatch**: finish merging, then
53
+ [course-correct](recipes/course-correct.md) to its `mu human-needed`.
54
+ - **Edit or build: `--worktree`.** Never make your own.
55
+
56
+ ## Gotchas
57
+
58
+ - `close --as rejected|wontfix --why` unblocks dependents; `park --why` keeps them waiting.
59
+ - Prose goes through `-` and a quoted heredoc ([brief](recipes/brief.md)).
60
+ - Teardown, rebuild, sync, `doctor` DRIFT: [recovery](recipes/recovery.md) first.
61
+ - Claimed for you: [worker](recipes/worker.md). Remote host:
62
+ [remote-workers](recipes/remote-workers.md).
272
63
 
273
64
  ## Recipes
274
65
 
275
- Read the recipe before starting the shape it names. For a large or
276
- risky job that needs several of them, start with
277
- [ultrathink](recipes/ultrathink.md).
278
-
279
66
  | Recipe | Read when |
280
67
  | --- | --- |
281
- | [ultrathink](recipes/ultrathink.md) | a job is too large or risky for one context; composes the rest |
282
- | [orchestrator-loop](recipes/orchestrator-loop.md) | you dispatch tasks and merge results |
283
- | [brief](recipes/brief.md) | you write a task note or prompt a worker will read |
284
- | [plan](recipes/plan.md) | you turn a spec or requirements into a task DAG |
68
+ | [orchestrator-loop](recipes/orchestrator-loop.md) | you dispatch and merge |
69
+ | [brief](recipes/brief.md) | you write what a worker reads |
70
+ | [tasks-or-calls](recipes/tasks-or-calls.md) | a step spawns an agent |
71
+ | [findings](recipes/findings.md) | a check reports problems |
72
+ | [adversarial-review](recipes/adversarial-review.md) | a unit needs a gate |
73
+ | [test-health](recipes/test-health.md) | you set gates or verify a merge |
74
+ | [models](recipes/models.md) | you pick a model |
75
+ | [remote-workers](recipes/remote-workers.md) | an agent runs on another host |
76
+ | [recovery](recipes/recovery.md) | teardown, rebuild, sync |
285
77
  | [worker](recipes/worker.md) | a task was claimed for you |
286
- | [test-health](recipes/test-health.md) | define gates, choose verification, add tests, or upkeep at milestones/budget crossings |
287
- | [recovery](recipes/recovery.md) | undo, rebuild, teardown, sync setup, `doctor` cleanup |
288
- | [remote-workers](recipes/remote-workers.md) | an agent runs on another machine |
289
- | [waves](recipes/waves.md) | more than one worker edits the same repo at once |
290
- | [long-run](recipes/long-run.md) | a task or proof runs for hours, or must survive flakes |
291
- | [drift-audit](recipes/drift-audit.md) | hours into a long run, after a batch, compaction or resume, before a stop rule |
292
- | [watcher](recipes/watcher.md) | a helper polls a PR, CI, or log for change |
293
- | [findings](recipes/findings.md) | any review, audit, or check reports problems: where they live, how they are triaged |
294
- | [models](recipes/models.md) | you pick a model for a spawn or delegate call |
295
- | [tasks-or-calls](recipes/tasks-or-calls.md) | a recipe step spawns an agent: DAG task or delegate call |
296
- | [adversarial-review](recipes/adversarial-review.md) | gate each unit you dispatch before it merges (a review task per unit) |
297
- | [fan-out](recipes/fan-out.md) | a sweep or migration: the same change over many files or call sites |
298
- | [refute](recipes/refute.md) | you start an audit, bug hunt, or fact-check |
299
- | [hypothesis-panel](recipes/hypothesis-panel.md) | debugging: "why does X", a regression, a flaky test, an intermittent bug |
300
- | [tournament](recipes/tournament.md) | several answers are possible and the best is a judgement call |
301
- | [loop-until-done](recipes/loop-until-done.md) | fix until a check is clean (tsc, lint, tests), or search until nothing new |
302
- | [backlog-triage](recipes/backlog-triage.md) | a backlog of external items needs classifying and acting on |
303
- | [deep-research](recipes/deep-research.md) | a question needs many sources read and cross-checked |
304
- | [review-panel](recipes/review-panel.md) | code review of a PR, branch, or diff |
305
- | [rules-audit](recipes/rules-audit.md) | a change must follow AGENTS.md rule by rule, or rules keep being restated |
306
- | [codemode-driver](recipes/codemode-driver.md) | you have the `codemode` tool and one step dispatches many workers or delegate calls |
307
-
308
- ## See also
309
-
310
- - `mu --help`, `mu <verb> --help` — canonical CLI reference.
78
+ | [course-correct](recipes/course-correct.md) | a `course check due` hint, or a human asks |
79
+ | [move](recipes/move.md) | a human asks to move a 3.x workstream |
@@ -1,111 +1,20 @@
1
1
  # Adversarial review
2
2
 
3
- Use when a unit of work must be checked by someone other than its
4
- author before it counts: a unit that produces commits (a fix, a feature).
5
- Checking a finding or claim is a delegate call
6
- ([findings § Triage](findings.md#triage), [refute](refute.md)). The author
7
- grades its own work generously; a fresh agent told to refute it does
8
- not. Every other review-shaped recipe builds on this one.
3
+ Use when a unit that produces commits must be checked by someone other than its author before it counts. Checking a claim is a delegate call ([findings](findings.md)).
9
4
 
10
- The review is a task in the DAG, not a step inside the worker's
11
- session. Its verdict, its evidence, and every finding it makes stay in the
12
- DB: each is a finding task ([findings](findings.md)). For a one-off
13
- check outside any workstream, one
14
- [delegate call](tasks-or-calls.md#delegate-call) is enough; to review a
15
- PR or diff from several angles, use [review-panel](review-panel.md).
16
-
17
- ## Steps
18
-
19
- 1. **Write the criteria first.** Before dispatching the work, note on
20
- the work task what "accepted" means: requirements, risky behaviours
21
- needing coverage, and files that must not change. The reviewer judges
22
- against this note, not against its own taste.
23
- 2. **Add the review task, blocked by the work:**
5
+ 1. **Criteria first**, on the work task: requirements, risky behaviour needing coverage, files that must not change.
6
+ 2. **Gate**, blocked by the work:
24
7
 
25
8
  ```bash
26
- mu task add review_x -w <ws> -t "Review x" -i 50 -e 0.5 --blocked-by x \
27
- --note 'ACCEPTANCE: see x notes. Refute; report findings, not style.'
9
+ mu task add review_x -w <ws> -t "Review x" --blocked-by x --note 'ACCEPTANCE: see x notes. Refute; findings, not style.'
28
10
  ```
29
11
 
30
- 3. **Dispatch the work** as usual. When `x` closes, `review_x` becomes
31
- ready.
32
- 4. **Spawn a fresh reviewer.** A new agent, or `--fresh` on an idle one,
33
- so it has none of the author's reasoning, at the worker's tier or
34
- higher and from another family ([models](models.md#checkers)). Give it the worker's workspace path
35
- and commits read-only by instruction; it edits nothing.
36
- 5. **Claim `review_x` for the reviewer**, send the brief (below), wait.
37
- 6. **Act on the verdict:**
38
- The review's state is the verdict: `CLOSED/done` for ACCEPT,
39
- `CLOSED/rejected` for REJECT.
40
- - `ACCEPT`: cherry-pick `x`'s commits and verify the merge.
41
- - `REJECT`: the reviewer recorded each finding as an `OPEN/triage` task.
42
- Add `review_x_2` and block it on every finding
43
- (`mu task block review_x_2 --by <finding>`). Closing `review_x`
44
- `--as rejected` unblocked its dependents, so re-block each task
45
- downstream of `x` on `review_x_2`
46
- (`mu task block <downstream> --by review_x_2`). Decide each
47
- finding ([findings § Triage](findings.md#triage)), then
48
- dispatch the accepted ones to the original worker, whose context
49
- still holds the work. Repeat from step 4 when the findings are closed.
50
- The DAG grows; nothing is rewritten.
51
- 7. **Cap the rounds.** After two rejections on the same unit, stop the
52
- loop and decide yourself: split the unit, change the criteria, or
53
- ask the human. A third round of the same argument rarely converges.
54
-
55
- Done when the latest review task is `CLOSED/done` (ACCEPT), and the
56
- accepted commits are merged and the batch passes the merged-tree gates
57
- ([orchestrator-loop § Merging](orchestrator-loop.md#merging)).
58
-
59
- ## Reviewer brief
60
-
61
- Send this with the task id, workspace path, commit range, gate records and
62
- [test-health](test-health.md) pointer:
63
-
64
- ```text
65
- You are reviewing task <x>. You did not write it. Your job is to find
66
- where it fails the acceptance criteria in `mu task notes <x>`.
67
-
68
- - Read the diff (<range>), criteria and worker gate records. Follow
69
- test-health.md for record equivalence, targeted runs and test findings.
70
- Reproduce claimed failures; a full rerun or parent build is not routine.
71
- - Report findings against the criteria: a requirement not met, risky
72
- untested/broken behaviour, a change outside scope, unsupported evidence.
73
- Not style, not preferences.
74
- - Record each as a finding, per findings.md § Record:
75
- mu task add -w <ws> --triage -t "<severity>: <title>" -i <n> -e <days> \
76
- --note 'FINDING: <severity> <file:line> <what fails> EVIDENCE: <command + output>'
77
- - If you could not check something (tool failed, no access), say
78
- UNVERIFIED for it. Unverified is not a pass and not a fail.
79
- - Your only writes are `mu task add` (findings), the verdict note, and
80
- the close; leave the workspace as you found it.
81
-
82
- Write the verdict note (FILES/COMMANDS/FINDINGS/VERIFIED), then close
83
- (long reasons: a heredoc variable, brief.md § Quoting):
84
- ACCEPT: mu task close review_<x> --evidence "<key command>: <result>"
85
- REJECT: mu task close review_<x> --as rejected \
86
- --why "<n> findings: <id> (<why it fails, one clause>), ..."
87
- ```
88
-
89
- mu adds each named finding's title to the REJECTED note.
90
-
91
- **Closing a review yourself** (you fixed a finding, or accept without a
92
- fresh reviewer): write the reviewer's note plus `COMMIT: <sha> fixes
93
- <finding>`, and name the check in `--evidence`. Not `one finding fixed
94
- by orchestrator`.
95
-
96
- ## Traps
12
+ 3. **Fresh reviewer**, a checker per [models](models.md). Send the diff range, criteria and gate records, not the worker's reasoning. Its only writes are findings, the verdict note and the close.
13
+ 4. **Reviewer brief:** reproduce claimed failures; report unmet requirements, untested or broken behaviour, scope creep, unsupported evidence, each as a [finding](findings.md); `UNVERIFIED` for what it could not check. Close:
14
+ - ACCEPT: `mu task close review_x --evidence "<command it ran>: <result>"`
15
+ - REJECT: `mu task close review_x --as rejected --why "<n> findings: <ids>"`
16
+ 5. **Act.** ACCEPT: cherry-pick `x`, verify the merge ([orchestrator-loop](orchestrator-loop.md)). REJECT: rejecting unblocked `x`'s dependents; add `review_x_2` blocked by every finding, re-block them on it, decide the findings, send accepted ones to the original worker, then a fresh reviewer.
17
+ 6. **Two rejections of one unit end the loop**: split it, change the criteria, or ask the human.
97
18
 
98
- - **A reviewer that sees the author's reasoning agrees with it.** Send
99
- the diff, criteria and gate records, not the worker's reasoning transcript.
100
- - **"Looks good" is not a verdict.** Require a close that matches the
101
- verdict (`done` or `--as rejected`) and at least one command the
102
- reviewer ran. A review with no evidence is a
103
- rejected review: re-send it.
104
- - **A review with only UNVERIFIED items is not a REJECT.** A broken
105
- environment or unreachable resource starts no coder round: report it
106
- to the human.
107
- - **Reviewers drift into fixing.** A reviewer that edits the code is now
108
- an author nobody reviews. The fix belongs to the finding tasks.
109
- - **Review is not merge verification.** An accepted unit can still
110
- break once merged with moved main. Verify the merge as in
111
- [orchestrator-loop](orchestrator-loop.md#merging).
19
+ - A review that ran no command is no verdict: re-send it.
20
+ - Only `UNVERIFIED` items is a report to the human, not a REJECT.
@@ -1,75 +1,35 @@
1
1
  # Writing a brief
2
2
 
3
- Use when you write anything a worker reads: a task note, a `--fresh`
4
- prompt, a reviewer brief. The worker starts with no context. What is
5
- not in the brief, or one pointer away, does not exist for it.
6
-
7
- <!-- Ideas adapted from mattpocock/skills `writing-for-agents` (MIT). -->
8
-
9
- ## Rules
10
-
11
- 1. **End on a completion criterion.** The brief says how the worker
12
- tells done from not done, and the criterion is both checkable and
13
- exhaustive: "every file in the UNITS list compiles under
14
- `npm run typecheck`", not "update the call sites". A vague bound
15
- invites the worker to stop at the first plausible point.
16
- 2. **Inline what every path needs; point to the rest.** Files, the
17
- targeted verify command, scope, and the final action go in the brief. Shared
18
- context goes in one place (an umbrella's note) and the brief points
19
- at it: `Read: mu task notes sweep -w audit`. Repeating it per task
20
- copies it into every worker's context and lets the copies drift.
21
- 3. **State the target, not the ban.** "Edit only files under
22
- `src/auth/`" works; "don't touch other files" puts other files in
23
- the worker's head. Keep a prohibition only for a hard guardrail
24
- with no positive form, and pair it with the positive target.
25
- 4. **Reuse the recipe words.** *Unit*, *stop rule*, *verdict*,
26
- *finding*, *umbrella* mean the same thing in every recipe. Use them
27
- as written; a worker that read one recipe brief reads the next
28
- faster.
29
- 5. **Cut the default.** A sentence the worker would obey anyway
30
- ("be careful", "write clean code") costs attention and changes
31
- nothing. Delete the whole sentence.
32
- 6. **Ask for evidence, not reassurance.** The final note names the
33
- commands run and their exit codes (the task note contract). "Done,
34
- all good" is not a result.
35
- 7. **A brief that makes claims is refuted before dispatch** ([SKILL.md](../SKILL.md#orchestrator-rules)).
36
-
37
- ## Shape
3
+ Use when you write anything a worker reads: a task note, a `--fresh` prompt, a reviewer brief. The worker starts with no context.
38
4
 
39
5
  ```text
40
- Task <id> in <ws>. Workspace: <path>.
41
- Read: mu task notes <id> -w <ws> (and the umbrella's, if any)
42
-
6
+ Task <id> in <ws>. Read: mu task notes <id> -w <ws>
43
7
  GOAL: <one sentence>
44
8
  FILES: <paths it may change>
45
9
  DONE WHEN: <checkable, exhaustive criterion>
46
- VERIFY: <repo Gates pointer + exact targeted command/scope; test-health.md by role>
47
- NOTE: <applicable gate records before close; test-health.md § Gate contract>
48
-
49
- ⚠️ FINAL ACTION
50
- git commit -am '<msg>' THEN
51
- mu task close <id> -w <ws> --evidence "$v" # command + result; see Quoting
10
+ VERIFY: <exact targeted command>
11
+ FINAL ACTION: git commit, then
12
+ mu task close <id> -w <ws> --evidence "$v" # command + result
52
13
  ```
53
14
 
54
- Use [test-health](test-health.md) for worker/reviewer gate allocation, gate
55
- records, test levels and cheap bug red-green. Point to it rather than asking
56
- each role for a full gate or parent build.
15
+ - **End on a criterion** both checkable and exhaustive: "every file in UNITS compiles under `npm run typecheck`", not "update the call sites".
16
+ - **Share once.** Common context goes on the umbrella; each brief says `Read:` and holds only what differs.
17
+ - **State the target, not the ban**: "edit only `src/auth/`".
18
+ - **Ask for evidence**: commands run and exit codes.
19
+ - **Refutation.** A brief naming a cause, fix, threshold or code fact needs the recorded refutation ([SKILL](../SKILL.md)); any other carries `REFUTE-EXEMPT: <why>`.
20
+ - Never tell a worker to `cd`: its cwd is its worktree.
57
21
 
58
22
  ## Quoting
59
23
 
60
- Single quotes suit short text with no `'`. Prose (an apostrophe ends
61
- `'...'`; `"..."` expands `$` and backticks) goes through stdin with a
62
- quoted heredoc, stored verbatim:
24
+ An apostrophe ends `'...'`. Pass prose through `-` and a quoted heredoc, stored verbatim:
63
25
 
64
26
  ```bash
65
27
  mu task note <id> -w <ws> - <<'EOF'
66
- it's fine: $HOME and `pwd` stay literal
28
+ it's fine: $HOME stays literal
67
29
  EOF
68
30
  ```
69
31
 
70
- `mu task add --note -`, `--text -` and `mu agent send <a> -` read stdin
71
- the same way. `--why` and `--evidence` have no `-` form: capture the
72
- heredoc in a variable and double-quote it:
32
+ `task add --note -` and `agent send <a> -` read stdin too. `--why` and `--evidence` do not; capture the text first:
73
33
 
74
34
  ```bash
75
35
  v=$(cat <<'EOF'
@@ -78,10 +38,3 @@ EOF
78
38
  )
79
39
  mu task close <id> -w <ws> --evidence "$v"
80
40
  ```
81
-
82
- Chain batched adds with `&&`, then `mu task list`, so one
83
- quoting failure cannot half-apply the batch unseen.
84
-
85
- Done when the brief has GOAL, FILES, DONE WHEN, VERIFY and the
86
- final-action block, every shared fact is a `Read:` pointer, and the task
87
- holds a refuter verdict or a `REFUTE-EXEMPT:` note.
@@ -0,0 +1,23 @@
1
+ # Course-correct a long job
2
+
3
+ Use when a hint says `course check due: <n> closed since <date>`, or a human asks.
4
+
5
+ 1. **A read-only `mu_delegate` measures**:
6
+
7
+ ```bash
8
+ git log --since=<date> --format=%s | cut -d: -f1 | sort | uniq -c
9
+ mu db query -w <ws> "SELECT CASE WHEN instr(local_id,'_')>0 THEN substr(local_id,1,instr(local_id,'_')-1) ELSE local_id END AS prefix, status, substate, count(*) AS n, sum(local_id GLOB '*_[2-9]') AS rounds FROM tasks t JOIN workstreams w ON w.id=t.workstream_id AND w.name='<ws>' WHERE t.created_at>'<date>' GROUP BY 1,2,3"
10
+ mu db query -w <ws> "SELECT lower(substr(title,1,instr(title,':')-1)) AS severity, status, count(*) AS n FROM tasks t JOIN workstreams w ON w.id=t.workstream_id AND w.name='<ws>' WHERE t.created_at>'<date>' AND severity IN ('critical','high','medium','low') GROUP BY 1,2"
11
+ tokei src
12
+ mu task tree <umbrella> -w <ws>
13
+ ```
14
+
15
+ 2. **Second delegate refutes the numbers** before any proposal.
16
+ 3. **Compare with the spec**: stale text, then:
17
+ - Switch line: which open critical-path units can move after the switch?
18
+ - Review cost: rounds per unit, findings by severity. Bar: high = fix + re-review; medium = fix, evidence in the close note; low = one batch.
19
+ - Code budget: `src/` vs baseline; units >30% over budget.
20
+ - Real use: last dogfood date; what it found that review missed.
21
+ 4. **Propose at most 7 changes**, each tied to a number.
22
+ 5. **Stop**: `mu human-needed -w <ws> "course check: <n> proposed changes, see note"`: settle ends a turn only there.
23
+ 6. **Approved**: one umbrella note starting `COURSE CHECK <date>` (the hint counts from it) and the DAG diff, then dispatch.