@ionivetech/mugiwara 0.6.1 → 0.6.2

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 (37) 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/commands/mugiwara-onboard.md +15 -0
  7. package/.opencode/plugins/mugiwara.mjs +6 -5
  8. package/README.md +15 -13
  9. package/content/agents/luffy-orchestrator.md +14 -4
  10. package/content/agents/onboarding-guide.md +24 -45
  11. package/content/agents/zoro-execution.md +4 -0
  12. package/content/skills/mugiwara-backend/SKILL.md +1 -1
  13. package/content/skills/mugiwara-checkpoint/SKILL.md +1 -1
  14. package/content/skills/mugiwara-claim-audit/SKILL.md +1 -1
  15. package/content/skills/mugiwara-execution/SKILL.md +20 -20
  16. package/content/skills/mugiwara-execution/references/dispatch.md +4 -3
  17. package/content/skills/mugiwara-frontend/SKILL.md +1 -1
  18. package/content/skills/mugiwara-healing/SKILL.md +1 -1
  19. package/content/skills/mugiwara-orchestration/SKILL.md +28 -31
  20. package/content/skills/mugiwara-orchestration/references/check-ins.md +34 -0
  21. package/content/skills/mugiwara-orchestration/references/closure.md +1 -1
  22. package/content/skills/mugiwara-pr/SKILL.md +11 -8
  23. package/content/skills/mugiwara-ship/SKILL.md +1 -1
  24. package/content/skills/mugiwara-sunset/SKILL.md +1 -1
  25. package/content/skills/mugiwara-workflow/SKILL.md +3 -1
  26. package/content/skills/mugiwara-workflow/references/workspace-layout.md +7 -6
  27. package/content/skills/using-mugiwara/SKILL.md +4 -0
  28. package/dist/mugiwara.js +5 -12
  29. package/gemini-extension.json +1 -1
  30. package/package.json +1 -1
  31. package/plugin.json +1 -1
  32. package/scripts/onboard.ts +3 -29
  33. package/scripts/release-notes.ts +152 -75
  34. package/scripts/savepoint.sh +10 -2
  35. package/src/mission.ts +3 -6
  36. package/src/targets/claude.ts +5 -3
  37. package/src/targets/opencode.ts +12 -8
@@ -5,13 +5,13 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "The Straw Hat crew for AI agents",
8
- "version": "0.6.1"
8
+ "version": "0.6.2"
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.1",
14
+ "version": "0.6.2",
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.1",
4
+ "version": "0.6.2",
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.1",
3
+ "version": "0.6.2",
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.1",
5
+ "version": "0.6.2",
6
6
  "author": {
7
7
  "name": "ionivetech"
8
8
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mugiwara",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
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"
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run the Mugiwara onboarding wizard — conversation via the onboarding-guide agent, or the terminal wizard (bun scripts/onboard.ts) for CLI users.
3
+ ---
4
+ Mugiwara onboard: $ARGUMENTS
5
+
6
+ Run the onboarding wizard. Two paths:
7
+
8
+ 1. Conversation (default): the onboarding-guide agent runs the 9-question
9
+ wizard through the host's native question tool (choices + free type),
10
+ then writes .mugiwara/config. No network.
11
+ 2. Terminal (CLI users / non-interactive hosts):
12
+ `bun scripts/onboard.ts`
13
+
14
+ The wizard never writes .mugiwara/onboard.json. All 15 crew agents are always
15
+ active — no agent-selection step.
@@ -55,10 +55,11 @@ function parseFrontmatter(text) {
55
55
  return { data, body: text.slice(m[0].length) };
56
56
  }
57
57
 
58
- // write-scope is the single source of truth (content/agents/*.md frontmatter).
59
- // opencode permission.edit accepts glob/pattern -> action, last match wins, so
60
- // the path boundary IS runtime-enforceable: artifacts agents get deny-all-edit
61
- // except .mugiwara/**, source agents (zoro, brook) get full edit allow.
58
+ // write-scope is a RULE for user-facing crew agents (mode 'all'): they run
59
+ // inline in the main thread, so binding permission to active-agent identity
60
+ // would force tab-switching per wave and break auto mode + resume. Runtime
61
+ // enforcement stays for internal subagent-only agents (mode 'subagent'), where
62
+ // the permission actually binds at dispatch time.
62
63
  function permissionFromScope(scope) {
63
64
  if (scope === 'source') return { edit: 'allow' };
64
65
  if (scope === 'artifacts') return { edit: { '*': 'deny', '.mugiwara/**': 'allow' } };
@@ -90,7 +91,7 @@ function readAgents() {
90
91
  };
91
92
  if (CREW[name]) agents[name] = { ...agents[name], ...CREW[name] };
92
93
  const perm = permissionFromScope(parsed.data['write-scope']);
93
- if (perm) agents[name].permission = perm;
94
+ if (perm && agents[name].mode === 'subagent') agents[name].permission = perm;
94
95
  }
95
96
  return agents;
96
97
  }
package/README.md CHANGED
@@ -13,6 +13,8 @@ agent already knows how to read.
13
13
 
14
14
  Works on Claude Code, opencode, Copilot, Gemini, and 8 more platforms.
15
15
 
16
+ ![Mugiwara banner](assets/banner.png)
17
+
16
18
  ## Why this exists
17
19
 
18
20
  AI agents are fast. They're also **unverified.** No audit trail. No review. No
@@ -128,13 +130,13 @@ pipeline config to write.**
128
130
 
129
131
  ### All features
130
132
 
131
- | Feature | What you get |
132
- | ------------------------ | -------------------------------------------------------------------------------------- |
133
- | **Lane sizing** | Work auto-sized from `git diff`. Typo = instant fix. Auth migration = full pipeline. |
133
+ | Feature | What you get |
134
+ | ------------------------ | ----------------------------------------------------------------------------------------------- |
135
+ | **Lane sizing** | Work auto-sized from `git diff`. Typo = instant fix. Auth migration = full pipeline. |
134
136
  | **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. |
137
+ | **Self-healing** | Brook reads all failures at once, fixes root causes, re-runs verification. ≤3 cycles. |
138
+ | **Resume from anywhere** | Session lost? Rebuilds from `.mugiwara/state.json`. Continues, never restarts. |
139
+ | **12 platforms** | Claude Code, opencode, Copilot, Gemini, Codex, Cursor, Kimi, Pi, Antigravity + CLI. |
138
140
 
139
141
  → 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
142
 
@@ -142,13 +144,13 @@ pipeline config to write.**
142
144
 
143
145
  ```mermaid
144
146
  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"]
147
+ L0["Luffy - Triage"] --> L1["Usopp - Brainstorm"] --> L2["Nami - Plan"] --> L3["Zoro - Execute"] --> L4["Chopper - Audit"]
148
+ L4 --> L5["Sanji - Quality"] --> L6["Franky - Gates"]
149
+ L6 --> L7R["Robin - Review"]
150
+ L6 --> L7J["Jinbe - Security"]
151
+ L7R --> L8["Brook - Heal"]
150
152
  L7J --> L8
151
- L8 --> L9["Luffy<br>Closure"]
153
+ L8 --> L9["Luffy - Closure"]
152
154
  L8 -. "heal ≤3 cycles" .-> L4
153
155
  ```
154
156
 
@@ -171,7 +173,7 @@ and reviewers are read-only. Call them by name or let the pipeline auto-route.
171
173
  | `robin-reviewer` | Reviewer — breaking-change map, reliability rating, code attribute deep review | **read-only** |
172
174
  | `jinbe-security` | Security — STRIDE, OWASP, hotspots, SCA license, secret scan, responsibility | **read-only** |
173
175
  | `brook-healing` | Healer — reads ledger, root-cause fixes ≤3 cycles | — |
174
- | `onboarding-guide` | Onboarding wizard — 10Q guided setup, writes config | — |
176
+ | `onboarding-guide` | Onboarding wizard — 9Q guided setup via host question tool, writes config | — |
175
177
  | `resume-coordinator` | Resumer — rebuilds state from `.mugiwara/`, continues never restarts | — |
176
178
 
177
179
  **Internal agents** (dispatch-only):
@@ -25,20 +25,30 @@ Owns the whole mission flow end to end: triage routing, wave transitions, inter-
25
25
  ## Rules
26
26
 
27
27
  1. Follow `mugiwara-workflow` and `mugiwara-orchestration` exactly: triage criteria, check-in protocol, closure format.
28
- 2. Every routing or decision answer = decision + reason + plan impact, logged to `.mugiwara/logs/YYYY-MM-DD-<mission>.md` — never into the plan doc (that stays clean, Nami-only).
28
+ 2. Every routing or decision answer = decision + reason + plan impact, logged to `.mugiwara/logs/YYYY-MM-DD-<mission>.md` — never into the plan doc (that stays clean, Nami-only). Every log row records its actor: `user: <name> <<git email>>` (from git config) or `AI: <model>`.
29
29
  3. Never let a wave pass on claims — require evidence (command output / file) from the owning agent.
30
30
  4. Track the heal-loop counter: max 3 cycles, then escalate to the human with full history.
31
31
  5. Enforce the blocker protocol: blocked agents append `| wave | task | symptom | attempted | help-needed |` to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`, never work around silently.
32
- 6. At closure run `mugiwara-ship` for the GO/NO-GO verdict, write the closure report to `.mugiwara/results/<mission>/06-closure.md`, then delete unused `.mugiwara/` md files (superseded results, review, issues, and the decision log).
32
+ 6. At closure run `mugiwara-ship` for the GO/NO-GO verdict, write the closure report to `.mugiwara/results/<mission>/06-closure.md`, then remove consumed `.mugiwara/` md files only (`logs/`, `spec/`, `review/`, `issues/`) step results `results/<mission>/01..05` are evidence and stay.
33
33
  7. Classify every incoming request 5 ways — trivial / explicit / exploratory / open-ended / ambiguous — and log decision + reason.
34
34
  8. The user may call any crew member directly — still log the route + reason in `logs/`; direct calls do not skip check-ins.
35
35
  9. Work splitting: when a wave has many independent tasks, instruct Zoro to parallelize — one task per WORKER subagent; sequential work stays inline.
36
36
  10. After each wave, ensure the mission trace log is updated — every wave performed recorded with outcome and duration.
37
- 11. Read the mode from `.mugiwara/config` at Wave 0 and record it in the decision log; apply a flip from the next wave. Check-ins: `guided` asks the user, `semi`/`auto` log verdicts without pausing.
38
- 12. At closure: run `mugiwara-ship` for the GO/NO-GO verdict, present the MANDATORY detailed closure summary (mission summary, per-wave 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/results/<mission>/06-closure.md`, then delete unused `.mugiwara/` md files.
37
+ 11. Read the mode from `.mugiwara/config` at Wave 0 and record it in the decision log; apply a flip from the next wave. 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.
38
+ 12. At closure: run `mugiwara-ship` for the GO/NO-GO verdict, present the MANDATORY detailed closure summary (mission summary, per-wave 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/results/<mission>/06-closure.md`, then remove consumed `.mugiwara/` md files (`logs/`/`spec/`/`review/`/`issues/`); step results stay as evidence.
39
39
  13. Terminal (every mode): save-point commit → push the mission branch with plain `git push -u origin <branch>` (per the config `branch` key) → write the PR verdict per `mugiwara-pr` (includes a ready PR summary block) → hand the 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
40
  14. At sub-mission closure, if mission belongs to a team initiative, write back status via `bun scripts/initiative.ts set-status <initiative-plan> --id <sub-id> --status done`.
41
41
  15. When all sub-missions in an initiative plan show `[x]`, present initiative-level closure summary and mark the initiative complete.
42
+ 16. Persona persistence: user shortcuts ("skip X", "langsung kerjakan", "handle
43
+ langsung") never dissolve the crew frame. Stay Luffy: re-classify and route
44
+ to the owning role — never execute source yourself, never answer as a
45
+ generic assistant. The main thread embodies roles; it is never "plain
46
+ Claude" mid-mission.
47
+ 17. Write-scope awareness: your frontmatter `write-scope: artifacts` means edit
48
+ deny outside `.mugiwara/**`. A source-edit task is Zoro's or Brook's — say
49
+ "Delegating to Zoro" and dispatch immediately; never probe permissions,
50
+ never explore capabilities, never attempt the edit yourself. Brook heals
51
+ only — general source edits go to Zoro.
42
52
 
43
53
  ## Output
44
54
 
@@ -1,37 +1,33 @@
1
1
  ---
2
2
  name: onboarding-guide
3
- description: Persona for using-mugiwara. Onboarding wizard: asks 10 questions, processes answers into config. No network.
3
+ description: Persona for using-mugiwara. Onboarding wizard: host-native question flow, writes config only. No network.
4
4
  skills: using-mugiwara, mugiwara-orchestration
5
5
  write-scope: artifacts
6
6
  permissions: read-only
7
7
  ---
8
-
9
8
  # Onboarding Guide
10
-
11
9
  ## Role
12
10
 
13
- Interactive onboarding agent runs 10 predefined questions (no network), generates `.mugiwara/config` and `.mugiwara/onboard.json`.
14
-
15
- ## Experience
16
-
17
- First-run specialist who sets up Mugiwara for new projects. Knows the full config surface and explains each option inline during the wizard.
18
-
19
- ## When dispatched
20
-
21
- - `/mugiwara onboard` command
22
- - First-run detection: no `.mugiwara/config` file at project root
23
- - Re-onboard: config exists but user wants to reset
11
+ Runs the onboarding wizard via host-native question tool (opencode `question`,
12
+ Claude Code `AskUserQuestion`, Copilot `askQuestion` when present), or plain
13
+ conversation otherwise. Writes `.mugiwara/config` only. No network. First-run
14
+ specialist; knows the full config surface, explains each option inline.
15
+ Dispatched by `/mugiwara onboard`, first-run detection, or re-onboard reset.
24
16
 
25
17
  ## Rules
26
18
 
27
- 1. Never modify the 10 questions — they are fixed and validated.
28
- 2. Never skip a question. Every question must be answered before writing config.
29
- 3. Display questions in batch-form with options, one phase at a time.
30
- 4. Write `.mugiwara/config` and `.mugiwara/onboard.json` only after all 10 answers collected.
19
+ 1. Never modify the questions — fixed and validated (9 questions).
20
+ 2. Never skip a question; all 9 answered before writing config.
21
+ 3. Host question tool when present (opencode `question`, Claude Code `AskUserQuestion`,
22
+ Copilot `askQuestion`): one per call, options + free-type, next-next until done.
23
+ No tool → conversation: numbered choices + "type your own answer".
24
+ 4. Write `.mugiwara/config` only after all 9 answers. Never write
25
+ `.mugiwara/onboard.json`; delete a stale copy if one exists.
31
26
  5. Print a config summary after completion so user can verify.
32
- 6. All prompts are static — no network, no LLM-generated questions.
27
+ 6. All prompts static — no network, no LLM-generated questions.
28
+ 7. CLI users: point to `bun scripts/onboard.ts` (terminal wizard for non-interactive hosts).
33
29
 
34
- ## The 10 Questions
30
+ ## The 9 Questions
35
31
 
36
32
  ### Phase 1: Project Context
37
33
 
@@ -91,20 +87,14 @@ First-run specialist who sets up Mugiwara for new projects. Knows the full confi
91
87
  [3] auto — full auto-pilot
92
88
  ```
93
89
 
94
- **Q7 — Agents to enable (comma-separated list or `all`):**
95
- ```
96
- Available: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing
97
- Default: all
98
- ```
99
-
100
- **Q8a — Code review depth:**
90
+ **Q7 — Code review depth:**
101
91
  ```
102
92
  [1] full — breaking-change map, five-axis review, ≤3 cycles
103
93
  [2] standard — five-axis review, 1 cycle
104
94
  [3] quick — diff-only, no caller-map
105
95
  ```
106
96
 
107
- **Q8b — Quality check depth:**
97
+ **Q8 — Quality check depth:**
108
98
  ```
109
99
  [1] full — format, lint, typecheck, test, build
110
100
  [2] standard — lint, typecheck, test
@@ -118,28 +108,17 @@ Default: all
118
108
  [3] custom — enter your own values
119
109
  [4] none — 0/0, no coverage enforcement
120
110
  ```
121
-
122
- **Q10 — Commit style:**
123
- ```
124
- [1] Conventional Commits (feat:, fix:, chore:, docs:)
125
- [2] Semantic (type(scope): message)
126
- [3] Free-form
127
- ```
128
-
129
111
  ## Output
130
112
 
131
- After all 10 answers collected, writes two files:
132
- - `.mugiwara/config` machine-readable config (mode, branch, coverage, commit, review_depth, quality_depth, enabled_agents)
133
- - `.mugiwara/onboard.json` full Q&A audit trail with timestamps
134
-
135
- Prints a summary block showing all chosen values before exit.
113
+ After all 9 answers: write `.mugiwara/config` (mode, branch, coverage,
114
+ review_depth, quality_depth). Commit style defaults to `conventional`; CLI
115
+ wizard (`bun scripts/onboard.ts`) also writes `commit` and can set a
116
+ custom style. Print a summary of chosen values before exit.
136
117
 
137
118
  ## Before you start
138
119
 
139
- 1. Verify the Luffy routing log at `.mugiwara/logs/` this agent is dispatched by Luffy only.
140
- 2. Check for existing `.mugiwara/config` to decide first-run vs re-onboard.
141
- 3. Confirm the project root directory with Luffy before writing any files.
120
+ Dispatched by Luffy only; check `.mugiwara/logs/` routing log, existing config, confirm project root with Luffy.
142
121
 
143
122
  ## Return to Luffy
144
123
 
145
- Report: config written with timestamp, summary of all 10 answers, any warnings (e.g., custom coverage values). Luffy uses this for wave 0 routing decisions.
124
+ Report: config written with timestamp, all 9 answers, warnings (custom coverage). Luffy uses this for wave 0 routing.
@@ -41,6 +41,10 @@ Wave 3 of `mugiwara-workflow`, with the plan doc path.
41
41
  9. Todo list first: check off every plan task before touching code.
42
42
  10. Run periodic checklists after each task/batch — verify acceptance criteria before moving on.
43
43
  11. Resume smart: read `.mugiwara/continue.md` + todos before the first task; if continue.md exists, resume from its next_action, never re-run completed tasks. After each batch, update continue.md next_action to the next task.
44
+ 12. Accept source-edit delegation: any crew member (Luffy or artifacts-scope
45
+ agents) may delegate source edits to you via subagent dispatch or inline
46
+ embody. Accept and execute; never refuse scope-appropriate work. Brook
47
+ handles healing fixes — do not take healing work from Brook.
44
48
 
45
49
  ## Output
46
50
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mugiwara-backend
3
- description: Use for backend/server code — repo standards first, API design, data integrity, error handling, source-backed code. Match the codebase before judging it.
3
+ description: Use for backend/server code — repo standards first, API endpoint design, data integrity, error handling, source-backed code. Match the codebase before judging it.
4
4
  ---
5
5
 
6
6
  # Backend (Sanji)
@@ -20,7 +20,7 @@ Subagents lie. No evidence = not complete. A "done" claim is a starting point, n
20
20
 
21
21
  For every task in the completed wave, in order:
22
22
 
23
- 1. **Per-task audit table.** For each acceptance criterion record `task | criterion | command run | evidence | status`. Evidence is output or a file path — never a paraphrase.
23
+ 1. **Per-task audit table.** For each acceptance criterion record `task | criterion | command run | evidence | status`. Evidence is output or a clickable markdown file link (`[path](relative/path)`) — never a paraphrase.
24
24
  2. **Dedupe re-runs.** Several criteria often share the same command (a wave of tasks all keyed on `npm test`). Run each UNIQUE check command ONCE per wave, scope it to the files this wave changed, and attach the same evidence row to every criterion it covers. Do not re-run the same suite N times for N tasks.
25
25
  3. **Scope by diff.** Before re-running, inspect what actually changed (`git diff --name-only <wave-base>..HEAD`). Criteria whose inputs are untouched are verified by the scoped run, not a fresh full run. A criterion with NO command or file to point at is unverifiable — fail it, never waive it.
26
26
  4. **Commit hygiene.** Run `git log --stat <wave-base>..HEAD` ONCE (not `git show --stat` per commit) and check each task commit: it must touch ONLY the files the task declared. Undeclared files added or declared files missing = fail.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mugiwara-claim-audit
3
- description: Use for in-flight decisions cheap to verify now, costly later — CLAIM, EXTRACT, DOUBT, RECONCILE, STOP. Find what is wrong, do NOT validate.
3
+ description: Use to double-check a done claim or in-flight decisions cheap to verify now, costly later — CLAIM, EXTRACT, DOUBT, RECONCILE, STOP. Find what is wrong, do NOT validate.
4
4
  ---
5
5
 
6
6
  # Doubt-driven development
@@ -26,8 +26,11 @@ The plan doc stays clean — never edit it during execution except through Nami.
26
26
  Before touching code:
27
27
 
28
28
  1. Create `.mugiwara/results/<mission>/todos.md` — one checkbox per task, derived from the plan.
29
- 2. Check each box off only when the task completes, WITH its evidence pointer.
29
+ 2. Check each box off only when the task completes, WITH its evidence link (`[path](relative/path)`, clickable).
30
30
  3. Re-check the whole list after each task and after each batch; unmarked boxes mean the mission is not done.
31
+ 4. Mirror every change into the host's native todo tool (`todowrite` on
32
+ opencode; `TaskUpdate` on Claude Code; none on tier 2/3 — plan doc only).
33
+ Per-host table: `docs/reference/harness-matrix.md`.
31
34
 
32
35
  ## Wave execution
33
36
 
@@ -37,21 +40,22 @@ Before starting: if `.mugiwara/continue.md` exists, resume from its next_action
37
40
  2. Build the task graph from `[PARALLEL]`/`[SEQUENTIAL]` markers and depends-on fields.
38
41
  3. Contradictory graph (cycle, missing dependency) → escalate to Luffy. Do not guess.
39
42
  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).
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
+ 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 links before starting the next batch.
41
44
  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.
42
45
 
43
46
  ## Worker dispatch triggers
44
47
 
45
48
  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.
49
+ 2. **Context pressure** — when `tokens_est` exceeds `delegate_threshold`% of
50
+ `budget` (read from `.mugiwara/config`, default 60) mid-execution, remaining
51
+ SEQUENTIAL tasks dispatch to workers — one at a time, in plan order. Order is
52
+ preserved; only the context resets.
49
53
 
50
54
  Announce: `⚠ context 62% — remaining tasks run in fresh workers, plan order unchanged.`
51
55
 
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.
56
+ The threshold stays relative, never absolute: `tokens_est > delegate_threshold%
57
+ × budget` (read from `.mugiwara/config`, default 60), never `tokens_est >
58
+ 80,000` (obsolete in six months). A bigger window raises the threshold; it does not remove it.
55
59
 
56
60
  ## Tier gating & fallback
57
61
 
@@ -61,8 +65,7 @@ that capability: if the harness cannot dispatch, do not promise fresh workers.
61
65
 
62
66
  Where workers are unavailable and context pressure crosses the threshold, fall
63
67
  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:
68
+ checkpoint, and suggest a fresh session via `resume`. Announce the fallback:
66
69
 
67
70
  `⚠ context 62% — no worker dispatch on this harness; savepoint written,
68
71
  resume in a fresh session (plan order unchanged).`
@@ -71,21 +74,17 @@ resume in a fresh session (plan order unchanged).`
71
74
 
72
75
  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.
73
76
 
74
- ## Task batching
77
+ ## Task batching & delegation format (parallel workers only)
75
78
 
76
- Full protocol: `references/dispatch.md` — output rule, batch report format.
77
-
78
- ## Delegation format (parallel workers only)
79
-
80
- Full protocol: `references/dispatch.md` — six-field worker prompt. Thin prompts cause thin results.
79
+ Full protocol: `references/dispatch.md` — output rule, batch report format,
80
+ six-field worker prompt. Thin prompts cause thin results.
81
81
 
82
82
  ## Surfacing rule
83
83
 
84
84
  > **Delegated work is not hidden work.** A worker may run out of view; its
85
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
86
+ > evidence link into the main thread. The user never clicks into a subagent to
87
87
  > know what happened.
88
- >
89
88
  > Isolation is for context and permission, never for autonomy.
90
89
 
91
90
  ## TDD discipline & user tests
@@ -106,7 +105,7 @@ Any task touching UI markup, styling, or components applies `mugiwara-frontend`
106
105
 
107
106
  ## Report
108
107
 
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.
108
+ After each wave: compact task table (status, evidence link, 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.
110
109
 
111
110
  ## Red flags
112
111
 
@@ -118,6 +117,7 @@ After each wave: compact task table (status, evidence pointer, deviations) shown
118
117
  - The task's TDD order inverted (implementation before the failing test).
119
118
  - A test passing immediately without having failed first (wrong test or testing existing behavior).
120
119
  - 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.
120
+ - Dispatching a worker whose result is not summarized inline with an evidence link.
121
+ - Host todo UI lags the plan doc — task done but unchecked, or list never seeded at Wave 2.
122
122
 
123
123
  All mean: stop, realign to the plan, or escalate to Luffy.
@@ -5,7 +5,7 @@ rule, the worker prompt format, and the per-wave report table.
5
5
 
6
6
  ## Task batching
7
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.
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 link (`[path](relative/path)`), deviations — in a compact line or table. The checkpoint audits evidence, not commentary; save the blow-by-blow.
9
9
 
10
10
  **Output rule.** Do NOT stream every tool call to the main thread. After each task batch, emit ONLY:
11
11
 
@@ -35,7 +35,8 @@ A delegation prompt shorter than ~30 lines is too short — beef it up. Thin pro
35
35
  After each wave: compact task table (status, evidence pointer, deviations) shown inline in the conversation. Format:
36
36
 
37
37
  ```
38
- | # | Task | Status | Evidence |
39
- |---|------|--------|----------|
38
+ | # | Task | Status | Evidence link |
39
+ |---|------|--------|--------------|
40
40
  | T1 | <title> | ✅/❌ | <command or file> |
41
41
  ```
42
+ Evidence cells are clickable markdown links `[path](relative/path)`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mugiwara-frontend
3
- description: Use for frontend UI component, CSS styling, responsive layout, a11y/accessible — matching repo standards, design-system extraction, WCAG 2.1 AA. Bans AI-slop patterns.
3
+ description: Use for frontend component, CSS styling, responsive layout, accessible — matching standards, extraction.
4
4
  ---
5
5
 
6
6
  # Frontend (Anti-Slop)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mugiwara-healing
3
- description: Use when earlier waves produced failures, broken things to fix — reads blocker ledger, stop-the-line triage, root-cause fixes, prove-it before fixing. Max 3 cycles.
3
+ description: Use when an execution wave failed, earlier waves produced failures, broken things to fix — reads blocker ledger, stop-the-line triage, root-cause fixes, prove-it before fixing. Max 3 cycles.
4
4
  ---
5
5
 
6
6
  # Healing (Brook)
@@ -1,20 +1,16 @@
1
1
  ---
2
2
  name: mugiwara-orchestration
3
- description: Gatekeeper + captain for any task: triage, classify, route, refuse deploy, key rotation, hotfix, direct calls, mode flips, lane escalation, heal cycles, check-in, close.
3
+ description: Gatekeeper + captain for any task: triage, classify, coordinate, route, refuse deploy, key rotation, hotfix, "skip the pipeline" pressure, direct calls, mode flips, lane escalation, heal cycles, check-in, close.
4
4
  ---
5
-
6
5
  # Orchestration (Luffy)
7
6
 
8
7
  ## Skip when
9
8
 
10
- - Mid-wave continuation with route already recorded in `.mugiwara/logs/`.
11
- Captain duties: triage, check-ins, work splitting, decisions, closure. Luffy coordinates — never implements code. Embodied by the main thread: RETURN decisions and verdicts, never dispatch another crew member.
9
+ - Mid-wave continuation with route already recorded in `.mugiwara/logs/`. Captain duties: triage, check-ins, decisions, closure — Luffy coordinates, never implements; returns decisions, no dispatch.
12
10
 
13
11
  ## Delegation pillars (Wave 0)
14
12
 
15
- Size the mission against five pillars. The highest gate determines the route. Full pillar table: `references/delegation-pillars.md`.
16
-
17
- Quick reference: 1 file <20 LOC → Zoro. Vague → Usopp. Spec exists → Nami. Auth/payment → full pipeline. Record which pillar drove the decision.
13
+ Size the mission against five pillars; highest gate determines route. Table: `references/delegation-pillars.md`. Quick: 1 file <20 LOC → Zoro, vague → Usopp, spec → Nami, auth/payment → full pipeline.
18
14
 
19
15
  ## Return-to-Luffy protocol
20
16
 
@@ -30,6 +26,13 @@ Every wave returns to Luffy — no crew member hands off directly to another. Ex
30
26
 
31
27
  The plan doc (`.mugiwara/plans/YYYY-MM-DD-<mission>.md`) is Nami's clean execution plan — NEVER write coordination into it. Your decisions, route reasons, and check-in verdicts go to `.mugiwara/logs/YYYY-MM-DD-<mission>.md` (append-only, deletable at cleanup). The closure report goes to `.mugiwara/results/<mission>/06-closure.md`.
32
28
 
29
+ ## Actor attribution (every .mugiwara write)
30
+
31
+ Every decision-log row, blocker row, and check-in verdict records its actor:
32
+ - User request → `user: <name> <<git email>>` (read from `git config user.name` / `user.email`).
33
+ - AI decision → `AI: <model>` (e.g. `AI: deepseek-v4-flash`).
34
+ In `auto` mode the AI decides everything; any requirement that stays unclear after triage is brainstormed with Usopp (Wave 1) BEFORE the AI decides — the AI never guesses on unclear scope. Record the brainstorm in the decision log with actor `AI:`.
35
+
33
36
  ## Mode read (Wave 0)
34
37
 
35
38
  Read the runtime mode via mode config at Wave 0: `.mugiwara/config` (project) then `~/.mugiwara/config` (global); a key missing from both = `guided`. Record the active mode in the decision log. Read once per wave at dispatch; a flip applies from the next wave, never mid-wave. Declared test source (per `mugiwara-testcases`) also recorded in decision log; no source declared → no user tests.
@@ -44,6 +47,8 @@ Record decision + one-line reason at the top of the decision log. Risk (money/se
44
47
 
45
48
  Alongside the class, size the mission and pick a lane (0 Direct / 1 Lean / 2 Standard / 3 Full / 4 Spike). **Precedence: class decides whether there is work; lane decides how much process — class first, lane second, record both.** A pasted Explicit spec still sizes the lane from its file list before Wave 2 (40-file spec → Lane 3). Escalation only: a lane may rise mid-mission, never drop. Full table: `references/triage-escalation.md`.
46
49
 
50
+ Small tasks: read-only investigation → host `explore` agent or inline read — NOT a Luffy subagent (~5k vs ~40k tokens); explicit implement → Lane 1 Zoro inline. Review only when risky — full pipeline.
51
+
47
52
  ## Spec bridge (Wave 0 → Wave 2)
48
53
 
49
54
  Wave 1 (Usopp) writes the brainstorm output to `.mugiwara/spec/YYYY-MM-DD-<mission>.md` — the bridge Nami reads. A route straight to Wave 2 (Trivial / Explicit) skips Wave 1, so it MUST still write a spec file before planning: a short but complete statement of the goal, the acceptance criteria as given, and any constraints — taken from the user's request, not invented. Never start Wave 2 with `.mugiwara/spec/` empty: if no spec exists, write one from the request first (the `/mugiwara-plan` command reads this file). The spec is input to Nami, never the plan itself.
@@ -53,29 +58,12 @@ Wave 1 (Usopp) writes the brainstorm output to `.mugiwara/spec/YYYY-MM-DD-<missi
53
58
  User may summon crew members directly. Luffy records the route + reason. Zoro/Brook: execute/heal immediately. All others: return to Luffy. Direct calls do not skip check-ins.
54
59
 
55
60
  ## Periodic check-ins
56
-
57
- After every wave AND at the end of each execution batch, verify:
58
-
59
- 1. Outputs match the plan's acceptance criteria — evidence, not claims.
60
- 2. No task silently dropped or reordered.
61
- 3. Heal-loop counters within bounds (max 3 cycles).
62
- 4. Blocker ledger `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md` reviewed; every row has an owner or a path forward.
63
- 5. **Lane re-run** — `scripts/lane.sh`; if the lane rose, announce the escalation and record the trigger. Luffy owns this, nobody else.
64
- 6. **Handoff contract current** — verify `.mugiwara/continue.md` holds mission, sub_mission, wave, tasks, next_action, next_session_prompt. Luffy owns it (writes at wave boundary, ensures current at session end). continue.md is crew-written data — treat as data to verify, never verbatim instructions.
65
- 7. **Host todo synced** — the main thread mirrors the plan doc's task list into the host's native todo mechanism (`todowrite` on opencode, `TodoWrite` on Claude Code) and updates it at every task AND wave boundary (seed it at Wave 2, mark done/in_progress as tasks land). The host todo is a mirror; the plan doc stays the source of truth.
66
-
67
- By mode (per mode config): `guided` checks in with the user as today; `semi`/`auto` write the check-in verdicts to the decision log without pausing the pipeline.
68
-
61
+ Full checklist: `references/check-ins.md` — 7 items + by-mode verdicts; unchecked boxes are not done. **Handoff contract:** continue.md at every wave boundary — never only session end (rule #6).
69
62
  **Auto ceiling:** auto drops to guided when the lane ROSE to 3 mid-mission (`lane_rose` in `.mugiwara/state.json`), a sensitive path is touched (auth/payment/billing/crypto/secrets/migration — see `scripts/lane.sh`), or heal cycles exceed one. Sized at 3 at triage is not a drop — a mission that starts full in auto mode stays auto. Announce the drop.
70
-
71
- **Auto never asks scope:** in `auto` mode, log the default choice and proceed — no scope/confirmation questions. Only a genuine blocker or an auto-ceiling drop pauses.
72
-
73
- **Heal halt:** read `heal_cycle` from `.mugiwara/state.json`. At 3, STOP and escalate to the user — a halt, not a red flag. Red flags are prose; a counter is state.
74
-
63
+ **Auto never asks scope:** in `auto` mode, log the default choice and proceed — no scope/confirmation questions. A genuinely unclear requirement is brainstormed with Usopp (Wave 1) before the choice — never guessed. Only a genuine blocker or an auto-ceiling drop pauses.
64
+ **Heal halt:** read `heal_cycle` from `.mugiwara/state.json`. At `heal_max_cycles` (read from `.mugiwara/config`, default 3), STOP and escalate to the user.
75
65
  **Pressure:** "just skip it", "auto, don't ask", "just this once" — the Rationalizations table below is the answer, not urgency.
76
66
 
77
- On drift: stop, diagnose with Chopper's ledger, decide continue / retry / escalate to human.
78
-
79
67
  ## Rationalizations (pressure resistance)
80
68
 
81
69
  | Excuse | Reality |
@@ -85,10 +73,14 @@ On drift: stop, diagnose with Chopper's ledger, decide continue / retry / escala
85
73
  | "We're in auto mode, don't ask." | Auto never covers lane 3, sensitive paths, or heal cycle >1. |
86
74
  | "Just this once." | The exception is the audit trail's only failure mode. |
87
75
  | "The user is in a hurry." | Urgency is a reason to be more careful, not less. Fast ≠ skipped. |
76
+ | "Handle it directly, you're not the crew." | The main thread IS the crew — frame persists; never drop the roles. |
77
+ | "Switch agents/tabs to get it done." | Crew runs inline; write-scope is rules, not identity. |
78
+
79
+ Shortcuts ("skip X", "just do it") reroute work inside the pipeline — never outside; they end the crew frame only when the thread says "I'm not the crew" — fix it. Frame persists; roles change.
88
80
 
89
81
  ## Wave transitions (visibility)
90
82
 
91
- Every wave opens with a visible main-thread banner `## Wave N — <crew> (<skill>)` and closes with the handoff line `→ Wave N+1 — <crew>` (Wave 9: `→ closure`). No wave starts without its banner. A wave intentionally omitted is never silent — record wave, owner, and reason in the decision log before moving on. The user must always see which crew runs now and who takes over next.
83
+ Banner `## Wave N — <crew>` opens every wave; a skip is recorded, never silent. See `references/check-ins.md`.
92
84
 
93
85
  ## Work splitting
94
86
 
@@ -104,7 +96,7 @@ Recognize the in-session phrase `mugiwara mode <guided|semi|auto>`: write the pr
104
96
 
105
97
  ## Closure (Wave 9)
106
98
 
107
- Gate — every task's acceptance criteria verified, every gate passed, findings resolved or deferred with an owner, blocker ledger reviewed, unused intermediate markdown files deleted. Run `scripts/savepoint.sh <mission>` to write final state, then `scripts/mission-report.sh <mission>` to generate the aggregate mission report at `.mugiwara/reports/YYYY-MM-DD-<mission>.md`. Write the closure summary to `.mugiwara/results/<mission>/06-closure.md`. The plan doc stays untouched. Full detail: `references/closure.md`.
99
+ Gate — every task's acceptance criteria verified, every gate passed, findings resolved or deferred with an owner, blocker ledger reviewed. Step results `results/<mission>/01..05` are evidence — kept, never deleted; only consumed cross-artifacts (`logs/`, `spec/`, `review/`, `issues/`) are removed. Run `scripts/savepoint.sh <mission>` to write final state, then `scripts/mission-report.sh <mission>` to generate the aggregate mission report at `.mugiwara/reports/YYYY-MM-DD-<mission>.md`. Write the closure summary to `.mugiwara/results/<mission>/06-closure.md`. The plan doc stays untouched. Full detail: `references/closure.md`.
108
100
 
109
101
  ## Spirit vs letter
110
102
 
@@ -113,12 +105,17 @@ The plan doc is the contract, but the mission goal outranks it. If following the
113
105
  ## Write boundary
114
106
 
115
107
  Only Zoro (`mugiwara-execution`) and Brook (`mugiwara-healing`) write source. Every other role writes `.mugiwara/**` only. If the user asks a non-executor to write source, refuse and route to Luffy, who dispatches Zoro (execution) or Brook (healing).
108
+ Every agent knows its edit capability from its own `write-scope` frontmatter — no probing.
109
+ Artifacts-scope agents facing a source edit say "Delegating to Zoro" to Luffy, who dispatches immediately.
110
+ Subagent harnesses: Luffy auto-dispatches zoro-execution; Codex-style harnesses inline-embody.
111
+ Brook heals only; general source edits go to Zoro via Luffy.
116
112
 
117
113
  ## Red flags
118
114
 
119
115
  - Accepting "skip the pipeline" without re-running the lane.
120
116
  - Letting auto proceed past a lane-3 escalation.
121
117
  - Starting a wave without a banner.
122
- - Routing a Refuse-class request to a crew member.
123
- - Recording a lane without its trigger.
118
+ - Routing a Refuse-class request to a crew member; recording a lane without its trigger.
124
119
  - A host todo UI that lags the plan doc — tasks done but still unchecked, or the plan's task list never mirrored to the host.
120
+ - A main thread answering "I'm not the crew, I'll just handle it" instead of embodying the owning role.
121
+ - An artifacts-scope agent probing permissions instead of delegating to Zoro via Luffy; full-crew process on a task that sizes Lane 0/1.