@mu-crew/mu 3.4.0 → 3.6.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.
package/docs/VISION.md CHANGED
@@ -226,7 +226,9 @@ mu agent spawn reviewer-1 --cli pi_big
226
226
  calls. mu bets that visibility and steering are worth the cost. There
227
227
  are no agent types: the brief is plain text. A delegate's answer is
228
228
  not recorded in mu; only what the caller writes back (a note, a state
229
- change) is.
229
+ change) is. The one extension-held list with no pane is the delegate
230
+ queue: bounded, shown in pi's footer, cancellable, and named at
231
+ shutdown when it is dropped.
230
232
  - **DB-undoable, not substrate-undoable.** `mu undo <group> --yes`
231
233
  restores rows. It does not revive killed panes or freed workspace
232
234
  directories. Reconciliation then reports ghosts and orphans.
@@ -96,13 +96,32 @@ prefix previews, and `--yes` applies.
96
96
  - `restore` records and applies under the **same** HLC. `applyOp`
97
97
  excludes an op's own HLC from provenance. A fresher HLC would make
98
98
  the row outrank the op and lose every field to an insert default.
99
- - **Note tombstones are self-describing.** Every other `del` carries
100
- `'{}'`, because its key plus earlier puts describe the row. A note's
101
- key embeds its rowid (`<ws>/<task>#<id>`), and a rebuild or
102
- reprojection reassigns rowids. The `task_notes` delete trigger
103
- therefore records `OLD.*`, and `planUndo` falls back to the
104
- tombstone payload when folding the puts finds nothing. For the same
105
- reason `src/drift.ts` matches notes on the task-key prefix.
99
+ - **Note tombstones are self-describing only when they must be.** Every
100
+ other `del` carries `'{}'`, because its key plus earlier puts describe
101
+ the row. A note's key embeds its rowid (`<ws>/<task>#<id>`), and a
102
+ rebuild or reprojection reassigns rowids, so the puts can sit under an
103
+ old key (drift-641). The `task_notes` delete trigger records `OLD.*`
104
+ only when no put under the current key is in the log, and `'{}'`
105
+ otherwise; `planUndo` folds the puts first and falls back to the
106
+ tombstone payload. For the same reason `src/drift.ts` matches notes on
107
+ the task-key prefix.
108
+
109
+ ## Rewriting history (local only)
110
+
111
+ The log is append-only except for two operator verbs in `src/compact.ts`,
112
+ both dry-run by default, both backing up beside the DB and running the
113
+ drift check after:
114
+
115
+ - **`mu db compact`** blanks note tombstones a put under the same key
116
+ already explains: the slim form capture writes now, applied to older
117
+ rows. Undo and sync unaffected.
118
+ - **`mu db forget <workstream...>`** deletes every op of named
119
+ torn-down workstreams (keys `<ws>` and `<ws>/...`). Their rows are
120
+ already gone from the tables, so rebuild and drift stay consistent;
121
+ `mu undo` of those teardowns is gone on purpose.
122
+
123
+ Neither touches sync segments. A peer is not affected: watermarks only
124
+ read forward, so a peer never re-sends forgotten history.
106
125
 
107
126
  ## Rebuild
108
127
 
@@ -44,6 +44,25 @@ The list shows one row per teardown, newest first. `← recreated since`
44
44
  means the name is in use again, so the undo would change nothing.
45
45
  Killed panes and freed workspace directories do not come back.
46
46
 
47
+ ## Keep mu.db small
48
+
49
+ Teardown keeps history so `mu undo` works, and that history is most of
50
+ `mu.db`. `mu doctor` names the largest torn-down workstreams once they
51
+ are worth reclaiming.
52
+
53
+ ```bash
54
+ mu db compact # dry run: redundant note tombstones
55
+ mu db compact --yes
56
+ mu db forget hail-smoke reltest # dry run: per workstream, ops and size
57
+ mu db forget hail-smoke reltest --yes
58
+ ```
59
+
60
+ `compact` changes nothing you can see. `forget` deletes those
61
+ workstreams' history for good: `mu undo` can no longer restore them.
62
+ Both write a backup next to the DB first (`mu.db.pre-forget-<time>`),
63
+ which is the only way back, and run the drift check after. Only this
64
+ machine's DB shrinks; sync segments are untouched.
65
+
47
66
  ## Find workstreams you can remove
48
67
 
49
68
  The `housekeeping` section of `mu doctor` lists two kinds:
@@ -30,8 +30,18 @@ Delegates called in one turn run in parallel.
30
30
  as evidence.
31
31
  - pi's footer shows how many delegates this session is waiting on.
32
32
  - Each delegate costs a pane and a pi process. A session runs at most
33
- `MU_DELEGATE_MAX` at once (default 16); past that, the tool refuses
34
- and the rest wait for answers.
33
+ `MU_DELEGATE_MAX` at once (default 16). Further calls are queued, up
34
+ to four times the cap: the footer reads `16 delegates running, 4 queued`,
35
+ each starts when a slot frees, and `mu_delegate_cancel queued-N`
36
+ drops one. A queued call has no pane yet, so quitting pi or `/reload`
37
+ drops it; pi warns which ones never started.
38
+ - A delegate that stops on an API error (overloaded, connection, auth)
39
+ keeps its pane. The answer names the error and leaves the choice to
40
+ the model: re-issue, or record the check as unverified. The footer
41
+ counts it as `1 failed` until the pane is closed.
42
+ - Answers arrive as follow-up messages when pi would otherwise stop,
43
+ never mid-turn. To get several at once, set pi's `followUpMode` to
44
+ `"all"`.
35
45
 
36
46
  `MU_DELEGATE=0` hides the tool ([env vars](../reference/env.md)).
37
47
 
@@ -52,7 +62,9 @@ task's context.
52
62
  `needs_input`), never on an already idle agent. For pi, the `--json`
53
63
  row carries:
54
64
 
55
- - `outcome`: `done`, `empty`, `died`, `timeout`, or `pending`.
65
+ - `outcome`: `done`, `empty`, `error`, `died`, `timeout`, or `pending`.
66
+ `error` means the run stopped on an API error after pi's own retries;
67
+ `lastError` holds the message and the pane is kept.
56
68
  - `lastText`: the final message, capped at 64 KiB.
57
69
 
58
70
  Exit codes: `0` met, `5` timeout, `6` pane died. Non-pi agents have no
@@ -114,7 +114,8 @@ mu task wait auth/build auth/docs --first --on-stall exit --json
114
114
  commits. If the worker closed without committing, it says so.
115
115
  - Exit codes: `0` met, `5` timeout, `6` the owner's pane died,
116
116
  `7` the owner sat in `needs_input` for `--stuck-after` seconds
117
- (default 300).
117
+ (default 120). Exit 7 is the default; `--on-stall warn` keeps
118
+ polling instead.
118
119
 
119
120
  Exit 7 has several causes: the worker finished but did not close, it
120
121
  asked a question, or it hit a prompt. In each case, run
@@ -126,10 +126,15 @@ The exit code tells you what happened:
126
126
  | `0` | the task closed | merge the work |
127
127
  | `5` | `--timeout` expired (default 600 s) | wait again |
128
128
  | `6` | the worker's pane died and the task went back to `OPEN` | spawn and claim again |
129
- | `7` | the worker sat in `needs_input` for 5 minutes | `mu agent read worker-1 -w auth`, then answer it |
129
+ | `7` | the worker sat in `needs_input` for 2 minutes | `mu agent read worker-1 -w auth`, then answer it |
130
130
 
131
- Without `--on-stall exit`, a stalled worker only prints a warning and
132
- the wait keeps running.
131
+ `--on-stall exit` is the default; it is spelled out above so older mu
132
+ versions behave the same. With `--on-stall warn`, a stalled worker only
133
+ prints a warning and the wait keeps running.
134
+
135
+ A pi worker that ends its turn while it still owns an `IN_PROGRESS`
136
+ task gets one reminder to close it or say why not, so exit 7 mostly
137
+ means it is blocked or asking something.
133
138
 
134
139
  ## Merge the commit
135
140
 
@@ -67,8 +67,8 @@ pi agent's `--command`. mu never reads them back.
67
67
  | Name | Effect | Default |
68
68
  | --- | --- | --- |
69
69
  | `MU_DELEGATE` | `0` hides the `mu_delegate` tool. `mu doctor` reports it. | unset: shown |
70
- | `MU_DELEGATE_MAX` | Most delegates one pi session runs at once; `mu_delegate` refuses past it. A positive integer. | `16` |
71
- | `MU_NUDGE` | `0` turns off the keep-driving nudge: one reminder when an orchestrator ends a turn with dispatched work still IN_PROGRESS. `mu doctor` reports it. | unset: on |
70
+ | `MU_DELEGATE_MAX` | Most delegates one pi session runs at once. Further calls queue, up to four times this; past that `mu_delegate` refuses. A positive integer. | `16` |
71
+ | `MU_NUDGE` | `0` turns off both nudges: the keep-driving nudge (one reminder when an orchestrator ends a turn with dispatched work still IN_PROGRESS) and the close nudge (one reminder when a mu-spawned pi worker ends a turn still owning an IN_PROGRESS task). `mu doctor` reports it. | unset: on |
72
72
  | `MU_PI_HOME` | Root under which `mu link pi` writes `.pi/` and `.agents/`. | `$HOME` |
73
73
  | `PI_CODING_AGENT_DIR` | Read only. pi's agent dir, checked for a linked murmur extension. | `~/.pi/agent` |
74
74
  | `MU_EXTENSION_ENTRY` | Test only. Built extension the `mu link pi` shim imports. | `dist/extension/mu-pi.js` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mu-crew/mu",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "A persistent, observable crew of pi agents running in one tmux or herdr session per workstream, coordinated through a built-in task DAG.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -173,8 +173,8 @@ rules hold even when you skip it:
173
173
  - **Checks are calls, not tasks.** Refuters, claim checkers, judges and
174
174
  skeptics are [delegate calls](recipes/tasks-or-calls.md#delegate-call)
175
175
  (`mu_delegate`, or a `scratch` spawn without it), all issued in one
176
- turn; their verdict lands on the task they judged. Start near 8 at
177
- once; `mu_delegate` refuses past `MU_DELEGATE_MAX` (default 16).
176
+ turn; their verdict lands on the task they judged. `mu_delegate` runs
177
+ `MU_DELEGATE_MAX` (default 16) at once and queues the rest.
178
178
  - **Findings are tasks.** A reviewer's or auditor's findings become
179
179
  `mu task add --triage` tasks blocking the review, decided with
180
180
  `mu task accept` or `close --as rejected|duplicate`. A review nobody
@@ -33,8 +33,14 @@ keeps it.
33
33
 
34
34
  - **[Delegate calls](tasks-or-calls.md#delegate-call)** (read-only): 10 to 20 at once is reasonable.
35
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).
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>` line, so a batch still maps back. Record
43
+ every verdict in the batch before acting on any.
38
44
  - **Workers with workspaces** build and test: about one per CPU core,
39
45
  fewer when each runs the full suite. A remote host has its own
40
46
  session cap ([remote-workers](remote-workers.md)).
@@ -19,6 +19,9 @@ when done in the wrong order.
19
19
  mu never runs ssh or rsync; `mu sync` prints the line.
20
20
  `--repair <peer>` is always safe. Agents, workspaces, and task
21
21
  ownership never travel.
22
+ - **`mu db forget <ws...>`** deletes torn-down workstreams' ops for
23
+ good (no undo); `mu db compact` only blanks redundant tombstones. Both
24
+ back up beside the DB first. Forget only what the human named.
22
25
  - **`mu doctor --deep` DRIFT** (exit 5) is a capture bug: back up and
23
26
  report it. Do not rebuild; the live rows may hold work the log missed.
24
27
  - The `doctor` `disk` section is report-only: an orphan dir may hold the
@@ -24,9 +24,12 @@ mu agent wait refuter-1 -w scratch --json # answer in lastText
24
24
  then the next runs them in series.
25
25
  - **It leaves no task.** Its `scratch` pane stays attachable while it
26
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.
27
+ crash, timeout, or API error (`keep: true` always keeps it); the bash
28
+ form needs `mu agent close <name> -w scratch`. You record its verdict
29
+ on the task it judged.
30
+ - **An API error is yours to decide.** Re-issue the call, or record the
31
+ check as `UNVERIFIED` on its task, then close the kept pane
32
+ (`mu_delegate_cancel`, or `mu agent close`).
30
33
 
31
34
  ## The rule
32
35
 
@@ -60,8 +63,9 @@ Before a wave, count what it will add: units + gates + expected
60
63
  findings. If the count is more than a few hundred for one change, the
61
64
  steps that only check things are probably tasks by mistake.
62
65
 
63
- Run calls within the delegate cap (`MU_DELEGATE_MAX`, default 16; see
64
- [orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency)).
66
+ `mu_delegate` runs 16 at once (`MU_DELEGATE_MAX`) and queues the rest
67
+ up to four times the cap; see
68
+ [orchestrator-loop § Concurrency](orchestrator-loop.md#concurrency).
65
69
 
66
70
  Done when every agent a recipe step spawns is either a task in the DAG
67
71
  or a delegate call whose verdict is recorded on a task.