@ionivetech/mugiwara 0.8.2 → 0.9.1
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.kimi-plugin/plugin.json +1 -1
- package/.opencode/mugiwara-helpers.mjs +1 -1
- package/.opencode/plugins/mugiwara.mjs +173 -1
- package/README.md +63 -58
- package/content/agents/luffy-orchestrator.md +16 -1
- package/content/agents/zoro-execution.md +1 -1
- package/content/skills/mugiwara-checkpoint/SKILL.md +1 -0
- package/content/skills/mugiwara-execution/SKILL.md +5 -5
- package/content/skills/mugiwara-gates/SKILL.md +1 -0
- package/content/skills/mugiwara-healing/SKILL.md +1 -0
- package/content/skills/mugiwara-lessons/SKILL.md +2 -0
- package/content/skills/mugiwara-orchestration/SKILL.md +15 -20
- package/content/skills/mugiwara-orchestration/references/check-ins.md +4 -5
- package/content/skills/mugiwara-orchestration/references/output-contract.md +2 -2
- package/content/skills/mugiwara-orchestration/references/solo-team.md +18 -0
- package/content/skills/mugiwara-planning/SKILL.md +7 -15
- package/content/skills/mugiwara-planning/references/sub-missions.md +14 -0
- package/content/skills/mugiwara-quality/SKILL.md +1 -0
- package/content/skills/mugiwara-review/SKILL.md +2 -0
- package/content/skills/mugiwara-security/SKILL.md +2 -2
- package/content/skills/mugiwara-ship/SKILL.md +12 -0
- package/content/skills/mugiwara-workflow/SKILL.md +3 -3
- package/dist/mugiwara.js +934 -158
- package/gemini-extension.json +1 -1
- package/hooks/engagement-marker.js +9 -1
- package/hooks/engagement-marker.ts +9 -1
- package/hooks/hooks.json +12 -0
- package/hooks/pipeline-guard.js +137 -3
- package/hooks/pipeline-guard.ts +161 -3
- package/hooks/pretool-guard.js +84 -0
- package/hooks/pretool-guard.ts +60 -0
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/references/multi-actor.md +17 -14
- package/references/wave-banners.md +22 -27
- package/scripts/build-hooks.ts +1 -1
- package/scripts/gate-selftest.ts +480 -0
- package/scripts/savepoint.sh +139 -14
- package/scripts/validate-content.ts +345 -2
- package/scripts/write-metrics.ts +25 -1
- package/src/args.ts +1 -1
- package/src/cli.ts +158 -3
- package/src/config.ts +33 -11
- package/src/guards.ts +40 -0
- package/src/initiative.ts +174 -0
- package/src/mission.ts +137 -52
- package/src/targets/claude.ts +1 -0
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
},
|
|
6
6
|
"metadata": {
|
|
7
7
|
"description": "The Straw Hat crew for AI agents",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.9.1"
|
|
9
9
|
},
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "mugiwara",
|
|
13
13
|
"description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.9.1",
|
|
15
15
|
"source": "./"
|
|
16
16
|
}
|
|
17
17
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mugiwara",
|
|
3
3
|
"displayName": "Mugiwara",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ionivetech"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mugiwara",
|
|
3
3
|
"displayName": "Mugiwara",
|
|
4
4
|
"description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.9.1",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ionivetech"
|
|
8
8
|
},
|
package/.kimi-plugin/plugin.json
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
// or from the git repo:
|
|
18
18
|
// { "plugin": ["mugiwara@git+https://github.com/ionivetech/mugiwara.git"] }
|
|
19
19
|
|
|
20
|
-
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
20
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
|
|
21
|
+
import { execFileSync } from 'node:child_process';
|
|
21
22
|
import { dirname, join } from 'node:path';
|
|
22
23
|
import { fileURLToPath } from 'node:url';
|
|
23
24
|
import { readMode, parseModeChange, applyModeChange, ensureDefaultConfig } from '../mugiwara-helpers.mjs';
|
|
@@ -135,6 +136,144 @@ function readAgents(stepsEnabled = true) {
|
|
|
135
136
|
return agents;
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// Enforcement mirrors (E5, Stage B). The FORBIDDEN table is a copy of
|
|
140
|
+
// src/guards.ts between the GUARDS-TABLE markers — plugin.test.ts asserts the
|
|
141
|
+
// two blocks are byte-identical, so edit the source, never just this copy.
|
|
142
|
+
// The tool hook surface is binary (throw = deny): enforce=warn degrades to
|
|
143
|
+
// allow here, documented in docs/reference/harness-matrix.md.
|
|
144
|
+
|
|
145
|
+
const FORBIDDEN = [
|
|
146
|
+
// GUARDS-TABLE-START
|
|
147
|
+
[/\bgh\s+pr\s+(create|merge|ready)\b/, 'opening or merging a PR'],
|
|
148
|
+
[/\bgh\s+release\s+create\b/, 'creating a release'],
|
|
149
|
+
[/\bgit\s+merge\b/, 'merging a branch'],
|
|
150
|
+
[/\bgit\s+push\b[^|;&]*\b(main|master|production|release)\b/, 'pushing to a protected branch'],
|
|
151
|
+
[/\bgit\s+push\b[^|;&]*--force/, 'force-pushing'],
|
|
152
|
+
[/\bnpm\s+publish\b|\byarn\s+publish\b|\bpnpm\s+publish\b/, 'publishing a package'],
|
|
153
|
+
[/\bkubectl\s+(apply|delete|rollout)\b/, 'changing a cluster'],
|
|
154
|
+
[/\bterraform\s+(apply|destroy)\b/, 'changing infrastructure'],
|
|
155
|
+
[/\bdocker\s+push\b/, 'pushing an image'],
|
|
156
|
+
[/\baws\s+\w+\s+(create|delete|update|put)\b/, 'changing cloud resources'],
|
|
157
|
+
// GUARDS-TABLE-END
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
function checkCommand(command) {
|
|
161
|
+
for (const [re, action] of FORBIDDEN) {
|
|
162
|
+
if (re.test(command)) return action;
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function refusalMessage(action) {
|
|
168
|
+
return (
|
|
169
|
+
`Mugiwara: refusing to ${action}. The crew never creates a PR, merges, or ` +
|
|
170
|
+
`deploys — the human does, from the branch and the verdict the crew hands over. ` +
|
|
171
|
+
`Run it yourself, or set enforce=off in .mugiwara/config.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function readEnforce(cwd) {
|
|
176
|
+
for (const base of [cwd, process.env.HOME || '']) {
|
|
177
|
+
if (!base) continue;
|
|
178
|
+
const file = join(base, '.mugiwara', 'config');
|
|
179
|
+
if (!existsSync(file)) continue;
|
|
180
|
+
for (const line of readFileSync(file, 'utf8').split(/\r?\n/)) {
|
|
181
|
+
const [k, v] = line.split('=').map((s) => s.trim());
|
|
182
|
+
if (k !== 'enforce') continue;
|
|
183
|
+
if (v === 'off' || v === 'warn' || v === 'block') return v;
|
|
184
|
+
return 'block';
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return 'block';
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function markEngaged(cwd) {
|
|
191
|
+
try {
|
|
192
|
+
const dir = join(cwd, '.mugiwara');
|
|
193
|
+
mkdirSync(dir, { recursive: true });
|
|
194
|
+
const file = join(dir, '.engaged');
|
|
195
|
+
let firstSeen = new Date().toISOString();
|
|
196
|
+
try {
|
|
197
|
+
const prev = JSON.parse(readFileSync(file, 'utf8'));
|
|
198
|
+
if (prev && typeof prev.first_seen === 'string') firstSeen = prev.first_seen;
|
|
199
|
+
} catch { /* fresh marker */ }
|
|
200
|
+
writeFileSync(file, JSON.stringify({ first_seen: firstSeen, touched_at: new Date().toISOString() }, null, 2) + '\n');
|
|
201
|
+
} catch { /* fail open — no marker, no policing */ }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Git working tree changed outside .mugiwara/, or null when git is unreadable
|
|
205
|
+
// (no opinion — the caller treats null as "cannot tell", never as clean).
|
|
206
|
+
function gitSourceChanged(cwd) {
|
|
207
|
+
try {
|
|
208
|
+
const out = execFileSync('git', ['status', '--porcelain'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
209
|
+
return out.split(/\r?\n/).map((l) => l.slice(3).trim()).filter(Boolean).some((p) => !p.startsWith('.mugiwara/'));
|
|
210
|
+
} catch { return null; }
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function markerStart(cwd) {
|
|
214
|
+
try {
|
|
215
|
+
const marker = JSON.parse(readFileSync(join(cwd, '.mugiwara', '.engaged'), 'utf8'));
|
|
216
|
+
return Date.parse(marker.first_seen ?? '') || Date.parse(marker.touched_at ?? '') || 0;
|
|
217
|
+
} catch { return 0; }
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function artifactWorkSince(cwd, start) {
|
|
221
|
+
try {
|
|
222
|
+
const stack = ['missions', 'spec', 'plans'].map((s) => join(cwd, '.mugiwara', s)).filter((p) => existsSync(p));
|
|
223
|
+
while (stack.length) {
|
|
224
|
+
const cur = stack.pop();
|
|
225
|
+
for (const e of readdirSync(cur, { withFileTypes: true })) {
|
|
226
|
+
const full = join(cur, e.name);
|
|
227
|
+
try {
|
|
228
|
+
// Symlinks never resolve: a dirent symlink reports isDirectory()
|
|
229
|
+
// false, so the symlink check must come first, not nested inside.
|
|
230
|
+
if (e.isSymbolicLink()) continue;
|
|
231
|
+
if (e.isDirectory()) { stack.push(full); continue; }
|
|
232
|
+
if (statSync(full).mtimeMs + 1000 >= start) return true;
|
|
233
|
+
} catch { /* skip */ }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} catch { /* no artifact opinion */ }
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function triageOnDisk(cwd) {
|
|
241
|
+
const base = join(cwd, '.mugiwara', 'missions');
|
|
242
|
+
if (!existsSync(base)) return false;
|
|
243
|
+
for (const e of readdirSync(base, { withFileTypes: true })) {
|
|
244
|
+
if (!e.isDirectory()) continue;
|
|
245
|
+
for (const f of readdirSync(join(base, e.name))) {
|
|
246
|
+
const stem = f.replace(/\.json$/, '');
|
|
247
|
+
if (!f.endsWith('.json') || stem === 'continue' || stem.startsWith('continue-')) continue;
|
|
248
|
+
try {
|
|
249
|
+
const s = JSON.parse(readFileSync(join(base, e.name, f), 'utf8'));
|
|
250
|
+
if (s && typeof s.mission === 'string' && s.mission) return true;
|
|
251
|
+
} catch { /* corrupt savepoint is not triage */ }
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Check-1 port: engaged + (source or artifact work) + no triage on disk.
|
|
258
|
+
// Crisp on-disk facts only, mirroring hooks/pipeline-guard.ts. Fail open:
|
|
259
|
+
// any error returns null (no opinion), never a false accusation.
|
|
260
|
+
function sessionWorkNoTriage(cwd) {
|
|
261
|
+
try {
|
|
262
|
+
if (readEnforce(cwd) === 'off') return null;
|
|
263
|
+
if (!existsSync(join(cwd, '.mugiwara', '.engaged'))) return null;
|
|
264
|
+
const source = gitSourceChanged(cwd);
|
|
265
|
+
if (source === null) return null;
|
|
266
|
+
const start = markerStart(cwd);
|
|
267
|
+
const artifacts = start ? artifactWorkSince(cwd, start) : false;
|
|
268
|
+
if (!source && !artifacts) return null;
|
|
269
|
+
if (triageOnDisk(cwd)) return null;
|
|
270
|
+
return (
|
|
271
|
+
'Mugiwara: this session did work (source and/or .mugiwara artifacts) but no ' +
|
|
272
|
+
'Flow 0 triage is on disk. Run Flow 0 (classify, size the lane, write the decision log).'
|
|
273
|
+
);
|
|
274
|
+
} catch { return null; }
|
|
275
|
+
}
|
|
276
|
+
|
|
138
277
|
export default async () => ({
|
|
139
278
|
dispose: () => {},
|
|
140
279
|
|
|
@@ -170,4 +309,37 @@ export default async () => ({
|
|
|
170
309
|
}
|
|
171
310
|
}
|
|
172
311
|
},
|
|
312
|
+
|
|
313
|
+
'tool.execute.before': async (input, output) => {
|
|
314
|
+
// E4 port: refuse irreversible bash commands before they run (throw =
|
|
315
|
+
// deny). Engagement for the session-end check is recorded here too: any
|
|
316
|
+
// tool call mentioning the crew marks the session engaged.
|
|
317
|
+
try {
|
|
318
|
+
const cwd = process.cwd();
|
|
319
|
+
let shape = '';
|
|
320
|
+
try { shape = JSON.stringify(input); } catch { /* unshaped — skip marking */ }
|
|
321
|
+
if (shape.toLowerCase().includes('mugiwara')) markEngaged(cwd);
|
|
322
|
+
if (input && input.tool === 'bash') {
|
|
323
|
+
const command = output && output.args && typeof output.args.command === 'string' ? output.args.command : '';
|
|
324
|
+
const action = checkCommand(command);
|
|
325
|
+
if (action && readEnforce(cwd) === 'block') throw new Error(refusalMessage(action));
|
|
326
|
+
}
|
|
327
|
+
} catch (e) {
|
|
328
|
+
if (e && /Mugiwara: refusing/.test(e.message)) throw e;
|
|
329
|
+
// fail open — never wedge a tool call
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
event: async ({ event }) => {
|
|
334
|
+
// Check-1 port at session end: work with no triage surfaces loudly here.
|
|
335
|
+
// Advisory, not preventive — the work already happened; prevention on this
|
|
336
|
+
// harness is the tool hook above. Fail open.
|
|
337
|
+
try {
|
|
338
|
+
if (!event || event.type !== 'session.idle') return;
|
|
339
|
+
const reason = sessionWorkNoTriage(process.cwd());
|
|
340
|
+
if (reason) throw new Error(reason);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
if (e && /Mugiwara: this session did work/.test(e.message)) throw e;
|
|
343
|
+
}
|
|
344
|
+
},
|
|
173
345
|
});
|
package/README.md
CHANGED
|
@@ -17,6 +17,59 @@ Works on Claude Code, opencode, Copilot, Gemini, and 8 more platforms.
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
+
## The problem
|
|
21
|
+
|
|
22
|
+
An AI agent can write 400 lines in five minutes. It says "tests pass" — and
|
|
23
|
+
leaves nothing you can open, read, or attach to a PR. Review becomes a
|
|
24
|
+
formality, and a formality is worse than no review, because it launders the
|
|
25
|
+
change through a human name.
|
|
26
|
+
|
|
27
|
+
Mugiwara makes the work provable: every change carries a trail a human can
|
|
28
|
+
review, and the process sizes itself to the work.
|
|
29
|
+
|
|
30
|
+
## What you get back
|
|
31
|
+
|
|
32
|
+
Every mission closes with one file. This is what your reviewer reads:
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
# Mission: invitation-accepted-flow
|
|
36
|
+
2026-09-03 · farid · branch `feature/MKR-412` · lane **full** · mode guided
|
|
37
|
+
|
|
38
|
+
## Verdict
|
|
39
|
+
**GO** — all gates passed. 1 finding deferred with an owner.
|
|
40
|
+
|
|
41
|
+
## What changed
|
|
42
|
+
11 files, +340 / -82.
|
|
43
|
+
Sensitive paths touched: `src/auth/invitation.ts`, `migrations/004.sql`
|
|
44
|
+
|
|
45
|
+
## Gates
|
|
46
|
+
| Gate | Verdict | Evidence |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Checkpoint (Flow 4) | PASS | `flows/04-audit.md` |
|
|
49
|
+
| Quality (Flow 5) | PASS | `flows/05-quality.md` |
|
|
50
|
+
| Coverage (Flow 6) | PASS | new 94% / modified 87% |
|
|
51
|
+
| Security (Flow 7) | PASS | STRIDE, 0 high -> `review/security.md` |
|
|
52
|
+
|
|
53
|
+
## Cost
|
|
54
|
+
Used **8,781** of 12,000 tokens (73%). Lane `lean`. 1 heal cycle.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
*Generated from fixture `test/fixtures/report-sample.md` — 2026-09-03.*
|
|
58
|
+
|
|
59
|
+
## The process fits the work
|
|
60
|
+
|
|
61
|
+
| Your change | Lane | What runs |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| Typo, one file | **Direct** | nothing — just fix it |
|
|
64
|
+
| Small bug | **Lean** | execute -> quality |
|
|
65
|
+
| A feature | **Standard** | plan -> execute -> audit -> quality -> review |
|
|
66
|
+
| Touches `auth/`, `payments/`, migrations | **Full** | all 9 flow stages + security review |
|
|
67
|
+
| Requirements still fuzzy | **Spike** | brainstorm first, then re-size |
|
|
68
|
+
|
|
69
|
+
The lane is computed from `git diff` — never guessed by the model — and it only
|
|
70
|
+
ever rises. Once a mission touches a sensitive path it cannot drop back, even if
|
|
71
|
+
that file is reverted.
|
|
72
|
+
|
|
20
73
|
## What is Mugiwara? (30 seconds)
|
|
21
74
|
|
|
22
75
|
AI agents are fast. They're also **unverified** — no audit trail, no review, no
|
|
@@ -130,65 +183,17 @@ sequential. Inline stays the default.
|
|
|
130
183
|
|
|
131
184
|
---
|
|
132
185
|
|
|
133
|
-
## See the evidence
|
|
134
|
-
|
|
135
|
-
A closed mission leaves a report you can actually read — and after
|
|
136
|
-
`mugiwara archive <mission>`, the whole trail folds INTO it. This is the shape
|
|
137
|
-
of `.mugiwara/missions/<mission>/report.md`:
|
|
138
|
-
|
|
139
|
-
# Mission: invitation-accepted-flow . 2026-08-11
|
|
140
|
-
|
|
141
|
-
**Lane** full . **Mode** guided . **Actor** john . **Branch** feature/MKR-412
|
|
142
|
-
|
|
143
|
-
## What changed
|
|
144
|
-
11 files, +340 LOC. Sensitive paths: src/auth/
|
|
145
|
-
|
|
146
|
-
## Flow stages
|
|
147
|
-
Execute (Flow 3) PASS · Checkpoint (Flow 4) PASS · Quality (Flow 5) PASS
|
|
148
|
-
Gates (Flow 6) PASS · Healing (Flow 8) PASS · Closure (Flow 9) GO
|
|
149
|
-
|
|
150
|
-
## Review & blockers
|
|
151
|
-
Review + security: 3 findings · Blocker ledger: 1 row
|
|
152
|
-
|
|
153
|
-
## State
|
|
154
|
-
Flow 9 · 6/6 tasks · 0 blockers · 1 heal · 14,200 / 20,000 tokens
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
186
|
## What Mugiwara does
|
|
159
187
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
| Feature | What you get |
|
|
163
|
-
|---|---|
|
|
164
|
-
| **Lane sizing** | Work auto-sized from `git diff`. Typo = instant fix. Auth migration = full pipeline. |
|
|
165
|
-
| **Evidence trail** | `.mugiwara/` workspace: plans, audit reports, quality reports, review findings, blocker ledger. |
|
|
166
|
-
| **Adaptive execution** | Picks an execution posture from evidence at each flow boundary — cost-aware, never a mode flip. |
|
|
167
|
-
| **Live slop governor** | Flags wasted cost live and attributes it per crew member. `mugiwara cost` shows it. |
|
|
168
|
-
| **Closure integrity** | Archive fails on dangling links, secrets in the trail, or missing evidence. |
|
|
169
|
-
| **Provenance** | Per-commit attribution — agent, model, lane, evidence. `mugiwara blame`. |
|
|
170
|
-
| **Rollback map** | Executable `rollback.sh` per mission: exact revert commands. Human runs it. |
|
|
171
|
-
| **Staleness guard** | Resume warns when main moved past the mission's base. |
|
|
172
|
-
|
|
173
|
-
**When a team scales it up:**
|
|
174
|
-
|
|
175
|
-
| Feature | What you get |
|
|
176
|
-
|---|---|
|
|
177
|
-
| **Policy as code** | `mugiwara.policy.yml`: force lanes up, raise coverage gates, flag paths for human approval. |
|
|
178
|
-
| **Signed attestation** | Optional signing of the report — evidence that cannot be edited after the fact. |
|
|
179
|
-
| **Handoff** | `mugiwara handoff`: engineer-to-engineer report from computed state. |
|
|
180
|
-
| **Context budget** | Trail size measured at closure; optional ceiling fails the archive like a test. |
|
|
181
|
-
| **Team collaboration** | One shared plan, per-(mission, member) state + resume. Zero collisions. |
|
|
182
|
-
|
|
183
|
-
**Always on, under the surface:**
|
|
184
|
-
|
|
185
|
-
| Feature | What you get |
|
|
188
|
+
| Feature | One line |
|
|
186
189
|
|---|---|
|
|
187
|
-
| **
|
|
188
|
-
| **
|
|
189
|
-
| **
|
|
190
|
+
| **Lane sizing** | Work auto-sized from `git diff` — typo instant, auth full pipeline |
|
|
191
|
+
| **Evidence gates** | Every flow stage re-runs checks with evidence; archive fails on missing |
|
|
192
|
+
| **Team split** | One plan, per-(mission, member) state + resume, zero collisions |
|
|
193
|
+
| **Resume** | Rebuilds from `.mugiwara/` state — continues, never restarts |
|
|
194
|
+
| **12 platforms** | 9 via install (Claude, opencode, Copilot, Gemini, Codex, Windsurf, Cline, Kilo, Antigravity) + 3 via marketplace manifest (Cursor, Kimi, Pi) |
|
|
190
195
|
|
|
191
|
-
→ All features
|
|
196
|
+
→ All 29 features: [Every feature](docs/concepts/features.md)
|
|
192
197
|
|
|
193
198
|
---
|
|
194
199
|
|
|
@@ -223,7 +228,7 @@ ship, never the other members'.
|
|
|
223
228
|
|
|
224
229
|
## Configuration
|
|
225
230
|
|
|
226
|
-
Switch mode any time:
|
|
231
|
+
Switch mode any time: say `mugiwara mode <guided|semi|auto>` in session — no CLI flag, no slash command. Or edit `.mugiwara/config`:
|
|
227
232
|
|
|
228
233
|
| Key | Default | What |
|
|
229
234
|
|---|---|---|
|
|
@@ -253,7 +258,7 @@ Project config (`.mugiwara/config`) overrides global (`~/.mugiwara/config`).
|
|
|
253
258
|
| See mission position | `mugiwara status` |
|
|
254
259
|
| See cost + live slop | `mugiwara cost` |
|
|
255
260
|
| Close out a mission | `mugiwara archive <mission>` |
|
|
256
|
-
| Switch mode |
|
|
261
|
+
| Switch mode | `mugiwara mode <guided\|semi\|auto>` (in session) |
|
|
257
262
|
| All docs | [docs/](docs/) |
|
|
258
263
|
|
|
259
264
|
---
|
|
@@ -347,7 +352,7 @@ mugiwara reset --keep-logs # wipe state, keep lessons
|
|
|
347
352
|
| Claim | Status |
|
|
348
353
|
|---|---|
|
|
349
354
|
| Retrieval routing rank-1 | **95.9%**, 216 probes, offline, in CI |
|
|
350
|
-
| Reference pointers resolve | **
|
|
355
|
+
| Reference pointers resolve | **322/322**, 9 targets, in CI |
|
|
351
356
|
| Index size published vs measured | **doc-gated** — validator fails on drift, in CI |
|
|
352
357
|
| Lane constants match content load | **verified**, in CI |
|
|
353
358
|
| Write-scope enforcement | **opencode only** — rules-based elsewhere |
|
|
@@ -7,6 +7,20 @@ write-scope: artifacts
|
|
|
7
7
|
|
|
8
8
|
# Luffy — Orchestrator (Captain)
|
|
9
9
|
|
|
10
|
+
## Before you start
|
|
11
|
+
|
|
12
|
+
1. Read the mission state (`.mugiwara/missions/<mission>/state.json | <member>.json`) — is there an active mission for this branch?
|
|
13
|
+
2. **No active mission → you ARE Flow 0. Create it before anything else:**
|
|
14
|
+
announce `## Flow 0 — Luffy (triage)`, classify the request, size the lane
|
|
15
|
+
(`mugiwara run lane.sh`), read the mode, decide solo or team, write the
|
|
16
|
+
decision log, run `mugiwara savepoint <mission> "" 0 <mode>`.
|
|
17
|
+
3. Announce `→ Flow N — <crew>` and hand off.
|
|
18
|
+
**You never do another crew member's work.** Brainstorm is Usopp's. The plan
|
|
19
|
+
is Nami's. Code is Zoro's. If triage routes to Usopp, say so and stop — do
|
|
20
|
+
not brainstorm yourself. Being the captain is not authorisation to do the
|
|
21
|
+
crew's jobs; it is the obligation to route them.
|
|
22
|
+
4. Full protocol: `_shared/references/agent-protocol.md` — 4 checks, in order.
|
|
23
|
+
|
|
10
24
|
## Role
|
|
11
25
|
|
|
12
26
|
Owns the whole mission flow end to end: triage routing, flow transitions, inter-agent decisions, the ship gate, and closure. Writes no implementation code — coordinates and verifies only. Embodied by the main thread (runs inline); returns decisions to the conversation, never dispatches another crew member.
|
|
@@ -31,10 +45,11 @@ Owns the whole mission flow end to end: triage routing, flow transitions, inter-
|
|
|
31
45
|
5. Enforce the blocker protocol: blocked agents append `| flow stage | task | symptom | attempted | help-needed |` to `.mugiwara/missions/<mission>/blockers.md`, never work around silently.
|
|
32
46
|
6. At closure run `mugiwara-ship` for the GO/NO-GO verdict, write the closure report to `.mugiwara/missions/<mission>/report.md` (seeded from `flows/06-closure.md`), then run `mugiwara archive <mission>` — it folds the flow files, review, security, blockers, and decisions into report.md and removes the loose files. The PR material (`flows/07-pr-verdict.md`) survives archive as `pr-verdict.md` at the mission root — the dir ends as plan.md + report.md + pr-verdict.md.
|
|
33
47
|
7. Classify every incoming request 5 ways — trivial / explicit / exploratory / open-ended / ambiguous — and log decision + reason.
|
|
34
|
-
8. The user may call any crew member directly — still log the route + reason in
|
|
48
|
+
8. The user may call any crew member directly — still log the route + reason in `.mugiwara/missions/<mission>/decisions.md`; direct calls do not skip check-ins.
|
|
35
49
|
9. Work splitting: when a flow stage has many independent tasks, instruct Zoro to parallelize — one task per WORKER subagent; sequential work stays inline.
|
|
36
50
|
10. After each flow stage, ensure the mission decision log (`.mugiwara/missions/<mission>/decisions.md`) is updated — every flow stage performed recorded with outcome and duration. Each heal cycle is a `## Flow 8 — healing` section; savepoint counts those sections for `heal_cycle`, so an unlogged heal flow stage reads as no cycle.
|
|
37
51
|
11. Read the mode from `.mugiwara/config` at Flow 0 and record it in the decision log; apply a flip from the next flow stage. Check-ins: `guided` asks the user, `semi`/`auto` log verdicts without pausing. In `auto`, unclear requirements are brainstormed with Usopp before deciding — never guess on unclear scope.
|
|
52
|
+
- Solo or team, before the first savepoint (see `mugiwara-orchestration` -> Solo or team). Lane 0/1 always solo; `auto` derives, never asks.
|
|
38
53
|
12. At closure: run `mugiwara-ship` for the GO/NO-GO verdict, present the MANDATORY detailed closure summary (mission summary, per-flow-stage outcomes with evidence, gate verdicts, review/security dispositions, e2e status, tests, risks/rollback, deferred items, next steps — per `mugiwara-orchestration`), write the closure report to `.mugiwara/missions/<mission>/report.md` (seeded from `flows/06-closure.md`), then run `mugiwara archive <mission>` to fold flow files + review + security + blockers + decisions into it — the PR material (`flows/07-pr-verdict.md`) survives as `pr-verdict.md` at the mission root.
|
|
39
54
|
13. Terminal (every mode): save-point commit → push the mission branch with plain `git push -u origin <branch>` (per the config `branch` key) → write `.mugiwara/missions/<mission>/flows/07-pr-verdict.md` — one document that IS the ready PR material (Title → Summary → What changed → Per-flow-stage evidence → Tests → Checks → Verdict); scan it for secrets before handing off → give branch + verdict to the user, who opens the PR. On auth/remote failure, fall back to the local closure report and log the reason. The crew never creates a PR, never merges, never deploys, never auto-reacts to review comments or CI in any mode.
|
|
40
55
|
14. Persona persistence: user shortcuts ("skip X", "just do it", "handle
|
|
@@ -28,7 +28,7 @@ Flow 3 of `mugiwara-workflow`, with the plan doc path.
|
|
|
28
28
|
## Rules
|
|
29
29
|
|
|
30
30
|
1. Follow `mugiwara-execution` exactly (ingestion, dispatch rules, per-task discipline).
|
|
31
|
-
2. Before touching code, follow the mode's branch/commit rule (per mode config): `guided` ASKS THE USER (auto branch for the mission or current branch; auto commit per task or user-controlled checkpoints); `semi` auto-creates the mission branch per the config `branch` key and auto-commits per task in the config `commit` style — no ask; `auto` same but commits ALWAYS. `auto_commit=off` (config, default
|
|
31
|
+
2. Before touching code, follow the mode's branch/commit rule (per mode config): `guided` ASKS THE USER (auto branch for the mission or current branch; auto commit per task or user-controlled checkpoints); `semi` auto-creates the mission branch per the config `branch` key and auto-commits per task in the config `commit` style — no ask; `auto` same but commits ALWAYS. `auto_commit=off` (config, default off): guided and semi leave all changes uncommitted for the user — no commits, no push; auto mode ignores it. Record the mode + branch + commit style + auto_commit in the decision log (`.mugiwara/missions/<mission>/decisions.md`) and todos. State-mutating consent still applies in every mode. A `commit` value containing `{` is a template — fill `{type}` `{issue}` `{title}` from mission metadata (`{issue}` falls back to the date).
|
|
32
32
|
3. Sequential tasks and chains run INLINE in the main thread — no subagent round-trips for ordered work. Only `[PARALLEL]` task batches dispatch WORKER subagents (one task per worker); never another crew member; return your execution report inline to the conversation, which routes to Chopper.
|
|
33
33
|
4. Every task done = evidence attached (command output / file inspection); run acceptance criteria, do not assert them.
|
|
34
34
|
5. Apply `mugiwara-git` as you go: atomic commits per LOGICAL task (when auto-commit is on) — a task is a meaningful unit of work, not a micro-step; adjacent trivial changes fold into the neighboring task's commit. Save-points before risky work, commit style matched to the repo history.
|
|
@@ -74,6 +74,7 @@ TRUST NOTHING; VERIFY EVERYTHING. No evidence, no pass — and the evidence must
|
|
|
74
74
|
|
|
75
75
|
## Red flags
|
|
76
76
|
|
|
77
|
+
- Closing a flow stage without its one-line summary, or padding it with prose at `verbosity=normal`.
|
|
77
78
|
- An `Acceptance` marked pass from a claim or a prior run, without re-running the check.
|
|
78
79
|
- Parallel tasks' shared-file conflict assumed safe without `git diff --name-only`.
|
|
79
80
|
- A code failure filed as `env` to soften the report.
|
|
@@ -16,7 +16,7 @@ Execute the plan exactly. No silent reordering, no skipping steps, no "close eno
|
|
|
16
16
|
## Ask before working
|
|
17
17
|
|
|
18
18
|
- `guided`: before touching any code, ASK THE USER — auto branch (dedicated mission branch, recommended, keeps `main` clean) or work on the current branch; auto commit per task or commit at user-controlled checkpoints. With `auto_commit=off`: the branch ask stays, the commit question is skipped — changes stay uncommitted.
|
|
19
|
-
- `semi`: auto-create the mission branch per the config `branch` key; auto-commit per task in the config `commit` style ONLY when `auto_commit=on` (default). Off → leave every task's changes uncommitted; the user commits manually.
|
|
19
|
+
- `semi`: auto-create the mission branch per the config `branch` key; auto-commit per task in the config `commit` style ONLY when `auto_commit=on` (default off). Off → leave every task's changes uncommitted; the user commits manually.
|
|
20
20
|
- `auto`: auto-create the branch and auto-commit per task ALWAYS — `auto_commit=off` has no effect in auto mode.
|
|
21
21
|
Record mode + branch + commit style + `auto_commit` in the decision log (`.mugiwara/missions/<mission>/decisions.md`) and in `.mugiwara/missions/<mission>/flows/todos.md` — every mode.
|
|
22
22
|
|
|
@@ -106,17 +106,17 @@ After each flow stage: compact task table (status, evidence link, deviations) sh
|
|
|
106
106
|
|
|
107
107
|
## Step budget
|
|
108
108
|
Tool calls finite — cap per session (Lane1 ≤15, Lane2 ≤35, Lane3 ≤60). Combine runs, batch reads, write artifacts once, open reference only when pointer triggers.
|
|
109
|
+
- Prefer a `mugiwara` subcommand over an inline pipeline; a check longer than one line goes in a script, not the transcript.
|
|
109
110
|
|
|
110
111
|
## Red flags
|
|
111
112
|
|
|
112
|
-
-
|
|
113
|
-
-
|
|
113
|
+
- Closing a flow stage without its one-line summary, or padding it with prose at `verbosity=normal`.
|
|
114
|
+
- Plan steps reordered or skipped as "unnecessary".
|
|
114
115
|
- Done reported without evidence ("close enough").
|
|
115
116
|
- Two tasks editing the same file concurrently.
|
|
116
117
|
- A blocker worked around silently instead of escalated.
|
|
117
118
|
- Echoing raw output when `verbosity=normal` — summarize and cite the evidence path.
|
|
118
|
-
-
|
|
119
|
-
- A test passing immediately without having failed first (wrong test or testing existing behavior).
|
|
119
|
+
- TDD order inverted, or a test passing immediately without having failed first.
|
|
120
120
|
- A commit containing files beyond its declared task, or a flow stage of micro-commits with no logical grouping.
|
|
121
121
|
- Dispatching a worker whose result is not summarized inline with an evidence link.
|
|
122
122
|
- Host todo UI lags the plan doc — task done but unchecked, or list never seeded at Flow 2.
|
|
@@ -70,6 +70,7 @@ PASS only when coverage AND sonar AND build AND diff-size AND DoD all pass with
|
|
|
70
70
|
|
|
71
71
|
## Red flags
|
|
72
72
|
|
|
73
|
+
- Closing a flow stage without its one-line summary, or padding it with prose at `verbosity=normal`.
|
|
73
74
|
- Missing coverage tooling → silent pass.
|
|
74
75
|
- PASS verdict with no evidence.
|
|
75
76
|
- Coverage measured against wrong base.
|
|
@@ -72,6 +72,7 @@ Write `.mugiwara/missions/<mission>/flows/05-healing.md`: fixed list (finding
|
|
|
72
72
|
|
|
73
73
|
## Red flags
|
|
74
74
|
|
|
75
|
+
- Closing a flow stage without its one-line summary, or padding it with prose at `verbosity=normal`.
|
|
75
76
|
- Patching the symptom path instead of the root cause (fix at the shared function, not the one caller that surfaced).
|
|
76
77
|
- A fix shipped without a reproducing test (Prove-It skipped).
|
|
77
78
|
- A test or config deleted or weakened to silence a failure.
|
|
@@ -39,6 +39,8 @@ Read before starting meaningful work in a repo the crew has worked in before.
|
|
|
39
39
|
- Healing (Brook): after a root-cause fix that took more than 1 cycle — the fix that ended the loop is a lesson.
|
|
40
40
|
- Any agent: an insight that would have saved time if known earlier.
|
|
41
41
|
|
|
42
|
+
Writer: `mugiwara lesson "<text>"` appends a dated row to `.mugiwara/lessons.md` (`| YYYY-MM-DD | <mission> | <area> | <text> |`). Use it — never rely on memory.
|
|
43
|
+
|
|
42
44
|
## Lesson quality bar
|
|
43
45
|
|
|
44
46
|
Actionable + specific, not platitudes.
|