@mu-crew/mu 3.2.0 → 3.3.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 (71) hide show
  1. package/AGENTS.md +208 -599
  2. package/README.md +125 -329
  3. package/dist/cli.js +108 -78
  4. package/dist/cli.js.map +1 -1
  5. package/dist/extension/mu-pi.js +421 -56
  6. package/dist/extension/mu-pi.js.map +1 -1
  7. package/dist/index.d.ts +36 -10
  8. package/dist/index.js +89 -67
  9. package/dist/index.js.map +1 -1
  10. package/docs/ARCHITECTURE.md +176 -1072
  11. package/docs/ROADMAP.md +88 -169
  12. package/docs/VISION.md +205 -415
  13. package/docs/VOCABULARY.md +204 -466
  14. package/docs/architecture/control-socket.md +133 -0
  15. package/docs/architecture/dag.md +113 -0
  16. package/docs/architecture/mux.md +162 -0
  17. package/docs/architecture/ops-log.md +140 -0
  18. package/docs/architecture/sdk.md +185 -0
  19. package/docs/architecture/sync.md +129 -0
  20. package/docs/architecture/tui.md +146 -0
  21. package/docs/guide/README.md +30 -0
  22. package/docs/guide/backends.md +61 -0
  23. package/docs/guide/cleanup.md +74 -0
  24. package/docs/guide/delegate.md +87 -0
  25. package/docs/guide/dispatch.md +144 -0
  26. package/docs/guide/getting-started.md +180 -0
  27. package/docs/guide/recovery.md +135 -0
  28. package/docs/guide/remote.md +74 -0
  29. package/docs/guide/sql.md +76 -0
  30. package/docs/guide/stop-a-worker.md +64 -0
  31. package/docs/guide/sync.md +78 -0
  32. package/docs/guide/tui.md +98 -0
  33. package/docs/guide/upgrade.md +76 -0
  34. package/docs/history/CHANGELOG-pre-3.md +4866 -0
  35. package/docs/reference/env.md +87 -0
  36. package/docs/reference/naming.md +82 -0
  37. package/docs/specs/2026-09-28-agent-state-from-murmur.md +1 -1
  38. package/docs/specs/2026-09-29-task-substates.md +1 -1
  39. package/docs/specs/2026-10-03-keep-driving-nudge.md +142 -0
  40. package/package.json +2 -1
  41. package/prompts/mu-refute.md +8 -0
  42. package/prompts/mu-research.md +8 -0
  43. package/prompts/mu-review.md +8 -0
  44. package/prompts/mu-rules-audit.md +8 -0
  45. package/prompts/mu-tournament.md +9 -0
  46. package/prompts/ultrathink.md +9 -0
  47. package/skills/mu/SKILL.md +126 -255
  48. package/skills/mu/recipes/adversarial-review.md +83 -0
  49. package/skills/mu/recipes/brief.md +53 -0
  50. package/skills/mu/recipes/codemode-driver.md +54 -0
  51. package/skills/mu/recipes/deep-research.md +52 -0
  52. package/skills/mu/recipes/fan-out.md +36 -0
  53. package/skills/mu/recipes/hypothesis-panel.md +40 -0
  54. package/skills/mu/recipes/long-run.md +20 -0
  55. package/skills/mu/recipes/loop-until-done.md +38 -0
  56. package/skills/mu/recipes/orchestrator-loop.md +87 -0
  57. package/skills/mu/recipes/plan.md +54 -0
  58. package/skills/mu/recipes/recovery.md +26 -0
  59. package/skills/mu/recipes/refute.md +49 -0
  60. package/skills/mu/recipes/remote-workers.md +292 -0
  61. package/skills/mu/recipes/review-panel.md +57 -0
  62. package/skills/mu/recipes/rules-audit.md +70 -0
  63. package/skills/mu/recipes/tournament.md +37 -0
  64. package/skills/mu/recipes/triage.md +38 -0
  65. package/skills/mu/recipes/ultrathink.md +73 -0
  66. package/skills/mu/recipes/watcher.md +16 -0
  67. package/skills/mu/recipes/waves.md +19 -0
  68. package/skills/mu/recipes/worker.md +24 -0
  69. package/docs/HANDOVER.md +0 -486
  70. package/docs/USAGE_GUIDE.md +0 -2738
  71. package/skills/mu/REMOTE_WORKERS.md +0 -617
package/docs/ROADMAP.md CHANGED
@@ -1,192 +1,111 @@
1
1
  # Roadmap
2
2
 
3
- The single forward-looking doc. If a feature isn't here, it isn't
4
- planned.
5
-
6
- Canonical terms: [VOCABULARY.md](VOCABULARY.md). Pillars:
7
- [VISION.md](VISION.md). Module layout:
8
- [ARCHITECTURE.md](ARCHITECTURE.md). Shipped history:
9
- [CHANGELOG.md](../CHANGELOG.md).
10
-
11
- ---
3
+ If a feature is not here, it is not planned. Shipped work is in
4
+ [CHANGELOG.md](../CHANGELOG.md). Pillars are in [VISION.md](VISION.md).
12
5
 
13
6
  ## Promotion criteria
14
7
 
15
- A roadmap item earns implementation when **all three** are true:
8
+ A roadmap item is built when all three hold:
16
9
 
17
- 1. **Proven friction.** A real user hits the missing feature in a
18
- real workflow at least twice. Imagined polish doesn't count.
19
- 2. **No pillar refactor.** Fits the current substrate without
20
- bending any pillar in [VISION.md](VISION.md).
21
- 3. **Bounded scope.** Fits in <300 LOC or has a clear smaller
22
- subset that does.
10
+ 1. **Proven friction.** A real user hit the gap in a real workflow at
11
+ least twice.
12
+ 2. **No pillar refactor.** It fits without bending a
13
+ [VISION](VISION.md) pillar.
14
+ 3. **Bounded scope.** It fits in <300 LOC, or a smaller subset does.
23
15
 
24
- **Exceptions.** Data-loss footguns (silent destruction of user
25
- artifacts) ship on the *first* occurrence. Polish — bug fixes,
26
- ergonomic tweaks, error-message wording, doc tightening — doesn't
27
- need promotion at all; just ship clean (typecheck + lint + tests +
28
- build).
29
-
30
- ---
16
+ Data-loss footguns ship on the first occurrence. Polish (bug fixes,
17
+ ergonomics, error wording, docs) needs no promotion: ship it through the
18
+ green gate.
31
19
 
32
20
  ## Anti-feature pledges
33
21
 
34
- We will NOT, until each one earns its way back via the criteria
35
- above:
36
-
37
- - **Config file.** All config is CLI flags or env vars.
38
- - **Daemon / watcher / background process** beyond what tmux and
39
- SQLite give us.
40
- - **Anticipatory abstractions** with zero current consumer (the
41
- cautionary tale: a `RunContext` trait with no implementor).
42
- - **Wrappers around wrappers** (cautionary tale:
43
- `TextStream`/`TextState`/`StreamResult`).
44
- - **Codegen, embedded JS engine, macros, decorators** beyond
45
- TypeScript itself. No workflow DSL.
46
- - **Template/definition system for agent roles.** Spawn flags +
47
- the orchestrator's first message ARE the definition.
48
- - **Render layers beyond `cli-table3` + `picocolors`**, except
49
- `ink` confined to `src/cli/tui/`. No second TUI stack alongside
50
- `ink` — if `ink` ever stops paying off, *replace* it; don't
51
- stack stacks.
52
- - **Bundle pi.** It's a peer dep.
53
- - **Plugin runtime, web UI, RPC, chat/docs integrations, memory
54
- system, workflow engine.** Rejected as a class — these are
55
- exactly the accumulations a prior internal multi-agent runtime
56
- collected, and not inheriting them is the point.
57
-
58
- ---
22
+ mu does not add these unless one earns its way back under the criteria:
23
+
24
+ - **A config file.** Config is CLI flags and env vars.
25
+ - **A daemon, watcher, or background process** beyond tmux and SQLite.
26
+ - **Abstractions with no current consumer** (the cautionary tale: a
27
+ `RunContext` trait with no implementor).
28
+ - **Wrappers around wrappers** (`TextStream`/`TextState`/`StreamResult`).
29
+ - **Codegen, an embedded JS engine, macros, or decorators.** No workflow
30
+ DSL.
31
+ - **Templates or definitions for agent roles.** Spawn flags and the first
32
+ message are the definition.
33
+ - **Render layers beyond `cli-table3` + `picocolors`**, except `ink` in
34
+ `src/cli/tui/`. If `ink` stops paying off, replace it. Never run two
35
+ TUI stacks.
36
+ - **Bundling pi.** It is a peer dependency.
37
+ - **A plugin runtime, web UI, RPC, chat or docs integrations, a memory
38
+ system, or a workflow engine.** A prior internal runtime collected all
39
+ of these. Not inheriting them is the point.
59
40
 
60
41
  ## Rejected sync substrates
61
42
 
62
- Recorded so we don't relitigate them. mu syncs through an ops log in
63
- SQLite plus append-only JSONL **segments**; every alternative below
64
- was considered and rejected for the reason given.
43
+ mu syncs through the SQLite ops log plus append-only JSONL segments.
44
+ These alternatives were rejected:
65
45
 
66
46
  | Substrate | Why not |
67
47
  | --------- | ------- |
68
- | **Litestream** | Daemon; single-writer; one-way to object storage; `restore` is a whole-file clobber. Solves disaster recovery, not laptop↔devserver. No answer for "I added 3 tasks on the devserver while the laptop was offline." |
69
- | **LiteFS** | FUSE. On macOS that means macFUSE — a kernel extension needing SIP gymnastics on Apple Silicon. Dead on arrival for a mixed-OS fleet. |
70
- | **rqlite / dqlite / Marmot** | Raft or NATS clusters. A consensus cluster to sync a task graph between two machines that are usually not both awake. Requires daemons (anti-feature pledge). |
71
- | **cr-sqlite** | Merges rows by primary key, and every mu entity table is `INTEGER PRIMARY KEY AUTOINCREMENT` — laptop's task `id=5` and devserver's *different* task `id=5` merge into one row, column-by-column. Silent data loss. Fixing it means UUID PKs, i.e. tearing out the surrogate-PK substrate. Also: upstream still says WIP, DDL doesn't sync, and it's a native extension needing a darwin/linux × arm/x64 × glibc/musl build matrix. |
72
- | **RocksDB / LMDB for the op log** | No triggers, so capture becomes a convention every future call site must remember — and a forgotten op is now silent corruption of undo *and* sync. Single-process-exclusive, so it forces a daemon. mu's read side is ~96 prepared statements, ~70 JOINs, 3 views and recursive CTEs — all hand-rolled. Loses `mu sql`. |
73
- | **SQLite file per peer (instead of JSONL)** | A torn transfer makes the *whole* file unopenable, versus losing one JSONL line. `-wal`/`-shm` sidecars in a synced folder are the canonical way to corrupt a DB. Page churn defeats rsync/Syncthing delta transfer, where append-only files are the best case. |
74
- | **`MU_SYNC_PEERS` membership list** | A config file with extra steps, and it would have to be kept consistent across every machine — the drift problem it appears to solve. Peers are discovered from segment filenames instead. |
75
- | **`mu sync --push/--pull <host>` <!-- doc-cli-drift:skip -->** | Would make mu shell out to ssh/scp — its first network egress — dragging in ssh config, jump hosts, ProxyCommand, ports, identity files, interactive prompts, and network-vs-auth error mapping. A remote backend wearing a small hat. mu prints a copy-pasteable rsync line instead. |
76
-
77
- The chosen design's net dependency change is **zero**: still just
78
- `better-sqlite3`.
79
-
80
- ---
81
-
82
- ## Possible — small additions with an obvious shape
83
-
84
- These have a clear design but haven't yet hit promotion criterion
85
- 1 (friction in ≥2 real workflows). They earn implementation when
86
- real use surfaces them.
87
-
88
- ### A third mux backend (zellij, wezterm, kitty)
48
+ | **Litestream** | Daemon, single writer, one-way to object storage, and `restore` overwrites the whole file. It does disaster recovery, not laptop↔devserver merges. |
49
+ | **LiteFS** | FUSE, which on macOS means a macFUSE kernel extension. |
50
+ | **rqlite / dqlite / Marmot** | A consensus cluster and daemons to sync two machines that are rarely both awake. |
51
+ | **cr-sqlite** | Merges rows by primary key. mu's `INTEGER PRIMARY KEY AUTOINCREMENT` ids collide across machines and merge silently. Also WIP upstream, no DDL sync, and a native build matrix. |
52
+ | **RocksDB / LMDB for the op log** | No triggers, so a forgotten capture silently corrupts undo and sync. Single-process access forces a daemon. Loses SQL views, JOINs, and `mu sql`. |
53
+ | **SQLite file per peer** | A torn transfer makes the whole file unreadable instead of one JSONL line. `-wal`/`-shm` sidecars in a synced folder corrupt DBs. Page churn defeats delta transfer. |
54
+ | **`MU_SYNC_PEERS` list** | A config file that must match on every machine. Peers come from segment filenames instead. |
55
+ | **`mu sync --push/--pull <host>` <!-- doc-cli-drift:skip -->** | mu's first ssh egress, with ssh config, auth, and error mapping. mu prints an rsync line instead. |
89
56
 
90
- **Not promoted.** tmux and herdr are two real implementations, which
91
- is what justifies `MuxBackend` existing at all — the interface was
92
- extracted to serve a concrete second case, not in anticipation of an
93
- nth. A third backend needs its own friction evidence under the
94
- [promotion criteria](#promotion-criteria) like anything else. "The
95
- abstraction already exists" is not evidence.
57
+ The chosen design adds no dependency beyond `better-sqlite3`.
96
58
 
97
- ### Subscription-based wakeups
59
+ ## Possible: small additions with an obvious shape
98
60
 
99
- `mu log --tail` polls SQLite once per second. SQLite update hooks
100
- (via better-sqlite3) or `fs.watch` on the WAL would drop latency
101
- at the cost of more machinery. Promote when someone hits the
102
- cliff.
61
+ These have a design but no proven friction yet.
103
62
 
104
- ---
63
+ - **A third mux backend** (zellij, wezterm, kitty). tmux and herdr are
64
+ the two implementations that justify `MuxBackend`. A third needs its
65
+ own friction evidence. The existing interface is not evidence.
66
+ - **Subscription-based wakeups.** `mu log --tail` polls once a second.
67
+ SQLite update hooks or `fs.watch` on the WAL would cut latency for
68
+ more machinery. Build it when someone hits the limit.
105
69
 
106
70
  ## Open questions
107
71
 
108
- Listed so we don't pretend they're settled.
109
-
110
- - **Capability tags on operations.** mu's only authorization
111
- surface today is "the agent ran the verb." Promote capability
112
- enforcement when an agent actually does damage.
113
- - **Per-workstream config.** Resisted (anti-feature pledge). "This
114
- workstream uses one pi binary, that one uses another" is a real
115
- gap env vars don't solve cleanly. Revisit when a second user
116
- hits it.
117
-
118
- ---
119
-
120
- ## murmur and remote agents
121
-
122
- [murmur](https://github.com/mu-crew/murmur) is a separate binary for
123
- current agent state across machines. It owns collection and ssh egress;
124
- mu remains transport-free and owns the task DAG, claims, workspaces, and
125
- panes.
126
-
127
- **Done in 2.0:** mu reads murmur for agent state. See
128
- [Agent state from murmur](specs/2026-09-28-agent-state-from-murmur.md).
129
-
130
- ---
131
-
132
- ### Next schema change
133
-
134
- Drop the deprecated `agents.status` column at the first v11 migration.
135
- In 2.0 it remains for schema compatibility and always contains `spawning`.
136
-
137
- ---
138
-
139
- ## Pi extension and the three rules
140
-
141
- If a pi extension lands (typed `mu_*` tools, HUD widget, wakeups)
142
- bundled in this same npm package, three rules stay non-negotiable:
143
-
144
- 1. **The DB is canonical.** All state in `<state-dir>/mu.db`.
145
- Extension reads/writes through the same modules the CLI uses.
146
- No extension-only state.
147
- 2. **Every operation works from the CLI.** No tool registered in
148
- the extension has logic that doesn't exist in the CLI.
149
- 3. **The skill teaches the CLI.** Pi sessions without the
150
- extension still get a working mu by following
151
- [skills/mu/SKILL.md](../skills/mu/SKILL.md).
152
-
153
- If those three rules hold, mu stays driveable from a shell forever
154
- and the extension stays thin.
155
-
156
- ---
157
-
158
- ## Explicitly rejected (one-liners)
159
-
160
- Listed so we don't rediscover them.
161
-
162
- - **JS / Lisp DSL** (`mu run` / `mu eval` / `mu repl`) <!-- doc-cli-drift:skip --> — bash +
163
- jq + `--json` covers the gap. A workflow DSL is a maintenance
164
- liability.
165
- - **`defineOperation()` registry framework** — no consumer left
166
- after the DSL was rejected.
167
- - **Markdown agent-definition discovery** — spawn flags + first
168
- message already are the definition.
169
- - **mu as a pi extension only (no CLI)** — children couldn't drive
170
- mu; humans couldn't debug from a shell.
171
- - **mu as a library only (no CLI)** — multiple processes would
172
- fight over the DB.
173
- - **Two binaries (`mu-agents` + `mu-tasks`)** — agent ↔ task
174
- integration needs one transactional surface.
175
- - **`TaskSurface` adapter abstraction** — the built-in graph IS
176
- the killer feature.
177
- - **Live cross-machine state sync via a daemon or remote backend** —
178
- local-first SQLite. The ops-log sync is ambient but daemon-free
179
- (flush/ingest ride on ordinary mu invocations) and transport-free
180
- (mu reads and writes files; the user moves them). Rejected
181
- storage/replication substrates are in
182
- [§ Rejected sync substrates](#rejected-sync-substrates).
183
- - **Network-opening remote verbs (`mu remote check`, `mu sync --push/--pull`)** <!-- doc-cli-drift:skip --> — mu manages panes and a task graph on one machine; every network hop is an operator-owned command, either passed through `agent spawn --command` for the mux to run or printed as a copy-pasteable next step. Keeping mu's own process ssh-free avoids an ssh config/auth/host/error model. Spawn does not violate this boundary: the mux, not mu, runs the operator's string.
184
- - **HTTP API on top of SQLite** — write your own RPC if you need
185
- one.
186
- - **A "hosted" mu** — your machine is the deployment.
187
- - **Anthropomorphic agent names (`alice`, `bob`)** — use
188
- role-based names (`worker-1`, `reviewer-1`).
189
- - **Pane scraping as an agent-state fallback** — absence of a state source is `unknown`, not a guessed state.
190
- - **Storing runtime agent state in `mu.db`** — the copy goes stale; murmur or herdr owns the current reading.
191
- - **Reading murmur's `state.db`** — use murmur's stable public contract, not its private schema.
192
- - **murmur as a hard dependency** — installs that only use the task graph do not need murmur or its native dependencies.
72
+ - **Capability tags on operations.** Today the only authorization is
73
+ "the agent ran the verb". Enforce capabilities when an agent does real
74
+ damage.
75
+ - **Per-workstream config.** Resisted by the pledges, but "this
76
+ workstream uses a different pi binary" is a gap env vars solve poorly.
77
+ Revisit when a second user hits it.
78
+
79
+ ## Next schema change
80
+
81
+ Drop the deprecated `agents.status` column in schema v12. In v11 it
82
+ stays for compatibility and always holds `spawning`.
83
+
84
+ ## Explicitly rejected
85
+
86
+ - **A JS or Lisp DSL** (`mu run`, `mu eval`, `mu repl`) <!-- doc-cli-drift:skip -->. bash, `jq`,
87
+ and `--json` cover it.
88
+ - **A `defineOperation()` registry.** No consumer after the DSL went.
89
+ - **Markdown agent-definition discovery.** Spawn flags and the first
90
+ message are the definition.
91
+ - **mu as only a pi extension or only a library.** Children and humans
92
+ could not drive it from a shell, and processes would fight over the DB.
93
+ - **Two binaries (`mu-agents` + `mu-tasks`).** Agents and tasks need one
94
+ transactional surface.
95
+ - **A `TaskSurface` adapter.** The built-in graph is the point.
96
+ - **Live sync through a daemon or remote backend.** Sync rides on
97
+ ordinary mu calls and mu only reads and writes files. See
98
+ [Rejected sync substrates](#rejected-sync-substrates).
99
+ - **Network-opening verbs (`mu remote check`, `mu sync --push/--pull`)** <!-- doc-cli-drift:skip -->.
100
+ Every network hop is an operator command. Spawn passes it through
101
+ `--command` for the mux to run, or mu prints it as a next step. mu's
102
+ own process stays ssh-free.
103
+ - **An HTTP API over SQLite** or **a hosted mu.**
104
+ - **Personal agent names (`alice`, `bob`).** Use role names
105
+ (`worker-1`, `reviewer-1`).
106
+ - **Pane scraping as a state fallback.** No state source means `unknown`.
107
+ - **Runtime agent state in `mu.db`.** The copy goes stale. The control
108
+ socket, herdr, or murmur owns the current reading.
109
+ - **Reading murmur's `state.db`.** Use its public contract.
110
+ - **murmur as a hard dependency.** pi agents and the task graph do not
111
+ need it.