@femtomc/mu-agent 26.2.106 → 26.2.108

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 (42) hide show
  1. package/README.md +41 -21
  2. package/assets/mu-tui-logo.png +0 -0
  3. package/dist/extensions/index.d.ts +1 -1
  4. package/dist/extensions/index.d.ts.map +1 -1
  5. package/dist/extensions/index.js +1 -1
  6. package/dist/extensions/mu-command-dispatcher.d.ts +0 -1
  7. package/dist/extensions/mu-command-dispatcher.d.ts.map +1 -1
  8. package/dist/extensions/mu-command-dispatcher.js +5 -42
  9. package/dist/extensions/mu-operator.js +2 -2
  10. package/dist/extensions/mu-serve.js +2 -2
  11. package/dist/extensions/ui.d.ts +4 -0
  12. package/dist/extensions/ui.d.ts.map +1 -0
  13. package/dist/extensions/ui.js +1055 -0
  14. package/dist/operator.d.ts +93 -255
  15. package/dist/operator.d.ts.map +1 -1
  16. package/dist/operator.js +41 -32
  17. package/package.json +33 -33
  18. package/prompts/skills/automation/SKILL.md +25 -0
  19. package/prompts/skills/{crons → automation/crons}/SKILL.md +2 -2
  20. package/prompts/skills/{heartbeats → automation/heartbeats}/SKILL.md +2 -2
  21. package/prompts/skills/core/SKILL.md +28 -0
  22. package/prompts/skills/{code-mode → core/code-mode}/SKILL.md +1 -1
  23. package/prompts/skills/{memory → core/memory}/SKILL.md +2 -2
  24. package/prompts/skills/{mu → core/mu}/SKILL.md +52 -9
  25. package/prompts/skills/{tmux → core/tmux}/SKILL.md +1 -1
  26. package/prompts/skills/messaging/SKILL.md +27 -0
  27. package/prompts/skills/subagents/SKILL.md +93 -243
  28. package/prompts/skills/{control-flow → subagents/control-flow}/SKILL.md +122 -17
  29. package/prompts/skills/subagents/execution/SKILL.md +428 -0
  30. package/prompts/skills/{model-routing → subagents/model-routing}/SKILL.md +179 -19
  31. package/prompts/skills/subagents/planning/SKILL.md +393 -0
  32. package/prompts/skills/{orchestration → subagents/protocol}/SKILL.md +7 -10
  33. package/prompts/skills/writing/SKILL.md +3 -2
  34. package/dist/extensions/hud.d.ts +0 -4
  35. package/dist/extensions/hud.d.ts.map +0 -1
  36. package/dist/extensions/hud.js +0 -483
  37. package/prompts/skills/hud/SKILL.md +0 -205
  38. package/prompts/skills/planning/SKILL.md +0 -244
  39. /package/prompts/skills/{setup-discord → messaging/setup-discord}/SKILL.md +0 -0
  40. /package/prompts/skills/{setup-neovim → messaging/setup-neovim}/SKILL.md +0 -0
  41. /package/prompts/skills/{setup-slack → messaging/setup-slack}/SKILL.md +0 -0
  42. /package/prompts/skills/{setup-telegram → messaging/setup-telegram}/SKILL.md +0 -0
@@ -6,7 +6,7 @@ description: "Adds a model-selection overlay for issue DAG execution, recommendi
6
6
  # model-routing
7
7
 
8
8
  Use this skill when execution should choose different models for different issue
9
- kinds (for example code vs docs), while preserving orchestration protocol
9
+ kinds (for example code vs docs), while preserving protocol
10
10
  semantics.
11
11
 
12
12
  ## Contents
@@ -14,6 +14,7 @@ semantics.
14
14
  - [Purpose](#purpose)
15
15
  - [Required dependencies](#required-dependencies)
16
16
  - [Core contract](#core-contract)
17
+ - [Quality profile policy (high-stakes orchestration)](#quality-profile-policy-high-stakes-orchestration)
17
18
  - [Overlay identity (`route:model-routing-v1`)](#overlay-identity-routemodel-routing-v1)
18
19
  - [Tag vocabulary](#tag-vocabulary)
19
20
  - [Recommendation packet contract](#recommendation-packet-contract)
@@ -22,13 +23,13 @@ semantics.
22
23
  - [Planning handoff contract](#planning-handoff-contract)
23
24
  - [Subagents/heartbeat execution contract](#subagentsheartbeat-execution-contract)
24
25
  - [Failure + fallback policy](#failure--fallback-policy)
25
- - [HUD visibility and teardown](#hud-visibility-and-teardown)
26
+ - [mu_ui visibility and handoff](#mu_ui-visibility-and-handoff)
26
27
  - [Evaluation scenarios](#evaluation-scenarios)
27
28
 
28
29
  ## Purpose
29
30
 
30
- Model-routing policies are overlays. They do not replace `orchestration`
31
- protocol semantics.
31
+ Model-routing policies are overlays. They do not replace protocol
32
+ semantics.
32
33
 
33
34
  Examples:
34
35
  - use a strong coding model for implementation leaves
@@ -40,10 +41,10 @@ Examples:
40
41
 
41
42
  Load these skills before applying model-routing policies:
42
43
 
43
- - `orchestration` (protocol primitives/invariants)
44
- - `subagents` (durable execution runtime)
44
+ - `protocol` (protocol primitives/invariants)
45
+ - `execution` (durable execution runtime)
45
46
  - `heartbeats` and/or `crons` (scheduler clock)
46
- - `hud` (required visibility/handoff surface)
47
+ - `mu` (for `/mu ui` inspection commands and communication checks)
47
48
  - `control-flow` (optional; when loop/termination overlays are also active)
48
49
 
49
50
  ## Core contract
@@ -71,6 +72,25 @@ Load these skills before applying model-routing policies:
71
72
  - Use `mu exec --provider/--model/--thinking` or `mu turn ...` overrides.
72
73
  - Avoid changing workspace-global operator defaults for per-issue routing.
73
74
 
75
+ ## Quality profile policy (high-stakes orchestration)
76
+
77
+ For protocol/runtime/schema/cross-adapter work, apply an explicit quality floor.
78
+ Do not rely on implicit defaults.
79
+
80
+ Recommended high-stakes profile:
81
+
82
+ - provider: `openai-codex`
83
+ - model: `gpt-5.3-codex`
84
+ - thinking: `xhigh`
85
+
86
+ Required guardrails:
87
+
88
+ 1. Always pass explicit `--provider --model --thinking` when launching workers.
89
+ 2. Do not use mini/fast profiles for root-close decisions, acceptance-signoff,
90
+ or architecture-contract issues unless the user explicitly requests it.
91
+ 3. If authenticated capability for the high-stakes profile is unavailable,
92
+ emit a `ROUTE_FALLBACK` packet that explains the downgrade rationale.
93
+
74
94
  ## Overlay identity (`route:model-routing-v1`)
75
95
 
76
96
  - Tag scope root (or selected subtree root) with: `route:model-routing-v1`
@@ -151,6 +171,13 @@ Optional root-level packet for custom preferences:
151
171
  ROUTE_POLICY:
152
172
  {
153
173
  "version": "route:model-routing-v1",
174
+ "quality_profiles": {
175
+ "orchestration_critical": {
176
+ "provider": "openai-codex",
177
+ "model": "gpt-5.3-codex",
178
+ "thinking": "xhigh"
179
+ }
180
+ },
154
181
  "task_preferences": {
155
182
  "code": [
156
183
  { "provider": "openai-codex", "model": "gpt-5.3-codex", "thinking": "xhigh" }
@@ -218,7 +245,7 @@ For one-shot execution:
218
245
 
219
246
  ```bash
220
247
  mu exec --provider <provider> --model <model> --thinking <thinking> \
221
- "Use skills subagents, orchestration, model-routing, and hud. Work issue <issue-id>."
248
+ "Use skills subagents, protocol, execution, model-routing, and mu. Work issue <issue-id> and keep routing visibility current via mu_ui."
222
249
  ```
223
250
 
224
251
  For existing session turn:
@@ -257,7 +284,7 @@ When planning a routed subtree:
257
284
  2. Tag executable nodes with task/depth/budget intent.
258
285
  3. Record any hard constraints (modality/context) in issue body or forum packet.
259
286
  4. Optionally add root `ROUTE_POLICY` preferences.
260
- 5. Ensure DAG remains valid under `orchestration` invariants:
287
+ 5. Ensure DAG remains valid under `protocol` invariants:
261
288
  - `mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty`
262
289
  - `mu issues validate <root-id>`
263
290
 
@@ -272,18 +299,19 @@ Per orchestrator tick:
272
299
  5. Verify with:
273
300
  - `mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty`
274
301
  - `mu issues validate <root-id>`
275
- 6. Update HUD state.
302
+ 6. Upsert routing visibility via `mu_ui` (`ui_id:"ui:subagents"` when orchestration is shared, or `ui_id:"ui:model-routing"` when standalone).
276
303
  7. Post one concise `ORCH_PASS` status update.
277
304
  8. If root is final, disable supervising heartbeat.
278
305
 
279
306
  Reusable heartbeat prompt fragment:
280
307
 
281
308
  ```text
282
- Use skills orchestration, model-routing, subagents, and hud.
309
+ Use skills subagents, protocol, execution, model-routing, and mu.
283
310
  For root <root-id>, enforce route:model-routing-v1.
284
311
  Run exactly one bounded routing/orchestration transition pass: compute or validate
285
312
  one issue's model recommendation from live `mu control harness` capabilities,
286
- apply one action, verify DAG state, post one ORCH_PASS, then stop.
313
+ apply one action, keep route status current via mu_ui (`ui:subagents` or
314
+ `ui:model-routing`), verify DAG state, post one ORCH_PASS, then stop.
287
315
  If validate is final, disable the supervising heartbeat and report completion.
288
316
  ```
289
317
 
@@ -307,15 +335,147 @@ If validate is final, disable the supervising heartbeat and report completion.
307
335
  - every route change emits forum packet (`ROUTE_RECOMMENDATION`,
308
336
  `ROUTE_FALLBACK`, `ROUTE_DEGRADED`)
309
337
 
310
- ## HUD visibility and teardown
338
+ ## mu_ui visibility and handoff
339
+
340
+ Use `mu_ui` as the primary communication surface for active model-routing
341
+ execution.
342
+
343
+ - Publish routing status in one status-profile doc:
344
+ - shared orchestration: `ui_id:"ui:subagents"`
345
+ - standalone model-routing loop: `ui_id:"ui:model-routing"`
346
+ - Set status profile metadata for deterministic snapshots:
347
+ - `metadata.profile.id: "subagents"` or `"model-routing"`
348
+ - `metadata.profile.variant: "status"`
349
+ - `metadata.profile.snapshot.compact|multiline`
350
+ - Keep status docs non-interactive (`actions: []`).
351
+ - For user decisions (for example hard-constraint escalation), publish a separate
352
+ interactive prompt doc (for example `ui_id:"ui:model-routing:escalation"`).
353
+ - Update routing status docs each bounded pass before posting `ORCH_PASS`.
354
+ - On completion or handoff, remove model-routing-owned docs with explicit
355
+ `mu_ui remove` actions. Prefer `remove` over `clear`.
356
+
357
+ ### Canonical status doc (`ui:model-routing`)
358
+
359
+ ```json
360
+ {
361
+ "action": "set",
362
+ "doc": {
363
+ "v": 1,
364
+ "ui_id": "ui:model-routing",
365
+ "title": "Model-routing status",
366
+ "summary": "issue=<issue-id> · selected=openai-codex/gpt-5.3-codex/xhigh · alternates=2",
367
+ "components": [
368
+ {
369
+ "kind": "key_value",
370
+ "id": "route",
371
+ "title": "Current route",
372
+ "rows": [
373
+ { "key": "policy", "value": "route:model-routing-v1" },
374
+ { "key": "issue", "value": "<issue-id>" },
375
+ { "key": "selected", "value": "openai-codex/gpt-5.3-codex/xhigh" },
376
+ { "key": "alternates", "value": "2" },
377
+ { "key": "next", "value": "Launch worker with explicit overrides" }
378
+ ],
379
+ "metadata": {}
380
+ },
381
+ {
382
+ "kind": "list",
383
+ "id": "recent",
384
+ "title": "Recent routing events",
385
+ "items": [
386
+ {
387
+ "id": "e1",
388
+ "label": "ROUTE_RECOMMENDATION posted",
389
+ "detail": "selected openai-codex/gpt-5.3-codex/xhigh"
390
+ },
391
+ {
392
+ "id": "e2",
393
+ "label": "fallback budget",
394
+ "detail": "openrouter/google/gemini-3.1-pro-preview/high"
395
+ }
396
+ ],
397
+ "metadata": {}
398
+ }
399
+ ],
400
+ "actions": [],
401
+ "revision": { "id": "model-routing-status", "version": 7 },
402
+ "updated_at_ms": 1772069500000,
403
+ "metadata": {
404
+ "profile": {
405
+ "id": "model-routing",
406
+ "variant": "status",
407
+ "snapshot": {
408
+ "compact": "selected=openai-codex/gpt-5.3-codex/xhigh · alternates=2",
409
+ "multiline": "issue: <issue-id>\nselected: openai-codex/gpt-5.3-codex/xhigh\nalternates: 2\nnext: launch worker"
410
+ }
411
+ }
412
+ }
413
+ }
414
+ }
415
+ ```
416
+
417
+ ### Canonical escalation prompt (`ui:model-routing:escalation`)
311
418
 
312
- HUD usage is not optional for active model-routing execution.
419
+ ```json
420
+ {
421
+ "action": "set",
422
+ "doc": {
423
+ "v": 1,
424
+ "ui_id": "ui:model-routing:escalation",
425
+ "title": "Routing escalation required",
426
+ "summary": "No authenticated model satisfies image + deep reasoning constraints.",
427
+ "components": [
428
+ {
429
+ "kind": "text",
430
+ "id": "question",
431
+ "text": "Routing is blocked by missing provider capability. Should execution wait for provider auth or run with degraded constraints?",
432
+ "metadata": {}
433
+ },
434
+ {
435
+ "kind": "list",
436
+ "id": "options",
437
+ "title": "Choices",
438
+ "items": [
439
+ { "id": "opt-auth", "label": "Pause and authenticate provider" },
440
+ { "id": "opt-degrade", "label": "Proceed with degraded route" }
441
+ ],
442
+ "metadata": {}
443
+ }
444
+ ],
445
+ "actions": [
446
+ {
447
+ "id": "wait-for-auth",
448
+ "label": "Wait for provider auth",
449
+ "kind": "primary",
450
+ "payload": {},
451
+ "metadata": { "command_text": "/answer wait-for-auth" }
452
+ },
453
+ {
454
+ "id": "approve-degraded-route",
455
+ "label": "Approve degraded route",
456
+ "kind": "secondary",
457
+ "payload": {},
458
+ "metadata": { "command_text": "/answer approve-degraded-route" }
459
+ }
460
+ ],
461
+ "revision": { "id": "model-routing-escalation", "version": 1 },
462
+ "updated_at_ms": 1772069510000,
463
+ "metadata": {
464
+ "profile": {
465
+ "id": "model-routing-escalation",
466
+ "variant": "interactive"
467
+ }
468
+ }
469
+ }
470
+ }
471
+ ```
472
+
473
+ ### Teardown / handoff
313
474
 
314
- - If subagents HUD is active, publish routing state there (selected model,
315
- alternates remaining, last fallback reason).
316
- - If running model-routing standalone, own `hud_id:"model-routing"`.
317
- - Update HUD each bounded pass before ORCH_PASS output.
318
- - Follow `hud` skill ownership/teardown protocol on completion or handoff.
475
+ ```json
476
+ {"action":"remove","ui_id":"ui:model-routing:escalation"}
477
+ {"action":"remove","ui_id":"ui:model-routing"}
478
+ ```
319
479
 
320
480
  ## Evaluation scenarios
321
481
 
@@ -0,0 +1,393 @@
1
+ ---
2
+ name: planning
3
+ description: "Builds and refines issue-DAG plans using mu_ui status/prompt docs and approval loops. Use when the user asks for planning, decomposition, sequencing, or plan review."
4
+ ---
5
+
6
+ # planning
7
+
8
+ Use this skill when the user asks for planning, decomposition, or a staged
9
+ execution roadmap.
10
+
11
+ ## Contents
12
+
13
+ - [Planning communication contract (mu_ui-first)](#planning-communication-contract-mu_ui-first)
14
+ - [mu_ui communication dependency](#mu_ui-communication-dependency)
15
+ - [Shared protocol dependency](#shared-protocol-dependency)
16
+ - [Core contract](#core-contract)
17
+ - [Suggested workflow](#suggested-workflow)
18
+ - [Planning UI canonical docs](#planning-ui-canonical-docs)
19
+ - [Effective mu_ui usage heuristics](#effective-mu_ui-usage-heuristics)
20
+ - [Evaluation scenarios](#evaluation-scenarios)
21
+ - [Quality bar](#quality-bar)
22
+
23
+ ## Planning communication contract (mu_ui-first)
24
+
25
+ For this skill, `mu_ui` is the primary operator↔human communication surface.
26
+
27
+ - Keep one status doc at `ui_id:"ui:planning"` during active planning turns.
28
+ - Keep status docs non-interactive (`actions: []`).
29
+ - Publish user-decision prompts in a separate interactive doc (for example
30
+ `ui_id:"ui:planning:approval"`) with `action.metadata.command_text`.
31
+ - Update planning UI docs before and after each major planning turn.
32
+ - Keep status-profile metadata current:
33
+ - `metadata.profile.id: "planning"`
34
+ - `metadata.profile.variant: "status"`
35
+ - `metadata.profile.snapshot.compact|multiline`
36
+ - Teardown or hand off planning-owned docs explicitly when planning completes.
37
+
38
+ Default per-turn planning UI loop:
39
+
40
+ 1. Upsert `ui:planning` with current `phase`, `waiting_on_user`,
41
+ `next_action`, `blocker`, and `confidence`.
42
+ 2. Keep checklist progress and root-issue linkage synchronized with the live DAG.
43
+ 3. If user input is needed, upsert `ui:planning:approval` with concrete choices.
44
+ 4. Use `mu_ui` snapshot/status output in user-facing planning updates.
45
+
46
+ ## mu_ui communication dependency
47
+
48
+ Before publishing planning visibility or user prompts, use **`mu_ui`** and the
49
+ `/mu ui` command surface.
50
+
51
+ - Tool: `mu_ui`
52
+ - Actions: `status`, `snapshot`, `set`, `update`, `replace`, `remove`, `clear`
53
+ - Operator commands:
54
+ - `/mu ui status`
55
+ - `/mu ui snapshot compact`
56
+ - `/mu ui snapshot multiline`
57
+ - `/mu ui interact [ui_id [action_id]]`
58
+
59
+ If behavior is unclear, inspect implementation/tests before guessing:
60
+
61
+ - `packages/agent/src/extensions/ui.ts`
62
+ - `packages/agent/test/ui_extension.test.ts`
63
+ - `docs/mu-ui.md`
64
+
65
+ ## Shared protocol dependency
66
+
67
+ This skill plans DAGs for execution by `execution`, so planning must follow the
68
+ shared protocol in **`protocol`**.
69
+
70
+ Before creating or reshaping DAG nodes, load that skill and use its canonical:
71
+
72
+ - protocol identity/tag (`hierarchical-work.protocol/v1`,
73
+ `proto:hierarchical-work-v1`)
74
+ - node kinds and context tags
75
+ - invariants for executable vs non-executable nodes
76
+ - planning handoff contract
77
+
78
+ Do not invent alternate protocol names or tag schemas.
79
+
80
+ If the user asks for explicit loop/termination behavior (for example
81
+ review-gated retry rounds), load **`control-flow`** and encode policy via
82
+ `flow:*` overlays without changing protocol semantics.
83
+
84
+ If the user asks for per-issue model/provider/thinking recommendations based on
85
+ live harness capabilities, load **`model-routing`** and encode policy via
86
+ `route:*` overlays plus route packets (for example `ROUTE_POLICY`) without
87
+ changing protocol semantics.
88
+
89
+ ## Core contract
90
+
91
+ 1. **Investigate first**
92
+ - Read relevant code/docs/state before proposing work.
93
+ - Avoid speculative plans when evidence is cheap to gather.
94
+
95
+ 2. **Materialize the plan in mu issues using the shared protocol**
96
+ - Create root and child issues that comply with
97
+ `hierarchical-work.protocol/v1`.
98
+ - Encode dependencies so the DAG reflects execution order and synth fan-in.
99
+ - Add clear titles, scope, acceptance criteria, and protocol tags.
100
+ - When model specialization is required, attach explicit `route:*`
101
+ intent tags/constraints to executable nodes.
102
+
103
+ 3. **Drive communication through mu_ui**
104
+ - Keep `ui:planning` current as the canonical short planning status.
105
+ - Keep `phase`, `waiting_on_user`, `next_action`, `blocker`, and
106
+ `confidence` current in doc metadata/components.
107
+ - Keep status docs non-interactive; isolate user decisions in separate
108
+ interactive docs.
109
+ - Ensure UI doc state and natural-language responses never contradict each
110
+ other.
111
+
112
+ 4. **Present the plan to the user**
113
+ - Summarize goals, sequencing, risks, and tradeoffs.
114
+ - Include issue IDs so the user can reference exact nodes.
115
+ - Include one compact planning UI snapshot line.
116
+
117
+ 5. **Iterate until user approval**
118
+ - Treat user feedback as first-class constraints.
119
+ - Update issues/dependencies and re-present deltas.
120
+ - Do not begin broad execution until the user signals satisfaction.
121
+
122
+ 6. **After user approval, ask user about next steps**
123
+ - Remove resolved interactive planning docs (for example
124
+ `ui:planning:approval`).
125
+ - If handing off to `execution`, remove or replace `ui:planning` so
126
+ ownership is unambiguous.
127
+ - If no immediate follow-on skill starts, remove planning docs explicitly.
128
+ - Read the `execution` skill and offer to supervise execution to realize the
129
+ plan.
130
+
131
+ ## Suggested workflow
132
+
133
+ ### A) Investigation pass
134
+
135
+ ```bash
136
+ mu status --pretty
137
+ mu issues list --status open --limit 50 --pretty
138
+ mu forum read user:context --limit 50 --pretty
139
+ mu memory search --query "<topic>" --limit 30
140
+ ```
141
+
142
+ Inspect active planning UI state:
143
+
144
+ ```text
145
+ /mu ui status
146
+ /mu ui snapshot compact
147
+ ```
148
+
149
+ Tool checks (when tools are available):
150
+
151
+ ```json
152
+ {"action":"status"}
153
+ {"action":"snapshot","snapshot_format":"compact"}
154
+ ```
155
+
156
+ ### B) Draft DAG in mu-issue
157
+
158
+ ```bash
159
+ # 1) Create protocol root container
160
+ root_json="$(mu issues create "<Goal>" \
161
+ --body "<scope + success criteria>" \
162
+ --tag node:root \
163
+ --tag kind:root \
164
+ --tag proto:hierarchical-work-v1 \
165
+ --json)"
166
+ root_id="$(echo "$root_json" | jq -r '.id')"
167
+ mu issues update "$root_id" --remove-tag node:agent
168
+
169
+ # 2) Create executable child work nodes
170
+ mu issues create "<Subtask A>" \
171
+ --parent "$root_id" \
172
+ --body "<acceptance criteria>" \
173
+ --tag kind:spawn \
174
+ --tag ctx:clean \
175
+ --tag proto:hierarchical-work-v1 \
176
+ --priority 2 --pretty
177
+
178
+ mu issues create "<Subtask B>" \
179
+ --parent "$root_id" \
180
+ --body "<acceptance criteria>" \
181
+ --tag kind:fork \
182
+ --tag ctx:inherit \
183
+ --tag proto:hierarchical-work-v1 \
184
+ --priority 2 --pretty
185
+
186
+ # 3) Add dependency edges where needed
187
+ mu issues dep <child-a-id> blocks <child-b-id>
188
+
189
+ # 4) Validate ready set + protocol scope
190
+ mu issues ready --root "$root_id" --tag proto:hierarchical-work-v1 --pretty
191
+ mu issues validate "$root_id"
192
+ ```
193
+
194
+ ### C) Plan presentation template
195
+
196
+ - Objective
197
+ - Assumptions and constraints discovered in investigation
198
+ - Proposed issue DAG (IDs + titles + ordering)
199
+ - Risks and mitigations
200
+ - Open questions for user approval
201
+ - Planning UI snapshot (compact line)
202
+
203
+ ### D) Revision loop
204
+
205
+ - Apply feedback with `mu issues update` / `mu issues dep` / additional issues.
206
+ - Re-run `mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty`.
207
+ - Validate protocol-root status via `mu issues validate <root-id>`.
208
+ - Present a concise diff of what changed and why.
209
+ - Keep planning UI docs aligned with latest state each turn.
210
+
211
+ Required UI updates during the loop:
212
+
213
+ - Re-emit `ui:planning` with current `phase`, checklist progress,
214
+ `waiting_on_user`, `next_action`, and `blocker` after each meaningful
215
+ planning step.
216
+ - Use `{"action":"snapshot","snapshot_format":"compact"}` for concise
217
+ user-facing snapshot lines.
218
+ - Keep `revision.version` and `updated_at_ms` monotonic across updates.
219
+ - On plan completion/handoff, remove planning-owned docs explicitly with
220
+ `mu_ui remove`.
221
+
222
+ ## Planning UI canonical docs
223
+
224
+ Use these as copy/paste templates for planning communication.
225
+
226
+ ### Canonical status doc (`ui:planning`)
227
+
228
+ ```json
229
+ {
230
+ "action": "set",
231
+ "doc": {
232
+ "v": 1,
233
+ "ui_id": "ui:planning",
234
+ "title": "Planning status",
235
+ "summary": "phase=investigating · steps=1/4 · waiting=no · conf=medium",
236
+ "components": [
237
+ {
238
+ "kind": "key_value",
239
+ "id": "status",
240
+ "title": "Status",
241
+ "rows": [
242
+ { "key": "phase", "value": "investigating" },
243
+ { "key": "root", "value": "mu-root-123" },
244
+ { "key": "waiting", "value": "no" },
245
+ { "key": "confidence", "value": "medium" },
246
+ { "key": "next", "value": "Draft root DAG" },
247
+ { "key": "blocker", "value": "(none)" }
248
+ ],
249
+ "metadata": {}
250
+ },
251
+ {
252
+ "kind": "list",
253
+ "id": "checklist",
254
+ "title": "Checklist",
255
+ "items": [
256
+ { "id": "c1", "label": "Investigate relevant code/docs/state", "detail": "done" },
257
+ { "id": "c2", "label": "Create root + child issue DAG", "detail": "pending" },
258
+ { "id": "c3", "label": "Present plan + tradeoffs", "detail": "pending" },
259
+ { "id": "c4", "label": "Refine until approved", "detail": "pending" }
260
+ ],
261
+ "metadata": {}
262
+ }
263
+ ],
264
+ "actions": [],
265
+ "revision": { "id": "planning-status", "version": 3 },
266
+ "updated_at_ms": 1772069100000,
267
+ "metadata": {
268
+ "phase": "investigating",
269
+ "waiting_on_user": false,
270
+ "confidence": "medium",
271
+ "profile": {
272
+ "id": "planning",
273
+ "variant": "status",
274
+ "snapshot": {
275
+ "compact": "phase=investigating · steps=1/4 · waiting=no · conf=medium",
276
+ "multiline": "phase: investigating\nsteps: 1/4\nwaiting_on_user: no\nconfidence: medium\nnext_action: Draft root DAG"
277
+ }
278
+ }
279
+ }
280
+ }
281
+ }
282
+ ```
283
+
284
+ ### Canonical approval prompt (`ui:planning:approval`)
285
+
286
+ ```json
287
+ {
288
+ "action": "set",
289
+ "doc": {
290
+ "v": 1,
291
+ "ui_id": "ui:planning:approval",
292
+ "title": "Plan approval",
293
+ "summary": "Need user decision before execution handoff.",
294
+ "components": [
295
+ {
296
+ "kind": "text",
297
+ "id": "question",
298
+ "text": "Approve this plan for execution, or request one targeted revision?",
299
+ "metadata": {}
300
+ },
301
+ {
302
+ "kind": "list",
303
+ "id": "options",
304
+ "title": "Choices",
305
+ "items": [
306
+ { "id": "opt-approve", "label": "Approve and move to execution" },
307
+ { "id": "opt-revise", "label": "Request one revision" }
308
+ ],
309
+ "metadata": {}
310
+ }
311
+ ],
312
+ "actions": [
313
+ {
314
+ "id": "approve-plan",
315
+ "label": "Approve plan",
316
+ "kind": "primary",
317
+ "payload": {},
318
+ "metadata": { "command_text": "/answer approve-plan" }
319
+ },
320
+ {
321
+ "id": "request-revision",
322
+ "label": "Request revision",
323
+ "kind": "secondary",
324
+ "payload": { "reason": "<reason>" },
325
+ "metadata": { "command_text": "/answer request-revision {{reason}}" }
326
+ }
327
+ ],
328
+ "revision": { "id": "planning-approval", "version": 1 },
329
+ "updated_at_ms": 1772069110000,
330
+ "metadata": {
331
+ "profile": {
332
+ "id": "planning-approval",
333
+ "variant": "interactive"
334
+ }
335
+ }
336
+ }
337
+ }
338
+ ```
339
+
340
+ ### Teardown / handoff semantics
341
+
342
+ - Remove resolved decision prompts immediately.
343
+ - Remove or replace `ui:planning` when planning ends or execution takes over.
344
+ - Prefer `remove` over `clear` to avoid deleting docs owned by other skills.
345
+
346
+ ```json
347
+ {"action":"remove","ui_id":"ui:planning:approval"}
348
+ {"action":"remove","ui_id":"ui:planning"}
349
+ ```
350
+
351
+ ## Effective mu_ui usage heuristics
352
+
353
+ - Keep one canonical status doc (`ui:planning`) and refresh it whenever planning
354
+ state changes.
355
+ - Keep `revision.version` and `updated_at_ms` monotonic so replay/reconnect
356
+ keeps the newest state deterministically.
357
+ - Keep status docs non-interactive; place user decisions in separate interactive
358
+ docs.
359
+ - Keep `next_action` to one concrete action, not a paragraph.
360
+ - Keep approval prompts decision-shaped with explicit command-text actions.
361
+
362
+ ## Evaluation scenarios
363
+
364
+ 1. **Initial decomposition request**
365
+ - Prompt: user asks for a staged roadmap.
366
+ - Expected: investigation pass runs first, root + child issues are created
367
+ with `proto:hierarchical-work-v1`, and `ui:planning` reflects
368
+ `phase=drafting`, `waiting_on_user=false`.
369
+
370
+ 2. **Feedback-driven replan**
371
+ - Prompt: user requests scope change after first DAG draft.
372
+ - Expected: dependency/issue updates are applied, concise change diff is
373
+ presented, and planning UI transitions through `reviewing` and
374
+ `waiting_on_user` states.
375
+
376
+ 3. **Blocked-by-missing-input planning turn**
377
+ - Prompt: required architecture constraint is unknown.
378
+ - Expected: plan captures explicit assumption gap, `ui:planning` shows
379
+ blocked/waiting status, and an interactive planning prompt asks one concrete
380
+ unblock decision.
381
+
382
+ ## Quality bar
383
+
384
+ - Every issue should be actionable and testable.
385
+ - DAG nodes must satisfy `hierarchical-work.protocol/v1` before execution
386
+ handoff.
387
+ - Keep tasks small enough to complete in one focused pass.
388
+ - Explicitly call out uncertain assumptions for user confirmation.
389
+ - Prefer reversible plans and incremental checkpoints.
390
+ - If `model-routing` is in scope, route intent/constraints are explicit and
391
+ non-conflicting.
392
+ - Planning UI state must be fresh, accurate, and aligned with user-visible
393
+ status updates.