@femtomc/mu-agent 26.2.103 → 26.2.105
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/README.md +4 -1
- package/assets/mu-tui-logo.png +0 -0
- package/dist/extensions/branding.d.ts.map +1 -1
- package/dist/extensions/branding.js +56 -18
- package/package.json +4 -2
- package/prompts/skills/code-mode/SKILL.md +134 -0
- package/prompts/skills/control-flow/SKILL.md +164 -0
- package/prompts/skills/crons/SKILL.md +2 -1
- package/prompts/skills/heartbeats/SKILL.md +2 -1
- package/prompts/skills/hud/SKILL.md +34 -1
- package/prompts/skills/mu/SKILL.md +9 -3
- package/prompts/skills/{hierarchical-work-protocol → orchestration}/SKILL.md +20 -3
- package/prompts/skills/planning/SKILL.md +13 -2
- package/prompts/skills/setup-discord/SKILL.md +7 -0
- package/prompts/skills/setup-neovim/SKILL.md +7 -0
- package/prompts/skills/subagents/SKILL.md +34 -10
- package/prompts/skills/tmux/SKILL.md +149 -0
package/README.md
CHANGED
|
@@ -28,7 +28,10 @@ into `~/.mu/skills/` (or `$MU_HOME/skills/`) by the CLI store-initialization pat
|
|
|
28
28
|
- `memory`
|
|
29
29
|
- `planning`
|
|
30
30
|
- `hud`
|
|
31
|
-
- `
|
|
31
|
+
- `orchestration`
|
|
32
|
+
- `control-flow`
|
|
33
|
+
- `code-mode`
|
|
34
|
+
- `tmux`
|
|
32
35
|
- `subagents`
|
|
33
36
|
- `heartbeats`
|
|
34
37
|
- `crons`
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/extensions/branding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/extensions/branding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,+BAA+B,CAAC;AAsGpF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,QAuPjD;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* - Terminal title and working message branding
|
|
7
7
|
* - Lightweight periodic status refresh (open/ready/control-plane)
|
|
8
8
|
*/
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
9
10
|
import { basename } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { Image as TuiImage, detectCapabilities } from "@mariozechner/pi-tui";
|
|
10
13
|
import { MU_DEFAULT_THEME_NAME, MU_VERSION } from "../ui_defaults.js";
|
|
11
14
|
import { registerMuSubcommand } from "./mu-command-dispatcher.js";
|
|
12
15
|
import { fetchMuStatus, muServerUrl } from "./shared.js";
|
|
@@ -17,6 +20,24 @@ const EMPTY_SNAPSHOT = {
|
|
|
17
20
|
adapters: [],
|
|
18
21
|
error: null,
|
|
19
22
|
};
|
|
23
|
+
const TUI_LOGO_MIME_TYPE = "image/png";
|
|
24
|
+
const TUI_LOGO_FILENAME = "mu-tui-logo.png";
|
|
25
|
+
const TUI_LOGO_MAX_WIDTH_CELLS = 16;
|
|
26
|
+
function resolveTuiLogoPath() {
|
|
27
|
+
return fileURLToPath(new URL("../../assets/mu-tui-logo.png", import.meta.url));
|
|
28
|
+
}
|
|
29
|
+
function readTuiLogoBase64() {
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync(resolveTuiLogoPath()).toString("base64");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const TUI_LOGO_BASE64 = readTuiLogoBase64();
|
|
38
|
+
function canRenderTuiLogoImage() {
|
|
39
|
+
return TUI_LOGO_BASE64 !== null && detectCapabilities().images !== null;
|
|
40
|
+
}
|
|
20
41
|
const ANSI_RE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
21
42
|
function visibleWidth(text) {
|
|
22
43
|
return text.replace(ANSI_RE, "").length;
|
|
@@ -38,6 +59,12 @@ function centerLine(text, width) {
|
|
|
38
59
|
const pad = Math.floor((width - vw) / 2);
|
|
39
60
|
return " ".repeat(pad) + text;
|
|
40
61
|
}
|
|
62
|
+
function centerLogoLines(lines, width) {
|
|
63
|
+
const targetLogoWidth = Math.max(1, Math.min(TUI_LOGO_MAX_WIDTH_CELLS, width - 2));
|
|
64
|
+
const pad = Math.max(0, Math.floor((width - targetLogoWidth) / 2));
|
|
65
|
+
const prefix = " ".repeat(pad);
|
|
66
|
+
return lines.map((line) => (line.length > 0 ? `${prefix}${line}` : line));
|
|
67
|
+
}
|
|
41
68
|
function routesFromStatus(adapters, routes) {
|
|
42
69
|
if (routes && routes.length > 0)
|
|
43
70
|
return routes;
|
|
@@ -85,24 +112,35 @@ export function brandingExtension(pi) {
|
|
|
85
112
|
ctx.ui.setTitle(`mu · ${repoName}`);
|
|
86
113
|
ctx.ui.setWorkingMessage("working…");
|
|
87
114
|
ctx.ui.setWidget("mu-quick-actions", undefined);
|
|
88
|
-
ctx.ui.setHeader((_tui, theme) =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
ctx.ui.setHeader((_tui, theme) => {
|
|
116
|
+
const logoComponent = canRenderTuiLogoImage()
|
|
117
|
+
? new TuiImage(TUI_LOGO_BASE64, TUI_LOGO_MIME_TYPE, { fallbackColor: (text) => theme.fg("dim", text) }, { maxWidthCells: TUI_LOGO_MAX_WIDTH_CELLS, filename: TUI_LOGO_FILENAME })
|
|
118
|
+
: null;
|
|
119
|
+
return {
|
|
120
|
+
render(width) {
|
|
121
|
+
const cpPart = snapshot.error
|
|
122
|
+
? ""
|
|
123
|
+
: snapshot.controlPlaneActive
|
|
124
|
+
? ` ${theme.fg("muted", "·")} ${theme.fg("success", `cp:${snapshot.adapters.join(",") || "on"}`)}`
|
|
125
|
+
: "";
|
|
126
|
+
const line = [
|
|
127
|
+
theme.fg("accent", theme.bold("μ")),
|
|
128
|
+
theme.fg("muted", "·"),
|
|
129
|
+
theme.fg("dim", `v${MU_VERSION}`),
|
|
130
|
+
theme.fg("muted", "·"),
|
|
131
|
+
theme.fg("dim", repoName),
|
|
132
|
+
].join(" ") + cpPart;
|
|
133
|
+
if (!logoComponent) {
|
|
134
|
+
return [centerLine(line, width)];
|
|
135
|
+
}
|
|
136
|
+
const logoLines = centerLogoLines(logoComponent.render(width), width);
|
|
137
|
+
return [...logoLines, centerLine(line, width)];
|
|
138
|
+
},
|
|
139
|
+
invalidate() {
|
|
140
|
+
logoComponent?.invalidate();
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
});
|
|
106
144
|
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
107
145
|
const requestRender = () => tui.requestRender();
|
|
108
146
|
const unsubscribeBranch = footerData.onBranchChange(requestRender);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@femtomc/mu-agent",
|
|
3
|
-
"version": "26.2.
|
|
3
|
+
"version": "26.2.105",
|
|
4
4
|
"description": "Shared operator runtime for mu assistant sessions and serve extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mu",
|
|
@@ -20,14 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist/**",
|
|
23
|
+
"assets/**",
|
|
23
24
|
"prompts/**",
|
|
24
25
|
"themes/**"
|
|
25
26
|
],
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@femtomc/mu-core": "26.2.
|
|
28
|
+
"@femtomc/mu-core": "26.2.105",
|
|
28
29
|
"@mariozechner/pi-agent-core": "^0.54.2",
|
|
29
30
|
"@mariozechner/pi-ai": "^0.54.2",
|
|
30
31
|
"@mariozechner/pi-coding-agent": "^0.54.2",
|
|
32
|
+
"@mariozechner/pi-tui": "^0.54.2",
|
|
31
33
|
"zod": "^4.1.9"
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-mode
|
|
3
|
+
description: "Runs lightweight tmux-backed REPL workflows so agents can execute code and engineer context without bloating prompt history."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# code-mode
|
|
7
|
+
|
|
8
|
+
Use this skill when a task is better solved by iterative code execution in a live
|
|
9
|
+
REPL than by stuffing intermediate data into chat context.
|
|
10
|
+
|
|
11
|
+
The core idea is intentionally simple: `tmux` provides a persistent runtime shell,
|
|
12
|
+
and the agent drives it with `bash`.
|
|
13
|
+
|
|
14
|
+
## Contents
|
|
15
|
+
|
|
16
|
+
- [Core contract](#core-contract)
|
|
17
|
+
- [tmux skill dependency](#tmux-skill-dependency)
|
|
18
|
+
- [Minimal tmux execution loop](#minimal-tmux-execution-loop)
|
|
19
|
+
- [Context engineering contract](#context-engineering-contract)
|
|
20
|
+
- [Language-specific quick starts](#language-specific-quick-starts)
|
|
21
|
+
- [Integration with other mu skills](#integration-with-other-mu-skills)
|
|
22
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
23
|
+
|
|
24
|
+
## Core contract
|
|
25
|
+
|
|
26
|
+
1. **Use persistent runtime state, not prompt state**
|
|
27
|
+
- Keep working data in REPL variables, files, and process memory.
|
|
28
|
+
- Only return compact summaries/artifacts to chat.
|
|
29
|
+
|
|
30
|
+
2. **One session per task scope**
|
|
31
|
+
- Reuse the same tmux session while solving one problem.
|
|
32
|
+
- Use distinct session names for unrelated tasks to avoid state bleed.
|
|
33
|
+
|
|
34
|
+
3. **Bounded command passes**
|
|
35
|
+
- Send one coherent code block per pass.
|
|
36
|
+
- Capture output, summarize, decide next pass.
|
|
37
|
+
|
|
38
|
+
4. **On-demand discovery**
|
|
39
|
+
- Ask runtime for definitions/help only when needed (`help(...)`, `dir(...)`,
|
|
40
|
+
`.help`, etc.) instead of loading everything up front.
|
|
41
|
+
|
|
42
|
+
5. **No extra harness required**
|
|
43
|
+
- Trusted local workflows can stay minimal: `tmux` + `bash` + REPL.
|
|
44
|
+
|
|
45
|
+
## tmux skill dependency
|
|
46
|
+
|
|
47
|
+
Before mutating tmux session state, load **`tmux`** and follow its canonical
|
|
48
|
+
session lifecycle and bounded pass protocol.
|
|
49
|
+
|
|
50
|
+
- Treat `tmux` as source-of-truth for create/reuse, capture, fan-out, and teardown.
|
|
51
|
+
- This `code-mode` skill defines REPL/context-engineering behavior only.
|
|
52
|
+
|
|
53
|
+
## Minimal tmux execution loop
|
|
54
|
+
|
|
55
|
+
Follow the `Bounded execution protocol` in the `tmux` skill to create
|
|
56
|
+
sessions, run commands with a completion marker, and capture output.
|
|
57
|
+
|
|
58
|
+
Example session creation for a REPL:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
session="mu-code-py"
|
|
62
|
+
tmux has-session -t "$session" 2>/dev/null || tmux new-session -d -s "$session" "python3 -q"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then send your REPL commands and the marker, according to the `tmux` skill.
|
|
66
|
+
Teardown the session when finished.
|
|
67
|
+
|
|
68
|
+
## Context engineering contract
|
|
69
|
+
|
|
70
|
+
Use the runtime to compress context before speaking:
|
|
71
|
+
|
|
72
|
+
1. Load raw data into files/variables.
|
|
73
|
+
2. Execute code that filters, slices, or aggregates.
|
|
74
|
+
3. Persist useful artifacts (`summary.json`, `notes.md`, `results.csv`).
|
|
75
|
+
4. Report only:
|
|
76
|
+
- key findings,
|
|
77
|
+
- confidence/limits,
|
|
78
|
+
- artifact paths and next action.
|
|
79
|
+
|
|
80
|
+
Practical rules:
|
|
81
|
+
|
|
82
|
+
- Prefer computed summaries over pasted raw logs.
|
|
83
|
+
- Keep long transcripts in files; cite paths.
|
|
84
|
+
- Recompute when uncertain instead of guessing from stale text.
|
|
85
|
+
|
|
86
|
+
## Language-specific quick starts
|
|
87
|
+
|
|
88
|
+
Python:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
tmux new-session -d -s mu-code-py "python3 -q"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Node:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
tmux new-session -d -s mu-code-node "node"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
SQLite:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
tmux new-session -d -s mu-code-sql "sqlite3 data.db"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Shell-only REPL (for pipelines/tools):
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
tmux new-session -d -s mu-code-sh "bash --noprofile --norc -i"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Integration with other mu skills
|
|
113
|
+
|
|
114
|
+
- Use with `planning` when a plan step needs exploratory coding.
|
|
115
|
+
- Use with `orchestration`/`subagents` by assigning one tmux session per worker.
|
|
116
|
+
- Use with `control-flow` for explicit retry/termination policy around code passes.
|
|
117
|
+
- Use with `heartbeats`/`crons` when bounded code passes should run on schedule.
|
|
118
|
+
|
|
119
|
+
## Evaluation scenarios
|
|
120
|
+
|
|
121
|
+
1. **Exploratory data pass**
|
|
122
|
+
- Setup: large raw text/log corpus.
|
|
123
|
+
- Expected: agent uses REPL transforms to produce concise findings + artifact path,
|
|
124
|
+
without dumping full corpus into chat.
|
|
125
|
+
|
|
126
|
+
2. **Multi-pass debugging**
|
|
127
|
+
- Setup: bug reproduction requires iterative commands.
|
|
128
|
+
- Expected: same tmux session is reused across passes; state continuity reduces
|
|
129
|
+
repeated setup and prompt churn.
|
|
130
|
+
|
|
131
|
+
3. **Language swap with same control pattern**
|
|
132
|
+
- Setup: compare Python and Node approaches.
|
|
133
|
+
- Expected: same tmux send/capture loop works across both REPLs with only session
|
|
134
|
+
bootstrap command changed.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: control-flow
|
|
3
|
+
description: "Defines compositional control-flow policies for orchestration DAGs (for example review-gated retry loops) using protocol-preserving transitions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# control-flow
|
|
7
|
+
|
|
8
|
+
Use this skill when work needs explicit loop/termination policy on top of the
|
|
9
|
+
shared orchestration protocol.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- [Purpose](#purpose)
|
|
14
|
+
- [Required dependencies](#required-dependencies)
|
|
15
|
+
- [Core contract](#core-contract)
|
|
16
|
+
- [Review-gated policy (`flow:review-gated-v1`)](#review-gated-policy-flowreview-gated-v1)
|
|
17
|
+
- [Transition table](#transition-table)
|
|
18
|
+
- [Planning handoff contract](#planning-handoff-contract)
|
|
19
|
+
- [Subagents/heartbeat execution contract](#subagentsheartbeat-execution-contract)
|
|
20
|
+
- [HUD visibility and teardown](#hud-visibility-and-teardown)
|
|
21
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
22
|
+
|
|
23
|
+
## Purpose
|
|
24
|
+
|
|
25
|
+
Control-flow policies are overlays. They do not replace orchestration protocol
|
|
26
|
+
semantics; they guide which protocol primitive to apply next.
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
- review-gated retries
|
|
30
|
+
- bounded retry + human escalation
|
|
31
|
+
- checkpoint/approval gates
|
|
32
|
+
|
|
33
|
+
## Required dependencies
|
|
34
|
+
|
|
35
|
+
Load these skills before applying control-flow policies:
|
|
36
|
+
|
|
37
|
+
- `orchestration` (protocol primitives/invariants)
|
|
38
|
+
- `subagents` (durable execution runtime)
|
|
39
|
+
- `heartbeats` and/or `crons` (scheduler clock)
|
|
40
|
+
- `hud` (required visibility/handoff surface)
|
|
41
|
+
|
|
42
|
+
## Core contract
|
|
43
|
+
|
|
44
|
+
1. **Overlay, don’t fork protocol**
|
|
45
|
+
- Keep `hierarchical-work.protocol/v1` + `proto:hierarchical-work-v1`.
|
|
46
|
+
- Do not invent new protocol IDs for policy variants.
|
|
47
|
+
|
|
48
|
+
2. **Policy metadata lives in `flow:*`**
|
|
49
|
+
- Keep policy tags/metadata orthogonal to `kind:*` and `ctx:*`.
|
|
50
|
+
|
|
51
|
+
3. **Transitions compile to protocol primitives**
|
|
52
|
+
- Use only `spawn|fork|expand|ask|complete|serial` plus normal issue lifecycle
|
|
53
|
+
commands (`claim/open/close/dep`).
|
|
54
|
+
|
|
55
|
+
4. **Bounded pass per tick**
|
|
56
|
+
- One control-flow transition decision and one bounded mutation bundle per
|
|
57
|
+
heartbeat pass; verify then exit.
|
|
58
|
+
|
|
59
|
+
## Review-gated policy (`flow:review-gated-v1`)
|
|
60
|
+
|
|
61
|
+
### Tag vocabulary
|
|
62
|
+
|
|
63
|
+
- `flow:review-gated-v1` — subtree uses review-gated policy
|
|
64
|
+
- `flow:attempt` — implementation attempt node
|
|
65
|
+
- `flow:review` — review gate node
|
|
66
|
+
|
|
67
|
+
Optional metadata in issue body/forum packet:
|
|
68
|
+
- `max_review_rounds=<N>` (default recommended: 3)
|
|
69
|
+
|
|
70
|
+
### Required shape per round
|
|
71
|
+
|
|
72
|
+
For round `k` under policy scope:
|
|
73
|
+
|
|
74
|
+
- `attempt_k` (executable; usually `kind:spawn` or `kind:fork`)
|
|
75
|
+
- `review_k` (executable; usually `kind:fork`, `ctx:inherit`)
|
|
76
|
+
- edge: `attempt_k blocks review_k`
|
|
77
|
+
|
|
78
|
+
### Critical invariant
|
|
79
|
+
|
|
80
|
+
When review fails, **do not leave the review node closed as `needs_work`**.
|
|
81
|
+
That keeps the DAG non-final forever.
|
|
82
|
+
|
|
83
|
+
Instead:
|
|
84
|
+
1. record verdict in forum (`VERDICT: needs_work`)
|
|
85
|
+
2. spawn `attempt_{k+1}` + `review_{k+1}`
|
|
86
|
+
3. add `attempt_{k+1} blocks review_{k+1}`
|
|
87
|
+
4. close `review_k` with `outcome=expanded`
|
|
88
|
+
|
|
89
|
+
This preserves full audit history while keeping finalization reachable.
|
|
90
|
+
|
|
91
|
+
## Transition table
|
|
92
|
+
|
|
93
|
+
Given current round `(attempt_k, review_k)`:
|
|
94
|
+
|
|
95
|
+
1. **attempt not finished**
|
|
96
|
+
- action: continue attempt execution (normal worker loop)
|
|
97
|
+
|
|
98
|
+
2. **attempt finished, review pending**
|
|
99
|
+
- action: run review_k
|
|
100
|
+
|
|
101
|
+
3. **review verdict = pass**
|
|
102
|
+
- action: `complete(review_k)` with `success`
|
|
103
|
+
- if subtree validates final, disable supervising heartbeat
|
|
104
|
+
|
|
105
|
+
4. **review verdict = needs_work, rounds < max**
|
|
106
|
+
- action: apply fail->expand transition (spawn next round + close review_k as `expanded`)
|
|
107
|
+
|
|
108
|
+
5. **review verdict = needs_work, rounds >= max**
|
|
109
|
+
- action: create `kind:ask` escalation node (`ctx:human`, `actor:user`)
|
|
110
|
+
- downstream work blocks on that ask node
|
|
111
|
+
|
|
112
|
+
## Planning handoff contract
|
|
113
|
+
|
|
114
|
+
When planning a review-gated subtree:
|
|
115
|
+
|
|
116
|
+
1. Tag policy scope root (or selected goal node) with `flow:review-gated-v1`.
|
|
117
|
+
2. Create round-1 pair (`flow:attempt`, `flow:review`) + dependency edge.
|
|
118
|
+
3. Encode acceptance criteria for attempt + review explicitly.
|
|
119
|
+
4. Record max rounds policy in body/forum packet.
|
|
120
|
+
|
|
121
|
+
## Subagents/heartbeat execution contract
|
|
122
|
+
|
|
123
|
+
Per orchestrator tick:
|
|
124
|
+
|
|
125
|
+
1. `read_tree` + ready-set + round-state inspection.
|
|
126
|
+
2. Select one transition from the table above.
|
|
127
|
+
3. Apply one bounded transition bundle.
|
|
128
|
+
4. Verify with:
|
|
129
|
+
- `mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty`
|
|
130
|
+
- `mu issues validate <root-id>`
|
|
131
|
+
5. Post one concise ORCH_PASS update.
|
|
132
|
+
6. If final: disable heartbeat program.
|
|
133
|
+
|
|
134
|
+
Reusable bounded heartbeat prompt fragment:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
Use skills orchestration, control-flow, subagents, and hud.
|
|
138
|
+
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
|
+
post one ORCH_PASS, and stop. If validate is final, disable the supervising
|
|
141
|
+
heartbeat and report completion.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## HUD visibility and teardown
|
|
145
|
+
|
|
146
|
+
HUD usage is not optional for active control-flow execution.
|
|
147
|
+
|
|
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.
|
|
152
|
+
|
|
153
|
+
- Follow the HUD ownership and teardown protocol from the `hud` skill when completing or handing off.
|
|
154
|
+
|
|
155
|
+
## Evaluation scenarios
|
|
156
|
+
|
|
157
|
+
1. **Single-pass review success**
|
|
158
|
+
- attempt_1 succeeds, review_1 succeeds, subtree validates final, heartbeat disables.
|
|
159
|
+
|
|
160
|
+
2. **One failed review then success**
|
|
161
|
+
- review_1 fails -> expand to round 2; review_2 succeeds -> final.
|
|
162
|
+
|
|
163
|
+
3. **Max-round escalation**
|
|
164
|
+
- repeated failed reviews hit `max_review_rounds`; ask node created and execution blocks awaiting human input.
|
|
@@ -152,7 +152,8 @@ post concise summary, then exit.
|
|
|
152
152
|
|
|
153
153
|
For DAG execution workloads, combine with:
|
|
154
154
|
- `planning`
|
|
155
|
-
- `
|
|
155
|
+
- `orchestration`
|
|
156
|
+
- `control-flow` (when explicit loop/termination policy is required)
|
|
156
157
|
- `subagents`
|
|
157
158
|
- `heartbeats` (for short-cadence wake loops)
|
|
158
159
|
|
|
@@ -145,7 +145,8 @@ packet mechanics, raw issue-ID lists). Include them only when diagnosing a block
|
|
|
145
145
|
|
|
146
146
|
For hierarchical DAG execution, pair this skill with:
|
|
147
147
|
- `planning`
|
|
148
|
-
- `
|
|
148
|
+
- `orchestration`
|
|
149
|
+
- `control-flow` (when explicit loop/termination policy is required)
|
|
149
150
|
- `subagents`
|
|
150
151
|
|
|
151
152
|
For wall-clock scheduling semantics (`at`, `every`, `cron`), use `crons`.
|
|
@@ -18,6 +18,7 @@ This skill is the canonical HUD reference for:
|
|
|
18
18
|
- [Core contract](#core-contract)
|
|
19
19
|
- [HudDoc shape](#huddoc-shape)
|
|
20
20
|
- [Recommended turn loop](#recommended-turn-loop)
|
|
21
|
+
- [Ownership and teardown protocol](#ownership-and-teardown-protocol)
|
|
21
22
|
- [Planning and subagents profiles](#planning-and-subagents-profiles)
|
|
22
23
|
- [Determinism and rendering limits](#determinism-and-rendering-limits)
|
|
23
24
|
- [Evaluation scenarios](#evaluation-scenarios)
|
|
@@ -135,6 +136,38 @@ Example checklist doc:
|
|
|
135
136
|
|
|
136
137
|
4. Keep response text and HUD state aligned (no contradictions).
|
|
137
138
|
|
|
139
|
+
## Ownership and teardown protocol
|
|
140
|
+
|
|
141
|
+
HUD-using skills should treat HUD state as owned, explicit, and non-optional when
|
|
142
|
+
that skill declares HUD-required behavior.
|
|
143
|
+
|
|
144
|
+
1. **Own explicit `hud_id` values**
|
|
145
|
+
- Each active skill owns one canonical doc id (for example `planning`,
|
|
146
|
+
`subagents`, `control-flow`).
|
|
147
|
+
- Prefer `remove <hud_id>` over `clear` to avoid deleting other skills’ docs.
|
|
148
|
+
|
|
149
|
+
2. **Teardown is mandatory at skill end**
|
|
150
|
+
- When a HUD-owning skill completes, remove its doc(s).
|
|
151
|
+
- If no other HUD-owning skill is active next, turn HUD off.
|
|
152
|
+
|
|
153
|
+
3. **Teardown during HUD-to-HUD handoff**
|
|
154
|
+
- Remove current skill doc(s), keep HUD enabled, then let next skill set its doc.
|
|
155
|
+
- Never leave stale docs from prior skills during handoff.
|
|
156
|
+
|
|
157
|
+
Example teardown/handoff calls:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{"action":"remove","hud_id":"planning"}
|
|
161
|
+
{"action":"set","doc":{"v":1,"hud_id":"subagents","title":"Subagents HUD","snapshot_compact":"HUD(subagents)","updated_at_ms":1771853115001}}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Example full teardown (no next HUD skill):
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{"action":"remove","hud_id":"subagents"}
|
|
168
|
+
{"action":"off"}
|
|
169
|
+
```
|
|
170
|
+
|
|
138
171
|
## Planning and subagents profiles
|
|
139
172
|
|
|
140
173
|
Use profile-specific `hud_id` values:
|
|
@@ -168,4 +201,4 @@ If behavior is unclear, inspect implementation/tests before guessing:
|
|
|
168
201
|
- Expected: `subagents` doc updates queue/activity/chips after each bounded pass.
|
|
169
202
|
|
|
170
203
|
3. **HUD reset handoff**
|
|
171
|
-
- Expected: after phase completion, HUD is
|
|
204
|
+
- Expected: after phase completion, owned HUD docs are removed; HUD is turned off when no next HUD skill is active, or ownership cleanly hands off to the next skill with no stale docs.
|
|
@@ -177,8 +177,11 @@ mu cron --help
|
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
When work is multi-step and issue-graph driven, use `planning` to shape the DAG,
|
|
180
|
-
then `hud` for canonical HUD behavior, then `
|
|
181
|
-
semantics consistent, then `
|
|
180
|
+
then `hud` for canonical HUD behavior, then `orchestration` to keep DAG
|
|
181
|
+
semantics consistent, then `control-flow` for explicit loop/termination policy,
|
|
182
|
+
then `subagents` for durable execution.
|
|
183
|
+
For REPL-driven exploration and context compression, use `code-mode`.
|
|
184
|
+
For persistent terminal sessions and worker fan-out mechanics, use `tmux`.
|
|
182
185
|
For recurring bounded automation loops, use `heartbeats`.
|
|
183
186
|
For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
|
|
184
187
|
|
|
@@ -201,7 +204,10 @@ For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
|
|
|
201
204
|
- Historical context retrieval and index maintenance: **`memory`**
|
|
202
205
|
- Planning/decomposition and DAG review: **`planning`**
|
|
203
206
|
- HUD contract/state updates across surfaces: **`hud`**
|
|
204
|
-
- Shared DAG semantics for planning + execution: **`
|
|
207
|
+
- Shared DAG semantics for planning + execution: **`orchestration`**
|
|
208
|
+
- Loop/termination policy overlays (review gates, retries, escalation): **`control-flow`**
|
|
209
|
+
- Live REPL execution and context engineering via tmux: **`code-mode`**
|
|
210
|
+
- Persistent tmux session management + worker fan-out primitives: **`tmux`**
|
|
205
211
|
- Durable multi-agent orchestration: **`subagents`**
|
|
206
212
|
- Recurring bounded automation scheduling: **`heartbeats`**
|
|
207
213
|
- Wall-clock scheduling workflows: **`crons`**
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "Defines the shared
|
|
2
|
+
name: orchestration
|
|
3
|
+
description: "Defines the shared planning/execution orchestration protocol for issue-DAG work. Use when creating, validating, or executing protocol-driven DAG work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# orchestration
|
|
7
7
|
|
|
8
8
|
Use this skill when work should flow through one shared protocol from planning to execution.
|
|
9
9
|
|
|
10
|
+
This skill supersedes the previous `hierarchical-work-protocol` skill name.
|
|
11
|
+
|
|
10
12
|
## Contents
|
|
11
13
|
|
|
12
14
|
- [Protocol identity](#protocol-identity)
|
|
13
15
|
- [Canonical tags and node roles](#canonical-tags-and-node-roles)
|
|
16
|
+
- [Control-flow overlays](#control-flow-overlays)
|
|
14
17
|
- [Protocol primitives](#protocol-primitives)
|
|
15
18
|
- [Required invariants](#required-invariants)
|
|
16
19
|
- [Planning handoff contract](#planning-handoff-contract)
|
|
@@ -62,6 +65,20 @@ Node role rules:
|
|
|
62
65
|
- Must include: `proto:hierarchical-work-v1`, `kind:ask`, `ctx:human`, `actor:user`
|
|
63
66
|
- Must be non-executable (`node:agent` removed)
|
|
64
67
|
|
|
68
|
+
## Control-flow overlays
|
|
69
|
+
|
|
70
|
+
Control-flow is layered on top of this protocol and should not redefine protocol
|
|
71
|
+
primitives or `kind:*` semantics.
|
|
72
|
+
|
|
73
|
+
- Keep orchestration protocol tags/kinds as source-of-truth for structure.
|
|
74
|
+
- Represent policy-specific behavior (for example review gates, retry rounds,
|
|
75
|
+
escalation thresholds) with `flow:*` tags/metadata.
|
|
76
|
+
- Compile control-flow policy decisions into existing primitives (`spawn`, `fork`,
|
|
77
|
+
`expand`, `ask`, `complete`, `serial`) instead of introducing ad-hoc mutations.
|
|
78
|
+
|
|
79
|
+
Current compositional control-flow policy skill:
|
|
80
|
+
- `control-flow` (for example `flow:review-gated-v1` behavior)
|
|
81
|
+
|
|
65
82
|
## Protocol primitives
|
|
66
83
|
|
|
67
84
|
### `read_tree`
|
|
@@ -21,11 +21,13 @@ Use this skill when the user asks for planning, decomposition, or a staged execu
|
|
|
21
21
|
## Planning HUD is required
|
|
22
22
|
|
|
23
23
|
For this skill, the planning HUD is the primary status/communication surface.
|
|
24
|
+
HUD usage is not optional for planning turns.
|
|
24
25
|
|
|
25
26
|
- Keep HUD state in sync with real planning progress.
|
|
26
27
|
- Update HUD before and after each major planning turn.
|
|
27
28
|
- Use `waiting_on_user`, `next_action`, and `blocker` to communicate exactly what the user needs to do.
|
|
28
29
|
- Include a HUD snapshot in user-facing planning updates.
|
|
30
|
+
- Teardown/handoff HUD state explicitly when planning ends or transitions to another HUD-owning skill.
|
|
29
31
|
|
|
30
32
|
Default per-turn HUD loop:
|
|
31
33
|
|
|
@@ -33,6 +35,7 @@ Default per-turn HUD loop:
|
|
|
33
35
|
2. Keep checklist progress and root issue linkage synchronized with the live issue DAG.
|
|
34
36
|
3. Emit `snapshot` (`compact` or `multiline`) and reflect it in your response.
|
|
35
37
|
|
|
38
|
+
|
|
36
39
|
## HUD skill dependency
|
|
37
40
|
|
|
38
41
|
Before emitting or mutating planning HUD state, load **`hud`** and follow its canonical contract.
|
|
@@ -43,7 +46,7 @@ Before emitting or mutating planning HUD state, load **`hud`** and follow its ca
|
|
|
43
46
|
## Shared protocol dependency
|
|
44
47
|
|
|
45
48
|
This skill plans DAGs for execution by `subagents`, so planning must follow the
|
|
46
|
-
shared protocol in **`
|
|
49
|
+
shared protocol in **`orchestration`**.
|
|
47
50
|
|
|
48
51
|
Before creating or reshaping DAG nodes, load that skill and use its canonical:
|
|
49
52
|
|
|
@@ -54,6 +57,10 @@ Before creating or reshaping DAG nodes, load that skill and use its canonical:
|
|
|
54
57
|
|
|
55
58
|
Do not invent alternate protocol names or tag schemas.
|
|
56
59
|
|
|
60
|
+
If the user asks for explicit loop/termination behavior (for example review-gated
|
|
61
|
+
retry rounds), load **`control-flow`** and encode policy via `flow:*` overlays
|
|
62
|
+
without changing orchestration protocol semantics.
|
|
63
|
+
|
|
57
64
|
## Core contract
|
|
58
65
|
|
|
59
66
|
1. **Investigate first**
|
|
@@ -82,7 +89,10 @@ Do not invent alternate protocol names or tag schemas.
|
|
|
82
89
|
- Do not begin broad execution until the user signals satisfaction.
|
|
83
90
|
|
|
84
91
|
6. **After user approval, ask user about next steps**
|
|
85
|
-
- On user acceptance of the plan,
|
|
92
|
+
- On user acceptance of the plan, teardown planning HUD ownership.
|
|
93
|
+
- If handing off to another HUD-owning skill (for example `subagents`), remove
|
|
94
|
+
`hud_id:"planning"` and keep HUD on for the next skill.
|
|
95
|
+
- If no next HUD-owning skill starts immediately, remove planning doc and turn HUD off.
|
|
86
96
|
- Read the `subagents` skill and offer to supervise subagents to execute the plan.
|
|
87
97
|
|
|
88
98
|
## Suggested workflow
|
|
@@ -193,6 +203,7 @@ Required HUD updates during the loop:
|
|
|
193
203
|
- Re-emit the `planning` HUD doc with current `phase`, checklist progress, `waiting_on_user`, `next_action`, and `blocker` after each meaningful planning step.
|
|
194
204
|
- Use `{"action":"snapshot","snapshot_format":"compact"}` for concise user-facing HUD lines.
|
|
195
205
|
- Keep `updated_at_ms` monotonic across updates so latest doc wins deterministically.
|
|
206
|
+
- On plan completion/handoff, remove `hud_id:"planning"` and apply handoff/off semantics from the `hud` skill.
|
|
196
207
|
|
|
197
208
|
## Effective HUD usage heuristics
|
|
198
209
|
|
|
@@ -9,6 +9,13 @@ Use this skill when the user asks to set up Discord messaging for `mu`.
|
|
|
9
9
|
|
|
10
10
|
Goal: get Discord `/mu` ingress working with minimal user effort outside the terminal.
|
|
11
11
|
|
|
12
|
+
## Contents
|
|
13
|
+
|
|
14
|
+
- [Required user-provided inputs](#required-user-provided-inputs)
|
|
15
|
+
- [Agent-first workflow](#agent-first-workflow)
|
|
16
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
17
|
+
- [Notes and caveats](#notes-and-caveats)
|
|
18
|
+
|
|
12
19
|
## Required user-provided inputs
|
|
13
20
|
|
|
14
21
|
- Public webhook base URL reachable by Discord (for example `https://mu.example.com`)
|
|
@@ -9,6 +9,13 @@ Use this skill when the user asks to set up the Neovim messaging channel (`mu.nv
|
|
|
9
9
|
|
|
10
10
|
Goal: get `:Mu ...` working against `mu` control-plane with minimal user-side editor actions.
|
|
11
11
|
|
|
12
|
+
## Contents
|
|
13
|
+
|
|
14
|
+
- [Required user-provided inputs](#required-user-provided-inputs)
|
|
15
|
+
- [Agent-first workflow](#agent-first-workflow)
|
|
16
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
17
|
+
- [Safety and UX requirements](#safety-and-ux-requirements)
|
|
18
|
+
|
|
12
19
|
## Required user-provided inputs
|
|
13
20
|
|
|
14
21
|
- Confirmation that `mu.nvim` is installed (or permission for the agent to provide install snippet)
|
|
@@ -9,7 +9,9 @@ description: "Orchestrates issue-driven subagent execution with heartbeat superv
|
|
|
9
9
|
|
|
10
10
|
- [Purpose (what this skill is for)](#purpose-what-this-skill-is-for)
|
|
11
11
|
- [Shared protocol dependency](#shared-protocol-dependency)
|
|
12
|
+
- [Control-flow dependency](#control-flow-dependency)
|
|
12
13
|
- [HUD skill dependency](#hud-skill-dependency)
|
|
14
|
+
- [tmux skill dependency](#tmux-skill-dependency)
|
|
13
15
|
- [When to use](#when-to-use)
|
|
14
16
|
- [Success condition](#success-condition)
|
|
15
17
|
- [Dispatch modes](#dispatch-modes)
|
|
@@ -36,7 +38,7 @@ Source of truth remains in `mu issues` + `mu forum`.
|
|
|
36
38
|
|
|
37
39
|
## Shared protocol dependency
|
|
38
40
|
|
|
39
|
-
This skill executes DAG work defined by **`
|
|
41
|
+
This skill executes DAG work defined by **`orchestration`**.
|
|
40
42
|
|
|
41
43
|
Before orchestration begins, load that skill and enforce:
|
|
42
44
|
|
|
@@ -46,13 +48,32 @@ Before orchestration begins, load that skill and enforce:
|
|
|
46
48
|
|
|
47
49
|
Do not run subagent orchestration against alternate protocol tags.
|
|
48
50
|
|
|
51
|
+
## Control-flow dependency
|
|
52
|
+
|
|
53
|
+
When a subtree declares explicit loop/termination policy (for example
|
|
54
|
+
`flow:review-gated-v1`), load **`control-flow`** and apply policy transitions as
|
|
55
|
+
an overlay on orchestration primitives.
|
|
56
|
+
|
|
57
|
+
- Keep DAG structure protocol-valid (`orchestration` remains source-of-truth).
|
|
58
|
+
- Compile control-flow decisions into protocol primitives (`spawn`, `expand`,
|
|
59
|
+
`ask`, `complete`, `serial`), not ad-hoc mutations.
|
|
60
|
+
|
|
49
61
|
## HUD skill dependency
|
|
50
62
|
|
|
51
63
|
Before emitting or mutating subagent HUD state, load **`hud`** and follow its canonical contract.
|
|
64
|
+
HUD usage is not optional for this skill.
|
|
52
65
|
|
|
53
66
|
- Treat `hud` as source-of-truth for generic `mu_hud` actions, `HudDoc` shape, and rendering constraints.
|
|
54
67
|
- This subagents skill defines orchestration-specific conventions only (for example `hud_id: "subagents"`, queue/activity semantics).
|
|
55
68
|
|
|
69
|
+
## tmux skill dependency
|
|
70
|
+
|
|
71
|
+
Before spawning/inspecting worker sessions, load **`tmux`** and follow its
|
|
72
|
+
canonical session lifecycle and bounded send/capture protocol.
|
|
73
|
+
|
|
74
|
+
- Treat `tmux` as source-of-truth for session ownership, completion markers, and teardown.
|
|
75
|
+
- This subagents skill defines orchestration semantics and queue policy.
|
|
76
|
+
|
|
56
77
|
## When to use
|
|
57
78
|
|
|
58
79
|
- Work is represented as issue-scoped deliverables with explicit outcomes.
|
|
@@ -103,14 +124,15 @@ mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty
|
|
|
103
124
|
mu forum read issue:<root-id> --limit 20 --pretty
|
|
104
125
|
```
|
|
105
126
|
|
|
106
|
-
2. Choose exactly one action/primitive from `
|
|
127
|
+
2. Choose exactly one action/primitive from `orchestration`.
|
|
107
128
|
3. Apply it.
|
|
108
129
|
4. Verify (`get`, `children`, `ready`, `validate`).
|
|
109
|
-
5.
|
|
130
|
+
5. Update `hud_id:"subagents"` (required) and emit a compact snapshot.
|
|
131
|
+
6. Post a human-facing `ORCH_PASS` update to forum:
|
|
110
132
|
- start with a short title that captures status in plain language
|
|
111
133
|
- follow with one concise paragraph covering: project objective context, milestone moved this pass, impact, overall progress, and next high-level step
|
|
112
134
|
- include queue/worker/drift internals only when diagnosing blocker/anomaly.
|
|
113
|
-
|
|
135
|
+
7. Exit tick.
|
|
114
136
|
|
|
115
137
|
Stop automation when `mu issues validate <root-id>` returns final.
|
|
116
138
|
|
|
@@ -132,7 +154,7 @@ Repeat bounded passes until issue closes.
|
|
|
132
154
|
## Bootstrap and queue targeting
|
|
133
155
|
|
|
134
156
|
If root DAG does not yet exist, create it using the
|
|
135
|
-
`
|
|
157
|
+
`orchestration` bootstrap template first.
|
|
136
158
|
|
|
137
159
|
During orchestration, always scope queue reads with protocol tag:
|
|
138
160
|
|
|
@@ -147,9 +169,9 @@ mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --pretty
|
|
|
147
169
|
```bash
|
|
148
170
|
mu heartbeats create \
|
|
149
171
|
--title "hierarchical-work-v1 <root-id>" \
|
|
150
|
-
--reason
|
|
172
|
+
--reason orchestration_v1 \
|
|
151
173
|
--every-ms 15000 \
|
|
152
|
-
--prompt "Use skills subagents,
|
|
174
|
+
--prompt "Use skills subagents, orchestration, control-flow, and hud for root <root-id>. Run exactly one bounded orchestration pass: inspect the proto:hierarchical-work-v1 queue, perform exactly one corrective orchestration action (including in_progress-without-worker drift recovery) or claim/work-start one ready issue, then verify state. If flow:* policy tags are present, apply one control-flow transition from the control-flow skill in this pass. Report human-facing progress as a titled status note plus one concise paragraph that explains project context, milestone moved, impact, overall progress, and next high-level step; avoid low-level orchestration internals unless diagnosing a blocker/anomaly. Post a matching ORCH_PASS update to issue:<root-id>. Stop when 'mu issues validate <root-id>' is final."
|
|
153
175
|
```
|
|
154
176
|
|
|
155
177
|
Reusable status-voice add-on for heartbeat prompts (copy/paste):
|
|
@@ -169,13 +191,13 @@ run_id="$(date +%Y%m%d-%H%M%S)"
|
|
|
169
191
|
for issue_id in $(mu issues ready --root <root-id> --tag proto:hierarchical-work-v1 --json | jq -r '.[].id' | head -n 3); do
|
|
170
192
|
session="mu-sub-${run_id}-${issue_id}"
|
|
171
193
|
tmux new-session -d -s "$session" \
|
|
172
|
-
"cd '$PWD' && mu exec 'Use skills subagents,
|
|
194
|
+
"cd '$PWD' && mu exec 'Use skills subagents, orchestration, control-flow, and hud. Work issue ${issue_id} using hierarchical-work.protocol/v1. If flow:* policy tags are present, apply the control-flow overlay before selecting the next primitive. Claim first, then run one full control loop.' ; rc=\$?; echo __MU_DONE__:\$rc"
|
|
173
195
|
done
|
|
174
196
|
```
|
|
175
197
|
|
|
176
198
|
## Subagents HUD
|
|
177
199
|
|
|
178
|
-
|
|
200
|
+
HUD usage is required for this skill. Truth still lives in issues/forum.
|
|
179
201
|
|
|
180
202
|
```text
|
|
181
203
|
/mu hud on
|
|
@@ -194,7 +216,8 @@ Tool: `mu_hud`
|
|
|
194
216
|
- actions: refresh/spawn command hooks (if desired)
|
|
195
217
|
- metadata: include `style_preset:"subagents"` for consistent renderer emphasis
|
|
196
218
|
- Example update:
|
|
197
|
-
- `{"action":"set","doc":{"
|
|
219
|
+
- `{"action":"set", "doc": {"hud_id":"subagents", ...}}` (see `hud` skill for exact shape)
|
|
220
|
+
- Follow the HUD ownership and teardown protocol from `hud` skill for completion and handoff.
|
|
198
221
|
|
|
199
222
|
## Evaluation scenarios
|
|
200
223
|
|
|
@@ -216,6 +239,7 @@ Tool: `mu_hud`
|
|
|
216
239
|
- Merge synth-node outputs into one final user-facing result.
|
|
217
240
|
- Convert unresolved gaps into new child issues tagged `proto:hierarchical-work-v1`.
|
|
218
241
|
- Tear down temporary tmux sessions.
|
|
242
|
+
- Tear down/handoff `hud_id:"subagents"` ownership following the `hud` skill protocol.
|
|
219
243
|
|
|
220
244
|
## Safety
|
|
221
245
|
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tmux
|
|
3
|
+
description: "Provides canonical tmux session patterns for persistent REPLs, bounded command execution, and parallel worker fan-out."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tmux
|
|
7
|
+
|
|
8
|
+
Use this skill when other workflows need durable shell state, long-lived REPLs,
|
|
9
|
+
or parallel worker sessions.
|
|
10
|
+
|
|
11
|
+
This is a transport/runtime primitive skill. It does not define task semantics;
|
|
12
|
+
it defines how to run sessions reliably.
|
|
13
|
+
|
|
14
|
+
## Contents
|
|
15
|
+
|
|
16
|
+
- [Core contract](#core-contract)
|
|
17
|
+
- [Session lifecycle primitives](#session-lifecycle-primitives)
|
|
18
|
+
- [Bounded execution protocol](#bounded-execution-protocol)
|
|
19
|
+
- [Parallel fan-out pattern](#parallel-fan-out-pattern)
|
|
20
|
+
- [Teardown and diagnostics](#teardown-and-diagnostics)
|
|
21
|
+
- [Integration map](#integration-map)
|
|
22
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
23
|
+
|
|
24
|
+
## Core contract
|
|
25
|
+
|
|
26
|
+
1. **One logical task scope per session**
|
|
27
|
+
- Reuse a session for one task/thread.
|
|
28
|
+
- Use distinct names for unrelated tasks.
|
|
29
|
+
|
|
30
|
+
2. **Create-or-reuse, do not assume**
|
|
31
|
+
- Always check `tmux has-session` before creating.
|
|
32
|
+
|
|
33
|
+
3. **Bound command passes**
|
|
34
|
+
- Send one coherent pass, capture output, then decide the next pass.
|
|
35
|
+
- Use completion markers when possible.
|
|
36
|
+
|
|
37
|
+
4. **Prefer explicit ownership**
|
|
38
|
+
- Track which sessions this run created.
|
|
39
|
+
- Tear down owned sessions at completion/handoff.
|
|
40
|
+
|
|
41
|
+
5. **Keep it simple**
|
|
42
|
+
- `tmux` is a substrate; avoid extra protocol complexity unless the task requires it.
|
|
43
|
+
|
|
44
|
+
## Session lifecycle primitives
|
|
45
|
+
|
|
46
|
+
List and inspect:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
tmux list-sessions
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Create or reuse a shell session:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
session="mu-shell-main"
|
|
56
|
+
tmux has-session -t "$session" 2>/dev/null || tmux new-session -d -s "$session" "bash --noprofile --norc -i"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Attach for manual inspection:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
tmux attach -t "$session"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Bounded execution protocol
|
|
66
|
+
|
|
67
|
+
Send one command pass and wait for a marker:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
session="mu-shell-main"
|
|
71
|
+
token="__MU_DONE_$(date +%s%N)__"
|
|
72
|
+
|
|
73
|
+
tmux send-keys -t "$session" "echo start && pwd && ls" C-m
|
|
74
|
+
tmux send-keys -t "$session" "echo $token" C-m
|
|
75
|
+
|
|
76
|
+
for _ in $(seq 1 80); do
|
|
77
|
+
out="$(tmux capture-pane -pt "$session" -S -200)"
|
|
78
|
+
echo "$out" | grep -q "$token" && break
|
|
79
|
+
sleep 0.05
|
|
80
|
+
done
|
|
81
|
+
|
|
82
|
+
printf "%s\n" "$out"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use this same pattern for REPL sessions (`python3 -q`, `node`, `sqlite3`, etc.).
|
|
86
|
+
|
|
87
|
+
## Parallel fan-out pattern
|
|
88
|
+
|
|
89
|
+
Spawn one session per independent unit of work:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
run_id="$(date +%Y%m%d-%H%M%S)"
|
|
93
|
+
for work_id in a b c; do
|
|
94
|
+
session="mu-worker-${run_id}-${work_id}"
|
|
95
|
+
tmux new-session -d -s "$session" "bash -lc 'echo START:${work_id}; sleep 1; echo DONE:${work_id}'"
|
|
96
|
+
done
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Inspect recent output from all workers:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
for s in $(tmux list-sessions -F '#S' | grep '^mu-worker-'); do
|
|
103
|
+
echo "=== $s ==="
|
|
104
|
+
tmux capture-pane -pt "$s" -S -60 | tail -n 20
|
|
105
|
+
done
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Teardown and diagnostics
|
|
109
|
+
|
|
110
|
+
Kill one session:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
tmux kill-session -t "$session"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Kill owned worker set by prefix:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
for s in $(tmux list-sessions -F '#S' | grep '^mu-worker-20260224-'); do
|
|
120
|
+
tmux kill-session -t "$s"
|
|
121
|
+
done
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Quick diagnostics checklist:
|
|
125
|
+
|
|
126
|
+
1. `tmux list-sessions` (does session exist?)
|
|
127
|
+
2. `tmux capture-pane -pt <session> -S -200` (what actually happened?)
|
|
128
|
+
3. check marker presence / timeout behavior
|
|
129
|
+
4. recreate session if shell state is irrecoverably bad
|
|
130
|
+
|
|
131
|
+
## Integration map
|
|
132
|
+
|
|
133
|
+
- `code-mode`: tmux-backed REPL persistence and context engineering loops
|
|
134
|
+
- `subagents`: tmux fan-out for parallel worker execution
|
|
135
|
+
- `heartbeats` / `crons`: schedule bounded passes that dispatch into tmux workers
|
|
136
|
+
|
|
137
|
+
## Evaluation scenarios
|
|
138
|
+
|
|
139
|
+
1. **Persistent REPL continuity**
|
|
140
|
+
- Setup: run multi-pass Python debugging task.
|
|
141
|
+
- Expected: same session reused; state persists across passes.
|
|
142
|
+
|
|
143
|
+
2. **Bounded pass completion**
|
|
144
|
+
- Setup: command that emits long output.
|
|
145
|
+
- Expected: completion marker reliably terminates capture loop.
|
|
146
|
+
|
|
147
|
+
3. **Parallel worker fan-out**
|
|
148
|
+
- Setup: three independent work items.
|
|
149
|
+
- Expected: one session per item, inspectable output, clean teardown.
|