@mu-crew/mu 3.13.3 → 4.1.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-4ULY3ZKO.js +4482 -0
  4. package/dist/chunk-4ULY3ZKO.js.map +1 -0
  5. package/dist/chunk-7M634JMD.js +375 -0
  6. package/dist/chunk-7M634JMD.js.map +1 -0
  7. package/dist/{chunk-3BARPJLY.js → chunk-PZ5GOCWH.js} +16 -2
  8. package/dist/chunk-PZ5GOCWH.js.map +1 -0
  9. package/dist/chunk-SS7NQSSZ.js +3660 -0
  10. package/dist/chunk-SS7NQSSZ.js.map +1 -0
  11. package/dist/chunk-UCZPJX7K.js +14253 -0
  12. package/dist/chunk-UCZPJX7K.js.map +1 -0
  13. package/dist/{cli-CKOMHBXV.js → cli-TV3N47AZ.js} +7317 -4593
  14. package/dist/cli-TV3N47AZ.js.map +1 -0
  15. package/dist/cli.js +2 -3
  16. package/dist/cli.js.map +1 -1
  17. package/dist/errors-GRONKWFS.js +65 -0
  18. package/dist/extension/mu-pi.js +1632 -837
  19. package/dist/extension/mu-pi.js.map +1 -1
  20. package/dist/index.d.ts +4067 -2561
  21. package/dist/index.js +614 -297
  22. package/dist/index.js.map +1 -1
  23. package/dist/tui-FUBQ326D.js +1848 -0
  24. package/dist/tui-FUBQ326D.js.map +1 -0
  25. package/docs/ARCHITECTURE.md +118 -66
  26. package/docs/VOCABULARY.md +113 -49
  27. package/docs/guide/README.md +3 -3
  28. package/docs/guide/backends.md +8 -4
  29. package/docs/guide/cleanup.md +69 -33
  30. package/docs/guide/delegate.md +149 -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 +122 -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 +24 -32
  41. package/docs/reference/naming.md +14 -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 +17 -318
  63. package/skills/mu/recipes/tasks-or-calls.md +15 -78
  64. package/skills/mu/recipes/test-health.md +19 -77
  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-GRONKWFS.js.map} +0 -0
@@ -1,123 +1,29 @@
1
1
  # Findings
2
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.
3
+ Use when an agent reviews, audits or checks something and reports problems.
6
4
 
7
- ## Pick the mode first
5
+ **Mode.** Will agents fix these through the DAG? No (someone's PR, a doc): delegates answer with one `FINDING:` line each and you act; nothing enters your DAG (calls are synced `scratch` tasks). Yes: workstream mode, below.
8
6
 
9
- Ask: **will anyone act on these findings through the DAG?**
7
+ ## Record
10
8
 
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:
9
+ One `OPEN/triage` task per finding, blocking the review's umbrella.
47
10
 
48
11
  ```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>
12
+ mu task add -w <ws> --triage --blocks <umbrella> -t "high: PUT /user skips auth" -i 70 -e 0.5 \
13
+ --note 'FINDING: high src/api/user.ts:88 PUT skips the auth check EVIDENCE: curl -X PUT returned 200'
53
14
  ```
54
15
 
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
- **Severity** drives the three-refuter rule, so grade it strictly:
61
- `critical` needs a concrete scenario to data loss, a security breach or
62
- an outage; `high` a plausible bug; style is `low` unless it hides a bug.
63
- When unsure, pick the lower. A vague finding from one reviewer (no line,
64
- no scenario) drops a level at consolidation. Reviewers who differ by 2+
65
- levels go to the human.
66
-
67
- **More than 5 findings from one reviewer:** the reviewer writes them as
68
- `FINDING:` lines in its own task note instead. Before that reviewer
69
- task closes, the orchestrator adds `triage_<umbrella>` blocking the
70
- umbrella; the triage agent ([Triage](#triage) step 1) merges duplicates
71
- across reviewers and creates one task per real problem.
72
-
73
- ### Triage
74
-
75
- 1. **Who:** a handful of findings, the orchestrator triages itself. Many,
76
- or several reviewers on one change: a `triage_<umbrella>` task, run
77
- by a fresh agent, so the orchestrator reads only its result.
78
- 2. **Refute** each finding before accepting it with a
79
- [delegate call](tasks-or-calls.md#delegate-call) that passes
80
- `record: { task: "<ws>/<id>" }`: a fresh agent tries to prove it
81
- false, and its VERDICT block lands on the finding as a
82
- `REFUTER <label> (<delegate>, <elapsed>):` note (VERDICT line, 3-6
83
- EVIDENCE lines), or `REFUTER <label>: no verdict (<outcome>)` when
84
- it times out or dies. Without `mu_delegate`, write that note yourself
85
- before deciding
86
- ([tasks-or-calls § Delegate call](tasks-or-calls.md#delegate-call)).
87
- Skip this for low-severity style findings. High severity: three
88
- refuters, accept only if at least two say CONFIRMED.
89
- 3. **Decide** each one; the decision is the task's state. The reason
90
- names the deciding evidence, not a tally or a judgement. mu warns
91
- when a reason is under 40 chars and no note holds a `VERDICT:` line
92
- or `REFUTER` note. Prose reasons go through a heredoc variable
93
- ([brief § Quoting](brief.md#quoting)).
94
-
95
- | Decision | Command | Bad reason |
96
- | --- | --- | --- |
97
- | real work | `mu task accept <id> --evidence "2/3 CONFIRMED: refuters 1 and 3 show the checklist:3 vs :33 cycle"` | `valid`, `orchestrator: valid`, `2/3 CONFIRMED` |
98
- | false | `mu task close <id> --as rejected --why "<the guard or command that disproves it>"` | `refuter REFUTED` |
99
- | same as another | `mu task close <id> --as duplicate --why "same as <id>"` | |
100
- | valid, not worth it | `mu task close <id> --as wontfix --why "<cost vs impact>"` | `not worth it` |
101
- | could not check | stays in triage, with an `UNVERIFIED: <why>` note | |
102
-
103
- 4. **Group** accepted findings that touch the same files into one fix
104
- task when separate workers would collide. Block the umbrella on the
105
- fix task (`mu task block <umbrella> --by <fix-task>`), then close the
106
- grouped findings `--as superseded --why "fixed in <fix-task>"`:
107
- superseding unblocks the umbrella.
108
-
109
- Done when `mu task list --substate triage -w <ws>` lists only findings
110
- with an `UNVERIFIED` note, and each of those is reported to the human.
16
+ Grade strictly: `critical` needs a concrete path to data loss, breach or outage; `high` a plausible bug; style is `low`. When unsure, lower.
111
17
 
112
- ### Fix and close
18
+ ## Triage
113
19
 
114
- Accepted findings are ordinary tasks: dispatch them, review the fix
115
- ([adversarial-review](adversarial-review.md)), merge. The umbrella
116
- closes with `mu task close <umbrella> --if-ready` once every finding is
117
- `CLOSED/*`. A plain `close` would succeed with findings still open; an
118
- `UNVERIFIED` finding blocks `--if-ready`, so the umbrella stays open
119
- until the human decides it.
20
+ 1. **Refute each** with a [delegate call](tasks-or-calls.md) passing `record`. Skip low style findings. High: three refuters, accept at 2 CONFIRMED.
21
+ 2. **Decide**; the state is the decision, and `--why` names the deciding evidence:
22
+ - real: `mu task accept <id> --evidence "2/3 CONFIRMED: <why>"`
23
+ - false: `mu task close <id> --as rejected --why "<the guard that disproves it>"`
24
+ - same as another: `--as duplicate --why "same as <id>"`
25
+ - true, not worth it: `--as wontfix --why "<cost vs impact>"`
26
+ - unchecked: stays in triage with `UNVERIFIED: <why>`; report it to the human. It is not REFUTED.
27
+ 3. **Group** accepted findings sharing files into one fix task, block the umbrella on it, close the grouped ones `--as superseded`.
120
28
 
121
- The report is a query, not a document: `mu task list -w <ws>
122
- --substate rejected`, `--substate duplicate`, `--status OPEN`, and the
123
- notes on each task.
29
+ `mu task close <umbrella> --if-ready` does nothing until every finding is closed.
@@ -1,102 +1,27 @@
1
- # Model tiers
1
+ # Models
2
2
 
3
- Read when you pick a model for a spawn or a delegate call. mu passes the
4
- model through and never picks one; the choice is yours. Recipes name a
5
- tier (cheap, mid, strong, frontier) and say which one their roles need;
6
- this file says how to tell a model's tier.
3
+ Use when you pick a model. mu passes it through.
7
4
 
8
- ## Tiers
5
+ Rank a model within its own family; the id prefix in `pi --list-models` names the family, the provider column often does not.
9
6
 
10
- Rank a model within its own family. The model-id prefix in
11
- `pi --list-models` (`anthropic/`, `openai/`, `google/`) names the family
12
- when it names a lab; the provider column is often one shared gateway, so
13
- it does not tell families apart.
14
-
15
- | Tier | Where it sits in its family | Names as of 2026-10 |
7
+ | Tier | Position | Examples (2026-10) |
16
8
  | --- | --- | --- |
17
- | **frontier** | an exceptional tier above the lab's normal flagship, priced well above it, often gated | fable, astra |
18
- | **strong** | the lab's normal flagship | opus, sol |
19
- | **mid** | the everyday default | sonnet, terra |
20
- | **cheap** | the lab's small, fast hosted model | haiku, luna, flash, mini, nano, lite |
21
- | **local** | runs on this machine (ollama, lmstudio, llama.cpp) | qwen, gemma, gpt-oss |
22
-
23
- Names go stale within months; the position in the family does not. Rank
24
- a model you cannot place by the lab's own description of its lineup
25
- (flagship, balanced, fast). `pi --list-models` shows context and max
26
- output, not price or quality, and siblings often share both. Still
27
- unsure: run it on a small slice of the real work and compare it with a
28
- model you can place. Until then, pick conservatively: a model you know
29
- is strong enough for the work, and for a checker never one that might
30
- sit below the author.
31
-
32
- Thinking effort strengthens a model within its tier. It does not change
33
- the tier, and it does not stand in for another family.
34
-
35
- ## Local models are a last resort
36
-
37
- A hosted cheap model beats a small local one at agent work: tool calls,
38
- long briefs, multi-step edits. Small local models lose the thread of a
39
- brief and fake tool results; in `pi --list-models` they tend to show
40
- thinking `no` and small context and output limits. Use one only when no
41
- hosted model is available, or the work must stay on the machine, and
42
- then only for cheap-tier work whose output something stronger checks. A
43
- local model never reviews, refutes or judges.
44
-
45
- ## Roles
9
+ | frontier | above the flagship | fable |
10
+ | strong | the flagship | opus |
11
+ | mid | everyday default | sonnet |
12
+ | cheap | small, fast, hosted | haiku, flash |
13
+ | local | on this machine | qwen |
46
14
 
47
15
  | Work | Tier |
48
16
  | --- | --- |
49
- | fan-out scouting (listing units), searchers collecting quoted claims, watchers, first-pass finders | cheap |
50
- | building, refactoring, tests, routine fixes | mid |
51
- | review, refute, judge, audit, synthesize | the tier of whoever wrote the thing being checked, or higher; another family when one exists |
52
- | design, plans, incidents, root cause, final synthesis of a large run | strong |
53
- | a strong attempt failed, or the final judge of a close call | frontier; none available: the strongest model, from a family not yet used on the job |
54
-
55
- Cheap work suits bounded tasks whose output can be checked: a searcher's
56
- claim carries a quote a checker verifies. A cheap finder's misses stay
57
- missed, since refuters only test what was reported. When an omission is
58
- costly (a security audit, a coverage sweep), run the finders mid or
59
- strong, or add a second finder from another family.
60
-
61
- ## Checkers
62
-
63
- A checker (reviewer, refuter, judge, auditor) must not share the
64
- author's blind spots. The author is whoever wrote the thing being
65
- checked: the worker for a diff, the planner for a brief, the finder for
66
- a finding.
67
-
68
- - **Level or up.** At least the author's tier; never down.
69
- - **Another family when one exists**, at that tier. One model's blind
70
- spot repeated is still one blind spot.
71
- - **No peer in another family**: the same model, fresh context, higher
72
- thinking unless at max.
73
-
74
- A delegate with no `model` runs the cli's configured default, which is
75
- your own model only if you are on that default. When the tier or family
76
- matters, pass `model`.
77
-
78
- ## How to pass a model and effort level
79
-
80
- pi takes both in one `--model` value: `<provider/id>:<level>`, where the
81
- thinking (effort) level is one of `off`, `minimal`, `low`, `medium`,
82
- `high`, `xhigh`, `max`. Leave `:<level>` off to keep the model's default. With `:<level>`, pi
83
- reads the first segment as the provider, so copy `<provider>/<model>`
84
- exactly from `pi --list-models`. Through a gateway that is
85
- `modelbridge/anthropic/claude-sonnet-5-5:high`; `anthropic/…:high` fails
86
- with "No API key".
17
+ | scouts, watchers, first-pass finders | cheap |
18
+ | building, routine fixes | mid |
19
+ | design, plans, root cause, synthesis | strong |
20
+ | review, refute, judge, audit | the author's or higher |
21
+ | a strong attempt failed; a close final call | frontier, else the strongest unused family |
87
22
 
88
- - `mu_delegate`: `model: "<provider>/<model>:high"`.
89
- - Spawn: `mu agent spawn r -w <ws> --command "pi --model <provider>/<model>:high"`.
90
- - A `cli` key (`--cli pi_big`) works only if `$MU_<KEY>_COMMAND` is set
91
- in the environment; check before you rely on one.
92
- - herdr refuses a command override, so neither model nor level can be
93
- set per agent there: every helper runs the cli's default. The only
94
- independence left is fresh context; say so in the verdict.
23
+ A cheap finder's misses stay missed: use mid or strong where omission is costly. Effort is no other family. A local model never checks.
95
24
 
96
- Probe a model you have not used this session
97
- (`pi --model <id> -p "say ok"`); `ctl: ok` after spawn does not test the
98
- model.
25
+ **Checkers** must not share the author's blind spots: the author's tier or higher, another family when one exists; else the same model, fresh context, higher effort.
99
26
 
100
- Done when the chosen `model` is placed in a tier, a checker is at the
101
- author's tier or higher and from another family (or the verdict says why
102
- not), and a model new this session answered `pi --model <id> -p "say ok"`.
27
+ **Passing it.** `mu_delegate`: `model: "<provider>/<id>:<effort>"`. Spawn: `--command "pi --model <provider>/<id>:<effort>"`. Effort: `off|minimal|low|medium|high|xhigh|max`. Copy `<provider>/<id>` from `pi --list-models`. No `model`: the cli default. herdr refuses a command override.
@@ -0,0 +1,14 @@
1
+ # Move a 3.x workstream
2
+
3
+ Use when the human asks to move ONE 3.x workstream into 4.0, from the machine holding it. Open tasks move; the rest stays in the 3.x DB. `mu` is 4.0; `<mu3>` is 3.x, e.g. `npx -y @mu-crew/mu@3.13.3`.
4
+
5
+ 1. **Read the old DB**: `sqlite3 -readonly -json <old.db> "<query>"`, never `MU_DB_PATH`. 4.0 runs on its own state dir and `MU_SYNC_DIR` (or blank).
6
+ 2. **IN_PROGRESS first**: finish, or `<mu3> task release <id> -w <ws>` (park refuses it).
7
+ 3. **Select** the open tasks (local_id, title, impact, effort_days, substate), each one's first and last note (brief; park reason or status), and the `task_edges` with both ends open (`from_task_id` blocks `to_task_id`). A last note that is the brief or `CLAIM: dispatch` is no status: write one.
8
+ 4. **Write a script** (python argv lists: briefs hold quotes) that runs, per task, dependents first (`--blocks` needs the umbrella):
9
+
10
+ `mu task add <id> -t <title> -i <impact> -e <effort> --blocks <its dependents> --note - -w <ws>`
11
+
12
+ with the brief on stdin, then `mu task note <id> -w <ws> -` with `moved from 3.x <ws>/<id>; last note: <it, capped 2 KB>`; for a parked task, pass that text to `mu task park <id> -w <ws> --why` instead. Keep the ids.
13
+ 5. **Verify**: open-task and edge counts (`mu db query ... --all`) match; `mu task tree <a root> -w <ws>` matches. Mismatch: fix, never mark.
14
+ 6. **Mark the old one**: `MU_DB_PATH=<old.db> <mu3> task park <id> -w <ws> --why "moved to 4.0"` per moved task.
@@ -1,135 +1,36 @@
1
1
  # Orchestrator loop
2
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.
3
+ For dispatch and merge.
6
4
 
7
- ## Every turn
5
+ ## Each turn
8
6
 
9
- 1. `mu state -w <ws>` — read agents, IN_PROGRESS, ready tasks.
10
- 2. Spawn one agent per ready task, up to the ceiling below. Tasks that
11
- edit the same files are chained with `block`, so only one is ready
12
- ([waves](waves.md)).
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 accepted worker's **new** commit(s) into a merge batch
23
- (below), then continue the loop in the same turn. Do not barrier or
24
- loop in shell.
25
- Only `CLOSED/done` ships; other closes: read the reason note.
26
- 7. Repeat from `mu state`.
7
+ 1. `mu state -w <ws> --json`.
8
+ 2. Note the ceiling on the umbrella (`CONCURRENCY: workers 4`); one worker per ready task.
9
+ 3. Dispatch with a [brief](brief.md) on stdin. New worker:
27
10
 
28
- ## Concurrency
11
+ ```bash
12
+ mu agent spawn worker-1 -w <ws> --worktree --task <id> --send - <<'EOF'
13
+ <brief>
14
+ EOF
15
+ ```
29
16
 
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` runs at most
37
- `MU_DELEGATE_MAX` (default 16) and queues up to four times that
38
- (`queued-N`, started as slots free); past that it refuses.
39
- - **Answers arrive when you stop**, as pi follow-up messages, never
40
- mid-turn. pi's `followUpMode: "all"` delivers every waiting answer in
41
- one turn instead of one turn each; each answer names its delegate and
42
- ends with its `VERDICT: <id>` block, so a batch still maps back. Read
43
- every verdict in the batch before deciding any.
44
- - **Workers with workspaces** build and test: about one per CPU core,
45
- fewer when targeted slow checks contend for resources. A remote host has
46
- its own session cap ([remote-workers](remote-workers.md)).
47
- - **Stream dispatch.** Keep the pool full: dispatch the next unit
48
- when one closes, rather than waiting for a whole wave. With the
49
- `codemode` tool, a [driver](codemode-driver.md) can dispatch a batch
50
- of workers in one script.
51
-
52
- ## Waiting
53
-
54
- Use `--first --on-stall exit`: `--first` populates `.firing`, and
55
- `--on-stall exit` stops an unattended wait when a worker needs attention.
56
- Exit 6: the owner's pane died and the reaper reopened the task; exit 7:
57
- the owner sat in `needs_input`. Run the exit's `Next:` and answer: the
58
- worker may be waiting on you. For a pi owner it leads with
59
- `mu agent wait <owner> --after-runs <runs-1> --json`, which returns the
60
- last answer at once. The pane read follows because dialogs and crashes
61
- show only in the pane.
62
-
63
- Never release or reassign a task because its owner reads `unknown`:
64
- that is degraded reading, not absence. Read the pane or run `mu doctor`
65
- first. The reaper acts only on a dead pane.
66
-
67
- For an idle worker, read its last answer (the same `--after-runs`
68
- wait for pi, else the pane), then answer, retry, or release its task.
69
- `MU_IDLE_THRESHOLD_MS` defaults to 5m. A remote owner: for pi,
70
- `mu agent wait --after-runs` first, then poll once; otherwise poll once
71
- per turn ([remote-workers](remote-workers.md#step-5-poll-once-per-turn)).
17
+ Idle worker: `mu task claim <id> -w <ws> --for <w> --evidence "..."`; `git -C <cwd> fetch && git -C <cwd> rebase <base>` (conflict: `rebase --abort`, tell the human); `mu agent send <w> -w <ws> --fresh -`.
18
+ 4. `mu wait -w <ws>` waits on what you started (workers, tasks, calls). `data.exit` 0: an event in `data.firing`, or `timedOut` (run `data.resume`); 6: worker died before closing, re-dispatch it; 7: `mu agent read <w>`, answer.
19
+ 5. Merge. Close a finished worker: `mu agent close <w> -w <ws>` only previews; run its printed `--if <rev>`. Then step 1. If `mu state` says a course check is due, finish merging, then follow [course-correct](course-correct.md) first.
72
20
 
73
21
  ## Merging
74
22
 
75
- - **Pipeline; don't barrier.** Cherry-pick accepted new commits as tasks
76
- close and dispatch the next unit. Choose a bounded merge batch; an umbrella
77
- wait hides progress and stale branches can restore reverted code.
78
- - **Pin the batch tree.** Run full slow once, plus fast if slow excludes it,
79
- under [the gate contract](test-health.md#gate-contract). Keep the tested
80
- checkout unchanged during the run; independent workers continue in their
81
- workspaces. Later merges form the next batch, not an extension of this pass.
82
- Remote hosts: [run the merged gate there](remote-workers.md#run-the-merged-gate-on-the-host).
83
- - **Bisect a failed batch.** Isolate the offending commit/interaction, fix it,
84
- and gate the corrected merged tree before shipping.
85
- - **Push only the verified tree.** Make `git push` the last line under
86
- `set -e`; required integration and safety checks must actually run.
87
- Record the gate result and slow duration with the merged tree in the merge
88
- note/`mu log`. Queue [upkeep](test-health.md#upkeep-loop) on a budget crossing
89
- or milestone, rather than stopping all independent work.
90
- - **Accept evidence, not close notes.** Re-run the key measurement from
91
- a clean checkout; close notes have claimed unpushed commits. A
92
- worker's "done" counts only once the diff shows the change. Your own
93
- accept and close notes name the check run and the commit.
94
- - **Ask whether the check could have failed.** A gate that cannot say
95
- no is not evidence: a test filtered to zero cases, a script you wrote
96
- agreeing with itself, a fixture you tuned on. A nonzero diff is a
97
- failure even when the command exited 0.
98
-
99
- ## Build cache
100
-
101
- Keep build targets private per workspace and auth/profile lane. Share dependency
102
- downloads and use an existing compiler cache when available; measure cold/warm
103
- cost and contention. Keep normal-auth, test-auth and release artifacts distinct,
104
- with explicit executable paths for consumers. A shared writable Cargo target
105
- can replace a binary after its build lock is released, while tests still use it.
106
- Warm-up may copy a quiescent snapshot into private storage, never hardlinks or
107
- a live target. This is build guidance, not a new mu cache or dependency.
23
+ - Cherry-pick new commits as workers close; gate one pinned batch ([test-health](test-health.md)); push the verified tree.
24
+ - Accept evidence, not close notes: rerun the check.
108
25
 
109
26
  ## Sending
110
27
 
111
- A running worker sees what you send, never a new task note: deliver
112
- an instruction for it with a send (or the next `--fresh` brief), and
113
- keep the note as the durable copy. pi:
114
-
115
- | `mu agent send` | busy pi acts | Use for |
116
- | --- | --- | --- |
117
- | plain | after the run ends | answers, same-task additions |
118
- | `--steer` | after the current tool call | advice that can wait for the tool boundary |
119
- | `--interrupt` | now: kills the running tool | a correction that wastes the current work (stale input, wrong target, changed stop rule) |
120
- | `--fresh` | refused (`--force` drops the run) | unrelated work: new session + prompt |
28
+ `--steer`: after the tool. `--interrupt`: now, kills the tool. `--fresh`: unrelated work.
121
29
 
122
- - claude-code/codex: send `/new` (codex: `/clear`), then the prompt; a
123
- send it cannot confirm prints a `warning:` on stderr.
124
- - Use `mu agent send`, not raw mux input. Quote prompts per
125
- [brief](brief.md#quoting).
126
- - Cross-workstream wait and claim use qualified refs; only task
127
- ownership crosses.
128
- - A long run drifts unseen: audit it per [drift-audit](drift-audit.md).
30
+ ## Delegate waves
129
31
 
130
- ## Stopping a worker
32
+ One `wave` label per fan-out ([tasks-or-calls](tasks-or-calls.md)); `mu wait -w <ws> --wave <label>` returns its tally. An answer read via `task notes` still arrives once from `mu wait`; act once.
131
33
 
132
- `mu agent abort <w>` first for pi, then `mu agent kick` (pi
133
- unresponsive, or non-pi), then `mu agent close`.
34
+ ## Stopping
134
35
 
135
- Done when every task is closed, or a decision only a human can make blocks all progress (SKILL.md § Orchestrator rules).
36
+ `mu agent abort <w>`; close as step 5.
@@ -1,32 +1,11 @@
1
- # Recovery: undo, rebuild, sync
1
+ # Recovery
2
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.
3
+ Use before you tear down a workstream, rebuild the DB, set up sync, or act on `mu doctor` output. Each can lose work in the wrong order.
6
4
 
7
- - **`workstream teardown`** is reversible: `workstream list --torn-down`
8
- lists the group ids to `mu undo`; the log is the backup.
9
- - **`mu undo`** restores rows only: killed panes and freed workspace
10
- dirs do not come back. Redo = undo the undo.
11
- - **`mu rebuild <file>`** writes a new DB from the ops log, without
12
- agents or workspaces; re-spawn after the swap. Recovery is
13
- `mu rebuild`, not `mu db backup`.
14
- - **Sync:** set `MU_SYNC_DIR` on each machine to a shared folder
15
- (Syncthing). Every command flushes and ingests ops, merged per field.
16
- mu never runs ssh or rsync; `mu sync` prints the line.
17
- `--repair <peer>` is always safe. Agents, workspaces, and task
18
- ownership never travel.
19
- - **`mu db forget <ws...>`** deletes torn-down workstreams' ops for
20
- good (no undo); `mu db compact` only blanks redundant tombstones. Both
21
- back up beside the DB first. Forget only what the human named.
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.
5
+ - **Teardown** is soft: `mu workstream teardown <ws>` previews with `rev=<n>`; apply with `--if <n>`. Rows stay hidden, worktrees stay (`mu agent close` removes them). Reusing a name later permanently deletes the old rows, after its own preview.
6
+ - **`mu rebuild <file>`** writes a new DB from the ops log, without agents or worktrees; swap it in with the printed command, then re-spawn. Recovery is `rebuild`, not `mu db backup`.
7
+ - **Sync:** set `MU_SYNC_DIR` on each machine to a shared folder; every verb ingests and flushes. mu runs no ssh or rsync. `mu sync --repair <peer>` is safe. Agents, worktrees and ownership never travel.
8
+ - **`mu db forget <ws...>`** deletes torn-down workstreams' ops for good. Forget only what the human named; it backs up first.
9
+ - **`mu doctor --deep` DRIFT** is a capture bug: back up and report it. Do not rebuild; live rows may hold work the log missed.
10
+ - **Doctor's `disk` section** prints cleanup commands and runs none. An orphan dir may hold the only copy of uncommitted work; read each command before you run it.
27
11
 
28
- Done when, per operation: undo or teardown was previewed, then applied
29
- with `--yes`; rebuild was swapped in and agents re-spawned; `mu sync`
30
- lists the peer; forget touched only the named workstreams. Any
31
- `doctor --deep` DRIFT is backed up and reported to the human, and you
32
- read every cleanup command before you ran it.