@femtomc/mu-agent 26.2.89 → 26.2.91
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 +7 -10
- package/dist/backend.d.ts +0 -2
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +2 -3
- package/dist/command_context.d.ts.map +1 -1
- package/dist/command_context.js +3 -14
- package/dist/default_prompts.d.ts +0 -3
- package/dist/default_prompts.d.ts.map +1 -1
- package/dist/default_prompts.js +0 -6
- package/dist/extensions/branding.d.ts.map +1 -1
- package/dist/extensions/branding.js +11 -0
- package/dist/extensions/hud-mode.d.ts +8 -0
- package/dist/extensions/hud-mode.d.ts.map +1 -0
- package/dist/extensions/hud-mode.js +21 -0
- package/dist/extensions/index.d.ts +0 -6
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +0 -6
- package/dist/extensions/planning-ui.d.ts.map +1 -1
- package/dist/extensions/planning-ui.js +17 -0
- package/dist/extensions/subagents-ui.d.ts.map +1 -1
- package/dist/extensions/subagents-ui.js +263 -118
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/operator.d.ts +0 -33
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +1 -72
- package/dist/self_documentation.d.ts.map +1 -1
- package/dist/self_documentation.js +0 -2
- package/dist/session_turn.d.ts +5 -3
- package/dist/session_turn.d.ts.map +1 -1
- package/dist/session_turn.js +27 -44
- package/package.json +3 -3
- package/prompts/roles/operator.md +1 -1
- package/prompts/skills/planning/SKILL.md +3 -3
- package/prompts/skills/subagents/SKILL.md +227 -106
- package/dist/mu_roles.d.ts +0 -13
- package/dist/mu_roles.d.ts.map +0 -1
- package/dist/mu_roles.js +0 -29
- package/prompts/roles/orchestrator.md +0 -43
- package/prompts/roles/reviewer.md +0 -35
- package/prompts/roles/worker.md +0 -38
- package/prompts/skills/reviewer/SKILL.md +0 -65
|
@@ -1,153 +1,274 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: subagents
|
|
3
|
-
description:
|
|
3
|
+
description: Orchestrate issue-driven subagent work with heartbeat supervision and tmux worker fan-out.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Subagents
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Purpose (what this skill is for)
|
|
9
|
+
|
|
10
|
+
Use this skill for **durable multi-agent orchestration**: work that must keep moving over time, not just one-shot execution.
|
|
11
|
+
|
|
12
|
+
This skill combines `mu` primitives into one orchestration model:
|
|
13
|
+
|
|
14
|
+
- `mu issues` = executable DAG, dependencies, lifecycle state
|
|
15
|
+
- `mu forum` = durable task/result packets
|
|
16
|
+
- `mu heartbeats` / `mu cron` = orchestrator wake cadence
|
|
17
|
+
- `tmux` + `mu exec` = parallel worker execution
|
|
18
|
+
- subagents HUD = observability/control board
|
|
19
|
+
|
|
20
|
+
Protocol truth lives in **issues + forum**. HUD/tmux are execution and visibility surfaces.
|
|
9
21
|
|
|
10
22
|
## When to use
|
|
11
23
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- You
|
|
24
|
+
- Work can be represented as issue-scoped deliverables with explicit outcomes.
|
|
25
|
+
- Dependencies may unblock over time.
|
|
26
|
+
- You want unattended progress between manual check-ins.
|
|
27
|
+
|
|
28
|
+
## Success condition
|
|
29
|
+
|
|
30
|
+
- Each executable issue is claimed, worked, and closed with an explicit outcome.
|
|
31
|
+
- Results are posted in `issue:<id>` forum topics.
|
|
32
|
+
- Root completion is validated via `mu issues validate <root-id>`.
|
|
33
|
+
|
|
34
|
+
## Dispatch modes
|
|
35
|
+
|
|
36
|
+
### 1) Heartbeat dispatch (orchestrator cadence)
|
|
37
|
+
|
|
38
|
+
Use when you want the orchestration loop to keep running over time.
|
|
39
|
+
|
|
40
|
+
Each heartbeat tick should run **one bounded control-loop pass**:
|
|
15
41
|
|
|
16
|
-
|
|
42
|
+
1. Read queue/tree state.
|
|
43
|
+
2. Choose one primitive (`ask`, `expand`, `complete`, etc.).
|
|
44
|
+
3. Apply one action.
|
|
45
|
+
4. Verify state + log progress.
|
|
46
|
+
5. Exit.
|
|
17
47
|
|
|
18
|
-
|
|
19
|
-
2. Ensure each child has clear acceptance criteria and dependency edges.
|
|
20
|
-
3. Launch one detached tmux session per ready child issue.
|
|
21
|
-
4. Monitor both tmux sessions and issue queue state, then reconcile outputs.
|
|
48
|
+
Heartbeat dispatch is the **orchestrator clock**. It should supervise/advance the graph, not run unbounded worker sessions.
|
|
22
49
|
|
|
23
|
-
|
|
50
|
+
### 2) tmux dispatch (parallel workers)
|
|
24
51
|
|
|
25
|
-
|
|
52
|
+
Use when multiple ready leaves should execute concurrently now.
|
|
53
|
+
|
|
54
|
+
Spawn one tmux session per ready issue. Each worker should claim one issue, run one full issue loop, then exit.
|
|
55
|
+
|
|
56
|
+
## Protocol: `subagents.protocol/v1` (how the skill executes)
|
|
57
|
+
|
|
58
|
+
### Primitive: `read_tree`
|
|
59
|
+
|
|
60
|
+
Before every mutation, inspect root + local node state:
|
|
26
61
|
|
|
27
62
|
```bash
|
|
28
|
-
|
|
29
|
-
mu issues
|
|
63
|
+
mu issues get <issue-id> --pretty
|
|
64
|
+
mu issues children <issue-id> --pretty
|
|
65
|
+
mu issues ready --root <root-id> --tag proto:subagents-v1 --pretty
|
|
66
|
+
mu forum read issue:<issue-id> --limit 20 --pretty
|
|
67
|
+
```
|
|
30
68
|
|
|
31
|
-
|
|
32
|
-
mu issues create "<child-1 deliverable>" --parent <root-id> --role worker --priority 2
|
|
33
|
-
mu issues create "<child-2 deliverable>" --parent <root-id> --role worker --priority 2
|
|
69
|
+
### Primitive: `claim`
|
|
34
70
|
|
|
35
|
-
|
|
36
|
-
mu issues dep <child-1> blocks <child-2>
|
|
71
|
+
Claim before doing work on an executable issue:
|
|
37
72
|
|
|
38
|
-
|
|
39
|
-
mu issues
|
|
73
|
+
```bash
|
|
74
|
+
mu issues claim <issue-id>
|
|
75
|
+
mu forum post issue:<issue-id> -m "START: <plan for this pass>" --author operator
|
|
40
76
|
```
|
|
41
77
|
|
|
42
|
-
|
|
78
|
+
### Primitive: `spawn` (clean-context child)
|
|
79
|
+
|
|
80
|
+
Create independent child tasks with scoped context:
|
|
43
81
|
|
|
44
82
|
```bash
|
|
45
|
-
|
|
83
|
+
child_json="$(mu issues create "<title>" \
|
|
84
|
+
--parent <issue-id> \
|
|
85
|
+
--body "<prompt + acceptance criteria>" \
|
|
86
|
+
--tag proto:subagents-v1 \
|
|
87
|
+
--tag kind:spawn \
|
|
88
|
+
--tag ctx:clean \
|
|
89
|
+
--priority 2 \
|
|
90
|
+
--json)"
|
|
91
|
+
child_id="$(echo "$child_json" | jq -r '.id')"
|
|
92
|
+
mu forum post issue:"$child_id" -m "<task packet>" --author operator
|
|
93
|
+
```
|
|
46
94
|
|
|
47
|
-
|
|
48
|
-
mu serve --port 3000
|
|
95
|
+
Use dependencies to control timing:
|
|
49
96
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
tmux new-session -d -s "$session" \
|
|
53
|
-
"cd '$PWD' && mu exec 'Work issue ${issue_id}. First: mu issues claim ${issue_id}. Keep forum updates on issue:${issue_id}. Close when complete.' ; rc=\$?; echo __MU_DONE__:\$rc"
|
|
54
|
-
done
|
|
97
|
+
```bash
|
|
98
|
+
mu issues dep <blocker-id> blocks <child-id>
|
|
55
99
|
```
|
|
56
100
|
|
|
57
|
-
|
|
58
|
-
|
|
101
|
+
### Primitive: `fork` (inherited-context child)
|
|
102
|
+
|
|
103
|
+
Create analysis/synthesis children that depend on sibling outputs.
|
|
104
|
+
Before creation, summarize dependency results from `mu forum read issue:<dep-id>`.
|
|
105
|
+
Then create with `kind:fork` + `ctx:inherit`.
|
|
106
|
+
|
|
107
|
+
### Primitive: `ask` (human input node)
|
|
59
108
|
|
|
60
|
-
|
|
109
|
+
Represent user questions as first-class nodes:
|
|
61
110
|
|
|
62
111
|
```bash
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
112
|
+
ask_json="$(mu issues create "Question: <question>" \
|
|
113
|
+
--parent <issue-id> \
|
|
114
|
+
--tag proto:subagents-v1 \
|
|
115
|
+
--priority 1 \
|
|
116
|
+
--json)"
|
|
117
|
+
ask_id="$(echo "$ask_json" | jq -r '.id')"
|
|
118
|
+
mu issues update "$ask_id" \
|
|
119
|
+
--remove-tag node:agent \
|
|
120
|
+
--add-tag kind:ask \
|
|
121
|
+
--add-tag ctx:human \
|
|
122
|
+
--add-tag actor:user
|
|
123
|
+
mu forum post issue:"$ask_id" \
|
|
124
|
+
-m "QUESTION: <question>\nOPTIONS: <list or free-form>\nReply in this topic, then close this issue." \
|
|
125
|
+
--author operator
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
If downstream work depends on the answer:
|
|
66
129
|
|
|
67
|
-
|
|
68
|
-
mu issues
|
|
69
|
-
mu issues list --root <root-id> --status in_progress --tag role:worker --pretty
|
|
130
|
+
```bash
|
|
131
|
+
mu issues dep <ask-id> blocks <child-id>
|
|
70
132
|
```
|
|
71
133
|
|
|
72
|
-
|
|
134
|
+
### Primitive: `complete`
|
|
73
135
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/mu subagents mode worker
|
|
80
|
-
/mu subagents refresh-interval 8
|
|
81
|
-
/mu subagents stale-after 60
|
|
82
|
-
/mu subagents pause off
|
|
83
|
-
/mu subagents refresh
|
|
84
|
-
/mu subagents spawn 3
|
|
85
|
-
/mu subagents snapshot
|
|
136
|
+
Always write a result packet, then close the issue:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
mu forum post issue:<issue-id> -m "RESULT:\n<result>" --author operator
|
|
140
|
+
mu issues close <issue-id> --outcome success
|
|
86
141
|
```
|
|
87
142
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
143
|
+
Use explicit non-success outcomes when needed (`failure`, `needs_work`, `skipped`).
|
|
144
|
+
|
|
145
|
+
### Primitive: `expand`
|
|
146
|
+
|
|
147
|
+
When decomposition is needed:
|
|
148
|
+
|
|
149
|
+
1. Create child work nodes via `spawn` / `fork`.
|
|
150
|
+
2. Create one synthesis child (`kind:synth`, `ctx:inherit`) blocked by all child work nodes.
|
|
151
|
+
3. Close current node with `mu issues close <issue-id> --outcome expanded`.
|
|
152
|
+
|
|
153
|
+
This encodes decompose→synthesize as explicit DAG nodes.
|
|
154
|
+
|
|
155
|
+
### Primitive: `serial`
|
|
156
|
+
|
|
157
|
+
Encode ordered execution with dependency edges:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
mu issues dep <step-a> blocks <step-b>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Required invariants
|
|
164
|
+
|
|
165
|
+
- **Read-before-act-verify:** every write is followed by a re-read.
|
|
166
|
+
- **Claim-before-work:** claim executable issues before file/work execution.
|
|
167
|
+
- **Scoped authority:** mutate only current issue + descendants.
|
|
168
|
+
- **Container hygiene:** remove `node:agent` from non-executable root/ask/container nodes.
|
|
169
|
+
- **Idempotent logging:** forum updates should be append-only and resumable.
|
|
170
|
+
- **Explicit outcomes:** every executable issue closes with concrete outcome.
|
|
171
|
+
|
|
172
|
+
## Control loops
|
|
173
|
+
|
|
174
|
+
### Orchestrator heartbeat tick loop (bounded)
|
|
175
|
+
|
|
176
|
+
For root `<root-id>`:
|
|
177
|
+
|
|
178
|
+
1. `read_tree` at root/selected node
|
|
179
|
+
2. Choose exactly one primitive to apply
|
|
180
|
+
3. Apply it
|
|
181
|
+
4. Verify state (`mu issues get`, `children`, `ready`, `validate`)
|
|
182
|
+
5. Post concise progress to forum
|
|
183
|
+
6. Exit tick
|
|
184
|
+
|
|
185
|
+
Stop automation when `mu issues validate <root-id>` returns final.
|
|
186
|
+
|
|
187
|
+
### Worker issue loop (single issue pass)
|
|
188
|
+
|
|
189
|
+
For claimed issue `<issue-id>` under `<root-id>`:
|
|
190
|
+
|
|
191
|
+
1. `read_tree`
|
|
192
|
+
2. Choose one primitive:
|
|
193
|
+
- missing input -> `ask`
|
|
194
|
+
- needs decomposition -> `expand`
|
|
195
|
+
- directly solvable -> `complete`
|
|
196
|
+
3. Apply primitive
|
|
197
|
+
4. Verify state
|
|
198
|
+
5. Post concise progress to `issue:<issue-id>`
|
|
199
|
+
|
|
200
|
+
Repeat until issue closes.
|
|
201
|
+
|
|
202
|
+
## Bootstrap template
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
root_json="$(mu issues create "Root: <goal>" --tag node:root --tag proto:subagents-v1 --json)"
|
|
206
|
+
root_id="$(echo "$root_json" | jq -r '.id')"
|
|
207
|
+
mu issues update "$root_id" --remove-tag node:agent
|
|
208
|
+
|
|
209
|
+
goal_json="$(mu issues create "Goal execution" \
|
|
210
|
+
--parent "$root_id" \
|
|
211
|
+
--tag proto:subagents-v1 \
|
|
212
|
+
--tag kind:goal \
|
|
213
|
+
--tag ctx:clean \
|
|
214
|
+
--priority 2 \
|
|
215
|
+
--json)"
|
|
216
|
+
goal_id="$(echo "$goal_json" | jq -r '.id')"
|
|
217
|
+
|
|
218
|
+
mu forum post issue:"$goal_id" -m "<goal brief + acceptance criteria>" --author operator
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Dispatch templates
|
|
222
|
+
|
|
223
|
+
### A) Heartbeat autopilot (preferred for supervision)
|
|
123
224
|
|
|
124
225
|
```bash
|
|
125
|
-
mu
|
|
226
|
+
mu heartbeats create \
|
|
227
|
+
--title "subagents-v1 <root-id>" \
|
|
228
|
+
--reason subagents_protocol_v1 \
|
|
229
|
+
--every-ms 15000 \
|
|
230
|
+
--prompt "Use skill subagents for root <root-id>. Run exactly one bounded orchestration pass: claim/work one ready proto:subagents-v1 issue (or perform one orchestration action), verify state, and report status. Stop when 'mu issues validate <root-id>' is final."
|
|
126
231
|
```
|
|
127
232
|
|
|
128
|
-
|
|
129
|
-
you can hand off with `mu turn`:
|
|
233
|
+
### B) tmux fan-out (parallel workers)
|
|
130
234
|
|
|
131
235
|
```bash
|
|
132
|
-
|
|
133
|
-
mu
|
|
236
|
+
run_id="$(date +%Y%m%d-%H%M%S)"
|
|
237
|
+
for issue_id in $(mu issues ready --root <root-id> --tag proto:subagents-v1 --json | jq -r '.[].id' | head -n 3); do
|
|
238
|
+
session="mu-sub-${run_id}-${issue_id}"
|
|
239
|
+
tmux new-session -d -s "$session" \
|
|
240
|
+
"cd '$PWD' && mu exec 'Work issue ${issue_id} using subagents.protocol/v1. Claim first, then run one full control loop.' ; rc=\$?; echo __MU_DONE__:\$rc"
|
|
241
|
+
done
|
|
134
242
|
```
|
|
135
243
|
|
|
136
|
-
|
|
137
|
-
|
|
244
|
+
## Subagents HUD (optional board)
|
|
245
|
+
|
|
246
|
+
Use HUD for visibility and bounded spawning. Protocol truth still lives in issues/forum.
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
/mu subagents on
|
|
250
|
+
/mu subagents prefix mu-sub-
|
|
251
|
+
/mu subagents root <root-id>
|
|
252
|
+
/mu subagents tag proto:subagents-v1
|
|
253
|
+
/mu subagents mode operator
|
|
254
|
+
/mu subagents refresh
|
|
255
|
+
/mu subagents snapshot
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Tool: `mu_subagents_hud`
|
|
259
|
+
|
|
260
|
+
- Actions: `status`, `snapshot`, `on`, `off`, `toggle`, `refresh`, `set_prefix`, `set_root`, `set_tag`, `set_mode`, `set_refresh_interval`, `set_stale_after`, `set_spawn_paused`, `update`, `spawn`
|
|
138
261
|
|
|
139
|
-
## Reconciliation
|
|
262
|
+
## Reconciliation
|
|
140
263
|
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
- Record follow-up tasks in `mu issues` / `mu forum`.
|
|
264
|
+
- Run `mu issues validate <root-id>` before declaring completion.
|
|
265
|
+
- Merge synth-node outputs into one final user-facing result.
|
|
266
|
+
- Convert unresolved gaps into new child issues tagged `proto:subagents-v1`.
|
|
267
|
+
- Tear down temporary tmux sessions.
|
|
146
268
|
|
|
147
|
-
## Safety
|
|
269
|
+
## Safety
|
|
148
270
|
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
- Tear down temporary tmux sessions when done.
|
|
271
|
+
- Prefer small, reversible child issues.
|
|
272
|
+
- Keep child prompts explicit about deliverables + acceptance criteria.
|
|
273
|
+
- Pause spawning while queue semantics are unclear.
|
|
274
|
+
- Never overwrite unrelated files across shards.
|
package/dist/mu_roles.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ORCHESTRATOR_PROMPT, DEFAULT_REVIEWER_PROMPT, DEFAULT_WORKER_PROMPT } from "./default_prompts.js";
|
|
2
|
-
export type MuRole = "orchestrator" | "reviewer" | "worker";
|
|
3
|
-
/** Determine role from tags. Defaults to orchestrator if no role tag present. */
|
|
4
|
-
export declare function roleFromTags(tags: readonly string[]): MuRole;
|
|
5
|
-
export { DEFAULT_ORCHESTRATOR_PROMPT, DEFAULT_REVIEWER_PROMPT, DEFAULT_WORKER_PROMPT };
|
|
6
|
-
/**
|
|
7
|
-
* Load the system prompt for a role.
|
|
8
|
-
*
|
|
9
|
-
* Role prompts are sourced from bundled markdown defaults only.
|
|
10
|
-
* Repo-local `.mu/roles/*.md` overrides are intentionally unsupported.
|
|
11
|
-
*/
|
|
12
|
-
export declare function systemPromptForRole(role: MuRole, _repoRoot?: string): Promise<string>;
|
|
13
|
-
//# sourceMappingURL=mu_roles.d.ts.map
|
package/dist/mu_roles.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mu_roles.d.ts","sourceRoot":"","sources":["../src/mu_roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEnH,MAAM,MAAM,MAAM,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5D,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAO5D;AAED,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,CAAC;AAEvF;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3F"}
|
package/dist/mu_roles.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ORCHESTRATOR_PROMPT, DEFAULT_REVIEWER_PROMPT, DEFAULT_WORKER_PROMPT } from "./default_prompts.js";
|
|
2
|
-
/** Determine role from tags. Defaults to orchestrator if no role tag present. */
|
|
3
|
-
export function roleFromTags(tags) {
|
|
4
|
-
for (const tag of tags) {
|
|
5
|
-
if (tag === "role:worker")
|
|
6
|
-
return "worker";
|
|
7
|
-
if (tag === "role:reviewer")
|
|
8
|
-
return "reviewer";
|
|
9
|
-
if (tag === "role:orchestrator")
|
|
10
|
-
return "orchestrator";
|
|
11
|
-
}
|
|
12
|
-
return "orchestrator";
|
|
13
|
-
}
|
|
14
|
-
export { DEFAULT_ORCHESTRATOR_PROMPT, DEFAULT_REVIEWER_PROMPT, DEFAULT_WORKER_PROMPT };
|
|
15
|
-
/**
|
|
16
|
-
* Load the system prompt for a role.
|
|
17
|
-
*
|
|
18
|
-
* Role prompts are sourced from bundled markdown defaults only.
|
|
19
|
-
* Repo-local `.mu/roles/*.md` overrides are intentionally unsupported.
|
|
20
|
-
*/
|
|
21
|
-
export async function systemPromptForRole(role, _repoRoot) {
|
|
22
|
-
if (role === "worker") {
|
|
23
|
-
return DEFAULT_WORKER_PROMPT;
|
|
24
|
-
}
|
|
25
|
-
if (role === "reviewer") {
|
|
26
|
-
return DEFAULT_REVIEWER_PROMPT;
|
|
27
|
-
}
|
|
28
|
-
return DEFAULT_ORCHESTRATOR_PROMPT;
|
|
29
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
You are an orchestrator: you help by engaging in planning and review as part of the orchestration engine within mu.
|
|
2
|
-
|
|
3
|
-
Mission:
|
|
4
|
-
- Read and think carefully about the issue assigned to you.
|
|
5
|
-
- Decompose your assigned issue into executable worker issues (or smaller orchestrator issues only when truly needed).
|
|
6
|
-
- Define ordering via dependencies.
|
|
7
|
-
- Move planning state forward by closing expanded planning nodes.
|
|
8
|
-
|
|
9
|
-
Available tools:
|
|
10
|
-
- bash: Execute commands (use `mu` CLI for issue/forum reads + mutations)
|
|
11
|
-
- read: Read repository files when needed for planning context
|
|
12
|
-
- edit/write: available but forbidden for orchestrator execution (planning only)
|
|
13
|
-
|
|
14
|
-
Hard Constraints:
|
|
15
|
-
1. You MUST NOT execute work directly. No code changes, no file edits, no git commits.
|
|
16
|
-
2. You MUST decompose the assigned issue into worker child issues.
|
|
17
|
-
3. You MUST close your assigned issue with outcome `expanded`.
|
|
18
|
-
4. Decomposition MUST be deterministic and scoped. Use `blocks` edges for sequencing.
|
|
19
|
-
5. Every executable leaf MUST be worker-owned.
|
|
20
|
-
|
|
21
|
-
If the task looks atomic, create exactly one worker child issue rather than doing the work yourself.
|
|
22
|
-
|
|
23
|
-
Workflow:
|
|
24
|
-
1. Inspect context:
|
|
25
|
-
- `bash("mu issues get <id> --pretty")`
|
|
26
|
-
- `bash("mu forum read issue:<id> --limit 20 --pretty")`
|
|
27
|
-
- `bash("mu issues children <id> --pretty")` (or `mu issues list --root <id> --pretty`)
|
|
28
|
-
- `bash("mu memory search --query <keywords> --issue-id <id> --limit 20 --pretty")`
|
|
29
|
-
- `bash("mu memory timeline --issue-id <id> --order desc --limit 40 --pretty")`
|
|
30
|
-
- `bash("mu memory index status --pretty")` (rebuild when missing/stale if broader retrieval is needed)
|
|
31
|
-
2. Decompose into worker issues:
|
|
32
|
-
- `bash("mu issues create \"<title>\" --body \"<body>\" --tags \"node:agent,role:worker\" --parent <id> --pretty")`
|
|
33
|
-
3. Add ordering where needed:
|
|
34
|
-
- `bash("mu issues dep <src> blocks <dst> --pretty")`
|
|
35
|
-
4. Close yourself:
|
|
36
|
-
- `bash("mu issues close <id> --outcome expanded --pretty")`
|
|
37
|
-
|
|
38
|
-
Guardrails:
|
|
39
|
-
- The only valid orchestrator close outcome is `expanded`.
|
|
40
|
-
- Never close with `success`, `failure`, `needs_work`, or `skipped`.
|
|
41
|
-
- Keep plans small, explicit, and testable.
|
|
42
|
-
- Plans should include proposed evidence for successful completion.
|
|
43
|
-
- Prefer bounded reads (`--limit`, scoped filters) before deep inspection.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
You are a reviewer. You evaluate one completed execution round and decide whether to accept or request refinement.
|
|
2
|
-
|
|
3
|
-
Mission:
|
|
4
|
-
- Verify whether the assigned work meets the issue requirements.
|
|
5
|
-
- Produce an explicit review outcome: accept or refine.
|
|
6
|
-
- Leave concrete feedback in the issue forum.
|
|
7
|
-
|
|
8
|
-
Available tools:
|
|
9
|
-
- read: Read files and logs
|
|
10
|
-
- bash: Run validation commands (including `mu` CLI for issue/forum actions)
|
|
11
|
-
- edit/write: available but avoid changing implementation directly
|
|
12
|
-
|
|
13
|
-
Hard Constraints:
|
|
14
|
-
- Do NOT create child issues. Refinement scheduling is orchestrator-owned.
|
|
15
|
-
- Do NOT perform implementation work unless explicitly asked by the issue.
|
|
16
|
-
- Keep review outcomes explicit and evidence-based.
|
|
17
|
-
|
|
18
|
-
Workflow:
|
|
19
|
-
1. Inspect:
|
|
20
|
-
- `bash("mu issues get <id> --pretty")`
|
|
21
|
-
- `bash("mu forum read issue:<id> --limit 20 --pretty")`
|
|
22
|
-
- `bash("mu memory search --query <keywords> --issue-id <id> --limit 20 --pretty")`
|
|
23
|
-
- `bash("mu memory timeline --issue-id <id> --order desc --limit 40 --pretty")`
|
|
24
|
-
2. Verify:
|
|
25
|
-
- Re-run relevant tests/checks, inspect changed files/logs.
|
|
26
|
-
3. Decide:
|
|
27
|
-
- Accept: `bash("mu issues close <id> --outcome success --pretty")`
|
|
28
|
-
- Refine: `bash("mu issues close <id> --outcome needs_work --pretty")`
|
|
29
|
-
4. Post rationale:
|
|
30
|
-
- `bash("mu forum post issue:<id> -m \"<evidence + rationale>\" --author reviewer --pretty")`
|
|
31
|
-
|
|
32
|
-
Guardrails:
|
|
33
|
-
- Use concrete evidence (commands/tests) over opinion.
|
|
34
|
-
- Keep feedback actionable and concise.
|
|
35
|
-
- If refining, specify exact gaps and expected follow-up checks.
|
package/prompts/roles/worker.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
You are a worker. You execute exactly one atomic issue end-to-end.
|
|
2
|
-
|
|
3
|
-
Mission:
|
|
4
|
-
- Implement the work described in your assigned issue.
|
|
5
|
-
- Keep scope tight to the issue specification.
|
|
6
|
-
- Verify outcomes and close with a terminal result.
|
|
7
|
-
|
|
8
|
-
Available tools:
|
|
9
|
-
- read: Read file contents
|
|
10
|
-
- bash: Execute commands (including direct `mu` CLI reads/mutations)
|
|
11
|
-
- edit: Make surgical edits to files
|
|
12
|
-
- write: Create or overwrite files
|
|
13
|
-
|
|
14
|
-
Hard Constraints:
|
|
15
|
-
- Do NOT create child issues — that is the orchestrator's job.
|
|
16
|
-
- If the issue is too large/unclear, close with `outcome="needs_work"` and explain what is missing.
|
|
17
|
-
|
|
18
|
-
Workflow:
|
|
19
|
-
1. Inspect:
|
|
20
|
-
- `bash("mu issues get <id> --pretty")`
|
|
21
|
-
- `bash("mu forum read issue:<id> --limit 20 --pretty")`
|
|
22
|
-
- `bash("mu memory search --query <keywords> --issue-id <id> --limit 20 --pretty")`
|
|
23
|
-
- `bash("mu memory timeline --issue-id <id> --order desc --limit 40 --pretty")`
|
|
24
|
-
- `bash("mu memory index status --pretty")` (rebuild when missing/stale if context retrieval quality is poor)
|
|
25
|
-
2. Implement:
|
|
26
|
-
- Edit files and run commands needed for this issue only.
|
|
27
|
-
3. Verify:
|
|
28
|
-
- Run tests/typecheck/build/lint as appropriate.
|
|
29
|
-
4. Close:
|
|
30
|
-
- `bash("mu issues close <id> --outcome success --pretty")` (or `failure` / `skipped` / `needs_work` when warranted)
|
|
31
|
-
5. Log key notes:
|
|
32
|
-
- `bash("mu forum post issue:<id> -m \"...\" --author worker --pretty")`
|
|
33
|
-
|
|
34
|
-
Guardrails:
|
|
35
|
-
- Prefer concrete evidence over claims (test output, build output, repro checks).
|
|
36
|
-
- Report what changed and why.
|
|
37
|
-
- Keep command output focused: use bounded reads first (`--limit`, scoped filters) and drill into specific IDs/files next.
|
|
38
|
-
- Be concise.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: reviewer
|
|
3
|
-
description: Run a dedicated reviewer pass in tmux and return a strict verdict with evidence.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Reviewer
|
|
7
|
-
|
|
8
|
-
Use this skill when you want a separate reviewer lane that audits work before finalizing.
|
|
9
|
-
|
|
10
|
-
## Goals
|
|
11
|
-
|
|
12
|
-
- Isolate review from implementation context.
|
|
13
|
-
- Require explicit pass/fail criteria.
|
|
14
|
-
- Produce concrete evidence (tests, diffs, traces) for the verdict.
|
|
15
|
-
|
|
16
|
-
## Reviewer lane pattern
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
run_id="$(date +%Y%m%d-%H%M%S)"
|
|
20
|
-
review_session="mu-review-${run_id}"
|
|
21
|
-
|
|
22
|
-
# Start a dedicated reviewer session
|
|
23
|
-
# (Use the same repo and server port as the main workflow.)
|
|
24
|
-
tmux new-session -d -s "$review_session" \
|
|
25
|
-
"cd '$PWD' && mu session --new --port 3000 ; rc=\$?; echo __MU_DONE__:\$rc"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then inject a strict reviewer prompt in that tmux pane (attach or send keys) with:
|
|
29
|
-
|
|
30
|
-
- Scope under review
|
|
31
|
-
- Acceptance criteria
|
|
32
|
-
- Required checks (build/test/lint, edge cases, regressions)
|
|
33
|
-
- Required output format: `PASS` or `FAIL`, plus blockers and fixes
|
|
34
|
-
|
|
35
|
-
## Suggested reviewer prompt shape
|
|
36
|
-
|
|
37
|
-
- "Act as a strict reviewer. Validate only against these acceptance criteria..."
|
|
38
|
-
- "Run the necessary checks and cite concrete evidence."
|
|
39
|
-
- "Return: verdict, evidence, risk list, and required fixes."
|
|
40
|
-
|
|
41
|
-
## Monitoring and collection
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
tmux capture-pane -pt "$review_session" -S -300
|
|
45
|
-
tmux attach -t "$review_session"
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
If the reviewer leaves open questions, ask follow-up turns in the same reviewer session:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
mu session list --json --pretty
|
|
52
|
-
mu turn --session-kind operator --session-id <session-id> --body "Clarify blocker #2"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Use `--session-kind operator` for terminal/tmux reviewer sessions.
|
|
56
|
-
If omitted, `mu turn` defaults to control-plane operator sessions (`cp_operator`).
|
|
57
|
-
|
|
58
|
-
Once complete, summarize reviewer findings back into the main workflow and create follow-up issues for each blocker.
|
|
59
|
-
|
|
60
|
-
## Safety rules
|
|
61
|
-
|
|
62
|
-
- Reviewer must not silently relax acceptance criteria.
|
|
63
|
-
- Prefer failing with explicit evidence over guessing.
|
|
64
|
-
- Keep reviewer output actionable (file paths, commands, failing checks).
|
|
65
|
-
- Close/kill temporary tmux sessions after review.
|