@mu-crew/mu 3.3.0 → 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 (43) hide show
  1. package/README.md +45 -31
  2. package/dist/cli.js +186 -20
  3. package/dist/cli.js.map +1 -1
  4. package/dist/extension/mu-pi.js +103 -74
  5. package/dist/extension/mu-pi.js.map +1 -1
  6. package/dist/index.d.ts +33 -4
  7. package/dist/index.js +70 -4
  8. package/dist/index.js.map +1 -1
  9. package/docs/VISION.md +3 -1
  10. package/docs/VOCABULARY.md +4 -1
  11. package/docs/architecture/dag.md +3 -3
  12. package/docs/guide/delegate.md +30 -3
  13. package/docs/reference/env.md +1 -0
  14. package/docs/reference/naming.md +18 -0
  15. package/docs/specs/2026-09-29-task-substates.md +1 -1
  16. package/package.json +1 -1
  17. package/prompts/mu-debug.md +8 -0
  18. package/prompts/mu-sweep.md +8 -0
  19. package/prompts/mu-until.md +8 -0
  20. package/prompts/ultrathink.md +2 -1
  21. package/skills/mu/SKILL.md +70 -31
  22. package/skills/mu/recipes/adversarial-review.md +27 -19
  23. package/skills/mu/recipes/{triage.md → backlog-triage.md} +9 -4
  24. package/skills/mu/recipes/codemode-driver.md +68 -20
  25. package/skills/mu/recipes/deep-research.md +23 -8
  26. package/skills/mu/recipes/fan-out.md +15 -11
  27. package/skills/mu/recipes/findings.md +103 -0
  28. package/skills/mu/recipes/hypothesis-panel.md +18 -13
  29. package/skills/mu/recipes/long-run.md +4 -4
  30. package/skills/mu/recipes/loop-until-done.md +7 -3
  31. package/skills/mu/recipes/orchestrator-loop.md +38 -27
  32. package/skills/mu/recipes/plan.md +8 -3
  33. package/skills/mu/recipes/recovery.md +2 -0
  34. package/skills/mu/recipes/refute.md +38 -36
  35. package/skills/mu/recipes/remote-workers.md +7 -2
  36. package/skills/mu/recipes/review-panel.md +36 -31
  37. package/skills/mu/recipes/rules-audit.md +30 -17
  38. package/skills/mu/recipes/tasks-or-calls.md +67 -0
  39. package/skills/mu/recipes/tournament.md +13 -10
  40. package/skills/mu/recipes/ultrathink.md +20 -11
  41. package/skills/mu/recipes/watcher.md +4 -1
  42. package/skills/mu/recipes/waves.md +6 -5
  43. package/skills/mu/recipes/worker.md +3 -1
@@ -9,12 +9,19 @@ anyone acts on them.
9
9
  This is a sweep over one change. To gate each unit of a larger job,
10
10
  use [adversarial-review](adversarial-review.md) instead.
11
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
+
12
17
  ## Steps
13
18
 
14
- 1. **Pin the target.** Record the exact range on an umbrella task:
15
- `git diff main...HEAD`, a PR number, or a commit range. Every
16
- reviewer reads the same range.
17
- 2. **One reviewer task per angle.** Pick the angles that apply:
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:
18
25
 
19
26
  | Angle | Looks for |
20
27
  | --- | --- |
@@ -22,36 +29,34 @@ use [adversarial-review](adversarial-review.md) instead.
22
29
  | security | injection, auth and permission checks, secrets, unsafe input |
23
30
  | simplicity | duplication, dead code, needless abstraction, an existing helper not reused |
24
31
  | tests | changed behaviour without a test, tests that cannot fail |
25
- | rules | the repo's `AGENTS.md` / contributing rules, one line per rule checked |
26
-
27
- Each reviewer gets the range, its angle, and the
28
- [brief](brief.md) rules; it edits nothing. Findings go in its note:
29
-
30
- ```text
31
- FINDING: s2 src/api/user.ts:88 high security: id from the URL reaches the query unescaped
32
- ```
33
-
34
- A reviewer that finds nothing closes with `FINDINGS: none` and the
35
- commands it ran.
36
- 3. **Dedupe** the findings across angles in one task.
37
- 4. **Refute each finding** with a fresh agent, as in
38
- [refute](refute.md) step 4. Low-severity style findings can skip this
39
- and go straight to the report.
40
- 5. **Act on confirmed findings:**
41
- - fix mode: one `fix_` task per finding or file cluster, each with
42
- its own review ([adversarial-review](adversarial-review.md));
43
- - report mode: a synthesis task writes one ranked list with
44
- file:line, the evidence, and a suggested fix.
45
-
46
- Done when every finding id has a verdict, and either every confirmed
47
- finding has a closed fix with an `ACCEPT` review, or the report lists
48
- them all.
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).
49
54
 
50
55
  ## Traps
51
56
 
52
- - **Reviewers padding the list.** Tell them a clean result is a valid
53
- result. A panel that always finds ten things is guessing.
57
+ - **Reviewers padding the list.** A panel that always finds ten things
58
+ is guessing.
54
59
  - **Use different models across angles** where you can; one model's
55
60
  blind spot repeated five times is still one blind spot.
56
- - **The panel is not the gate.** Merge verification still runs on the
61
+ - **The panel is not the gate command.** Merge verification still runs on the
57
62
  merged tree ([orchestrator-loop](orchestrator-loop.md#merging)).
@@ -8,10 +8,16 @@ against twenty rules skips some; one checker per rule does not.
8
8
  Two modes. **Check** asks "does this change follow our rules?".
9
9
  **Mine** asks "which rules are we missing?".
10
10
 
11
+ Check on someone's PR runs as delegates; check before merging your own
12
+ work, and mine always, run in a workstream. Violations and candidate
13
+ rules are findings: [findings](findings.md) says where they live.
14
+
11
15
  ## Check: a change against the rules
12
16
 
13
- 1. **List the rules.** A scout extracts every checkable rule from the
14
- rule files into the umbrella's note, one per line with its source:
17
+ 1. **List the rules.** A scout (a delegate call) extracts every
18
+ checkable rule from the rule files, one per line with its source,
19
+ into every checker's brief (delegate mode) or the umbrella's note
20
+ (workstream mode):
15
21
 
16
22
  ```text
17
23
  RULE: r7 AGENTS.md:52 "Throw typed error classes, not bare Error"
@@ -21,18 +27,21 @@ Two modes. **Check** asks "does this change follow our rules?".
21
27
  count.
22
28
  2. **Pin the target**: the diff, branch, or PR, as in
23
29
  [review-panel](review-panel.md) step 1.
24
- 3. **One checker task per rule.** The checker gets one rule and the
25
- diff, and reports each violation with file:line and the rule id, or
26
- `r7: no violations` with what it looked at. One rule per checker
27
- keeps it from skimming.
28
- 4. **A skeptic pass** over the flags: one fresh agent reads each flagged
30
+ 3. **One checker per rule**, as a [delegate call](tasks-or-calls.md#delegate-call)
31
+ The checker gets one rule and the diff, and records each violation
32
+ as a finding ([findings § Record](findings.md#record); title
33
+ `<severity>: r7 <what>`), or reports `r7: no violations` with what it
34
+ looked at. One rule per checker keeps it from skimming; batch under
35
+ the cap ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
36
+ 4. **A skeptic pass** over the flags, also a delegate call: one fresh agent reads each flagged
29
37
  line and the rule, and drops false positives (the rule does not
30
38
  apply here, the code already complies, the rule has a stated
31
- exception). Ending: `VERDICT: <flag> CONFIRMED | DROPPED <reason>`.
39
+ exception). In workstream mode, a dropped flag is
40
+ `close --as rejected --why '<reason>'`; a confirmed one is accepted.
32
41
  5. **Report or fix** confirmed violations, as in review-panel step 5.
33
42
 
34
43
  Done when every rule from step 1 has a checker result, and every flag
35
- has a skeptic verdict.
44
+ is decided.
36
45
 
37
46
  ## Mine: rules you keep stating but never wrote
38
47
 
@@ -41,23 +50,27 @@ has a skeptic verdict.
41
50
  tasks, and past agent sessions (with a session archive such as
42
51
  [museum](https://github.com/mu-crew/museum), search for user turns
43
52
  that correct the agent: "no, use", "don't", "we always"). One reader
44
- task per source batch writes each correction as one line:
53
+ (a delegate call) per source batch returns each correction as one
54
+ line:
45
55
 
46
56
  ```text
47
57
  CORRECTION: k12 <source ref> "use the shared retry helper instead of a hand-rolled loop"
48
58
  ```
49
59
 
50
- 2. **Cluster** the corrections in one task: the same lesson in
60
+ 2. **Cluster** the corrections in one delegate call: the same lesson in
51
61
  different words is one cluster. Keep clusters with at least two
52
62
  corrections from different occasions; a one-off is not a rule.
53
- 3. **Refute each candidate rule** with a fresh agent: would it have
63
+ 3. **One `OPEN/triage` task per candidate rule**, the rule as the
64
+ title and its cluster of corrections in the note.
65
+ 4. **Refute each candidate** with a [delegate call](tasks-or-calls.md#delegate-call): would it have
54
66
  prevented the real mistakes in its cluster? Does it contradict an
55
67
  existing rule? Is it already enforced by a linter or test (then it
56
- needs no prose)? Ending: `VERDICT: <rule> KEEP | DROP <reason>`.
57
- 4. **Propose, don't commit.** Write the surviving rules as a diff to
58
- the rule file, worded per [brief](brief.md) (positive, specific,
59
- with the reason), each citing its cluster. A rule file change is a
60
- human decision: park the umbrella with the diff in its note.
68
+ needs no prose)? Dropped candidates close `--as rejected`.
69
+ 5. **Propose, don't commit.** The candidates left in triage are the
70
+ proposal: write them as a diff to the rule file in the umbrella's
71
+ note, worded per [brief](brief.md) (positive, specific, with the
72
+ reason). A rule change is a human decision: the human accepts or
73
+ rejects each candidate task.
61
74
 
62
75
  Done when every cluster has a verdict and the proposal lists each kept
63
76
  rule with the corrections behind it.
@@ -0,0 +1,67 @@
1
+ # Tasks or calls
2
+
3
+ Use when a recipe step spawns an agent: decide whether that agent's job
4
+ is a **task** in the DAG or a **call** to a delegate. Getting it wrong
5
+ one way loses track of work; the other way, one PR review creates
6
+ hundreds of tasks and a workstream nobody wanted.
7
+
8
+ ## Delegate call
9
+
10
+ A **delegate call** is one `mu_delegate` tool call in pi. Without the
11
+ tool (another harness, a script):
12
+
13
+ ```bash
14
+ mu agent spawn refuter-1 -w scratch
15
+ mu agent send refuter-1 -w scratch --fresh '<brief>'
16
+ mu agent wait refuter-1 -w scratch --json # answer in lastText
17
+ ```
18
+
19
+ - **It starts empty.** The brief carries everything: the finding or
20
+ claim, file paths, the criteria, and the answer line to end with
21
+ (`VERDICT: ...`, `WINNER: ...`). See [brief](brief.md).
22
+ - **Fan out in one turn.** Issue every call for a step together; in pi
23
+ the answers arrive later as follow-up messages. Calling one, waiting,
24
+ then the next runs them in series.
25
+ - **It leaves no task.** Its `scratch` pane stays attachable while it
26
+ runs. `mu_delegate` closes it after a clean finish and keeps it on a
27
+ crash or timeout (`keep: true` always keeps it); the bash form needs
28
+ `mu agent close <name> -w scratch`. You record its verdict on the task
29
+ it judged.
30
+
31
+ ## The rule
32
+
33
+ **A task is a thing the graph tracks. Checking a thing is a call.**
34
+
35
+ | Make it a task | Make it a delegate call |
36
+ | --- | --- |
37
+ | a unit of work that produces commits | refuting a finding |
38
+ | a gate that decides whether work counts (`review_x`) | checking a claim against its source |
39
+ | a finding, claim, or hypothesis that survives into the workstream | judging a pair in a tournament |
40
+ | the umbrella, and each round of a loop | a skeptic or dedupe pass |
41
+ | anything that needs its own workspace | a reader or scout whose output feeds one step |
42
+
43
+ A call writes nothing to mu. Its answer lands on the task it judged:
44
+ the orchestrator records the verdict as a note and a state change
45
+ (`mu task accept`, `close --as rejected --why '<evidence>'`). The graph
46
+ keeps the decision and its evidence without a node per check.
47
+
48
+ ## Examples
49
+
50
+ - A refuter checks 30 findings: 30 delegate calls, 0 new tasks; each
51
+ finding task gets the refuter's evidence and is accepted or closed.
52
+ - A tournament over 16 names: 15 judge delegate calls; the winner goes
53
+ in the umbrella's note.
54
+ - A hypothesis test that reverts commits or forces a race needs a
55
+ workspace: that one is a task.
56
+
57
+ ## Counting
58
+
59
+ Before a wave, count what it will add: units + gates + expected
60
+ findings. If the count is more than a few hundred for one change, the
61
+ steps that only check things are probably tasks by mistake.
62
+
63
+ Run calls within the delegate cap (`MU_DELEGATE_MAX`, default 16; see
64
+ [orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
65
+
66
+ Done when every agent a recipe step spawns is either a task in the DAG
67
+ or a delegate call whose verdict is recorded on a task.
@@ -9,17 +9,20 @@ reliable than scoring one.
9
9
 
10
10
  1. **Write the rubric first**, on the umbrella: what good looks like,
11
11
  in a few ranked criteria. Judges apply it; they do not invent one.
12
- 2. **Generate.** N attempt tasks with the same brief and a different
13
- approach or model each. Code attempts run in separate workspaces.
14
- For ideas (names, plans), one task can generate many candidates as
15
- note lines.
16
- 3. **Filter** (when there are many candidates): one task drops the ones
17
- that fail a hard rubric criterion and merges duplicates. What is left
12
+ 2. **Generate.** N attempts with the same brief and a different
13
+ approach or model each. Code attempts are tasks, each in its own
14
+ workspace. Ideas (names, plans) are delegate calls; one call can
15
+ generate many candidates.
16
+ 3. **Filter** (when there are many candidates): one delegate call drops
17
+ the ones that fail a hard rubric criterion and merges duplicates. What is left
18
18
  enters the bracket.
19
- 4. **Judge in pairs.** One task per comparison, a fresh agent each, so no
20
- judge holds the whole field. The judge sees the two candidates and
21
- the rubric and ends with `WINNER: <a|b> <reason>`. Winners meet in the
22
- next round; add those tasks as the round closes.
19
+ 4. **Judge in pairs.** One [delegate call](tasks-or-calls.md#delegate-call) per comparison, a fresh agent
20
+ each, so no judge holds the whole field
21
+ ([tasks-or-calls](tasks-or-calls.md)). The judge sees the two
22
+ candidates and the rubric and ends with `WINNER: <a|b> <reason>`.
23
+ Record each round's results in the umbrella's note; winners meet in
24
+ the next round. A round wider than the cap runs in batches
25
+ ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
23
26
  5. **Confirm the winner** with a final check against the rubric, then
24
27
  merge it. Free the losing workspaces.
25
28
 
@@ -3,22 +3,24 @@
3
3
  Use when a task is too large or too risky for one context: a migration
4
4
  across many files, a repo-wide audit, a hard bug, a design with real
5
5
  alternatives, any long autonomous run where you will not read every
6
- line. Ultrathink composes the other recipes. Every unit of work, every
7
- check on it, and every round is a task in the DAG, so the run is as
8
- visible as the code it produces.
6
+ line. Ultrathink composes the other recipes. Every unit, gate, finding
7
+ and round is a task in the DAG, so the run is as visible as the code it
8
+ produces; the checks on them are delegate calls whose verdicts land on
9
+ those tasks.
9
10
 
10
11
  It costs many agents and many tokens. For a change one agent can hold
11
12
  and check, skip it.
12
13
 
13
14
  ## Steps
14
15
 
15
- 1. **Fix done.** Write the goal and the stop rule on an umbrella task:
16
+ 1. **Define done.** Write the goal and the stop rule on an umbrella task:
16
17
  the command that must pass, the report that must exist, the criteria
17
18
  a reviewer will apply. Ask the human now for anything only they can
18
19
  decide (scope, budget, external actions); after this step, keep
19
20
  driving.
20
21
  2. **Understand before you change.** If the shape of the work is not
21
- known, run a scout or a [fan-out](fan-out.md) of readers first. Their
22
+ known, run a scout ([delegate call](tasks-or-calls.md#delegate-call))
23
+ or a [fan-out](fan-out.md) of readers first. Their
22
24
  output is the unit list and the facts the plan needs, in notes.
23
25
  3. **Pick the shape** for the main phase:
24
26
 
@@ -29,7 +31,7 @@ and check, skip it.
29
31
  | a cause to find | [hypothesis-panel](hypothesis-panel.md) |
30
32
  | a choice between real alternatives | [tournament](tournament.md) |
31
33
  | an unknown amount, until a check passes | [loop-until-done](loop-until-done.md) |
32
- | a backlog of external items | [triage](triage.md) |
34
+ | a backlog of external items | [backlog-triage](backlog-triage.md) |
33
35
  | a question across many sources | [deep-research](deep-research.md) |
34
36
  | one change to review from every angle | [review-panel](review-panel.md) |
35
37
  | a change against the repo's written rules | [rules-audit](rules-audit.md) |
@@ -42,8 +44,8 @@ and check, skip it.
42
44
  of a loop are the one exception: add each when the last closes.
43
45
  5. **Review every unit that ships.** Each commit-producing task gets a
44
46
  review task ([adversarial-review](adversarial-review.md)), on a
45
- different model where you can. Findings and claims get refuters
46
- instead.
47
+ different model where you can. Every finding is a triage task,
48
+ refuted before it is accepted ([findings](findings.md)).
47
49
  6. **Run the loop** ([orchestrator-loop](orchestrator-loop.md)): pipeline
48
50
  merges, verify each merge, keep workers busy
49
51
  ([waves](waves.md) when they share files). Long runs follow
@@ -54,12 +56,19 @@ and check, skip it.
54
56
  `mu task close <umbrella> --if-ready --evidence '...'`.
55
57
 
56
58
  Done when the umbrella is closed, its stop rule holds on the merged
57
- tree, and every shipped unit has a review task that closed `ACCEPT`.
59
+ tree, every shipped unit's latest review task is `CLOSED/done`
60
+ (ACCEPT), and
61
+ `mu task list --substate triage` is empty or only `UNVERIFIED`.
58
62
 
59
63
  ## Budget
60
64
 
61
- - Agree a ceiling in step 1: concurrent agents and total agents. Write
62
- it on the umbrella.
65
+ - Agree a ceiling in step 1 and write it on the umbrella
66
+ ([orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
67
+ - Checks are calls, not tasks ([tasks-or-calls](tasks-or-calls.md)): a
68
+ 50-unit run should add about 50 units, 50 gates and the findings that
69
+ survive, not a task per refuter and judge.
70
+ - The run gets its own workstream, `<project>-ut-<topic>`, torn down
71
+ when the umbrella closes ([recovery](recovery.md) before teardown).
63
72
  - Cheap models scout and find (`pi_mini`); the default builds (`pi`);
64
73
  strong models review, refute, judge, and synthesize (`pi_big`).
65
74
  - Calibrate on a slice: run the phase on a few units, check the result
@@ -13,4 +13,7 @@ acts on change. Run it in `scratch`, or in the workstream it serves.
13
13
  returns when an agent goes busy → idle.
14
14
 
15
15
  The ledger survives a dead or fresh helper: a replacement reads the
16
- last line and carries on.
16
+ last line and carries on. To act on new items (issues, alerts), see
17
+ [backlog-triage](backlog-triage.md).
18
+
19
+ Done when the watched thing reaches its end state (PR merged, CI green) and the last ledger line says so.
@@ -10,10 +10,11 @@ runs in its own `--workspace`; this recipe decides what each one gets.
10
10
  the shared files. A blanket freeze idled four of five workers for a
11
11
  day.
12
12
  3. **Pipeline the merge.** Cherry-pick each task as it closes and
13
- verify the merged tree; never wait for the whole wave.
14
- 4. **Refresh between waves.** `mu workspace refresh <agent>` rebases
15
- onto main and keeps the agent's context. Dispatch the next wave only
16
- from refreshed workspaces.
13
+ verify the merged tree ([orchestrator-loop § Merging](orchestrator-loop.md#merging));
14
+ never wait for the whole wave.
15
+ 4. **Refresh before each dispatch.** `mu workspace refresh <agent>`
16
+ rebases onto main and keeps the agent's context; run it before every
17
+ `--fresh` send, so each unit starts from the latest merge.
17
18
 
18
19
  Done when every task in the wave is `CLOSED/done`, merged, and the
19
- merged tree passes the gate.
20
+ merged tree passes the gate command.
@@ -18,7 +18,9 @@ mu task close <id> --evidence "tests pass: ..." # LAST action
18
18
  ```
19
19
 
20
20
  The note follows the task note contract in SKILL.md. Commit before you
21
- close: the orchestrator cherry-picks your commits, not your tree.
21
+ close: the orchestrator cherry-picks your commits, not your tree. A
22
+ review or audit task records each problem per
23
+ [findings § Record](findings.md#record).
22
24
 
23
25
  Done when the task is closed. Skipping close makes the orchestrator's
24
26
  wait hang. Won't do it: `close --as wontfix --why "..."`.