@ionivetech/mugiwara 0.5.5 → 0.6.0

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 (145) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +3 -2
  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-continue.md +16 -0
  7. package/.opencode/commands/mugiwara-execute.md +6 -4
  8. package/.opencode/commands/mugiwara-heal.md +6 -4
  9. package/.opencode/commands/mugiwara-plan.md +6 -4
  10. package/.opencode/commands/mugiwara-review.md +6 -4
  11. package/.opencode/commands/mugiwara-security.md +6 -4
  12. package/.opencode/commands/mugiwara-ship.md +6 -4
  13. package/.opencode/commands/mugiwara.md +4 -2
  14. package/.opencode/commands/using-mugiwara.md +7 -13
  15. package/.opencode/plugins/mugiwara.mjs +18 -6
  16. package/AGENTS.md +1 -1
  17. package/GEMINI.md +1 -1
  18. package/README.md +251 -120
  19. package/content/agents/brook-healing.md +17 -3
  20. package/content/agents/chopper-checkpoint.md +17 -3
  21. package/content/agents/eval-runner.md +17 -2
  22. package/content/agents/franky-gates.md +19 -5
  23. package/content/agents/jinbe-security.md +19 -3
  24. package/content/agents/luffy-orchestrator.md +6 -3
  25. package/content/agents/memory-keeper.md +15 -0
  26. package/content/agents/nami-planner.md +21 -6
  27. package/content/agents/onboarding-guide.md +145 -0
  28. package/content/agents/resume-coordinator.md +21 -5
  29. package/content/agents/robin-reviewer.md +18 -3
  30. package/content/agents/sanji-quality.md +19 -4
  31. package/content/agents/skeptic-verifier.md +18 -3
  32. package/content/agents/usopp-brainstorm.md +17 -3
  33. package/content/agents/zoro-execution.md +18 -3
  34. package/content/skills/mugiwara-backend/SKILL.md +1 -1
  35. package/content/skills/mugiwara-brainstorm/SKILL.md +5 -1
  36. package/content/skills/mugiwara-checkpoint/SKILL.md +2 -2
  37. package/content/skills/mugiwara-contract-first/SKILL.md +2 -36
  38. package/content/skills/mugiwara-contract-first/references/process.md +37 -0
  39. package/content/skills/mugiwara-execution/SKILL.md +30 -13
  40. package/content/skills/mugiwara-execution/references/resume-batching.md +32 -0
  41. package/content/skills/mugiwara-frontend/SKILL.md +1 -1
  42. package/content/skills/mugiwara-gates/SKILL.md +32 -30
  43. package/content/skills/mugiwara-healing/SKILL.md +1 -1
  44. package/content/skills/mugiwara-orchestration/SKILL.md +41 -25
  45. package/content/skills/mugiwara-orchestration/references/delegation-pillars.md +40 -0
  46. package/content/skills/mugiwara-orchestration/references/triage-escalation.md +96 -0
  47. package/content/skills/mugiwara-planning/SKILL.md +23 -27
  48. package/content/skills/mugiwara-planning/references/plan-template.md +42 -0
  49. package/content/skills/mugiwara-pr/SKILL.md +2 -2
  50. package/content/skills/mugiwara-quality/SKILL.md +10 -6
  51. package/content/skills/mugiwara-resume/SKILL.md +7 -2
  52. package/content/skills/mugiwara-review/SKILL.md +20 -1
  53. package/content/skills/mugiwara-review/references/code-attributes.md +38 -0
  54. package/content/skills/mugiwara-root-cause/SKILL.md +3 -30
  55. package/content/skills/mugiwara-root-cause/references/process.md +35 -0
  56. package/content/skills/mugiwara-security/SKILL.md +17 -32
  57. package/content/skills/mugiwara-security/references/owasp-top10.md +12 -0
  58. package/content/skills/mugiwara-security/references/rationalizations.md +8 -0
  59. package/content/skills/mugiwara-ship/SKILL.md +5 -4
  60. package/content/skills/mugiwara-workflow/SKILL.md +74 -77
  61. package/content/skills/mugiwara-workflow/references/workspace-layout.md +50 -0
  62. package/content/skills/using-mugiwara/SKILL.md +8 -19
  63. package/dist/mugiwara.js +107 -41
  64. package/gemini-extension.json +1 -1
  65. package/hooks/session-start.ts +1 -1
  66. package/package.json +11 -4
  67. package/plugin.json +1 -1
  68. package/references/multi-actor.md +1 -1
  69. package/scripts/evidence.sh +12 -5
  70. package/scripts/gate-selftest.ts +266 -0
  71. package/scripts/initiative.ts +248 -0
  72. package/scripts/lane.sh +15 -0
  73. package/scripts/mission-report.sh +90 -12
  74. package/scripts/onboard.ts +292 -0
  75. package/scripts/release-notes.ts +42 -13
  76. package/scripts/savepoint.sh +97 -50
  77. package/scripts/validate-content.ts +77 -0
  78. package/scripts/verify-install.ts +72 -0
  79. package/src/installer.ts +34 -7
  80. package/src/mission.ts +7 -5
  81. package/src/targets/claude.ts +20 -3
  82. package/src/targets/generic.ts +1 -1
  83. package/src/targets/opencode.ts +31 -10
  84. package/docs/concepts/agents.md +0 -53
  85. package/docs/concepts/audit-trail.md +0 -65
  86. package/docs/concepts/comparison.md +0 -58
  87. package/docs/concepts/config.md +0 -55
  88. package/docs/concepts/cost.md +0 -45
  89. package/docs/concepts/execution-model.md +0 -92
  90. package/docs/concepts/git-strategy.md +0 -62
  91. package/docs/concepts/lanes.md +0 -82
  92. package/docs/concepts/modes.md +0 -73
  93. package/docs/concepts/pr-summary.md +0 -54
  94. package/docs/concepts/skills.md +0 -55
  95. package/docs/concepts/workflow.md +0 -89
  96. package/docs/getting-started.md +0 -158
  97. package/docs/index.md +0 -56
  98. package/docs/install/antigravity.md +0 -45
  99. package/docs/install/claude.md +0 -77
  100. package/docs/install/cli.md +0 -115
  101. package/docs/install/codex.md +0 -44
  102. package/docs/install/copilot.md +0 -45
  103. package/docs/install/cursor.md +0 -45
  104. package/docs/install/gemini.md +0 -44
  105. package/docs/install/index.md +0 -53
  106. package/docs/install/kimi.md +0 -45
  107. package/docs/install/opencode.md +0 -143
  108. package/docs/install/pi.md +0 -46
  109. package/docs/reference/adoption-guide.md +0 -72
  110. package/docs/reference/agent-anatomy.md +0 -72
  111. package/docs/reference/compliance-matrix.md +0 -81
  112. package/docs/reference/developer-onboarding.md +0 -89
  113. package/docs/reference/enforcement.md +0 -35
  114. package/docs/reference/harness-matrix.md +0 -41
  115. package/docs/reference/skill-anatomy.md +0 -71
  116. package/docs/troubleshooting.md +0 -91
  117. package/evals/cases/_no-skill.json +0 -16
  118. package/evals/cases/adversarial-pressure-fake-pass.json +0 -25
  119. package/evals/cases/adversarial-pressure-skip-review.json +0 -25
  120. package/evals/cases/lane-exploratory-vague.json +0 -24
  121. package/evals/cases/lane-sensitivity-payment.json +0 -24
  122. package/evals/cases/positive-refactor-existing-tests.json +0 -25
  123. package/evals/cases/positive-resume-mid-mission.json +0 -24
  124. package/evals/cases/routing-agent-security.json +0 -25
  125. package/evals/cases/routing-auth-feature.json +0 -26
  126. package/evals/cases/routing-backend.json +0 -25
  127. package/evals/cases/routing-bug-one-file.json +0 -26
  128. package/evals/cases/routing-claim-audit.json +0 -25
  129. package/evals/cases/routing-context-budget.json +0 -25
  130. package/evals/cases/routing-contract-first.json +0 -25
  131. package/evals/cases/routing-execution.json +0 -25
  132. package/evals/cases/routing-frontend.json +0 -26
  133. package/evals/cases/routing-gates.json +0 -25
  134. package/evals/cases/routing-git.json +0 -25
  135. package/evals/cases/routing-healing.json +0 -25
  136. package/evals/cases/routing-lessons.json +0 -25
  137. package/evals/cases/routing-orchestration.json +0 -25
  138. package/evals/cases/routing-planning.json +0 -26
  139. package/evals/cases/routing-pr.json +0 -25
  140. package/evals/cases/routing-quality.json +0 -25
  141. package/evals/cases/routing-ship.json +0 -26
  142. package/evals/cases/routing-sunset.json +0 -25
  143. package/evals/cases/routing-using-mugiwara.json +0 -25
  144. package/evals/cases/routing-workflow.json +0 -25
  145. package/evals/floor.json +0 -6
@@ -8,114 +8,111 @@ description: Use at start of any non-trivial mission — Luffy triage gateway, f
8
8
  ## Skip when
9
9
 
10
10
  - Lane 0 direct work: typo, rename, or single-file fix under 20 LOC.
11
- - User explicitly declined the harness for this request.
11
+ - User explicitly declined the harness for this request (`mugiwara off` — Luffy acknowledges, records it in the decision log, and the crew stands down).
12
12
 
13
- The Straw Hat harness: Wave 0 triage + Waves 1-9, with an optional adversarial pass at Wave 4.5. Waves are phases of the mission, not files — Nami writes them into the plan doc, Zoro executes them. The main thread runs the harness and embodies each crew role inline (Execution model below); the harness always starts through Luffy unless the user summons a crew member directly.
13
+ ## Pipeline
14
14
 
15
- ## Execution model (every harness)
16
-
17
- **Inline by default.** The main/primary agent runs the pipeline and plays each crew role itself using that member's skill. Every wave's work is performed in the main conversation so the user sees the process live — no hidden subagent jumps, no click-to-expand. The crew members are personas + skills the main thread embodies, not mandatory dispatch targets.
15
+ ```
16
+ Triage → Brainstorm → Plan → Execute
17
+ Luffy Usopp Nami Zoro
18
+ 0 1 2 3
19
+ ↓ ↑ heal loop (max 3)
20
+ Audit → Quality → Gates → Review → Heal → Closure
21
+ Chopper Sanji Franky Robin∥Jinbe Brook Luffy
22
+ 4 5 6 7 8 9
23
+ ↑ Wave 4.5 (optional)
24
+ Skeptic — adversarial verify
25
+ ```
18
26
 
19
- **Visible wave transitions.** Every wave opens with a 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; the conversation names who runs now and who takes over next so the user always sees the chain live.
27
+ Waves are phases, not files. The plan doc defines them. The harness runs inline.
20
28
 
21
- **Auto-activation.** Any non-trivial request fires the harness without the user asking. Check first, before exploring or answering: if the request could benefit from the crew, start Wave 0 triage. The user does not need to invoke `using-mugiwara` explicitly — the workflow starts itself.
29
+ | # | Wave | Crew | Skill | Delivers |
30
+ |---|------|------|-------|----------|
31
+ | 0 | Triage | Luffy | `orchestration` | 5-way class + lane |
32
+ | 1 | Brainstorm | Usopp | `brainstorm` | options + recommendation |
33
+ | 2 | Planning | Nami | `planning` | task plan + acceptance |
34
+ | 3 | Execute | Zoro | `execution` | implemented + evidence |
35
+ | 4 | Audit | Chopper | `checkpoint` | re-verified + ledger |
36
+ | 4.5 | Verify | Skeptic | `claim-audit` | adversarial check (optional) |
37
+ | 5 | Quality | Sanji | `quality` | lint + format + test |
38
+ | 6 | Gates | Franky | `gates` | coverage + build + DoD |
39
+ | 7 | Review | Robin∥Jinbe | `review`+`security` | findings (parallel) |
40
+ | 8 | Heal | Brook | `healing` | fixes → back to Wave 4 |
41
+ | 9 | Close | Luffy | `orchestration` | push + PR verdict |
22
42
 
23
- **Checkpoint-report presentation.** The banner marks a stage boundary; no wave passes silently. At each boundary the owning crew reports inline — one compact per-crew report: what ran, the result, the evidence pointer. No narration of every tool call. Each wave closes with a short progress summary (done / in-flight / blocked + next handoff). On failure or risk, PAUSE: report the problem and get a continue / retry / escalate decision before proceeding.
43
+ ## Execution model
24
44
 
25
- 1. For each wave, the main thread loads the owning crew member's skill (e.g. `mugiwara-checkpoint` for Wave 4) and performs that role inline: triage, planning, execution, audit, quality, gates, review, closure — all in the main thread.
26
- 2. Dispatch a subagent ONLY when the work is genuinely parallel or background: an independent `[PARALLEL]` task batch (Zoro's WORKER subagents, Wave 3), parallel fixes (Brook, Wave 8), or a long-running check that would stall the conversation. Subagent results return to the main thread as a report; the main thread summarizes the outcome inline with evidence pointers.
27
- 3. Crew members NEVER dispatch another crew member. A crew role that must split work returns the split plan to the main thread, which spawns the workers.
28
- 4. Escalation = "blocked" + ledger row returned to the main thread, which routes it to Luffy/Brook. Never a nested crew dispatch.
45
+ **Inline by default.** Main thread embodies each crew role using that crew's skill. Every wave runs in the main conversation.
29
46
 
30
- Why: crew-inside-crew nesting hides work behind subagent expansion and bloats context. Inline roles keep every wave visible as it happens. Subagents exist to parallelize, not to hide. In any harness Claude Code, opencode, Codex, Cursor, Gemini — subagent internals sit behind a click; the only way the user sees the process is to run it in the main conversation.
47
+ **One role at a time.** The main thread embodies ONE crew role per response completes that role's report, then moves to the next. Never role-bleeds two personas into one response; never starts the next role before the current one returns its output.
31
48
 
32
- ## Workspace layout
49
+ **Banners.** Waves open with `==================== WAVE N - CREW (SKILL) ====================` and close with `→ Wave N+1 — Crew`.
33
50
 
34
- Every mission creates and works inside `.mugiwara/` at the repo root:
51
+ **Subagents only for parallelism.** `[PARALLEL]` task batches, parallel review, parallel heal workers. Crew members never dispatch crew members.
35
52
 
36
- ```
37
- .mugiwara/
38
- ├── config # runtime mode config: mode/branch/commit/pr key=value (gitignored; project overrides global)
39
- ├── state.json # computed mission state at every wave boundary (scripts/savepoint.sh)
40
- ├── spec/ # brainstorm output: YYYY-MM-DD-<mission>.md
41
- ├── plans/ # plan doc: YYYY-MM-DD-<mission>.md — CLEAN, Nami-only, source of truth from Wave 2
42
- ├── results/ # wave results: audit/quality/gate reports, todos, closure report
43
- ├── reports/ # human-readable mission reports: YYYY-MM-DD-<mission>.md
44
- ├── review/ # review + security findings
45
- ├── issues/ # blocker log: YYYY-MM-DD-<mission>-blockers.md
46
- └── logs/ # Luffy's decision + check-in log: YYYY-MM-DD-<mission>.md (deleted at cleanup)
47
- ```
53
+ **Compact output.** Do not stream tool calls. After each batch: one status table. Full logs → `.mugiwara/results/<mission>/01-execution.md`.
48
54
 
49
- The plan doc stays clean: it holds ONLY Nami's execution plan (waves, tasks,
50
- criteria, risks). Who did what, route decisions, and check-in verdicts go to
51
- `logs/`; the closure report goes to `results/`. Nothing non-plan pollutes the plan doc.
55
+ **Mode flips.** `/mugiwara mode <guided|semi|auto>` applies from the next wave, never mid-wave. If a flip arrives mid-wave, say so — "recorded, applies from Wave N+1" — never apply silently, never ignore.
52
56
 
53
- The owning agent creates the folder it needs on first write. No mission artifacts go outside `.mugiwara/`.
57
+ ## Workspace
54
58
 
55
- ## Resume
59
+ Full layout: `references/workspace-layout.md`.
56
60
 
57
- At session start, after context loss, or on any "where were we?" — embody `resume-coordinator` inline (mugiwara-resume) BEFORE Wave 0 triage. Rebuild the picture from disk (plan, todos, trace, blockers) and report the resume point. Resume before any wave; never start over. Disk state is truth.
61
+ ## Wave 0 Triage (always first)
58
62
 
59
- ## Wave 0 Luffy Triage (always first)
63
+ Luffy classifies every request 8 ways:
60
64
 
61
- Front door: embody `using-mugiwara` inline (the router) — it routes to the right crew member and records the route. For a full triage embody `luffy-orchestrator` inline. NEVER start directly with brainstorming or planning. Luffy classifies every request 5 ways (Trivial / Explicit / Exploratory / Open-ended / Ambiguous) and routes: Trivial and Explicit → Wave 2 directly; Exploratory, Open-ended, and Ambiguous → Wave 1 brainstorm first. Alongside the class, Luffy sizes the mission and picks a lane (0 Direct / 1 Lean / 2 Standard / 3 Full / 4 Spike) — small work skips the pipeline, sensitive work never sneaks through the lean path. The user may summon any crew member directly — Luffy still records the route.
65
+ | Class | Signal | Route |
66
+ |-------|--------|-------|
67
+ | Trivial | obvious, single file | → Wave 2 |
68
+ | Explicit | clear spec exists | → Wave 2 (still sizes the lane from the spec's file list) |
69
+ | Exploratory | needs research | → Wave 1 |
70
+ | Open-ended | broad, undefined | → Wave 1 |
71
+ | Ambiguous | unclear scope | → Wave 1 |
72
+ | Answer | question, no file change | answer directly, no mission |
73
+ | Refuse | deploy / migration / key rotation / merge | decline at Wave 0, offer branch handoff |
74
+ | Hotfix | production broken | Lane 1, gates deferred with owner |
62
75
 
63
- Alongside triage, read the mode config per mode config: `.mugiwara/config` (project) then `~/.mugiwara/config` (global); a key missing from both = `guided`. Lazy-create the project config on first WRITE only, never auto-create on read.
76
+ Precedence: class decides whether there is work; lane decides how much process class first, lane second.
64
77
 
65
- ## Waves
78
+ Lane: 0=Direct (<20 LOC), 1=Lean (1-2 files), 2=Standard (3-8 files), 3=Full (9+ or sensitive), 4=Spike. Record route in `.mugiwara/logs/`.
66
79
 
67
- | Wave | Owner | Skill | Output |
68
- |------|-------|-------|--------|
69
- | 0 Triage | Luffy | mugiwara-orchestration | route decision + reason |
70
- | 1 Brainstorm | Usopp | mugiwara-brainstorm | refined direction, options, recommendation |
71
- | 2 Planning | Nami | mugiwara-planning | plan doc: waves/tasks/criteria, parallel markers |
72
- | 3 Execution | Zoro | mugiwara-execution | implemented tasks with evidence |
73
- | 4 Checkpoint | Chopper | mugiwara-checkpoint | audit report + failure ledger |
74
- | 4.5 Adversarial | Skeptic | mugiwara-claim-audit | findings report + failure ledger |
75
- | 5 Quality | Sanji | mugiwara-quality | formatter/linter/test results |
76
- | 6 Gates | Franky | mugiwara-gates | coverage + build verdict |
77
- | 7 Review | Robin ∥ Jinbe | mugiwara-review + mugiwara-security | severity-tagged findings |
78
- | 8 Healing | Brook | mugiwara-healing | fixes, then loop back to Wave 4 |
79
- | 9 Closure | Luffy | mugiwara-orchestration | closure report + push mission branch + PR verdict file handed to user, who opens the PR (terminal gate in every mode) |
80
+ ## Session handoff
80
81
 
81
- Wave 4.5 is optional Luffy invokes Skeptic after Chopper on high-stakes missions (verdicts, plans, reviews), or parallel to Wave 7 review when he calls for it. Skip means recorded without a pass.
82
+ At session end (step limit, crash, or manual stop) the crew writes `.mugiwara/continue.md` before the final text response: mission, sub_mission, wave, tasks, next_action (exact files + commands), next_session_prompt. Owner: orchestrator (captain); writer: the agent ending the wave. Next session starts with `/mugiwara continue` — no re-explanation. `auto` mode continues across sessions via continue.md: one command per session, no re-explanation. state.json proves what is done; continue.md says what is next — verify next_action against state.json, escalate contradictions.
82
83
 
83
- ## Blockers
84
+ ## Blocker protocol
84
85
 
85
- Any agent that hits a blocker APPENDS a row to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`:
86
-
87
- `| <wave> | <task> | <symptom> | <attempted> | <help-needed> |`
88
-
89
- Never silently work around a blocker. Brook reads this ledger at Wave 8 to decide what to heal; Luffy reviews it at every check-in.
86
+ Blocked agent appends to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`:
87
+ ```
88
+ | wave | task | symptom | attempted | help-needed |
89
+ ```
90
+ Brook reads this at Wave 8. Never silently work around a blocker.
90
91
 
91
- ## Cleanup
92
+ ## Cleanup (Wave 9)
92
93
 
93
- At closure (Wave 9), after the terminal step, run cleanup per `mugiwara-ship`: delete consumed intermediates superseded results, review, issues, the decision log in `logs/`, and consumed spec. Keep the plan doc, closure report, PR verdict, mission report, `config`, `state.json`, and cross-mission state (`logs/lessons.md`, `backup/`, `manifest.json`). List candidates before deleting.
94
+ Delete consumed: `results/<mission>/01-execution.md`…`05-healing.md` + `todos.md`, `logs/` (except `logs/lessons.md`), `spec/`, `review/`, `issues/`. Keep: `results/<mission>/06-closure.md`, `results/<mission>/07-pr-verdict.md`, `plans/`, `reports/`, `config`, `state.json`, `logs/lessons.md`. Full layout: `references/workspace-layout.md`.
94
95
 
95
96
  ## Rules
96
97
 
97
- 1. Evidence over claims: no wave passes on assertion. The owning agent runs the checks and shows output.
98
- 2. No wave skipped without the reason recorded in the decision log (`.mugiwara/logs/`) — name the wave, owner, and reason at the moment of omission.
99
- 3. Heal loop is bounded: Wave 8 → Wave 4, max 3 cycles. After that, escalate to the human with full history.
100
- 4. Any agent may consult Luffy mid-flight (embody `luffy-orchestrator` inline) for decisions and escalations.
101
- 5. Wave 7 runs Robin and Jinbe in parallel over the same diff.
102
- 6. The plan doc is the single source of truth from Wave 2 onward.
103
- 7. Frontend tasks in Wave 3 must apply `mugiwara-frontend`.
104
- 8. On session start or context loss — resume via `resume-coordinator` before any wave; never start over.
105
- 9. Push branch + hand verdict file to the user, who opens the PR; crew never merges, never deploys.
98
+ 1. Evidence over claims run checks, show output.
99
+ 2. No wave skipped without reason recorded in logs.
100
+ 3. Heal loop: max 3 cycles, then escalate.
101
+ 4. Wave 7: Robin and Jinbe parallel over same diff.
102
+ 5. Plan doc is source of truth from Wave 2.
103
+ 6. Resume via `resume-coordinator` before any wave never restart.
104
+ 7. Push branch + hand verdict to user; crew never merges or deploys.
106
105
 
107
106
  ## Iron Law
108
107
 
109
- EVIDENCE OVER CLAIMS. No wave passes on assertion — the owning agent runs the checks and shows output. "Done", "passes", and "fixed" must be proved by running the check command in the same turn; no stale results, no guesses, no worker's word for it.
108
+ EVIDENCE OVER CLAIMS. "Done" = command re-run, output captured, evidence fresh.
110
109
 
111
110
  ## Red flags
112
111
 
113
- - A wave passes on a spoken claim with no command output.
114
- - Heal loop beyond 3 cycles with the same failure still open.
115
- - Wave skipped with no reason recorded in the decision log.
116
- - Execution before triage (Wave 0).
117
- - Mission artifacts outside `.mugiwara/`.
118
- - Wave order drifts (e.g. quality before checkpoint).
119
- - Blocker worked around silently with no ledger row.
112
+ - Wave passes on spoken claim, no command output.
113
+ - Execution before triage (Wave 0 skipped).
114
+ - Blocker worked around silently.
115
+ - Heal loop past 3 cycles with same failure.
116
+ - Plan doc polluted with logs/decisions.
120
117
 
121
- All mean: stop, diagnose with Chopper's ledger, decide continue/retry/escalate.
118
+ Stop, diagnose, escalate.
@@ -0,0 +1,50 @@
1
+ # Workspace layout
2
+
3
+ Every mission creates and works inside `.mugiwara/` at the repo root.
4
+
5
+ ```
6
+ .mugiwara/
7
+ ├── config → runtime mode config (gitignored; project overrides global)
8
+ ├── state.json → computed mission state at every wave boundary (scripts/savepoint.sh)
9
+ ├── spec/ → brainstorm output: YYYY-MM-DD-<mission>.md
10
+ ├── plans/ → plan doc: YYYY-MM-DD-<mission>.md — CLEAN, Nami-only, source of truth from Wave 2
11
+ ├── results/ → per-mission folder: results/<mission>/ holds every wave artifact
12
+ │ └── <mission>/
13
+ │ ├── 01-execution.md → wave 3: task table + evidence
14
+ │ ├── 02-audit.md → wave 4: checkpoint report
15
+ │ ├── 03-quality.md → wave 5: quality report
16
+ │ ├── 04-gates.md → wave 6: gate verdict
17
+ │ ├── 05-healing.md → wave 8: healing report (only when heal ran)
18
+ │ ├── 06-closure.md → wave 9: closure summary (KEEP at cleanup)
19
+ │ ├── 07-pr-verdict.md → wave 9: PR material (KEEP at cleanup)
20
+ │ └── todos.md → execution checkbox list
21
+ ├── reports/ → mission report (aggregate): YYYY-MM-DD-<mission>.md — one-file summary of all waves
22
+ ├── review/ → review + security findings
23
+ ├── issues/ → blocker log: YYYY-MM-DD-<mission>-blockers.md
24
+ └── logs/ → Luffy's decision + check-in log: YYYY-MM-DD-<mission>.md (deleted at cleanup)
25
+ ```
26
+
27
+ Naming rule: every artifact inside `results/<mission>/` uses the SAME mission
28
+ name, no date prefix — the folder is the grouping, numbered by wave order
29
+ (`01-`, `02-`, …). Unnumbered support files may sit alongside the numbered
30
+ ones (`todos.md`, `resume.md`, `eval.md`, evidence logs) and are not part of
31
+ the waves table. `reports/` and `logs/` and `plans/` files carry the
32
+ `YYYY-MM-DD-` date prefix because they are cross-mission folders; `results/`
33
+ does not, because each mission owns its folder.
34
+
35
+ The plan doc stays clean: it holds ONLY the execution plan (waves, tasks,
36
+ criteria, risks). Who did what, route decisions, and check-in verdicts go to
37
+ `logs/`; the closure report goes to `results/<mission>/06-closure.md`. Nothing
38
+ non-plan pollutes the plan doc.
39
+
40
+ The owning agent creates the folder it needs on first write. No mission
41
+ artifacts go outside `.mugiwara/`.
42
+
43
+ ## Cleanup (Wave 9)
44
+
45
+ Delete consumed: `results/<mission>/01-execution.md` through
46
+ `05-healing.md` and `todos.md` (wave artifacts), `logs/`, `spec/`, `review/`,
47
+ `issues/`. Keep: `results/<mission>/06-closure.md`,
48
+ `results/<mission>/07-pr-verdict.md`, `plans/`, `reports/`, `config`,
49
+ `state.json`, `lessons.md` (cross-mission state: `logs/lessons.md`, `backup/`,
50
+ `manifest.json`). List candidates before deleting.
@@ -1,20 +1,18 @@
1
1
  ---
2
2
  name: using-mugiwara
3
- description: How mugiwara works. Crew overview, where to start, which agent to summon for each task, what each specialist does. Front-door router. Trigger: "which agent for", "pick crew", "mugiwara how", new session overview.
3
+ description: How Mugiwara works crew overview, pipeline summary. Documentation reference. Trigger: "how does mugiwara work", "what is mugiwara", "which crew member", "crew overview", "mugiwara how".
4
4
  ---
5
-
6
- # Using Mugiwara (Front Door)
5
+ # Using Mugiwara (Reference)
7
6
 
8
7
  ## Skip when
9
8
 
10
- - Lane 0 direct work: typo, rename, or single-file fix under 20 LOC.
11
- - User explicitly declined the crew for this request.
9
+ - `mugiwara-orchestration` is the gatekeeper it auto-loads for task routing and classification. This skill is a documentation reference only.
12
10
 
13
- Mugiwara is a governed engineering team in your coding agent. 14 specialists — triage, brainstorm, plan, execute, audit, quality, gates, review, security, heal — with evidence at every step and cost tracking. Runs inline in the main conversation.
11
+ Mugiwara is a governed engineering team in your coding agent. 11 specialists — triage, brainstorm, plan, execute, audit, quality, gates, review, security, heal — with evidence at every step and cost tracking. Runs inline in the main conversation.
14
12
 
15
13
  ## How it works
16
14
 
17
- 1. The crew auto-activates for non-trivial requests. You do NOT need to call `using-mugiwara` at session start — it's an optional router.
15
+ 1. `mugiwara-orchestration` auto-loads as gatekeeper for every task classify, route, check-in, close.
18
16
  2. The pipeline: Luffy triage → Usopp brainstorm → Nami plan → Zoro execute → Chopper audit → Sanji quality → Franky gates → Robin/Jinbe review → Brook heal → Luffy closure.
19
17
  3. Every wave runs inline in the main thread. Subagents only for [PARALLEL] task batches.
20
18
  4. Evidence over claims — no wave passes on assertion. Checks must be re-run.
@@ -35,18 +33,9 @@ Mugiwara is a governed engineering team in your coding agent. 14 specialists —
35
33
  | Robin | Reviewer — breaking-change map (read-only) |
36
34
  | Jinbe | Security — STRIDE, OWASP, secret scan (read-only) |
37
35
  | Brook | Healer — reads ledger, fixes failures |
38
- | Skeptic | Adversarial verifier (read-only) |
39
36
  | Resume | Continuity — rebuild from state.json |
40
37
 
41
- ## What to do
42
-
43
- 1. If the user asks how mugiwara works — summarize in 3 lines.
44
- 2. If the user gives a task — classify: Trivial / Explicit / Exploratory / Open-ended / Ambiguous.
45
- 3. Route:
46
- - Clear, small → Nami (plan) or Zoro (execute).
47
- - Vague, needs direction → Usopp (brainstorm).
48
- - Anything else → Luffy (full triage + check-ins).
49
- - Review → Robin. Security → Jinbe. Audit → Chopper. Heal → Brook.
50
- 4. Record the route in `.mugiwara/logs/`.
51
-
38
+ For task routing and classification, `mugiwara-orchestration` auto-loads as gatekeeper.
39
+ This skill is documentation — load manually with `/using-mugiwara` or similar trigger phrases.
52
40
  Full pipeline: see skills/mugiwara-workflow.
41
+ First time? Run `/mugiwara onboard` for guided setup. See `content/agents/onboarding-guide.md`.
package/dist/mugiwara.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { existsSync as existsSync7, readdirSync as readdirSync3, rmSync as rmSync3 } from "node:fs";
4
+ import { existsSync as existsSync7, readdirSync as readdirSync5, rmSync as rmSync3 } from "node:fs";
5
5
  import { homedir as homedir2 } from "node:os";
6
6
  import { join as join8, resolve } from "node:path";
7
7
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -81,7 +81,7 @@ async function confirm(rl, question) {
81
81
  }
82
82
 
83
83
  // src/targets/claude.ts
84
- import { existsSync, mkdirSync, copyFileSync } from "node:fs";
84
+ import { existsSync, mkdirSync, copyFileSync, chmodSync, readdirSync } from "node:fs";
85
85
  import { dirname, join } from "node:path";
86
86
  import { fileURLToPath } from "node:url";
87
87
 
@@ -113,10 +113,12 @@ ${body}`;
113
113
  // src/targets/claude.ts
114
114
  var here = dirname(fileURLToPath(import.meta.url));
115
115
  var HOOK_SRC = join(here, "..", "..", "hooks", "session-start.ts");
116
+ var COMMANDS_SRC = join(here, "..", "..", ".claude", "commands");
116
117
  var target = {
117
118
  id: "claude",
118
119
  label: "Claude Code",
119
120
  native: true,
121
+ refPointerPrefix: "../",
120
122
  paths({ scope, projectDir, home }) {
121
123
  const root = scope === "global" ? join(home, ".claude") : join(projectDir, ".claude");
122
124
  return { skillsDir: join(root, "skills"), agentsDir: join(root, "agents") };
@@ -140,48 +142,81 @@ var target = {
140
142
  postInstall({ scope, projectDir, home, dryRun }) {
141
143
  const root = scope === "global" ? join(home, ".claude") : join(projectDir, ".claude");
142
144
  const hookFile = join(root, "hooks", "session-start.ts");
145
+ const written = [];
146
+ const notes = [];
143
147
  if (dryRun)
144
148
  return { written: [], notes: [] };
145
149
  if (existsSync(HOOK_SRC) && !existsSync(hookFile)) {
146
150
  mkdirSync(dirname(hookFile), { recursive: true });
147
151
  copyFileSync(HOOK_SRC, hookFile);
148
- return { written: [hookFile], notes: [] };
152
+ chmodSync(hookFile, 493);
153
+ written.push(hookFile);
154
+ }
155
+ if (existsSync(COMMANDS_SRC)) {
156
+ const dstDir = join(root, "commands");
157
+ mkdirSync(dstDir, { recursive: true });
158
+ for (const f of readdirSync(COMMANDS_SRC)) {
159
+ if (!f.endsWith(".md"))
160
+ continue;
161
+ const src = join(COMMANDS_SRC, f);
162
+ const dst = join(dstDir, f);
163
+ if (!existsSync(dst)) {
164
+ copyFileSync(src, dst);
165
+ written.push(dst);
166
+ } else
167
+ notes.push(`existing command kept: ${dst}`);
168
+ }
149
169
  }
150
- return { written: [], notes: [] };
170
+ return { written, notes };
151
171
  }
152
172
  };
153
173
 
154
174
  // src/targets/opencode.ts
155
- import { existsSync as existsSync2, readdirSync, copyFileSync as copyFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
175
+ import { existsSync as existsSync2, readdirSync as readdirSync2, copyFileSync as copyFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
156
176
  import { dirname as dirname2, join as join2 } from "node:path";
157
177
  import { fileURLToPath as fileURLToPath2 } from "node:url";
158
178
  var here2 = dirname2(fileURLToPath2(import.meta.url));
159
- var COMMANDS_SRC = join2(here2, "..", "..", ".opencode", "commands");
179
+ var COMMANDS_SRC2 = join2(here2, "..", "..", ".opencode", "commands");
160
180
  var CREW = {
161
181
  "luffy-orchestrator": { color: "#ef4444", temperature: 0.2, steps: 15 },
162
182
  "usopp-brainstorm": { color: "#f59e0b", temperature: 0.6, steps: 15 },
163
183
  "nami-planner": { color: "#f97316", temperature: 0.2, steps: 15 },
164
184
  "zoro-execution": { color: "#22c55e", temperature: 0.1, steps: 30 },
165
- "chopper-checkpoint": { color: "#3b82f6", temperature: 0.1, permission: { edit: "deny" }, steps: 15 },
166
- "sanji-quality": { color: "#a855f7", temperature: 0.1, permission: { edit: "deny" }, steps: 10 },
167
- "franky-gates": { color: "#06b6d4", temperature: 0.1, permission: { edit: "deny" }, steps: 10 },
168
- "robin-reviewer": { color: "#8b5cf6", temperature: 0.2, permission: { edit: "deny" }, steps: 15 },
169
- "jinbe-security": { color: "#6366f1", temperature: 0.2, permission: { edit: "deny" }, steps: 15 },
185
+ "chopper-checkpoint": { color: "#3b82f6", temperature: 0.1, steps: 15 },
186
+ "sanji-quality": { color: "#a855f7", temperature: 0.1, steps: 10 },
187
+ "franky-gates": { color: "#06b6d4", temperature: 0.1, steps: 10 },
188
+ "robin-reviewer": { color: "#8b5cf6", temperature: 0.2, steps: 15 },
189
+ "jinbe-security": { color: "#6366f1", temperature: 0.2, steps: 15 },
170
190
  "brook-healing": { color: "#ec4899", temperature: 0.1, steps: 20 },
171
- "skeptic-verifier": { color: "#64748b", temperature: 0.1, permission: { edit: "deny" }, steps: 12 },
191
+ "skeptic-verifier": { color: "#64748b", temperature: 0.1, steps: 12 },
172
192
  "eval-runner": { color: "#14b8a6", temperature: 0.2, steps: 15 },
173
193
  "resume-coordinator": { color: "#d97706", temperature: 0.2, steps: 10 },
174
194
  "memory-keeper": { color: "#d946ef", temperature: 0.2, steps: 8 }
175
195
  };
176
- function agentFrontmatter(name, description) {
196
+ function permissionFromScope(scope) {
197
+ if (scope === "source")
198
+ return { edit: "allow" };
199
+ if (scope === "artifacts")
200
+ return { edit: { "*": "deny", ".mugiwara/**": "allow" } };
201
+ return;
202
+ }
203
+ function agentFrontmatter(name, description, writeScope) {
177
204
  const crew = CREW[name];
178
205
  const lines = [`description: ${description}`, `mode: all`];
179
206
  if (crew) {
180
207
  lines.push(`color: '${crew.color}'`, `temperature: ${crew.temperature}`, `steps: ${crew.steps}`);
181
- if (crew.permission) {
208
+ const perm = permissionFromScope(writeScope);
209
+ if (perm) {
182
210
  lines.push("permission:");
183
- for (const [k, v] of Object.entries(crew.permission))
184
- lines.push(` ${k}: ${v}`);
211
+ for (const [k, v] of Object.entries(perm)) {
212
+ if (typeof v === "string") {
213
+ lines.push(` ${k}: ${v}`);
214
+ } else {
215
+ lines.push(` ${k}:`);
216
+ for (const [pk, pv] of Object.entries(v))
217
+ lines.push(` "${pk}": ${pv}`);
218
+ }
219
+ }
185
220
  }
186
221
  }
187
222
  return lines.join(`
@@ -191,6 +226,7 @@ var target2 = {
191
226
  id: "opencode",
192
227
  label: "opencode",
193
228
  native: true,
229
+ refPointerPrefix: "../",
194
230
  paths({ scope, projectDir, home }) {
195
231
  const root = scope === "global" ? join2(home, ".config", "opencode") : join2(projectDir, ".opencode");
196
232
  return { skillsDir: join2(root, "skills"), agentsDir: join2(root, "agents") };
@@ -202,7 +238,8 @@ var target2 = {
202
238
  };
203
239
  },
204
240
  transformAgent(data, body) {
205
- const fm = agentFrontmatter(data.name, data.description);
241
+ const desc = data["internal-agent"] === "true" ? `[INTERNAL] ${data.description}` : data.description;
242
+ const fm = agentFrontmatter(data.name, desc, data["write-scope"]);
206
243
  return { relPath: `${data.name}.md`, text: `---
207
244
  ${fm}
208
245
  ---
@@ -217,14 +254,14 @@ ${body}` };
217
254
  const dstDir = join2(root, "commands");
218
255
  if (dryRun)
219
256
  return { written: [], notes: [] };
220
- if (!existsSync2(COMMANDS_SRC))
257
+ if (!existsSync2(COMMANDS_SRC2))
221
258
  return { written: [], notes: [] };
222
259
  mkdirSync2(dstDir, { recursive: true });
223
260
  const written = [];
224
- for (const f of readdirSync(COMMANDS_SRC)) {
261
+ for (const f of readdirSync2(COMMANDS_SRC2)) {
225
262
  if (!f.endsWith(".md"))
226
263
  continue;
227
- const src = join2(COMMANDS_SRC, f);
264
+ const src = join2(COMMANDS_SRC2, f);
228
265
  const dst = join2(dstDir, f);
229
266
  copyFileSync2(src, dst);
230
267
  written.push(dst);
@@ -313,7 +350,10 @@ ${body}` };
313
350
 
314
351
  > ${data.description}
315
352
 
316
- Skills: ${data.skills ?? ""}. Read \`.mugiwara/refs/${data.name}.md\` when embodying this role.`
353
+ Skills: ${data.skills ?? ""}. Read \`.mugiwara/refs/${data.name}.md\` when embodying this role.
354
+
355
+ Only zoro-execution and brook-healing may modify source code.
356
+ Return your output to luffy-orchestrator; do not choose the next step.`
317
357
  };
318
358
  }
319
359
  return { relPath: `agent-${data.name}.md`, text: `# Agent: ${data.name}
@@ -421,7 +461,7 @@ var targets = { claude: target, opencode: target2, copilot: target3, gemini: tar
421
461
  var TARGET_IDS = Object.keys(targets);
422
462
 
423
463
  // src/installer.ts
424
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync2, copyFileSync as copyFileSync3, rmSync } from "node:fs";
464
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync2, readdirSync as readdirSync3, writeFileSync as writeFileSync2, copyFileSync as copyFileSync3, rmSync } from "node:fs";
425
465
  import { dirname as dirname3, join as join5 } from "node:path";
426
466
  import { homedir } from "node:os";
427
467
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -429,27 +469,36 @@ var CONTENT_DIR = join5(dirname3(fileURLToPath3(import.meta.url)), "..", "conten
429
469
  var pkg = JSON.parse(readFileSync2(join5(dirname3(fileURLToPath3(import.meta.url)), "..", "package.json"), "utf8"));
430
470
  var VERSION = pkg.version;
431
471
  function collectContent() {
432
- const skillNames = readdirSync2(join5(CONTENT_DIR, "skills"), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
472
+ const skillNames = readdirSync3(join5(CONTENT_DIR, "skills"), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
433
473
  const skills = skillNames.map((name) => {
434
474
  const { data, body } = parseFrontmatter(readFileSync2(join5(CONTENT_DIR, "skills", name, "SKILL.md"), "utf8"));
435
475
  return { name, data, body, refs: collectRefs(join5(CONTENT_DIR, "skills", name)) };
436
476
  });
437
- const agents = readdirSync2(join5(CONTENT_DIR, "agents")).filter((f) => f.endsWith(".md")).map((f) => {
477
+ const agents = readdirSync3(join5(CONTENT_DIR, "agents")).filter((f) => f.endsWith(".md")).map((f) => {
438
478
  const { data, body } = parseFrontmatter(readFileSync2(join5(CONTENT_DIR, "agents", f), "utf8"));
439
- return { name: f.replace(/\.md$/, ""), data, body, refs: [] };
479
+ return { name: f.replace(/\.md$/, ""), data, body, refs: [], internal: data.internal === "true" };
440
480
  });
441
- return { skills, agents };
481
+ const sharedRefsDir = join5(dirname3(CONTENT_DIR), "references");
482
+ const sharedRefs = [];
483
+ if (existsSync4(sharedRefsDir)) {
484
+ for (const f of readdirSync3(sharedRefsDir)) {
485
+ if (!f.endsWith(".md"))
486
+ continue;
487
+ sharedRefs.push({ relPath: f, text: readFileSync2(join5(sharedRefsDir, f), "utf8") });
488
+ }
489
+ }
490
+ return { skills, agents, sharedRefs };
442
491
  }
443
492
  function collectRefs(skillDir) {
444
493
  const refsDir = join5(skillDir, "references");
445
494
  if (!existsSync4(refsDir))
446
495
  return [];
447
- return readdirSync2(refsDir, { recursive: true }).map((f) => String(f)).filter((f) => f.endsWith(".md")).map((rel) => ({ relPath: rel, text: readFileSync2(join5(refsDir, rel), "utf8") }));
496
+ return readdirSync3(refsDir, { recursive: true }).map((f) => String(f)).filter((f) => f.endsWith(".md")).map((rel) => ({ relPath: rel, text: readFileSync2(join5(refsDir, rel), "utf8") }));
448
497
  }
449
498
  function installTo(target10, opts) {
450
499
  const { scope, projectDir, dryRun = false, force = false } = opts;
451
500
  const home = opts.home ?? homedir();
452
- const { skills, agents } = collectContent();
501
+ const { skills, agents, sharedRefs } = collectContent();
453
502
  const dirs = target10.paths({ scope, projectDir, home });
454
503
  const backupRoot = join5(scope === "global" ? home : projectDir, ".mugiwara");
455
504
  const result = { written: [], skipped: [], backedUp: [], notes: [] };
@@ -482,12 +531,22 @@ function installTo(target10, opts) {
482
531
  };
483
532
  for (const s of skills) {
484
533
  const out = target10.transformSkill(s.data, s.body);
485
- if (out)
486
- writeOne(join5(dirs.skillsDir, out.relPath), out.text);
534
+ if (out) {
535
+ let text = out.text;
536
+ if (target10.refPointerPrefix !== undefined && target10.refPointerPrefix !== "") {
537
+ text = text.replace(/`_shared\/references\//g, "`" + target10.refPointerPrefix + "_shared/references/");
538
+ }
539
+ writeOne(join5(dirs.skillsDir, out.relPath), text);
540
+ }
487
541
  if (target10.transformSkillFull) {
488
542
  const full = target10.transformSkillFull(s.data, s.body);
489
- if (full && target10.refsDir)
490
- writeOne(join5(target10.refsDir({ scope, projectDir, home }, s.name), full.relPath), full.text);
543
+ if (full && target10.refsDir) {
544
+ let text = full.text;
545
+ if (target10.refPointerPrefix !== undefined && target10.refPointerPrefix !== "") {
546
+ text = text.replace(/`_shared\/references\//g, "`" + target10.refPointerPrefix + "_shared/references/");
547
+ }
548
+ writeOne(join5(target10.refsDir({ scope, projectDir, home }, s.name), full.relPath), text);
549
+ }
491
550
  }
492
551
  if (s.refs.length && target10.refsDir) {
493
552
  const refsRoot = target10.refsDir({ scope, projectDir, home }, s.name);
@@ -496,7 +555,7 @@ function installTo(target10, opts) {
496
555
  }
497
556
  }
498
557
  for (const a of agents) {
499
- const out = target10.transformAgent(a.data, a.body);
558
+ const out = target10.transformAgent({ ...a.data, ...a.internal ? { "internal-agent": "true" } : {} }, a.body);
500
559
  if (out)
501
560
  writeOne(join5(dirs.agentsDir, out.relPath), out.text);
502
561
  if (target10.transformAgentFull) {
@@ -505,6 +564,11 @@ function installTo(target10, opts) {
505
564
  writeOne(join5(target10.refsDir({ scope, projectDir, home }, a.name), full.relPath), full.text);
506
565
  }
507
566
  }
567
+ if (sharedRefs.length) {
568
+ const sharedRoot = join5(dirs.skillsDir, "_shared", "references");
569
+ for (const r of sharedRefs)
570
+ writeOne(join5(sharedRoot, r.relPath), r.text);
571
+ }
508
572
  if (target10.postInstall) {
509
573
  const post = target10.postInstall({ scope, projectDir, home, dryRun, files: result.written });
510
574
  result.written.push(...post.written);
@@ -524,7 +588,7 @@ function removeInstalled(manifest, { dryRun = false } = {}) {
524
588
  if (!dryRun) {
525
589
  for (const f of manifest.files) {
526
590
  let d = dirname3(f);
527
- while (existsSync4(d) && readdirSync2(d).length === 0) {
591
+ while (existsSync4(d) && readdirSync3(d).length === 0) {
528
592
  if (d.endsWith("/.mugiwara") || d === dirname3(d))
529
593
  break;
530
594
  rmSync(d, { recursive: true, force: true });
@@ -551,7 +615,7 @@ function writeManifest(file, data) {
551
615
  }
552
616
 
553
617
  // src/mission.ts
554
- import { existsSync as existsSync6, rmSync as rmSync2, readFileSync as readFileSync4 } from "node:fs";
618
+ import { existsSync as existsSync6, rmSync as rmSync2, readFileSync as readFileSync4, readdirSync as readdirSync4 } from "node:fs";
555
619
  import { join as join7 } from "node:path";
556
620
  function activeActor(projectDir) {
557
621
  const stateFile = join7(projectDir, ".mugiwara", "state.json");
@@ -583,11 +647,13 @@ function resetMission(projectDir, keepLogs, force) {
583
647
  removed.push(dir);
584
648
  }
585
649
  }
586
- for (const f of ["state.json"]) {
587
- const p = join7(root, f);
588
- if (existsSync6(p)) {
589
- rmSync2(p);
590
- removed.push(f);
650
+ for (const f of readdirSync4(root)) {
651
+ if (/^state(-.+)?\.json$/.test(f)) {
652
+ const p = join7(root, f);
653
+ if (existsSync6(p)) {
654
+ rmSync2(p);
655
+ removed.push(f);
656
+ }
591
657
  }
592
658
  }
593
659
  if (!keepLogs) {
@@ -758,7 +824,7 @@ async function uninstall(flags) {
758
824
  if (!flag(flags.dryRun)) {
759
825
  rmSync3(file);
760
826
  const mugiDir = join8(scope === "global" ? home : projectDir, ".mugiwara");
761
- if (existsSync7(mugiDir) && readdirSync3(mugiDir).length === 0) {
827
+ if (existsSync7(mugiDir) && readdirSync5(mugiDir).length === 0) {
762
828
  rmSync3(mugiDir, { recursive: true, force: true });
763
829
  }
764
830
  if (manifest.targets.includes("opencode")) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mugiwara",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, healing.",
5
5
  "contextFileName": "GEMINI.md"
6
6
  }