@mu-crew/mu 3.2.1 → 3.4.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 (60) hide show
  1. package/AGENTS.md +10 -5
  2. package/README.md +83 -22
  3. package/dist/cli.js +294 -98
  4. package/dist/cli.js.map +1 -1
  5. package/dist/extension/mu-pi.js +346 -85
  6. package/dist/extension/mu-pi.js.map +1 -1
  7. package/dist/index.d.ts +68 -13
  8. package/dist/index.js +159 -71
  9. package/dist/index.js.map +1 -1
  10. package/docs/ARCHITECTURE.md +1 -0
  11. package/docs/VISION.md +3 -1
  12. package/docs/VOCABULARY.md +6 -1
  13. package/docs/architecture/control-socket.md +17 -3
  14. package/docs/architecture/dag.md +3 -3
  15. package/docs/architecture/mux.md +3 -4
  16. package/docs/guide/README.md +5 -0
  17. package/docs/guide/delegate.md +30 -3
  18. package/docs/guide/dispatch.md +11 -4
  19. package/docs/guide/getting-started.md +3 -0
  20. package/docs/guide/recovery.md +3 -1
  21. package/docs/guide/remote.md +1 -1
  22. package/docs/history/CHANGELOG-pre-3.md +1 -1
  23. package/docs/reference/env.md +2 -1
  24. package/docs/reference/naming.md +18 -0
  25. package/docs/specs/2026-09-29-task-substates.md +1 -1
  26. package/docs/specs/2026-10-03-keep-driving-nudge.md +142 -0
  27. package/package.json +2 -1
  28. package/prompts/mu-debug.md +8 -0
  29. package/prompts/mu-refute.md +8 -0
  30. package/prompts/mu-research.md +8 -0
  31. package/prompts/mu-review.md +8 -0
  32. package/prompts/mu-rules-audit.md +8 -0
  33. package/prompts/mu-sweep.md +8 -0
  34. package/prompts/mu-tournament.md +9 -0
  35. package/prompts/mu-until.md +8 -0
  36. package/prompts/ultrathink.md +10 -0
  37. package/skills/mu/SKILL.md +124 -145
  38. package/skills/mu/recipes/adversarial-review.md +91 -0
  39. package/skills/mu/recipes/backlog-triage.md +43 -0
  40. package/skills/mu/recipes/brief.md +53 -0
  41. package/skills/mu/recipes/codemode-driver.md +102 -0
  42. package/skills/mu/recipes/deep-research.md +67 -0
  43. package/skills/mu/recipes/fan-out.md +40 -0
  44. package/skills/mu/recipes/findings.md +103 -0
  45. package/skills/mu/recipes/hypothesis-panel.md +45 -0
  46. package/skills/mu/recipes/long-run.md +20 -0
  47. package/skills/mu/recipes/loop-until-done.md +42 -0
  48. package/skills/mu/recipes/orchestrator-loop.md +98 -0
  49. package/skills/mu/recipes/plan.md +59 -0
  50. package/skills/mu/recipes/recovery.md +28 -0
  51. package/skills/mu/recipes/refute.md +51 -0
  52. package/skills/mu/{REMOTE_WORKERS.md → recipes/remote-workers.md} +7 -2
  53. package/skills/mu/recipes/review-panel.md +62 -0
  54. package/skills/mu/recipes/rules-audit.md +83 -0
  55. package/skills/mu/recipes/tasks-or-calls.md +67 -0
  56. package/skills/mu/recipes/tournament.md +40 -0
  57. package/skills/mu/recipes/ultrathink.md +82 -0
  58. package/skills/mu/recipes/watcher.md +19 -0
  59. package/skills/mu/recipes/waves.md +20 -0
  60. package/skills/mu/recipes/worker.md +26 -0
@@ -0,0 +1,67 @@
1
+ # Deep research
2
+
3
+ Use when a question needs more sources than one context can read and
4
+ checking them against each other: how a library or protocol behaves,
5
+ what changed between versions, how competitors solve a problem, whether
6
+ a claim in a draft holds. This is [refute](refute.md) applied to
7
+ sources. Workers need a web search tool (pi's `brave_search`, or
8
+ `curl` on docs) or the code they research.
9
+
10
+ **Mode:** delegates by default: the report is the result, and claims
11
+ need no permanent record. Use a workstream for a long run that must
12
+ survive compaction or feeds a tracked decision; then each claim the
13
+ answer rests on is an `OPEN/triage` task, decided like a finding
14
+ ([findings](findings.md)).
15
+
16
+ ## Steps
17
+
18
+ 1. **Write the question and the bar**, into every searcher's brief
19
+ (delegate mode) or on an umbrella task (workstream mode): the exact
20
+ question, what a good answer contains (a recommendation, a
21
+ comparison table, a yes/no with conditions), and how fresh sources
22
+ must be.
23
+ 2. **Split by angle**, one searcher per angle (delegates; tasks only in
24
+ workstream mode): official docs,
25
+ changelogs and release notes, issue trackers, independent write-ups,
26
+ the code itself. Each searcher reads, fetches, and writes claims to
27
+ its note, one per line:
28
+
29
+ ```text
30
+ CLAIM: c4 "Node 22 enables the permission model by default" SOURCE: <url> QUOTE: "<exact words>"
31
+ ```
32
+
33
+ A claim without a source and a quote is not a claim. Searchers can
34
+ run on a cheap model.
35
+ 3. **Dedupe claims**: merge the same fact from several sources (keep
36
+ every source), and flag claims that contradict each other. In
37
+ workstream mode, each surviving claim becomes an `OPEN/triage` task
38
+ titled with the claim, its sources and quotes in the note.
39
+ 4. **One checker per claim** that the answer depends on, as a
40
+ [delegate call](tasks-or-calls.md#delegate-call) in both modes. The checker
41
+ gets the claim and its sources, not the searcher's reasoning, fetches
42
+ the source itself, and tries to break the claim: is the quote there,
43
+ does it say that, is it current, does another source disagree? It
44
+ ends with `VERDICT: c4 CONFIRMED | REFUTED | UNVERIFIED <evidence>`.
45
+ For contradicted claims, one checker per side. Batch under the cap
46
+ ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)). In workstream mode the
47
+ verdict is the claim task's state: `accept` for confirmed,
48
+ `close --as rejected` for refuted, an `UNVERIFIED:` note in triage
49
+ otherwise.
50
+ 5. **Synthesize** once every checker has answered (in workstream mode,
51
+ when no claim task is left undecided): answer the question
52
+ from confirmed claims only, each with its source URL. List
53
+ unverified claims separately. Note what the sources disagree on and
54
+ which side the evidence favours.
55
+
56
+ Done when every claim the answer uses has a `CONFIRMED` verdict line,
57
+ every sentence of fact in the report cites a URL, and the report meets
58
+ the bar from step 1.
59
+
60
+ ## Traps
61
+
62
+ - **A fetch failure is UNVERIFIED, not REFUTED.** Rate limits and
63
+ paywalls block checkers; say so, do not drop the claim silently.
64
+ - **Secondary sources copy each other.** Three blog posts repeating one
65
+ changelog are one source. Prefer the primary source in the dedupe.
66
+ - **Version drift.** A claim true for v2 can be false for v3. Checkers
67
+ confirm the version the question asks about.
@@ -0,0 +1,40 @@
1
+ # Fan-out
2
+
3
+ Use when the same treatment applies to many units: files, call sites,
4
+ failing tests, findings, modules. One context holding 50 units drops
5
+ some and calls the job done; one task per unit cannot.
6
+
7
+ ## Steps
8
+
9
+ 1. **Enumerate first.** A scout (a [delegate call](tasks-or-calls.md#delegate-call)) lists the units and
10
+ writes them to the umbrella's note, one per line. The list is done
11
+ when it matches a command the scout ran (`rg -l`, a test listing),
12
+ not when it looks complete. Record the command and the count.
13
+ 2. **One task per unit**, blocked into an umbrella:
14
+
15
+ ```bash
16
+ mu task add sweep -w <ws> -t "Sweep: <goal>" -i 60 -e 1 --note 'UNITS: 37 (rg -l ... | wc -l)'
17
+ mu task add sweep_auth_ts -w <ws> -t "Sweep src/auth.ts" -i 50 -e 0.2
18
+ mu task block sweep -w <ws> --by sweep_auth_ts
19
+ ```
20
+
21
+ Put the shared [brief](brief.md) and acceptance criteria on the
22
+ umbrella; each unit task's note holds only what differs. A sweep that
23
+ only checks (no commits) makes each unit a delegate call instead
24
+ ([tasks-or-calls](tasks-or-calls.md)).
25
+ 3. **Cap concurrency** ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
26
+ Spawn at most one agent per ready track. Tell workers to avoid
27
+ repo-wide commands so more can run.
28
+ 4. **Pipeline.** Dispatch, wait `--first`, merge
29
+ ([orchestrator-loop § Merging](orchestrator-loop.md#merging)), dispatch
30
+ the next unit to the freed worker with `--fresh`. With `codemode`, a
31
+ [driver](codemode-driver.md) can dispatch each batch. Units that touch the same files
32
+ go on one track (see [waves](waves.md)).
33
+ 5. **Review per unit** when a wrong unit is costly: add a review task
34
+ per unit ([adversarial-review](adversarial-review.md)).
35
+ 6. **Synthesize** when the output is a report, not commits: one
36
+ delegate call reads the unit notes (not transcripts) and writes one
37
+ result into the umbrella's note.
38
+
39
+ Done when `mu task close sweep --if-ready` closes the umbrella: every
40
+ unit is closed, and the closed count matches the step 1 count.
@@ -0,0 +1,103 @@
1
+ # Findings
2
+
3
+ Use whenever an agent reviews, audits, checks, or researches something
4
+ and reports problems: every recipe that produces findings follows this
5
+ one. It decides where findings live, and how they become work.
6
+
7
+ ## Pick the mode first
8
+
9
+ Ask: **will anyone act on these findings through the DAG?**
10
+
11
+ | Situation | Mode | Findings live in |
12
+ | --- | --- | --- |
13
+ | The result is read once and acted on directly: PR comments, doc edits, a go/no-go, a draft fact-check | **Delegate** | the delegate's answer |
14
+ | Findings become work agents fix, or must be tracked to closure | **Workstream** | one `OPEN/triage` task per finding |
15
+
16
+ Delegate mode keeps reviews of other people's PRs and docs out of the
17
+ ops log, which is permanent and syncs to every machine. Workstream mode
18
+ is the mu way for your own work: the graph shows every finding, who
19
+ decided it, and the fix.
20
+
21
+ ## Delegate mode
22
+
23
+ 1. Run reviewers as [delegate calls](tasks-or-calls.md#delegate-call):
24
+ one per angle or slice, all in one turn so they run in parallel,
25
+ under the cap ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
26
+ 2. Each delegate ends its answer with one line per finding:
27
+
28
+ ```text
29
+ FINDING: high src/api/user.ts:88 PUT handler skips the auth check EVIDENCE: curl -X PUT ... returned 200
30
+ ```
31
+
32
+ 3. You read the answers, merge duplicates, and act: post the comments,
33
+ edit the doc, give the verdict.
34
+ 4. **Promote** when the findings turn out to be work: create one
35
+ `OPEN/triage` task per line (below) and continue in workstream mode.
36
+
37
+ Done when every delegate answered and every finding line was acted on
38
+ or dropped with a reason.
39
+
40
+ ## Workstream mode
41
+
42
+ ### Record
43
+
44
+ The reviewer records each finding as a task in triage, blocking the
45
+ review's umbrella so the umbrella cannot close while findings are
46
+ undecided:
47
+
48
+ ```bash
49
+ mu task add -w <ws> --triage \
50
+ -t "high: PUT /user skips the auth check" -i 70 -e 0.5 \
51
+ --note 'FINDING: high src/api/user.ts:88 PUT skips the auth check EVIDENCE: curl -X PUT ... returned 200 without a token'
52
+ mu task block <umbrella> -w <ws> --by <finding-id>
53
+ ```
54
+
55
+ The title starts with the severity. The note is one `FINDING:` line,
56
+ the same shape everywhere: `FINDING: <severity> <file:line> <what>
57
+ EVIDENCE: <command + output>`. `OPEN/triage` keeps the finding out of `mu task next`, and
58
+ `claim` refuses it, so no worker starts on an undecided finding.
59
+
60
+ **More than 5 findings from one reviewer:** the reviewer writes them as
61
+ `FINDING:` lines in its own task note instead. Before that reviewer
62
+ task closes, the orchestrator adds `triage_<umbrella>` blocking the
63
+ umbrella; the triage agent ([Triage](#triage) step 1) merges duplicates
64
+ across reviewers and creates one task per real problem.
65
+
66
+ ### Triage
67
+
68
+ 1. **Who:** a handful of findings, the orchestrator triages itself. Many,
69
+ or several reviewers on one change: a `triage_<umbrella>` task, run
70
+ by a fresh agent, so the orchestrator reads only its result.
71
+ 2. **Refute** each finding before accepting it with a
72
+ [delegate call](tasks-or-calls.md#delegate-call): a fresh agent tries
73
+ to prove it false and ends with
74
+ `VERDICT: <id> CONFIRMED | REFUTED | UNVERIFIED <evidence>`. Skip this
75
+ for low-severity style findings. High severity: three refuters,
76
+ accept only if at least two say CONFIRMED.
77
+ 3. **Decide** each one; the decision is the task's state:
78
+
79
+ | Decision | Command |
80
+ | --- | --- |
81
+ | real work | `mu task accept <id> --evidence '<what confirmed it>'` |
82
+ | false | `mu task close <id> --as rejected --why '<evidence>'` |
83
+ | same as another | `mu task close <id> --as duplicate --why 'same as <id>'` |
84
+ | valid, not worth it | `mu task close <id> --as wontfix --why '<reason>'` |
85
+ | could not check | stays in triage, with an `UNVERIFIED: <why>` note |
86
+
87
+ 4. **Group** accepted findings that touch the same files into one fix
88
+ task when separate workers would collide; close the grouped findings
89
+ `--as superseded --why 'fixed in <fix-task>'`.
90
+
91
+ Done when `mu task list --substate triage -w <ws>` lists only findings
92
+ with an `UNVERIFIED` note, and each of those is reported to the human.
93
+
94
+ ### Fix and close
95
+
96
+ Accepted findings are ordinary tasks: dispatch them, review the fix
97
+ ([adversarial-review](adversarial-review.md)), merge. The umbrella
98
+ closes with `mu task close <umbrella> --if-ready` once every finding is
99
+ `CLOSED/*`. A plain `close` would succeed with findings still open.
100
+
101
+ The report is a query, not a document: `mu task list -w <ws>
102
+ --substate rejected`, `--substate duplicate`, `--status OPEN`, and the
103
+ notes on each task.
@@ -0,0 +1,45 @@
1
+ # Hypothesis panel
2
+
3
+ Use for root-cause work: a flaky test, an intermittent bug, a metric
4
+ that moved. One agent that forms a theory then tests its own theory
5
+ finds evidence for it. Separate agents, each given different evidence,
6
+ form independent theories; separate agents then try to kill them.
7
+
8
+ ## Steps
9
+
10
+ 1. **Write the symptom** on the umbrella: what happens, how often, the
11
+ repro command, and what would count as fixed.
12
+ 2. **One reader per evidence source** (a [delegate call](tasks-or-calls.md#delegate-call)): logs, the
13
+ code path, recent commits, data, environment. Each sees only its
14
+ source, so the theories do not anchor on each other. Record each
15
+ theory as an `OPEN/triage` task blocking the umbrella, decided like
16
+ a finding ([findings § Triage](findings.md#triage)):
17
+
18
+ ```bash
19
+ mu task add -w <ws> --triage -t "h: <cause>" -i 60 -e 0.5 \
20
+ --note 'PREDICTS: <an observation true if this is the cause, false otherwise>'
21
+ ```
22
+
23
+ 3. **Test each hypothesis.** An experiment that changes code (force the
24
+ race, revert the commit) needs a workspace: `mu task accept` the
25
+ hypothesis and dispatch it as a task. One that only reads (feed the
26
+ data, grep the logs) is a delegate call. A killed hypothesis closes
27
+ `--as rejected --why '<evidence>'`; a survivor gets a
28
+ `SURVIVED: <evidence>` note.
29
+ 4. **If one survives**, add a fix task for it, then a review task
30
+ ([adversarial-review](adversarial-review.md)). The fix is accepted
31
+ only if the step 1 repro stops reproducing.
32
+ 5. **If none survives**, start another round
33
+ ([loop-until-done](loop-until-done.md)): the new hypothesis tasks get
34
+ the killed hypotheses and their evidence as input.
35
+
36
+ Done when the fix's review task is `CLOSED/done` (ACCEPT) and the
37
+ repro from step 1 no longer
38
+ reproduces at the rate step 1 recorded.
39
+
40
+ ## Traps
41
+
42
+ - **Two survivors** usually means the experiments were too weak. Design
43
+ one experiment that separates them before you fix either.
44
+ - **Flaky repros need counts** ([long-run](long-run.md) step 1). "Passed once" proves nothing for a 1 in
45
+ 50 failure. Put the run count in step 1.
@@ -0,0 +1,20 @@
1
+ # Long runs
2
+
3
+ Use when a task or proof runs for hours, crosses context compaction,
4
+ or may hit flakes.
5
+
6
+ 1. **Define done first.** Before dispatch, write the completion criterion
7
+ into the task note: the checks, how many runs must agree, the
8
+ allowed variance. A worker that finds the bar in the note stops at
9
+ the bar, not at the first green.
10
+ 2. **Split into independent units** ([fan-out](fan-out.md)). Shard a long proof into tasks
11
+ that run in parallel, so one flake restarts only its unit. Each unit
12
+ carries its own criterion.
13
+ 3. **Keep state in the DB.** Progress lives in task notes, not in the
14
+ orchestrator's context. After a compaction, `mu state` and
15
+ `mu task notes <id>` are the whole picture.
16
+ 4. **Accept evidence, not close notes**
17
+ ([orchestrator-loop § Merging](orchestrator-loop.md#merging)).
18
+
19
+ Done when every unit is `CLOSED/done` and the criterion from step 1
20
+ holds on the merged tree.
@@ -0,0 +1,42 @@
1
+ # Loop until done
2
+
3
+ Use when the amount of work is unknown: fix type errors until clean,
4
+ find flaky tests until none are new, search until nothing new turns up.
5
+ A fixed number of passes stops too early or runs too long; a stop rule
6
+ written down first does neither.
7
+
8
+ ## Steps
9
+
10
+ 1. **Write the stop rule** on the umbrella before the first round. It
11
+ names a command and a condition, plus a no-progress rule:
12
+
13
+ ```text
14
+ STOP: `npx tsc --noEmit` exits 0
15
+ NO-PROGRESS: two rounds in a row reduce the error count by zero
16
+ ```
17
+
18
+ 2. **Each round is a task** that blocks the umbrella and is blocked by
19
+ the previous round:
20
+ `round_1`, `round_2`, .... Add the next round only when the current
21
+ one closes; never pre-create rounds. Dispatch each per
22
+ [orchestrator-loop](orchestrator-loop.md); multi-hour loops follow
23
+ [long-run](long-run.md).
24
+ 3. **Each round ends with its measurement** in the note:
25
+ `MEASURE: 14 errors (was 31)`, or `NEW: 0 flaky tests`.
26
+ 4. **After each round, check the rule** yourself, from the measurement
27
+ command, not from the worker's note.
28
+ - Rule met: `mu task close <umbrella> --if-ready --evidence '<stop
29
+ command + result>'` (each round blocks the umbrella).
30
+ - No progress: stop the loop and decide. Change the approach, split
31
+ the work, or park the umbrella with
32
+ `mu task park <umbrella> --why '<what is stuck>'` and tell the human.
33
+ - Otherwise: add the next round and dispatch it.
34
+
35
+ Done when the stop rule holds on the merged tree, run by you.
36
+
37
+ ## Traps
38
+
39
+ - **A round that only reports is not progress.** Each round must change
40
+ something (fix, new search slice) or produce a new measurement.
41
+ - **Moving goalposts.** Edit the stop rule only with a note saying why;
42
+ the old rule stays in the history.
@@ -0,0 +1,98 @@
1
+ # Orchestrator loop
2
+
3
+ Use when you run a workstream: you dispatch DAG tasks to workers and
4
+ merge their commits. The hard rules in SKILL.md still apply; this is
5
+ the loop and the reasons behind them.
6
+
7
+ ## Every turn
8
+
9
+ 1. `mu state -w <ws>` — read agents, IN_PROGRESS, ready tasks,
10
+ parallel tracks.
11
+ 2. Spawn at most one agent per independent ready track ([waves](waves.md)
12
+ when workers share files).
13
+ 3. **Claim before sending — even one-shot reviewers/scouts.**
14
+ `mu task claim <id> -w <ws> --for <agent> --evidence "..."`.
15
+ If no task exists, `mu task add` first (`--note 'REPRO: ...'` when
16
+ the title is not enough). Ownership is durable and waitable; agent
17
+ state is not. Review tasks: [adversarial-review](adversarial-review.md).
18
+ 4. Run `mu workspace refresh <w>`, then send a [brief](brief.md) with
19
+ `mu agent send <w> --fresh '...'` (new session + prompt in one step;
20
+ refuses while busy). The brief ends with its final-action block.
21
+ 5. `mu task wait ... --first --on-stall exit --json`.
22
+ 6. Cherry-pick the closed worker's **new** commit(s), verify the MERGE,
23
+ then continue the loop in the same turn. Do not barrier or loop in
24
+ shell.
25
+ Only `CLOSED/done` ships; other closes: read the reason note.
26
+ 7. Repeat from `mu state`.
27
+
28
+ ## Concurrency
29
+
30
+ Write the ceiling on the umbrella before the first wave
31
+ (`CONCURRENCY: delegates 12, workers 4`) so a resumed orchestrator
32
+ keeps it.
33
+
34
+ - **[Delegate calls](tasks-or-calls.md#delegate-call)** (read-only): 10 to 20 at once is reasonable.
35
+ Token spend and provider rate limits bind first; start near 8 and
36
+ raise after a clean wave. `mu_delegate` refuses past
37
+ `MU_DELEGATE_MAX` (default 16).
38
+ - **Workers with workspaces** build and test: about one per CPU core,
39
+ fewer when each runs the full suite. A remote host has its own
40
+ session cap ([remote-workers](remote-workers.md)).
41
+ - **Stream, do not batch.** Keep the pool full: dispatch the next unit
42
+ when one closes, rather than waiting for a whole wave. With the
43
+ `codemode` tool, a [driver](codemode-driver.md) can dispatch a batch
44
+ of workers in one script.
45
+
46
+ ## Waiting
47
+
48
+ Use `--first --on-stall exit`: `--first` populates `.firing`, and
49
+ `--on-stall exit` stops an unattended wait when a worker needs attention.
50
+ Exit 6: the owner's pane died and the reaper reopened the task; exit 7:
51
+ the owner sat in `needs_input`. Read that
52
+ pane (`mu agent read <owner>`) and answer: the worker may be waiting on
53
+ you.
54
+
55
+ For an idle worker, read the pane, then answer, retry, or release its
56
+ task. `MU_IDLE_THRESHOLD_MS` defaults to 5m. A remote owner: poll once
57
+ per turn ([remote-workers](remote-workers.md#step-5-poll-once-per-turn)).
58
+
59
+ ## Merging
60
+
61
+ - **Pipeline; don't barrier.** Wait for one task, cherry-pick only its
62
+ new commits, verify, dispatch the next. An umbrella wait hides progress;
63
+ merging stale branches can restore reverted code.
64
+ - **Verify the merge, not the worker's rerun.** Only the combination
65
+ with moved main is new, and it breaks in ways the worker's own run
66
+ cannot show. Remote hosts: [run the merged gate there](remote-workers.md#run-the-merged-gate-on-the-host).
67
+ - **Push only when the gate command passes.** Make `git push` the last
68
+ line under `set -e`. Check the gate command runs what it claims: an env-gated randomized
69
+ test once passed with zero cases.
70
+ - **Accept evidence, not close notes.** Re-run the key measurement from
71
+ a clean checkout; close notes have claimed unpushed commits. A
72
+ worker's "done" counts only once the diff shows the change.
73
+ - **Ask whether the check could have failed.** A gate that cannot say
74
+ no is not evidence: a test filtered to zero cases, a script you wrote
75
+ agreeing with itself, a fixture you tuned on. A nonzero diff is a
76
+ failure even when the command exited 0.
77
+
78
+ ## Sending
79
+
80
+ - A plain `mu agent send` appends to prior context; use it to steer or
81
+ answer. Unrelated work to pi: `mu agent send worker-1 --fresh 'Claim
82
+ task_x...'`.
83
+ - claude-code/codex: send `/new` (codex: `/clear`), then the prompt; a
84
+ send it cannot confirm prints a `warning:` on stderr. For pi,
85
+ `--fresh` does both in one step.
86
+ - Use `mu agent send`, not raw mux input. Single-quote prompts
87
+ containing shell expansions, or use a quoted heredoc.
88
+ - Cross-workstream wait and claim use qualified refs; only task
89
+ ownership crosses.
90
+
91
+ ## Stopping a worker
92
+
93
+ `mu agent abort <w>` first for pi (exact, local or remote, keeps
94
+ context, waits for idle; exit 5 = still busy; queued follow-ups return
95
+ to the editor unsent). Then `mu agent kick` (pi unresponsive, or
96
+ non-pi; local panes only), then `mu agent close`.
97
+
98
+ Done when every task is closed, or a decision only a human can make blocks all progress (SKILL.md § Orchestrator rules).
@@ -0,0 +1,59 @@
1
+ # Planning a DAG
2
+
3
+ Use when you turn a spec or a clear set of requirements into tasks.
4
+ The DAG is the plan: each task's note carries its full content, and
5
+ `mu state` is the progress tracker. Write a markdown plan only when the
6
+ human asks for a file.
7
+
8
+ ## Steps
9
+
10
+ 1. **Map the files first.** List what gets created or changed and what
11
+ each file is responsible for. Task boundaries fall out of this map.
12
+ 2. **Size the tasks.** A task is the smallest unit that carries its own
13
+ verification and is worth a review. Split only where a reviewer
14
+ could reject one task and accept its neighbour. Fold setup, config,
15
+ and docs into the task whose deliverable needs them.
16
+ 3. **Write the root task.** `task_0` holds the goal, the architecture
17
+ in two or three sentences, and the global constraints copied
18
+ verbatim from the spec. Every other task is blocked by it; close it
19
+ at once. It carries notes, not work.
20
+ 4. **Write each task's note** as a [brief](brief.md): its Shape, plus
21
+ INTERFACES and STEPS:
22
+
23
+ ```text
24
+ GOAL: one sentence
25
+ DONE WHEN: checkable, exhaustive criterion
26
+ FILES: Create/Modify/Test with exact paths (line ranges if known)
27
+ INTERFACES: Consumes: <exact signatures from earlier tasks>
28
+ Produces: <exact names and types later tasks use>
29
+ STEPS: one action each; code steps carry the code
30
+ VERIFY: <exact command and expected result>
31
+ ```
32
+
33
+ The worker sees only its own task. INTERFACES is how it learns the
34
+ names its neighbours use.
35
+ 5. **No placeholders.** "TBD", "add error handling", "similar to
36
+ task 3", "write tests for the above": each is a missing decision the
37
+ worker will make alone. Write the actual content; tasks are read out
38
+ of order.
39
+ 6. **Add edges for dependencies only.** `mu task block A --by B` when A
40
+ consumes what B produces. Plan order is not a dependency: an extra
41
+ edge serialises tracks that could run in parallel. The exception:
42
+ tasks that edit the same files share a track ([waves](waves.md)).
43
+ 7. **Self-review before dispatch.** Walk each spec requirement and name
44
+ the task that implements it. Grep the notes for placeholders. Check
45
+ that names in INTERFACES match across tasks. Then read the graph back
46
+ with `mu task tree task_0 -w <ws> --down`, or `mu state -w <ws>` for the tracks.
47
+
48
+ Done when every spec requirement maps to a task, no note holds a
49
+ placeholder, and `mu state` shows the intended parallel tracks. Then
50
+ dispatch per [orchestrator-loop](orchestrator-loop.md).
51
+
52
+ ## Notes
53
+
54
+ - `impact` comes from what breaks without the task; `effort_days` from
55
+ its step count. Guess honestly rather than defaulting to 50 and 1.
56
+ - Review gates follow [adversarial-review](adversarial-review.md): a
57
+ review task blocked by the work.
58
+ - When reality disagrees with the plan, append a note saying so. Do not
59
+ rewrite earlier notes.
@@ -0,0 +1,28 @@
1
+ # Recovery: undo, rebuild, sync
2
+
3
+ Use before you undo a change, rebuild the DB, tear down a workstream,
4
+ set up sync, or act on `mu doctor` output. Each of these can lose work
5
+ when done in the wrong order.
6
+
7
+ - **`workstream teardown`** is dry-run without `--yes`. It writes
8
+ TOMBSTONE ops, so `mu undo <group> --yes` reverses it; the log is the
9
+ backup. `workstream list --torn-down` lists group ids to undo.
10
+ - **`mu undo`** bare lists groups; `<group>` previews; `<group> --yes`
11
+ emits inverse ops for that group only (redo = undo the undo). Exit 4
12
+ if a later action changed the same fields (`--force` discards it).
13
+ Rows only: killed panes and freed workspace dirs do not come back.
14
+ - **`mu rebuild <file>`** writes a new DB from the ops log, without
15
+ agents or workspaces; re-spawn after the swap. Recovery is
16
+ `mu rebuild`, not `mu db backup`.
17
+ - **Sync:** set `MU_SYNC_DIR` on each machine to a shared folder
18
+ (Syncthing). Every command flushes and ingests ops, merged per field.
19
+ mu never runs ssh or rsync; `mu sync` prints the line.
20
+ `--repair <peer>` is always safe. Agents, workspaces, and task
21
+ ownership never travel.
22
+ - **`mu doctor --deep` DRIFT** (exit 5) is a capture bug: back up and
23
+ report it. Do not rebuild; the live rows may hold work the log missed.
24
+ - The `doctor` `disk` section is report-only: an orphan dir may hold the
25
+ only copy of uncommitted work, so mu prints cleanup commands and runs
26
+ none. Read before you run them.
27
+
28
+ Done when `mu doctor` reports no DRIFT and every cleanup command you ran was read first.
@@ -0,0 +1,51 @@
1
+ # Find, refute, synthesize
2
+
3
+ Use for audits, bug sweeps, and fact-checks: anything that produces
4
+ findings. Finders over-report; a separate agent told to kill each
5
+ finding filters what survives. Where findings live and how triage works
6
+ is [findings](findings.md); this recipe is the search around it. Builds
7
+ on [fan-out](fan-out.md).
8
+
9
+ **Mode:** workstream by default (an audit feeds fixes). For a quick
10
+ fact-check nobody will track, use delegate mode from
11
+ [findings](findings.md) and skip the tasks.
12
+
13
+ ## Steps
14
+
15
+ 1. **Pin the scope** on an umbrella task: what is searched, and what
16
+ counts as a finding.
17
+ 2. **Split the search** into slices (security, data integrity, one
18
+ module each). One finder task per slice. Finders read; they do not
19
+ fix.
20
+ 3. **Finders record findings** as `OPEN/triage` tasks blocking the
21
+ umbrella, one per finding, severity first in the title, file:line and
22
+ evidence in the note ([findings § Record](findings.md#record)). A
23
+ finder with more than 5 writes `FINDING:` lines in its own note
24
+ instead, and [findings § Triage](findings.md#triage) turns them into
25
+ tasks.
26
+ 4. **Refute each finding** with a
27
+ [delegate call](tasks-or-calls.md#delegate-call), not a task. The
28
+ refuter gets the finding and the code, not the finder's reasoning,
29
+ and tries to prove it false: run it, find the guard, read the caller.
30
+ Record its verdict on the finding, and apply the skip and
31
+ three-refuter rules, as in [findings § Triage](findings.md#triage).
32
+ Many findings: issue the calls in batches under the cap ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)); to
33
+ get the verdicts back as one table, see
34
+ [codemode-driver § Delegate calls](codemode-driver.md#delegate-calls).
35
+ 5. **Report** from the graph: accepted findings are the result, ranked
36
+ by impact; `mu task list --substate rejected` is what was refuted.
37
+ A synthesis task is needed only when the human wants prose.
38
+
39
+ Done when no finding is left in triage without an `UNVERIFIED` note,
40
+ and the umbrella closes with `--if-ready` once the accepted findings
41
+ are fixed or handed off.
42
+
43
+ ## Traps
44
+
45
+ - **UNVERIFIED is not REFUTED.** A refuter that hit a rate limit or
46
+ could not run the code disproved nothing. The finding stays in triage
47
+ with an `UNVERIFIED:` note, reported apart.
48
+ - **Cheap finders, strong refuters.** Finders can run on `pi_mini`; the
49
+ refute step is where the judgement is (`pi_big`).
50
+ - **No findings is a result.** A slice that finds nothing closes with
51
+ that in its note; do not re-run it until it finds something.
@@ -1,7 +1,8 @@
1
1
  # Remote workers
2
2
 
3
- mu has no remote backend, ssh code, or host registry. This is a recipe
4
- plus the traps that cost time.
3
+ Use when an agent's process runs on another machine (a devserver, a
4
+ bigger box) while its pane stays local. mu has no remote backend, ssh
5
+ code, or host registry. This is a recipe plus the traps that cost time.
5
6
 
6
7
  **If you read one thing:** on a session-capped host, an open attach pane
7
8
  holds the only ssh channel and silently breaks `git fetch`,
@@ -49,6 +50,10 @@ mu agent send worker-1 -w big --fresh '...'
49
50
  git fetch "ssh://dev/~/ws/worker-1" HEAD && git cherry-pick FETCH_HEAD
50
51
  ```
51
52
 
53
+ Done when the worker's commits are cherry-picked locally, the merged
54
+ tree passes the gate command (on the host, below), and the pane is
55
+ closed.
56
+
52
57
  ### Step 2: the note is load-bearing
53
58
 
54
59
  Keep the exact forms `REMOTE: <host>:<path>` and
@@ -0,0 +1,62 @@
1
+ # Review panel
2
+
3
+ Use to review one diff, branch, or PR from several angles before it
4
+ ships: correctness, security, simplicity, tests, the repo's own rules.
5
+ One reviewer looking at everything finds the obvious; one reviewer per
6
+ angle, each in a fresh context, finds more. Findings are refuted before
7
+ anyone acts on them.
8
+
9
+ This is a sweep over one change. To gate each unit of a larger job,
10
+ use [adversarial-review](adversarial-review.md) instead.
11
+
12
+ **Mode:** delegates by default: reviewing a PR, a doc, or a draft needs
13
+ an answer, not a permanent record. Switch to workstream mode when the
14
+ panel's findings will be fixed by agents. Both modes are in
15
+ [findings](findings.md).
16
+
17
+ ## Steps
18
+
19
+ 1. **Pin the target**: `git diff main...HEAD`, a PR number, or a commit
20
+ range. Put it in every reviewer's brief (delegate mode) or on an
21
+ umbrella task (workstream mode), so every reviewer reads the same
22
+ range.
23
+ 2. **One reviewer per angle**: a delegate in delegate mode, a task in
24
+ workstream mode. Pick the angles that apply:
25
+
26
+ | Angle | Looks for |
27
+ | --- | --- |
28
+ | correctness | logic errors, edge cases, error paths, races |
29
+ | security | injection, auth and permission checks, secrets, unsafe input |
30
+ | simplicity | duplication, dead code, needless abstraction, an existing helper not reused |
31
+ | tests | changed behaviour without a test, tests that cannot fail |
32
+ | rules | the repo's written rules (see [rules-audit](rules-audit.md)) |
33
+
34
+ Each reviewer gets the range, its angle, and the [brief](brief.md)
35
+ rules; it edits nothing. A clean result (`FINDINGS: none` plus the
36
+ commands it ran) is a valid result.
37
+ 3. **Record findings** by mode:
38
+ - delegate: each reviewer ends its answer with `FINDING:` lines;
39
+ - workstream: each finding is an `OPEN/triage` task blocking the
40
+ umbrella ([findings § Record](findings.md#record)).
41
+ 4. **Merge and refute.** Merge duplicates across angles, then refute
42
+ with [delegate calls](tasks-or-calls.md#delegate-call) in both modes,
43
+ following the skip and three-refuter rules in
44
+ [findings § Triage](findings.md#triage).
45
+ 5. **Act:**
46
+ - delegate mode: post the comments or edit the doc from the merged
47
+ list, citing file:line and evidence;
48
+ - workstream mode: accept the confirmed findings, dispatch the
49
+ fixes, each with its own review
50
+ ([adversarial-review](adversarial-review.md)).
51
+
52
+ Done when every finding is acted on (delegate mode) or decided in
53
+ triage and the umbrella closes with `--if-ready` (workstream mode).
54
+
55
+ ## Traps
56
+
57
+ - **Reviewers padding the list.** A panel that always finds ten things
58
+ is guessing.
59
+ - **Use different models across angles** where you can; one model's
60
+ blind spot repeated five times is still one blind spot.
61
+ - **The panel is not the gate command.** Merge verification still runs on the
62
+ merged tree ([orchestrator-loop](orchestrator-loop.md#merging)).