@femtomc/mu-agent 26.2.107 → 26.2.109

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: core
3
- description: "Meta-skill for core mu operating primitives. Routes to mu, memory, tmux, and code-mode based on task shape."
3
+ description: "Meta-skill for core mu operating primitives. Routes to mu, programmable-ui, memory, tmux, and code-mode based on task shape."
4
4
  ---
5
5
 
6
6
  # core
@@ -10,19 +10,22 @@ Use this meta-skill when the user asks for general `mu` operation guidance and y
10
10
  ## Subskills
11
11
 
12
12
  - `mu` — default CLI-first operating workflow (inspect, mutate, verify, handoff).
13
- - `memory` — historical context retrieval, timeline reconstruction, and memory-index maintenance.
13
+ - `programmable-ui` — canonical `mu_ui`/`UiDoc` workflow for publishing, inspecting, and debugging interactive UI docs.
14
+ - `memory` — prior-context retrieval, timeline reconstruction, and memory-index maintenance.
14
15
  - `tmux` — persistent terminal/session substrate for bounded command execution and fan-out.
15
16
  - `code-mode` — tmux-backed REPL loops for iterative execution and context compression.
16
17
 
17
18
  ## Selection guide
18
19
 
19
20
  1. Start with `mu` for most day-to-day operator work.
20
- 2. Add `memory` when historical context or timeline anchors are required.
21
- 3. Add `tmux` when durable shell state or parallel worker shells are needed.
22
- 4. Add `code-mode` when solving by live execution is cheaper than chat-only reasoning.
21
+ 2. Route to `programmable-ui` when the user asks about `mu_ui`, `/mu ui ...`, `UiDoc` payloads, action wiring, or interactive prompt behavior.
22
+ 3. Add `memory` when prior context or timeline anchors are required.
23
+ 4. Add `tmux` when durable shell state or parallel worker shells are needed.
24
+ 5. Add `code-mode` when solving by live execution is cheaper than chat-only reasoning.
23
25
 
24
26
  ## Common patterns
25
27
 
26
28
  - **Bounded investigation**: Use `mu` commands (`get`, `read`, `health`) to inspect current state, then use `memory` to find "when did this last work?" before attempting a fix.
29
+ - **Programmable UI scaffolding**: Route to `programmable-ui` to emit schema-valid `UiDoc` templates quickly, verify state with `/mu ui status|snapshot`, and close docs with `mu_ui remove|clear`.
27
30
  - **Context compression**: If a user asks for complex debugging that involves running code and printing huge errors, route to `code-mode`. The agent can spin up a REPL, iterate on a fix offline, and return only the root cause to the chat.
28
31
  - **Parallel fan-out**: If a command takes a long time, or needs to run across multiple directories, route to `tmux` to spawn parallel worker shells, keep them running in the background, and periodically read their output.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: memory
3
- description: "Runs cross-store memory retrieval and index maintenance workflows with bounded filters and timeline anchors. Use when querying historical context or repairing memory index health."
3
+ description: "Runs cross-store memory retrieval and index maintenance workflows with bounded filters and timeline anchors. Use when querying prior context or repairing memory index health."
4
4
  ---
5
5
 
6
6
  # memory
7
7
 
8
- Use this skill when the user asks for historical context lookup, timeline reconstruction,
8
+ Use this skill when the user asks for prior-context lookup, timeline reconstruction,
9
9
  or memory index diagnostics.
10
10
 
11
11
  ## Contents
@@ -197,7 +197,15 @@ One-shot prompt (no durable session):
197
197
  mu exec --message "<task>" --json
198
198
  ```
199
199
 
200
- In attached terminal operator chat, `/mu` helpers are available (`/mu events`, `/mu hud ...`, `/mu help`).
200
+ In attached terminal operator chat, `/mu` helpers are available (`/mu events`, `/mu ui status`, `/mu ui snapshot compact`, `/mu help`).
201
+
202
+ Canonical visibility checks while running orchestrated work:
203
+
204
+ ```bash
205
+ /mu ui status
206
+ /mu ui snapshot compact
207
+ /mu ui snapshot multiline
208
+ ```
201
209
 
202
210
  ## Durable automation handoff
203
211
 
@@ -209,10 +217,14 @@ mu cron --help
209
217
  ```
210
218
 
211
219
  When work is multi-step and issue-graph driven, use `planning` to shape the DAG,
212
- then `hud` for canonical HUD behavior, then `protocol` to keep DAG
213
- semantics consistent, then `control-flow` for explicit loop/termination policy,
214
- then `model-routing` for per-issue provider/model/thinking selection overlays,
215
- then `execution` for durable execution supervision.
220
+ then `protocol` to keep DAG semantics consistent, then `control-flow` for explicit
221
+ loop/termination policy, then `model-routing` for per-issue provider/model/thinking
222
+ selection overlays, then `execution` for durable execution supervision.
223
+ Keep operator↔human communication mu_ui-first across these skills:
224
+ - one non-interactive status doc per active profile (`metadata.profile.variant: "status"`)
225
+ - separate interactive prompt docs for decisions (`metadata.command_text` actions)
226
+ - explicit `mu_ui remove` teardown for resolved prompts and completed passes
227
+ For focused `UiDoc` schema templates/action wiring/status diagnostics, use `programmable-ui`.
216
228
  For REPL-driven exploration and context compression, use `code-mode`.
217
229
  For persistent terminal sessions and worker fan-out mechanics, use `tmux`.
218
230
  For recurring bounded automation loops, use `heartbeats`.
@@ -234,9 +246,10 @@ For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
234
246
 
235
247
  ## Escalation map
236
248
 
237
- - Historical context retrieval and index maintenance: **`memory`**
249
+ - Prior-context retrieval and index maintenance: **`memory`**
238
250
  - Planning/decomposition and DAG review: **`planning`**
239
- - HUD contract/state updates across surfaces: **`hud`**
251
+ - Programmable UI schema/templates/action-routing diagnostics: **`programmable-ui`**
252
+ - mu_ui-first status/prompt communication patterns for DAG work: **`planning`**, **`execution`**, **`control-flow`**, **`model-routing`**
240
253
  - Shared DAG semantics for planning + execution: **`protocol`**
241
254
  - Loop/termination policy overlays (review gates, retries, escalation): **`control-flow`**
242
255
  - Per-issue model/provider/thinking selection overlays: **`model-routing`**
@@ -0,0 +1,299 @@
1
+ ---
2
+ name: programmable-ui
3
+ description: "Builds and debugs mu_ui UiDocs with schema-valid payloads, interaction wiring, and status/snapshot verification."
4
+ ---
5
+
6
+ # programmable-ui
7
+
8
+ Use this skill when the task involves `mu_ui`, `UiDoc` payloads, interactive actions, or `/mu ui ...` inspection commands.
9
+
10
+ ## Contents
11
+
12
+ - [Core contract](#core-contract)
13
+ - [60-second quickstart](#60-second-quickstart)
14
+ - [UiDoc schema cheat sheet](#uidoc-schema-cheat-sheet)
15
+ - [mu_ui action semantics](#mu_ui-action-semantics)
16
+ - [Canonical templates](#canonical-templates)
17
+ - [Status-profile rules](#status-profile-rules)
18
+ - [Debugging playbook](#debugging-playbook)
19
+ - [Verify and teardown checklist](#verify-and-teardown-checklist)
20
+ - [Evaluation scenarios](#evaluation-scenarios)
21
+
22
+ ## Core contract
23
+
24
+ 1. **Publish schema-valid docs only**
25
+ - `mu_ui` accepts `doc: object`, but runtime validation is strict (`UiDoc` schema).
26
+ - Invalid payloads fail with `Invalid UiDoc.`.
27
+
28
+ 2. **Keep interaction command-driven**
29
+ - Interactive actions must set `action.metadata.command_text` (for example `/answer yes`).
30
+ - User clicks/taps are translated back into normal command turns.
31
+
32
+ 3. **Separate status and decisions**
33
+ - Keep one non-interactive status doc per active profile (`metadata.profile.variant: "status"`).
34
+ - Use separate interactive docs for user decisions.
35
+
36
+ 4. **Use monotonic revisions**
37
+ - Increment `revision.version` on each update for the same `ui_id`.
38
+ - Replays/reconnects keep the highest revision deterministically.
39
+
40
+ 5. **Read -> act -> verify**
41
+ - After each `set|update|replace|remove|clear`, check `/mu ui status` and `/mu ui snapshot`.
42
+
43
+ 6. **Close docs explicitly**
44
+ - Resolve prompts with `mu_ui remove` (preferred) or `mu_ui clear`.
45
+
46
+ ## 60-second quickstart
47
+
48
+ 1. Publish one interactive doc:
49
+
50
+ ```json
51
+ {
52
+ "action": "set",
53
+ "doc": {
54
+ "v": 1,
55
+ "ui_id": "ui:demo",
56
+ "title": "Demo",
57
+ "summary": "Minimal interactive panel",
58
+ "components": [
59
+ { "kind": "text", "id": "intro", "text": "Choose an option", "metadata": {} }
60
+ ],
61
+ "actions": [
62
+ {
63
+ "id": "ack",
64
+ "label": "Acknowledge",
65
+ "kind": "primary",
66
+ "payload": { "choice": "ack" },
67
+ "metadata": { "command_text": "/answer ack" }
68
+ }
69
+ ],
70
+ "revision": { "id": "rev:demo:1", "version": 1 },
71
+ "updated_at_ms": 1,
72
+ "metadata": {}
73
+ }
74
+ }
75
+ ```
76
+
77
+ 2. Verify live state:
78
+
79
+ ```text
80
+ /mu ui status
81
+ /mu ui snapshot compact
82
+ /mu ui snapshot multiline
83
+ ```
84
+
85
+ 3. Handle command (`/answer ack`) in normal skill logic.
86
+
87
+ 4. Remove prompt doc:
88
+
89
+ ```json
90
+ { "action": "remove", "ui_id": "ui:demo" }
91
+ ```
92
+
93
+ ## UiDoc schema cheat sheet
94
+
95
+ Required top-level fields for each doc:
96
+
97
+ - `v`: `1`
98
+ - `ui_id`: non-empty string (max 64)
99
+ - `title`: non-empty string
100
+ - `components`: non-empty array (`text|list|key_value|divider`)
101
+ - `revision`: `{ id: string, version: nonnegative int }`
102
+ - `updated_at_ms`: nonnegative integer
103
+
104
+ Common optional fields (recommended):
105
+
106
+ - `summary`: deterministic fallback summary
107
+ - `actions`: interactive options (empty for pure status)
108
+ - `metadata`: profile/snapshot metadata and custom annotations
109
+
110
+ Component minimums:
111
+
112
+ - `text`: `id`, `text`
113
+ - `list`: `id`, `items[]` (`id`, `label`, optional `detail`, optional `tone`)
114
+ - `key_value`: `id`, `rows[]` (`key`, `value`, optional `tone`)
115
+ - `divider`: `id`
116
+
117
+ Action minimums:
118
+
119
+ - `id`, `label`
120
+ - `metadata.command_text` required for interactive routing
121
+ - optional: `kind`, `description`, `payload`, `component_id`, `callback_token`
122
+
123
+ ## mu_ui action semantics
124
+
125
+ - `status`
126
+ - Returns count, `ui_id` list, status-profile counts/warnings, and awaiting counts.
127
+ - `snapshot`
128
+ - `snapshot_format`: `compact|multiline` (defaults to `compact`).
129
+ - `set`
130
+ - Upsert one doc by `ui_id`.
131
+ - `update`
132
+ - Same behavior as `set` (single-doc upsert).
133
+ - `replace`
134
+ - Replace entire active doc set with `docs[]`.
135
+ - `remove`
136
+ - Remove one doc by `ui_id`.
137
+ - `clear`
138
+ - Remove all docs for the session.
139
+
140
+ ## Canonical templates
141
+
142
+ ### 1) Interactive `/answer` prompt
143
+
144
+ ```json
145
+ {
146
+ "action": "set",
147
+ "doc": {
148
+ "v": 1,
149
+ "ui_id": "ui:answer",
150
+ "title": "Answer",
151
+ "summary": "Please choose yes or no",
152
+ "components": [
153
+ { "kind": "text", "id": "prompt", "text": "Choose an answer", "metadata": {} }
154
+ ],
155
+ "actions": [
156
+ {
157
+ "id": "answer_yes",
158
+ "label": "Yes",
159
+ "kind": "primary",
160
+ "payload": { "choice": "yes" },
161
+ "metadata": { "command_text": "/answer yes" }
162
+ },
163
+ {
164
+ "id": "answer_no",
165
+ "label": "No",
166
+ "kind": "secondary",
167
+ "payload": { "choice": "no" },
168
+ "metadata": { "command_text": "/answer no" }
169
+ }
170
+ ],
171
+ "revision": { "id": "rev:answer:1", "version": 1 },
172
+ "updated_at_ms": 1,
173
+ "metadata": {}
174
+ }
175
+ }
176
+ ```
177
+
178
+ Handler contract:
179
+
180
+ 1. Parse `/answer <choice>`.
181
+ 2. Validate choice.
182
+ 3. `mu_ui remove` (or `clear`) for `ui:answer`.
183
+ 4. Emit normal response.
184
+
185
+ ### 2) Status-profile doc (non-interactive)
186
+
187
+ ```json
188
+ {
189
+ "action": "set",
190
+ "doc": {
191
+ "v": 1,
192
+ "ui_id": "ui:planning",
193
+ "title": "Planning status",
194
+ "summary": "Drafting issue DAG",
195
+ "components": [
196
+ {
197
+ "kind": "key_value",
198
+ "id": "kv",
199
+ "rows": [
200
+ { "key": "phase", "value": "decomposition" },
201
+ { "key": "next", "value": "approval prompt" }
202
+ ],
203
+ "metadata": {}
204
+ },
205
+ {
206
+ "kind": "list",
207
+ "id": "milestones",
208
+ "items": [
209
+ { "id": "m1", "label": "Root issue captured" },
210
+ { "id": "m2", "label": "Leaf tasks drafted" }
211
+ ],
212
+ "metadata": {}
213
+ }
214
+ ],
215
+ "actions": [],
216
+ "revision": { "id": "rev:planning:12", "version": 12 },
217
+ "updated_at_ms": 1730000000000,
218
+ "metadata": {
219
+ "profile": {
220
+ "id": "planning",
221
+ "variant": "status",
222
+ "snapshot": {
223
+ "compact": "planning: DAG draft ready",
224
+ "multiline": "phase: decomposition\nnext: approval prompt"
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ ### 3) Parameterized command text with payload defaults
233
+
234
+ ```json
235
+ {
236
+ "id": "approve",
237
+ "label": "Approve",
238
+ "payload": { "choice": "approve", "note": "looks good" },
239
+ "metadata": { "command_text": "/answer choice={{choice}} note={{note}}" }
240
+ }
241
+ ```
242
+
243
+ In terminal UI interaction flow, placeholders are auto-filled from `payload` when possible, and unresolved fields are prompted.
244
+
245
+ ## Status-profile rules
246
+
247
+ When `metadata.profile.id` is one of `planning|subagents|control-flow|model-routing` and variant is `status`:
248
+
249
+ - expected `ui_id` values:
250
+ - `planning` -> `ui:planning`
251
+ - `subagents` -> `ui:subagents`
252
+ - `control-flow` -> `ui:control-flow`
253
+ - `model-routing` -> `ui:model-routing`
254
+ - keep `actions: []` (status docs are non-interactive)
255
+ - include `summary` plus `metadata.profile.snapshot.compact`
256
+ - preferred components by profile:
257
+ - `planning`: `key_value` + `list`
258
+ - `subagents`: `key_value` + `list`
259
+ - `control-flow`: `key_value`
260
+ - `model-routing`: `key_value` + `list`
261
+
262
+ Use `/mu ui status` to catch profile warnings early.
263
+
264
+ ## Debugging playbook
265
+
266
+ - **`doc is required`**
267
+ - Missing `doc` parameter for `set|update`.
268
+ - **`Invalid UiDoc.`**
269
+ - Schema mismatch. Re-check required fields and component/action shapes.
270
+ - **`docs must be an array` / `docs[i]: invalid UiDoc`**
271
+ - `replace` payload malformed.
272
+ - **Action appears but cannot run**
273
+ - Missing/empty `metadata.command_text`, or status-profile doc (actions intentionally non-runnable).
274
+ - **`awaiting` stays non-zero**
275
+ - Prompt doc still active. Remove with `mu_ui remove` once handled.
276
+
277
+ ## Verify and teardown checklist
278
+
279
+ After each change:
280
+
281
+ 1. `/mu ui status` shows expected doc count and ids.
282
+ 2. `/mu ui snapshot compact` shows deterministic summary.
283
+ 3. `/mu ui snapshot multiline` shows readable panel/action projection.
284
+ 4. Prompt resolved? Remove/clear doc explicitly.
285
+ 5. Keep issue/forum truth in sync; `mu_ui` is communication state, not source-of-truth task state.
286
+
287
+ ## Evaluation scenarios
288
+
289
+ 1. **First-time interactive prompt**
290
+ - Publish `ui:answer`, click action, confirm `/answer ...` reaches normal handler, remove prompt doc.
291
+
292
+ 2. **Status + decision split**
293
+ - Keep `ui:planning` status-profile doc active; open separate interactive approval doc; verify status remains non-interactive.
294
+
295
+ 3. **Replay/reconnect safety**
296
+ - Publish revisions 1 then 2; replay stale rev 1; verify highest revision remains active.
297
+
298
+ 4. **Channel degrade resilience**
299
+ - Ensure every actionable row has deterministic `command_text` fallback so manual command entry always works.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: subagents
3
- description: "Meta-skill for protocol-driven planning and execution. Routes to planning, protocol, execution, control-flow, model-routing, and hud."
3
+ description: "Meta-skill for protocol-driven planning and execution. Routes to planning, protocol, execution, control-flow, and model-routing with mu_ui-first communication."
4
4
  ---
5
5
 
6
6
  # subagents
@@ -14,21 +14,105 @@ Use this meta-skill when work should run through the full multi-agent DAG stack.
14
14
  - `execution` — durable orchestration/supervision loop over the DAG.
15
15
  - `control-flow` — loop/termination overlays (`flow:*`) on top of protocol primitives.
16
16
  - `model-routing` — provider/model/thinking overlays (`route:*`) from live harness capabilities.
17
- - `hud` — canonical HUD ownership/update/teardown contract.
18
17
 
19
- ## Hard-cutover naming
18
+ ## Naming conventions
20
19
 
21
20
  - Use `protocol` (not `orchestration`).
22
- - Use `execution` (not the old execution leaf named `subagents`).
21
+ - Use `execution` for execution/supervision workflows.
23
22
 
24
23
  ## Recommended bundles
25
24
 
26
- - Planning bundle: `planning` + `protocol` + `hud`
27
- - Execution bundle: `execution` + `protocol` + `hud`
25
+ - Planning bundle: `planning` + `protocol`
26
+ - Execution bundle: `execution` + `protocol`
28
27
  - Policy overlays: add `control-flow` and/or `model-routing` as needed
29
28
 
29
+ ## Canonical mu_ui communication pattern
30
+
31
+ Use `mu_ui` as the shared operator↔human surface during planning/execution passes.
32
+
33
+ ```bash
34
+ /mu ui status
35
+ /mu ui snapshot compact
36
+ /mu ui snapshot multiline
37
+ ```
38
+
39
+ Status doc example (`ui:subagents`):
40
+
41
+ ```json
42
+ {
43
+ "action": "set",
44
+ "doc": {
45
+ "v": 1,
46
+ "ui_id": "ui:subagents",
47
+ "title": "Subagents execution status",
48
+ "summary": "ready=2 · active=1 · blocked=0",
49
+ "components": [
50
+ {
51
+ "kind": "key_value",
52
+ "id": "queue",
53
+ "title": "Queue",
54
+ "rows": [
55
+ { "key": "ready", "value": "2" },
56
+ { "key": "active", "value": "1" },
57
+ { "key": "blocked", "value": "0" }
58
+ ],
59
+ "metadata": {}
60
+ }
61
+ ],
62
+ "actions": [],
63
+ "revision": { "id": "subagents-status", "version": 3 },
64
+ "updated_at_ms": 1772060000000,
65
+ "metadata": {
66
+ "profile": {
67
+ "id": "subagents",
68
+ "variant": "status",
69
+ "snapshot": {
70
+ "compact": "ready=2 · active=1 · blocked=0",
71
+ "multiline": "ready: 2\nactive: 1\nblocked: 0"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Interactive prompt example (`ui:subagents:handoff`):
80
+
81
+ ```json
82
+ {
83
+ "action": "set",
84
+ "doc": {
85
+ "v": 1,
86
+ "ui_id": "ui:subagents:handoff",
87
+ "title": "Execution handoff decision",
88
+ "components": [
89
+ { "kind": "text", "id": "question", "text": "Close root now?", "metadata": {} }
90
+ ],
91
+ "actions": [
92
+ {
93
+ "id": "close-root",
94
+ "label": "Close root",
95
+ "kind": "primary",
96
+ "payload": {},
97
+ "metadata": { "command_text": "/answer close-root" }
98
+ }
99
+ ],
100
+ "revision": { "id": "subagents-handoff", "version": 1 },
101
+ "updated_at_ms": 1772060005000,
102
+ "metadata": { "profile": { "id": "subagents-handoff", "variant": "interactive" } }
103
+ }
104
+ }
105
+ ```
106
+
107
+ Teardown/handoff uses explicit removes:
108
+
109
+ ```json
110
+ {"action":"remove","ui_id":"ui:subagents:handoff"}
111
+ {"action":"remove","ui_id":"ui:subagents"}
112
+ ```
113
+
30
114
  ## Common patterns
31
115
 
32
- - **End-to-End Orchestration**: Route to `planning` to get a structured issue DAG, present the plan in the `hud` to the user, then route to `execution` to drive the workers until the DAG is complete.
116
+ - **End-to-End Orchestration**: Route to `planning` to get a structured issue DAG, publish plan state in `ui:planning` (status) plus `ui:planning:approval` (interactive prompt) when needed, then route to `execution` to drive workers until DAG completion.
33
117
  - **DAG Recovery / Unblocking**: If a DAG stalls, route to `protocol` to inspect `mu issues ready` constraints, followed by a bounded `execution` pass to claim and manually unblock the stalled task.
34
- - **Differentiated Model Provisioning**: If different nodes need different abilities (e.g. specialized docs vs. complex refactoring), add `model-routing` to set `route:model-routing-v1` policies per issue. The `execution` worker shell will then automatically spin up the required model profiles based on those policies.
118
+ - **Differentiated Model Provisioning**: If different nodes need different abilities (for example specialized docs vs. complex refactoring), add `model-routing` to set `route:model-routing-v1` policies per issue. The `execution` worker shell will then launch the required model profiles based on those policies.
@@ -17,7 +17,7 @@ shared protocol.
17
17
  - [Transition table](#transition-table)
18
18
  - [Planning handoff contract](#planning-handoff-contract)
19
19
  - [Subagents/heartbeat execution contract](#subagentsheartbeat-execution-contract)
20
- - [HUD visibility and teardown](#hud-visibility-and-teardown)
20
+ - [mu_ui visibility and handoff](#mu_ui-visibility-and-handoff)
21
21
  - [Evaluation scenarios](#evaluation-scenarios)
22
22
 
23
23
  ## Purpose
@@ -37,7 +37,7 @@ Load these skills before applying control-flow policies:
37
37
  - `protocol` (protocol primitives/invariants)
38
38
  - `execution` (durable execution runtime)
39
39
  - `heartbeats` and/or `crons` (scheduler clock)
40
- - `hud` (required visibility/handoff surface)
40
+ - `mu` (for `/mu ui` inspection commands and communication checks)
41
41
 
42
42
  ## Core contract
43
43
 
@@ -128,29 +128,134 @@ Per orchestrator tick:
128
128
  4. Verify with:
129
129
  - `mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty`
130
130
  - `mu issues validate <root-id>`
131
- 5. Post one concise ORCH_PASS update.
132
- 6. If final: disable heartbeat program.
131
+ 5. Upsert control-flow visibility via `mu_ui` (`ui_id:"ui:subagents"` when orchestration is shared, or `ui_id:"ui:control-flow"` when standalone).
132
+ 6. Post one concise ORCH_PASS update.
133
+ 7. If final: disable heartbeat program.
133
134
 
134
135
  Reusable bounded heartbeat prompt fragment:
135
136
 
136
137
  ```text
137
- Use skills subagents, protocol, execution, control-flow, and hud.
138
+ Use skills subagents, protocol, execution, control-flow, and mu.
138
139
  For root <root-id>, enforce flow:review-gated-v1 with spawn-per-attempt rounds.
139
- Run exactly one bounded control-flow transition pass, verify DAG state,
140
+ Run exactly one bounded control-flow transition pass, keep control-flow visibility
141
+ current via mu_ui (`ui:subagents` or `ui:control-flow`), verify DAG state,
140
142
  post one ORCH_PASS, and stop. If validate is final, disable the supervising
141
143
  heartbeat and report completion.
142
144
  ```
143
145
 
144
- ## HUD visibility and teardown
146
+ ## mu_ui visibility and handoff
147
+
148
+ Use `mu_ui` as the primary communication surface for active control-flow
149
+ execution.
150
+
151
+ - Publish control-flow status in one status-profile doc:
152
+ - shared orchestration: `ui_id:"ui:subagents"`
153
+ - standalone control-flow loop: `ui_id:"ui:control-flow"`
154
+ - Set profile metadata for deterministic snapshots:
155
+ - `metadata.profile.id: "subagents"` or `"control-flow"`
156
+ - `metadata.profile.variant: "status"`
157
+ - `metadata.profile.snapshot.compact|multiline`
158
+ - Keep status docs non-interactive (`actions: []`).
159
+ - For user decisions (for example max-round escalation), publish a separate
160
+ interactive prompt doc (for example `ui_id:"ui:control-flow:escalation"`).
161
+ - Update status docs each bounded pass before posting `ORCH_PASS`.
162
+ - On completion or handoff, remove control-flow-owned docs with explicit
163
+ `mu_ui remove` actions. Prefer `remove` over `clear`.
164
+
165
+ ### Canonical status doc (`ui:control-flow`)
166
+
167
+ ```json
168
+ {
169
+ "action": "set",
170
+ "doc": {
171
+ "v": 1,
172
+ "ui_id": "ui:control-flow",
173
+ "title": "Control-flow status",
174
+ "summary": "policy=review-gated · round=2/3 · state=review_pending",
175
+ "components": [
176
+ {
177
+ "kind": "key_value",
178
+ "id": "policy",
179
+ "title": "Review gate",
180
+ "rows": [
181
+ { "key": "policy", "value": "flow:review-gated-v1" },
182
+ { "key": "round", "value": "2/3" },
183
+ { "key": "attempt", "value": "mu-attempt-2" },
184
+ { "key": "review", "value": "mu-review-2" },
185
+ { "key": "next", "value": "Run review_2" }
186
+ ],
187
+ "metadata": {}
188
+ }
189
+ ],
190
+ "actions": [],
191
+ "revision": { "id": "control-flow-status", "version": 5 },
192
+ "updated_at_ms": 1772067720000,
193
+ "metadata": {
194
+ "profile": {
195
+ "id": "control-flow",
196
+ "variant": "status",
197
+ "snapshot": {
198
+ "compact": "round=2/3 · state=review_pending",
199
+ "multiline": "policy: review-gated\nround: 2/3\nstate: review_pending\nnext: run review_2"
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+ ```
145
206
 
146
- HUD usage is not optional for active control-flow execution.
207
+ ### Canonical escalation prompt (`ui:control-flow:escalation`)
208
+
209
+ ```json
210
+ {
211
+ "action": "set",
212
+ "doc": {
213
+ "v": 1,
214
+ "ui_id": "ui:control-flow:escalation",
215
+ "title": "Review rounds exhausted",
216
+ "summary": "Need user decision after max failed review rounds.",
217
+ "components": [
218
+ {
219
+ "kind": "text",
220
+ "id": "question",
221
+ "text": "Max review rounds were reached. Should execution open another attempt or stop for manual intervention?",
222
+ "metadata": {}
223
+ }
224
+ ],
225
+ "actions": [
226
+ {
227
+ "id": "open-extra-round",
228
+ "label": "Open one extra round",
229
+ "kind": "primary",
230
+ "payload": {},
231
+ "metadata": { "command_text": "/answer open-extra-round" }
232
+ },
233
+ {
234
+ "id": "stop-and-handoff",
235
+ "label": "Stop and hand off",
236
+ "kind": "secondary",
237
+ "payload": {},
238
+ "metadata": { "command_text": "/answer stop-and-handoff" }
239
+ }
240
+ ],
241
+ "revision": { "id": "control-flow-escalation", "version": 1 },
242
+ "updated_at_ms": 1772067730000,
243
+ "metadata": {
244
+ "profile": {
245
+ "id": "control-flow-escalation",
246
+ "variant": "interactive"
247
+ }
248
+ }
249
+ }
250
+ }
251
+ ```
147
252
 
148
- - If subagents HUD is already active, publish control-flow state in that HUD doc
149
- (for example policy mode, round counters, escalation state).
150
- - If running control-flow standalone, own a dedicated `hud_id:"control-flow"` doc.
151
- - Update HUD state each bounded pass before reporting ORCH_PASS output.
253
+ ### Teardown / handoff
152
254
 
153
- - Follow the HUD ownership and teardown protocol from the `hud` skill when completing or handing off.
255
+ ```json
256
+ {"action":"remove","ui_id":"ui:control-flow:escalation"}
257
+ {"action":"remove","ui_id":"ui:control-flow"}
258
+ ```
154
259
 
155
260
  ## Evaluation scenarios
156
261