@ionivetech/mugiwara 0.6.0 → 0.6.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.
Files changed (39) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.cursor-plugin/plugin.json +1 -1
  5. package/.kimi-plugin/plugin.json +1 -1
  6. package/.opencode/mugiwara-helpers.mjs +24 -0
  7. package/.opencode/plugins/mugiwara.mjs +10 -2
  8. package/AGENTS.md +1 -1
  9. package/README.md +115 -62
  10. package/content/skills/mugiwara-brainstorm/SKILL.md +7 -0
  11. package/content/skills/mugiwara-execution/SKILL.md +41 -41
  12. package/content/skills/mugiwara-execution/references/dispatch.md +41 -0
  13. package/content/skills/mugiwara-orchestration/SKILL.md +28 -24
  14. package/content/skills/mugiwara-orchestration/references/closure.md +34 -0
  15. package/content/skills/mugiwara-orchestration/references/triage-escalation.md +12 -11
  16. package/content/skills/mugiwara-planning/SKILL.md +6 -0
  17. package/content/skills/mugiwara-pr/SKILL.md +7 -0
  18. package/content/skills/mugiwara-quality/SKILL.md +7 -0
  19. package/content/skills/mugiwara-ship/SKILL.md +10 -8
  20. package/content/skills/mugiwara-testcases/SKILL.md +7 -0
  21. package/content/skills/mugiwara-workflow/SKILL.md +2 -2
  22. package/content/skills/using-mugiwara/SKILL.md +7 -1
  23. package/dist/mugiwara.js +190 -10
  24. package/gemini-extension.json +1 -1
  25. package/hooks/mugiwara-mode-tracker.ts +0 -0
  26. package/hooks/session-start.ts +0 -0
  27. package/package.json +1 -1
  28. package/plugin.json +1 -1
  29. package/scripts/evidence.sh +16 -1
  30. package/scripts/gate-selftest.ts +52 -1
  31. package/scripts/initiative.ts +34 -20
  32. package/scripts/lane.sh +4 -2
  33. package/scripts/mission-report.sh +152 -29
  34. package/scripts/savepoint.sh +57 -13
  35. package/scripts/validate-content.ts +20 -0
  36. package/src/cli.ts +20 -3
  37. package/src/installer.ts +37 -1
  38. package/src/mission.ts +111 -1
  39. package/src/targets/claude.ts +27 -8
@@ -5,13 +5,13 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "The Straw Hat crew for AI agents",
8
- "version": "0.6.0"
8
+ "version": "0.6.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.6.0",
14
+ "version": "0.6.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.6.0",
4
+ "version": "0.6.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"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mugiwara",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
5
5
  "author": {
6
6
  "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.6.0",
5
+ "version": "0.6.1",
6
6
  "author": {
7
7
  "name": "ionivetech"
8
8
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mugiwara",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
5
5
  "author": {
6
6
  "name": "ionivetech"
@@ -88,3 +88,27 @@ export function applyModeChange(mode, { projectDir = process.cwd(), home = homed
88
88
  mkdirSync(dirname(log), { recursive: true });
89
89
  appendFileSync(log, `| ${new Date().toISOString()} | mode flip | guided/semi/auto -> ${mode} | user |\n`);
90
90
  }
91
+
92
+ export const DEFAULT_CONFIG_LINES = [
93
+ 'mode=guided',
94
+ 'branch=feature/{type}-{issue}-{slug}',
95
+ 'commit=conventional',
96
+ 'base=main',
97
+ 'coverage_new=90',
98
+ 'coverage_modified=80',
99
+ 'review_depth=full',
100
+ 'quality_depth=full',
101
+ ];
102
+
103
+ // Idempotent: writes the full default config only when .mugiwara/config is
104
+ // absent (a fresh repo's first use). Never overwrites an existing config —
105
+ // mode=guided is the safe default; the user's later edits win.
106
+ export function ensureDefaultConfig({ projectDir = process.cwd() } = {}) {
107
+ const dir = join(projectDir, '.mugiwara');
108
+ const file = join(dir, 'config');
109
+ if (existsSync(file)) return false;
110
+ assertNotSymlink(file);
111
+ mkdirSync(dir, { recursive: true });
112
+ writeFileSync(file, DEFAULT_CONFIG_LINES.join('\n') + '\n');
113
+ return true;
114
+ }
@@ -14,7 +14,7 @@
14
14
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
15
15
  import { dirname, join } from 'node:path';
16
16
  import { fileURLToPath } from 'node:url';
17
- import { readMode, parseModeChange, applyModeChange } from '../mugiwara-helpers.mjs';
17
+ import { readMode, parseModeChange, applyModeChange, ensureDefaultConfig } from '../mugiwara-helpers.mjs';
18
18
 
19
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
20
20
 
@@ -82,7 +82,12 @@ function readAgents() {
82
82
  continue;
83
83
  }
84
84
  if (!parsed.data.description || !parsed.body) continue;
85
- agents[name] = { description: parsed.data.description, mode: 'all', prompt: parsed.body };
85
+ const internal = parsed.data.internal === 'true';
86
+ agents[name] = {
87
+ description: internal ? `[INTERNAL] ${parsed.data.description}` : parsed.data.description,
88
+ mode: internal ? 'subagent' : 'all',
89
+ prompt: parsed.body,
90
+ };
86
91
  if (CREW[name]) agents[name] = { ...agents[name], ...CREW[name] };
87
92
  const perm = permissionFromScope(parsed.data['write-scope']);
88
93
  if (perm) agents[name].permission = perm;
@@ -94,6 +99,9 @@ export default async () => ({
94
99
  dispose: () => {},
95
100
 
96
101
  config: (config) => {
102
+ // only seed .mugiwara/config when the cwd looks like a project — a global
103
+ // install must not create .mugiwara/ in an arbitrary non-project dir.
104
+ if (existsSync(join(process.cwd(), '.git'))) ensureDefaultConfig();
97
105
  config.skills = config.skills || {};
98
106
  config.skills.paths = config.skills.paths || [];
99
107
  if (!config.skills.paths.includes(skillsDir)) config.skills.paths.push(skillsDir);
package/AGENTS.md CHANGED
@@ -173,7 +173,7 @@ Conventional Commits: `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`.
173
173
 
174
174
  ```
175
175
  content/skills/ — 26 skill dirs, each with SKILL.md + optional references/
176
- content/agents/ — 14 agent .md files (11 user-facing + 3 internal)
176
+ content/agents/ — 15 agent .md files (12 user-facing + 3 internal)
177
177
  references/ — shared reference files (definition-of-done, source-grounding, etc.)
178
178
  docs/ — user-facing documentation
179
179
  scripts/ — validation + tooling scripts
package/README.md CHANGED
@@ -4,10 +4,12 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@ionivetech%2fmugiwara)](https://www.npmjs.com/package/@ionivetech/mugiwara)
5
5
  [![License: MIT](https://img.shields.io/github/license/ionivetech/mugiwara)](https://github.com/ionivetech/mugiwara/blob/main/LICENSE)
6
6
 
7
- **Ship quality code, not just fast code.** Mugiwara gives your AI agent a
8
- governed engineering team — 12 specialists who plan, build, audit, review, and
9
- heal with evidence at every step. No runtime, no API keys, no servers. Just
10
- markdown your agent already knows how to read.
7
+ **Your agent writes the code. Mugiwara proves it.**
8
+
9
+ A governed engineering crew for your AI agent evidence at every step, and a
10
+ process that sizes itself to the work. A typo costs nothing. An auth migration
11
+ gets all nine waves. No runtime, no API keys, no servers. Just markdown your
12
+ agent already knows how to read.
11
13
 
12
14
  Works on Claude Code, opencode, Copilot, Gemini, and 8 more platforms.
13
15
 
@@ -21,43 +23,63 @@ every agent, every skill, every rule is static markdown.
21
23
 
22
24
  → [Full pitch: why mugiwara vs just asking your agent](docs/concepts/comparison.md)
23
25
 
24
- ## What Mugiwara does
26
+ ## See the evidence
25
27
 
26
- ### 9-wave pipeline
28
+ A closed mission leaves a report you can actually read. This is the exact
29
+ format `scripts/mission-report.sh` produces:
27
30
 
28
- ```mermaid
29
- flowchart TB
30
- L0["Luffy<br>Triage"] --> L1["Usopp<br>Brainstorm"] --> L2["Nami<br>Plan"] --> L3["Zoro<br>Execute"] --> L4["Chopper<br>Audit"]
31
- L4 --> L5["Sanji<br>Quality"] --> L6["Franky<br>Gates"]
32
- L6 --> L7R["Robin<br>Review"]
33
- L6 --> L7J["Jinbe<br>Security"]
34
- L7R --> L8["Brook<br>Heal"]
35
- L7J --> L8
36
- L8 --> L9["Luffy<br>Closure"]
37
- L8 -. "heal ≤3 cycles" .-> L4
38
- ```
31
+ # Mission: invitation-accepted-flow . 2026-08-11
39
32
 
40
- [Full pipeline details](docs/concepts/workflow.md)
33
+ **Lane** full . **Mode** guided . **Actor** farid . **Branch** feature/MKR-412
41
34
 
42
- ### All features
35
+ ## What changed
36
+
37
+ 11 files, +340 LOC
38
+ Sensitive paths: src/auth/
39
+
40
+ ## Waves
41
+
42
+ | Wave | Artifact | Verdict |
43
+ |------|----------|---------|
44
+ | Execute (Wave 3) | `01-execution.md` | PASS |
45
+ | Checkpoint (Wave 4) | `02-audit.md` | PASS |
46
+ | Quality (Wave 5) | `03-quality.md` | PASS |
47
+ | Gates (Wave 6) | `04-gates.md` | PASS |
48
+ | Healing (Wave 8) | `05-healing.md` | PASS |
49
+ | Closure (Wave 9) | `06-closure.md` | GO |
50
+
51
+ ## Review & blockers
43
52
 
44
- | Feature | What you get |
45
- | --------------------------- | ----------------------------------------------------------------------------------------------- |
46
- | **Lane sizing** | Work auto-sized from `git diff`. Typo = instant fix. Auth migration = full pipeline. |
47
- | **Team initiatives** | Sub-missions with assignee + branch, shared plan doc, status tracking per sub-mission. |
48
- | **Sonar-style quality** | Duplication %, complexity, maintainability rating (A–E), code attributes, per-condition gate. |
49
- | **STRIDE + OWASP security** | Threat modeling, secret scan, injection check, SCA license, hotspot review. |
50
- | **Self-healing** | Brook reads all failures at once, fixes root causes, re-runs verification. ≤3 cycles. |
51
- | **3 autonomy modes** | guided (ask) / semi (auto branch+commit) / auto (hands-off). Flip mid-session. |
52
- | **Configurable depth** | `review_depth` + `quality_depth`: full / standard / quick. Set per project. |
53
- | **Resume from anywhere** | Session lost? Rebuilds from `.mugiwara/state.json`. Continues, never restarts. |
54
- | **Onboarding wizard** | 10 questions — project type, team size, mode, depth. `/mugiwara onboard`. |
55
- | **Evidence trail** | `.mugiwara/` workspace: plans, audit reports, quality reports, review findings, blocker ledger. |
56
- | **12 platforms** | Claude Code, opencode, Copilot, Gemini, Codex, Cursor, Kimi, Pi, Antigravity + CLI. |
57
- | **Cost tracking** | Token budget per lane. Warn at 1.5×, pause at 3×. Surfaced in mission reports. |
58
- | **Multi-actor safe** | Branch-scoped state. Two engineers, one repo. Reset refuses without `--force`. |
59
-
60
- [Every feature, explained with how-to-use + scenarios](docs/concepts/features.md) · [Full pipeline](docs/concepts/workflow.md) · [Lanes](docs/concepts/lanes.md) · [Modes](docs/concepts/modes.md) · [Config](docs/concepts/config.md) · [Audit trail](docs/concepts/audit-trail.md) · [Cost](docs/concepts/cost.md)
53
+ Review + security files: invitation-accepted-flow-review.md, invitation-accepted-flow-security.md
54
+ Findings: 3
55
+ Blocker ledger rows: 1
56
+
57
+ ## State
58
+
59
+ | Field | Value |
60
+ |-------|-------|
61
+ | Wave | 9 |
62
+ | Tasks | 6/6 done |
63
+ | Blockers open | 0 |
64
+ | Heal cycles | 1 |
65
+ | Tokens used | 14,200 / 20,000 |
66
+
67
+ ## Lanes
68
+
69
+ Work is sized to the diff a typo gets no pipeline, an auth migration gets
70
+ all nine waves. Mugiwara itself is free; token usage depends on the lane:
71
+
72
+ | Lane | Waves | Typical tokens |
73
+ | ------------------- | :---: | :------------: |
74
+ | Direct (typo) | 0 | ~0 |
75
+ | Lean (small bug) | 2 | ~4k |
76
+ | Standard (feature) | 5–7 | ~10k |
77
+ | Full (architecture) | 9–11 | ~20k |
78
+
79
+ Usage tracked in `.mugiwara/state.json` per mission. Budget warns at 1.5×,
80
+ pauses at 3×.
81
+
82
+ → [Full cost model](docs/concepts/cost.md)
61
83
 
62
84
  ## 30-second try
63
85
 
@@ -85,10 +107,6 @@ A Standard lane mission (~10k tokens) produces a branch with test-first
85
107
  commits, an audit report, a security review, and a ready PR summary — visible
86
108
  at every step in your chat.
87
109
 
88
- → [Full walkthrough](docs/getting-started.md)
89
-
90
- ## How it works
91
-
92
110
  You ask. The crew routes automatically. **No agent names to memorize, no
93
111
  pipeline config to write.**
94
112
 
@@ -104,11 +122,41 @@ pipeline config to write.**
104
122
  - **Direct agent** when you know exactly what you need — say the name
105
123
  - **Slash commands** when you want to drive: `/mugiwara-plan`, `/mugiwara-review`, `/mugiwara-security`, `/mugiwara-ship`, `/mugiwara onboard`
106
124
 
107
- → [Full workflow walkthrough](docs/concepts/workflow.md)
125
+ → [Full walkthrough](docs/getting-started.md) · [Full workflow walkthrough](docs/concepts/workflow.md)
126
+
127
+ ## What Mugiwara does
128
+
129
+ ### All features
130
+
131
+ | Feature | What you get |
132
+ | ------------------------ | -------------------------------------------------------------------------------------- |
133
+ | **Lane sizing** | Work auto-sized from `git diff`. Typo = instant fix. Auth migration = full pipeline. |
134
+ | **Evidence trail** | `.mugiwara/` workspace: plans, audit reports, quality reports, review findings, blocker ledger. |
135
+ | **Self-healing** | Brook reads all failures at once, fixes root causes, re-runs verification. ≤3 cycles. |
136
+ | **Resume from anywhere** | Session lost? Rebuilds from `.mugiwara/state.json`. Continues, never restarts. |
137
+ | **12 platforms** | Claude Code, opencode, Copilot, Gemini, Codex, Cursor, Kimi, Pi, Antigravity + CLI. |
138
+
139
+ → All 19 features, with how-to-use + scenarios: [Every feature](docs/concepts/features.md) · [Full pipeline](docs/concepts/workflow.md) · [Lanes](docs/concepts/lanes.md) · [Modes](docs/concepts/modes.md) · [Config](docs/concepts/config.md) · [Audit trail](docs/concepts/audit-trail.md) · [Cost](docs/concepts/cost.md)
140
+
141
+ ## The pipeline
142
+
143
+ ```mermaid
144
+ flowchart TB
145
+ L0["Luffy<br>Triage"] --> L1["Usopp<br>Brainstorm"] --> L2["Nami<br>Plan"] --> L3["Zoro<br>Execute"] --> L4["Chopper<br>Audit"]
146
+ L4 --> L5["Sanji<br>Quality"] --> L6["Franky<br>Gates"]
147
+ L6 --> L7R["Robin<br>Review"]
148
+ L6 --> L7J["Jinbe<br>Security"]
149
+ L7R --> L8["Brook<br>Heal"]
150
+ L7J --> L8
151
+ L8 --> L9["Luffy<br>Closure"]
152
+ L8 -. "heal ≤3 cycles" .-> L4
153
+ ```
154
+
155
+ → [Full pipeline details](docs/concepts/workflow.md)
108
156
 
109
157
  ## The crew
110
158
 
111
- 12 user-facing specialists (+3 internal). Each has role boundaries — auditors
159
+ 12 agents (+3 internal). Each has role boundaries — auditors
112
160
  and reviewers are read-only. Call them by name or let the pipeline auto-route.
113
161
 
114
162
  | Agent | Role | Permission |
@@ -136,21 +184,15 @@ and reviewers are read-only. Call them by name or let the pipeline auto-route.
136
184
 
137
185
  → [Agent details: summoning, boundaries, parameters](docs/concepts/agents.md)
138
186
 
139
- ## How much it costs
140
-
141
- Mugiwara itself is free. Token usage depends on mission lane:
142
-
143
- | Lane | Waves | Typical tokens |
144
- | ------------------- | :---: | :------------: |
145
- | Direct (typo) | 0 | ~0 |
146
- | Lean (small bug) | 2 | ~4k |
147
- | Standard (feature) | 5–7 | ~10k |
148
- | Full (architecture) | 9–11 | ~20k |
149
-
150
- Usage tracked in `.mugiwara/state.json` per mission. Budget warns at 1.5×,
151
- pauses at 3×.
187
+ ## When not to use Mugiwara
152
188
 
153
- [Full cost model](docs/concepts/cost.md)
189
+ - **Prototyping or spikes** — use Lane 4, or skip mugiwara entirely.
190
+ - **Unattended multi-hour runs** — the crew runs inline so you can interrupt it.
191
+ If you want to walk away, superpowers' subagent-driven-development is built
192
+ for that.
193
+ - **Solo scripts with no review path** — the audit trail has no audience.
194
+ - **Harnesses without agent dispatch** (Gemini, Codex, tier 3) — you get the
195
+ workflow and the trail, not enforced role boundaries.
154
196
 
155
197
  ## Configuration
156
198
 
@@ -209,6 +251,8 @@ Add to `opencode.json`:
209
251
  { "plugin": ["@ionivetech/mugiwara"] }
210
252
  ```
211
253
 
254
+ Update: `rm -rf ~/.cache/opencode/packages/@ionivetech/mugiwara* && opencode plugin @ionivetech/mugiwara -g` ([details](docs/install/opencode.md#update))
255
+
212
256
  Uninstall: remove `"@ionivetech/mugiwara"` from `opencode.json` plugins array
213
257
 
214
258
  </details>
@@ -315,20 +359,29 @@ Uninstall: `mugiwara uninstall`
315
359
 
316
360
  </details>
317
361
 
318
- All platforms get the full crew — 12 agents, 26 skills (+3 internal agents).
319
- No per-platform feature gaps.
362
+ All platforms get the full crew — 12 agents (+3 internal), 26 skills.
363
+ Enforcement depth varies by harness; see the [harness matrix](docs/reference/harness-matrix.md).
320
364
 
321
365
  → [Per-platform guides](docs/install/index.md)
322
366
 
323
367
  ## Update
324
368
 
325
369
  ```bash
326
- npm update @ionivetech/mugiwara # npm-based
327
- /plugin update mugiwara # marketplace-based
328
- # Reinstall with same install command # GitHub-based
370
+ # opencode — clear the pinned cache, then reinstall (npm update alone does NOT work)
371
+ rm -rf ~/.cache/opencode/packages/@ionivetech/mugiwara* && opencode plugin @ionivetech/mugiwara -g
372
+
373
+ # Claude Code — marketplace
374
+ /plugin update mugiwara
375
+
376
+ # CLI — npm global
377
+ npm i -g @ionivetech/mugiwara@latest
329
378
  ```
330
379
 
331
- [Full update reference](docs/install/index.md)
380
+ OpenCode pins the resolved version in its own package cache, so `npm update`
381
+ never touches it. Reinstall with the same command for GitHub-based plugins
382
+ (Gemini, Codex, Copilot, Cursor, Kimi, Pi, Antigravity).
383
+
384
+ → [Per-platform guides](docs/install/index.md)
332
385
 
333
386
  ## CLI
334
387
 
@@ -87,3 +87,10 @@ For UI directions, name slop risks (generic card grids, unmotivated gradients, t
87
87
  ## One sharp question rule
88
88
 
89
89
  If you cannot phrase the question as multiple choice with answerable options, you do not yet understand the decision — read the codebase until you can.
90
+
91
+ ## Red flags
92
+
93
+ - Collapsing to fewer than three interrogation rounds before handoff.
94
+ - Rubber-stamping ("yes, done") instead of options + trade-offs + recommendation.
95
+ - Guessing a version or library capability without web research.
96
+ - Handing off with a failing validation checklist.
@@ -14,8 +14,6 @@ Execute the plan exactly. No silent reordering, no skipping steps, no "close eno
14
14
 
15
15
  ## Ask before working
16
16
 
17
- By mode (per mode config):
18
-
19
17
  - `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.
20
18
  - `semi`/`auto`: auto-create the mission branch per the config `branch` key (default `feature/{type}-{issue}-{slug}`) and auto-commit per task using the config `commit` style (default conventional). No branch/commit ask. Record mode + branch + commit style in the decision log (`.mugiwara/logs/YYYY-MM-DD-<mission>.md`) and in `.mugiwara/results/<mission>/todos.md`.
21
19
 
@@ -38,40 +36,57 @@ Before starting: if `.mugiwara/continue.md` exists, resume from its next_action
38
36
  1. Read the plan doc fully before touching code.
39
37
  2. Build the task graph from `[PARALLEL]`/`[SEQUENTIAL]` markers and depends-on fields.
40
38
  3. Contradictory graph (cycle, missing dependency) → escalate to Luffy. Do not guess.
41
- 4. SEQUENTIAL tasks and chains → execute INLINE in the main thread, one at a time, in plan order. The user watches the work happen; no subagent round-trips for ordered work.
39
+ 4. SEQUENTIAL tasks and chains → execute INLINE in the main thread, one at a time, in plan order. The user watches the work happen; no subagent round-trips for ordered work — UNLESS context pressure triggers (see Worker dispatch triggers).
42
40
  5. Independent `[PARALLEL]` task batches → dispatch WORKER subagents concurrently, one task per worker (host's native task/subagent mechanism). Workers are not crew members. A worker's result returns as a report; summarize inline with evidence pointers before starting the next batch.
43
41
  6. Two tasks must never edit the same file concurrently. The plan should prevent this; if it doesn't, serialize them and note the deviation.
44
42
 
45
- ## Batch resume
43
+ ## Worker dispatch triggers
46
44
 
47
- After each batch, update `.mugiwara/continue.md` next_action to the next task; `[PARALLEL]` batches stay per sub-mission, never crossing a sub-mission boundary.
45
+ 1. **Independence** `[PARALLEL]` batches, concurrent, one task per worker.
46
+ 2. **Context pressure** — when `tokens_est` exceeds 60% of `budget`
47
+ mid-execution, remaining SEQUENTIAL tasks dispatch to workers — one at a
48
+ time, in plan order. Order is preserved; only the context resets.
48
49
 
49
- ## Task batching
50
+ Announce: `⚠ context 62% — remaining tasks run in fresh workers, plan order unchanged.`
51
+
52
+ The threshold stays relative, never absolute: `tokens_est > 60% × budget`
53
+ (survives model generations), never `tokens_est > 80,000` (obsolete in six
54
+ months). A bigger window raises the threshold; it does not remove it.
55
+
56
+ ## Tier gating & fallback
57
+
58
+ Real worker dispatch exists only where the harness has subagents — tier 1
59
+ (Claude Code, opencode) plus Copilot. Gate the context-pressure trigger on
60
+ that capability: if the harness cannot dispatch, do not promise fresh workers.
61
+
62
+ Where workers are unavailable and context pressure crosses the threshold, fall
63
+ back to the mechanism that already exists: write a savepoint, run the
64
+ checkpoint, and suggest a fresh session via `resume`. Announce the fallback so
65
+ the user is not guessing:
50
66
 
51
- Run task work tightly: do the steps without narrating each command or micro-step. Surface ONE per-task result + evidence per task (or per batch) status, evidence pointer, deviations in a compact line or table. The checkpoint audits evidence, not commentary; save the blow-by-blow.
67
+ `⚠ context 62%no worker dispatch on this harness; savepoint written,
68
+ resume in a fresh session (plan order unchanged).`
52
69
 
53
- **Output rule.** Do NOT stream every tool call to the main thread. After each task batch, emit ONLY:
70
+ ## Batch resume
71
+
72
+ After each batch, update `.mugiwara/continue.md` next_action to the next task; `[PARALLEL]` batches stay per sub-mission, never crossing a sub-mission boundary.
54
73
 
55
- ```
56
- T1: ✅ | built + tested | bun run test -- installer
57
- T2: ✅ | 7 pointers rewritten | grep refs/ → clean
58
- T3: ✅ | 38/38 tests | bun run test
59
- ```
74
+ ## Task batching
60
75
 
61
- Full logs go to `.mugiwara/results/<mission>/01-execution.md`. The main thread shows the summary table only. Tool calls visible below the banner are noise batch them, squash the output.
76
+ Full protocol: `references/dispatch.md`output rule, batch report format.
62
77
 
63
78
  ## Delegation format (parallel workers only)
64
79
 
65
- Sequential work runs inline no delegation. For every `[PARALLEL]` worker you dispatch, the prompt includes all six fields:
80
+ Full protocol: `references/dispatch.md`six-field worker prompt. Thin prompts cause thin results.
66
81
 
67
- - TASK — the task body, verbatim from the plan.
68
- - EXPECTED OUTCOME — what "done" looks like, concrete and checkable.
69
- - REQUIRED TOOLS — commands and files the subagent will need.
70
- - MUST DO — the steps in order, including the TDD failing-test-first step.
71
- - MUST NOT DO — boundaries: files not to touch, configs not to weaken, no silent workarounds.
72
- - CONTEXT — interfaces consumed/produced, related tasks, mission workspace paths.
82
+ ## Surfacing rule
73
83
 
74
- A delegation prompt shorter than ~30 lines is too short beef it up. Thin prompts cause thin results.
84
+ > **Delegated work is not hidden work.** A worker may run out of view; its
85
+ > result may not. Every worker returns a wave banner, a one-line verdict, and an
86
+ > evidence path into the main thread. The user never clicks into a subagent to
87
+ > know what happened.
88
+ >
89
+ > Isolation is for context and permission, never for autonomy.
75
90
 
76
91
  ## TDD discipline & user tests
77
92
 
@@ -79,19 +94,11 @@ Full protocol: `references/resume-batching.md` — batch-resume, TDD RED-GREEN-R
79
94
 
80
95
  ## One logical task, one commit
81
96
 
82
- 1. Follow the task's steps in order TDD discipline above: failing test first (watch it fail), implement, watch it pass, refactor while green.
83
- 2. Verify every acceptance criterion; capture command output as evidence.
84
- 3. Commit per LOGICAL task: a task is a meaningful unit of work (a feature, a fix, a refactor) — not a micro-step. Adjacent trivial changes (typo, formatting, a one-line tweak) fold into the neighboring logical task's commit; never one commit per keystroke. If the plan slices tasks finer than a logical change, group adjacent tasks into one commit and note the grouping in the execution report.
85
- 4. Commit only the files that task declared. No task commingles with its neighbors.
86
- 5. Report done (with evidence) or blocked (with reason).
97
+ Commit per LOGICAL task a feature, fix, or refactor, not a micro-step; verify every acceptance criterion, commit only the task's declared files. Report done (with evidence) or blocked (with reason).
87
98
 
88
99
  ## Blockers → issues ledger
89
100
 
90
- Blocked → write one row to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`:
91
-
92
- | wave | task | symptom | attempted | help-needed |
93
-
94
- Then escalate to Luffy. Never work around a blocker silently.
101
+ Blocked → one row `| wave | task | symptom | attempted | help-needed |` to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`, then escalate to Luffy. Never work around a blocker silently.
95
102
 
96
103
  ## Frontend tasks
97
104
 
@@ -99,15 +106,7 @@ Any task touching UI markup, styling, or components applies `mugiwara-frontend`
99
106
 
100
107
  ## Report
101
108
 
102
- After each wave: compact task table (status, evidence pointer, deviations) shown inline in the conversation. Format:
103
-
104
- ```
105
- | # | Task | Status | Evidence |
106
- |---|------|--------|----------|
107
- | T1 | <title> | ✅/❌ | <command or file> |
108
- ```
109
-
110
- Then return to Luffy, who routes to Chopper (Wave 4). Write detailed execution log to `.mugiwara/results/<mission>/01-execution.md`. Never dispatch another crew member.
109
+ After each wave: compact task table (status, evidence pointer, deviations) shown inline in the conversation. Format: `references/dispatch.md` — report table. Then return to Luffy, who routes to Chopper (Wave 4). Write detailed execution log to `.mugiwara/results/<mission>/01-execution.md`. Never dispatch another crew member.
111
110
 
112
111
  ## Red flags
113
112
 
@@ -119,5 +118,6 @@ Then return to Luffy, who routes to Chopper (Wave 4). Write detailed execution l
119
118
  - The task's TDD order inverted (implementation before the failing test).
120
119
  - A test passing immediately without having failed first (wrong test or testing existing behavior).
121
120
  - A commit containing files beyond its declared task, or a wave of micro-commits with no logical grouping.
121
+ - Dispatching a worker whose result is not summarized inline with an evidence path.
122
122
 
123
123
  All mean: stop, realign to the plan, or escalate to Luffy.
@@ -0,0 +1,41 @@
1
+ # Dispatch & batching detail
2
+
3
+ Full detail behind `content/skills/mugiwara-execution/SKILL.md` — the output
4
+ rule, the worker prompt format, and the per-wave report table.
5
+
6
+ ## Task batching
7
+
8
+ Run task work tightly: do the steps without narrating each command or micro-step. Surface ONE per-task result + evidence per task (or per batch) — status, evidence pointer, deviations — in a compact line or table. The checkpoint audits evidence, not commentary; save the blow-by-blow.
9
+
10
+ **Output rule.** Do NOT stream every tool call to the main thread. After each task batch, emit ONLY:
11
+
12
+ ```
13
+ T1: ✅ | built + tested | bun run test -- installer
14
+ T2: ✅ | 7 pointers rewritten | grep refs/ → clean
15
+ T3: ✅ | 38/38 tests | bun run test
16
+ ```
17
+
18
+ Full logs go to `.mugiwara/results/<mission>/01-execution.md`. The main thread shows the summary table only. Tool calls visible below the banner are noise — batch them, squash the output.
19
+
20
+ ## Delegation format (parallel workers only)
21
+
22
+ Sequential work runs inline — no delegation. For every `[PARALLEL]` worker you dispatch, the prompt includes all six fields:
23
+
24
+ - TASK — the task body, verbatim from the plan.
25
+ - EXPECTED OUTCOME — what "done" looks like, concrete and checkable.
26
+ - REQUIRED TOOLS — commands and files the subagent will need.
27
+ - MUST DO — the steps in order, including the TDD failing-test-first step.
28
+ - MUST NOT DO — boundaries: files not to touch, configs not to weaken, no silent workarounds.
29
+ - CONTEXT — interfaces consumed/produced, related tasks, mission workspace paths.
30
+
31
+ A delegation prompt shorter than ~30 lines is too short — beef it up. Thin prompts cause thin results.
32
+
33
+ ## Report table
34
+
35
+ After each wave: compact task table (status, evidence pointer, deviations) shown inline in the conversation. Format:
36
+
37
+ ```
38
+ | # | Task | Status | Evidence |
39
+ |---|------|--------|----------|
40
+ | T1 | <title> | ✅/❌ | <command or file> |
41
+ ```