@ionivetech/mugiwara 0.1.3 → 0.3.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 (83) hide show
  1. package/.opencode/commands/mugiwara-execute.md +11 -0
  2. package/.opencode/commands/mugiwara-heal.md +11 -0
  3. package/.opencode/commands/mugiwara-mode.md +6 -0
  4. package/.opencode/commands/mugiwara-plan.md +11 -0
  5. package/.opencode/commands/mugiwara-review.md +11 -0
  6. package/.opencode/commands/mugiwara-security.md +11 -0
  7. package/.opencode/commands/mugiwara-ship.md +11 -0
  8. package/.opencode/commands/mugiwara.md +11 -0
  9. package/.opencode/plugins/mugiwara.mjs +221 -0
  10. package/README.md +351 -324
  11. package/content/agents/brook-healing.md +8 -2
  12. package/content/agents/chopper-checkpoint.md +9 -4
  13. package/content/agents/eval-runner.md +5 -1
  14. package/content/agents/franky-gates.md +9 -4
  15. package/content/agents/jinbe-security.md +5 -1
  16. package/content/agents/luffy-orchestrator.md +15 -8
  17. package/content/agents/memory-keeper.md +4 -0
  18. package/content/agents/nami-planner.md +12 -5
  19. package/content/agents/resume-coordinator.md +5 -1
  20. package/content/agents/robin-reviewer.md +6 -2
  21. package/content/agents/sanji-quality.md +7 -3
  22. package/content/agents/skeptic-verifier.md +6 -2
  23. package/content/agents/using-mugiwara.md +16 -8
  24. package/content/agents/usopp-brainstorm.md +9 -3
  25. package/content/agents/zoro-execution.md +16 -11
  26. package/content/skills/mugiwara-api-and-interface-design/SKILL.md +87 -0
  27. package/content/skills/mugiwara-backend/SKILL.md +12 -0
  28. package/content/skills/mugiwara-brainstorm/SKILL.md +28 -1
  29. package/content/skills/mugiwara-checkpoint/SKILL.md +8 -6
  30. package/content/skills/mugiwara-context-engineering/SKILL.md +59 -0
  31. package/content/skills/mugiwara-deprecation/SKILL.md +77 -0
  32. package/content/skills/mugiwara-doubt-driven-development/SKILL.md +65 -0
  33. package/content/skills/mugiwara-dynamic-workflow/SKILL.md +3 -3
  34. package/content/skills/mugiwara-execution/SKILL.md +36 -15
  35. package/content/skills/mugiwara-frontend/SKILL.md +58 -56
  36. package/content/skills/mugiwara-frontend/references/checklist.md +37 -0
  37. package/content/skills/mugiwara-gates/SKILL.md +8 -0
  38. package/content/skills/mugiwara-git/SKILL.md +10 -0
  39. package/content/skills/mugiwara-git-worktrees/SKILL.md +62 -0
  40. package/content/skills/mugiwara-healing/SKILL.md +21 -3
  41. package/content/skills/mugiwara-mode/SKILL.md +72 -0
  42. package/content/skills/mugiwara-orchestration/SKILL.md +44 -8
  43. package/content/skills/mugiwara-planning/SKILL.md +57 -34
  44. package/content/skills/mugiwara-pr/SKILL.md +62 -0
  45. package/content/skills/mugiwara-quality/SKILL.md +29 -2
  46. package/content/skills/mugiwara-resume/SKILL.md +6 -4
  47. package/content/skills/mugiwara-security/SKILL.md +38 -1
  48. package/content/skills/mugiwara-ship/SKILL.md +24 -1
  49. package/content/skills/mugiwara-systematic-debugging/SKILL.md +77 -0
  50. package/content/skills/mugiwara-test-driven-development/SKILL.md +84 -0
  51. package/content/skills/mugiwara-testcases/SKILL.md +52 -0
  52. package/content/skills/mugiwara-workflow/SKILL.md +42 -13
  53. package/content/skills/mugiwara-writing-skills/SKILL.md +60 -0
  54. package/dist/mugiwara.js +42 -26
  55. package/docs/adoption-guide.md +72 -0
  56. package/docs/agent-anatomy.md +72 -0
  57. package/docs/agents.md +51 -0
  58. package/docs/claude-setup.md +43 -0
  59. package/docs/codex-setup.md +26 -0
  60. package/docs/comparison.md +63 -0
  61. package/docs/config.md +50 -0
  62. package/docs/copilot-setup.md +29 -0
  63. package/docs/cursor-setup.md +25 -0
  64. package/docs/developer-onboarding.md +85 -0
  65. package/docs/execution-model.md +92 -0
  66. package/docs/gemini-setup.md +27 -0
  67. package/docs/getting-started.md +96 -0
  68. package/docs/git-strategy.md +62 -0
  69. package/docs/index.md +50 -0
  70. package/docs/modes.md +74 -0
  71. package/docs/opencode-setup.md +54 -0
  72. package/docs/pr-summary.md +54 -0
  73. package/docs/rule-based-setup.md +31 -0
  74. package/docs/skill-anatomy.md +78 -0
  75. package/docs/skills.md +73 -0
  76. package/docs/windsurf-setup.md +18 -0
  77. package/docs/workflow.md +80 -0
  78. package/hooks/hooks.json +15 -0
  79. package/hooks/session-start.ts +8 -0
  80. package/package.json +20 -2
  81. package/src/targets/claude.ts +18 -1
  82. package/src/targets/codex.ts +1 -1
  83. package/src/targets/gemini.ts +1 -1
@@ -5,7 +5,24 @@ description: Use at the start of any non-trivial mission to run the Mugiwara cre
5
5
 
6
6
  # Mugiwara Workflow
7
7
 
8
- 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 harness always runs through Luffy unless the user summons a crew member directly.
8
+ 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.
9
+
10
+ ## Execution model (every harness)
11
+
12
+ **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.
13
+
14
+ **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.
15
+
16
+ **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.
17
+
18
+ **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.
19
+
20
+ 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.
21
+ 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.
22
+ 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.
23
+ 4. Escalation = "blocked" + ledger row returned to the main thread, which routes it to Luffy/Brook. Never a nested crew dispatch.
24
+
25
+ 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.
9
26
 
10
27
  ## Workspace layout
11
28
 
@@ -13,23 +30,30 @@ Every mission creates and works inside `.mugiwara/` at the repo root:
13
30
 
14
31
  ```
15
32
  .mugiwara/
33
+ ├── config # runtime mode config: mode/branch/commit/pr key=value (gitignored; project overrides global)
16
34
  ├── spec/ # brainstorm output: YYYY-MM-DD-<mission>.md
17
- ├── plans/ # plan doc: YYYY-MM-DD-<mission>.md — single source of truth from Wave 2
18
- ├── results/ # wave results: audit reports, quality/gate reports, test output
35
+ ├── plans/ # plan doc: YYYY-MM-DD-<mission>.md — CLEAN, Nami-only, source of truth from Wave 2. No agent names, no log, no closure.
36
+ ├── results/ # wave results: audit/quality/gate reports, todos, closure report
19
37
  ├── review/ # review + security findings
20
38
  ├── issues/ # blocker log: YYYY-MM-DD-<mission>-blockers.md
21
- └── logs/ # Luffy's decision log
39
+ └── logs/ # Luffy's decision + check-in log: YYYY-MM-DD-<mission>.md (deleted at cleanup)
22
40
  ```
23
41
 
42
+ The plan doc stays clean: it holds ONLY Nami's execution plan (waves, tasks,
43
+ criteria, risks). Who did what, route decisions, and check-in verdicts go to
44
+ `logs/`; the closure report goes to `results/`. Nothing non-plan pollutes the plan doc.
45
+
24
46
  The owning agent creates the folder it needs on first write. No mission artifacts go outside `.mugiwara/`.
25
47
 
26
48
  ## Resume
27
49
 
28
- At session start, after context loss, or on any "where were we?" — dispatch `resume-coordinator` (mugiwara-resume) BEFORE Wave 0 triage. It rebuilds the picture from disk (plan, todos, trace, blockers) and reports the resume point. Resume before any wave; never start over. Disk state is truth.
50
+ 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.
29
51
 
30
52
  ## Wave 0 — Luffy Triage (always first)
31
53
 
32
- Front door: dispatch `using-mugiwara` (easy to remember) — it routes to the right crew member and records the route. For a full triage dispatch `luffy-orchestrator`. 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. The user may summon any crew member directly — Luffy still records the route.
54
+ 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. The user may summon any crew member directly — Luffy still records the route.
55
+
56
+ Alongside triage, read the mode config per `mugiwara-mode`: `.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.
33
57
 
34
58
  ## Waves
35
59
 
@@ -45,7 +69,7 @@ Front door: dispatch `using-mugiwara` (easy to remember) — it routes to the ri
45
69
  | 6 Gates | Franky | mugiwara-gates | coverage + build verdict |
46
70
  | 7 Review | Robin ∥ Jinbe | mugiwara-review + mugiwara-security | severity-tagged findings |
47
71
  | 8 Healing | Brook | mugiwara-healing | fixes, then loop back to Wave 4 |
48
- | 9 Closure | Luffy | mugiwara-orchestration | closure report appended to plan |
72
+ | 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) |
49
73
 
50
74
  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.
51
75
 
@@ -59,29 +83,34 @@ Never silently work around a blocker. Brook reads this ledger at Wave 8 to decid
59
83
 
60
84
  ## Cleanup
61
85
 
62
- At closure (Wave 9), delete unused intermediate markdown files in `.mugiwara/` — superseded results, review, and issues reports. Keep the plan doc and the closure report.
86
+ At closure (Wave 9), after the terminal step, run the cleanup procedure in `mugiwara-ship`: delete consumed intermediates — superseded results, review, issues reports, the per-mission decision log in `logs/`, and the consumed spec. Keep the plan doc, the closure report, the PR verdict, `config`, and cross-mission state (`logs/lessons.md`, `backup/`, `manifest.json`). List candidates before deleting.
63
87
 
64
88
  ## Rules
65
89
 
66
90
  1. Evidence over claims: no wave passes on assertion. The owning agent runs the checks and shows output.
67
- 2. No wave skipped without the reason recorded in the plan doc.
91
+ 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.
68
92
  3. Heal loop is bounded: Wave 8 → Wave 4, max 3 cycles. After that, escalate to the human with full history.
69
- 4. Any agent may consult Luffy mid-flight (re-dispatch `luffy-orchestrator`) for decisions and escalations.
70
- 5. Wave 7 runs Robin and Jinbe in parallel.
93
+ 4. Any agent may consult Luffy mid-flight (embody `luffy-orchestrator` inline) for decisions and escalations.
94
+ 5. Wave 7 runs Robin and Jinbe review passes in parallel — both are inline passes over the same diff, or parallel review subagents for large diffs.
71
95
  6. The plan doc (`.mugiwara/plans/YYYY-MM-DD-<mission>.md`) is the single source of truth from Wave 2 onward.
72
96
  7. Frontend-touching tasks in Wave 3 must apply `mugiwara-frontend` in the same pass.
73
- 8. One agent may hold many skills (e.g. Usopp holds `mugiwara-brainstorm` + `mugiwara-frontend`; the crew is 11 members); dispatch the agent, not the skill.
97
+ 8. One crew member may hold many skills (e.g. Usopp holds `mugiwara-brainstorm` + `mugiwara-frontend`; the crew is 15 members); load the member's skills, embody the role inline.
74
98
  9. On session start, context loss, or "where were we?" — resume before any wave via `resume-coordinator` (mugiwara-resume); never start over.
99
+ 10. The crew never merges and never deploys — push the branch + hand the verdict file to the user, who opens the PR; PR review is the terminal gate in every mode.
75
100
 
76
101
  ## Iron Law
77
102
 
78
103
  EVIDENCE OVER CLAIMS. No wave passes on assertion — the owning agent runs the checks and shows output. A wave that cannot produce evidence is a failed wave.
79
104
 
105
+ ## Verification gate (every completion claim)
106
+
107
+ A claim is only as strong as the evidence produced in the same turn that made it. "Done", "passes", and "fixed" each name a command that would prove them — run that command, read its full output, then speak. A result from an earlier run, a guess, or a worker's word for it is not proof; re-run it and diff the work against the tree before reporting. Trust is not a substitute for verification.
108
+
80
109
  ## Red flags
81
110
 
82
111
  - A wave "passes" on a spoken claim with no command output or file to point at.
83
112
  - Heal loop beyond 3 cycles with the same failure still open.
84
- - A wave skipped with no reason recorded in the plan doc.
113
+ - A wave skipped with no reason recorded in the decision log.
85
114
  - Execution starts before triage (Wave 0), or planning before brainstorm when triage routed to Wave 1.
86
115
  - Mission artifacts landing outside `.mugiwara/`.
87
116
  - Wave order drifts from the table (e.g. quality before checkpoint).
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: mugiwara-writing-skills
3
+ description: Use when authoring a new mugiwara skill or revising an existing one. Enforces the skill anatomy (name/description 20-500 chars, when-to-use, process, rationalizations, red flags, verification), the 120-line body ceiling, and progressive disclosure of detail into a references/ file. Meta-skill: governs the other skills.
4
+ ---
5
+
6
+ # Writing Mugiwara Skills
7
+
8
+ A skill is a process workflow the agent runs on cue, not a reference guide. If it reads like a wiki page, it fails. The description decides when the skill loads; the body decides what happens next. Both must justify their size.
9
+
10
+ ## Skill anatomy
11
+
12
+ Every skill is a single `SKILL.md` at `content/skills/<name>/`, plus an optional `references/` folder for pulled-out detail. The name is the directory name; the validator checks that exact match.
13
+
14
+ | Part | Requirement |
15
+ |------|-------------|
16
+ | name | equals the directory name, `mugiwara-<domain>` |
17
+ | description | one "Use when..." sentence, 20-500 chars, loads the right skill and rejects the wrong ones |
18
+ | body | `# title` + sections below, 120 lines max |
19
+ | references/ | overflow detail, linked from the body |
20
+
21
+ ## When to use
22
+
23
+ Use this skill the moment you start authoring a new skill file or restructuring an existing one. Skip it only for edits so small they cannot touch anatomy, limits, or wording.
24
+
25
+ ## Process
26
+
27
+ 1. **Confirm the niche.** Grep `content/skills/` for overlap; a new skill must not duplicate an existing one. Name it `mugiwara-<domain>`.
28
+ 2. **Write the description first.** One "Use when..." sentence naming the trigger, the behavior, and the boundary of what the skill is not for. Target 60-120 chars; the 500-char cap is a ceiling, not a goal.
29
+ 3. **Draft the body as a workflow.** Concrete numbered steps the agent executes, in order, with decisions and branches embedded. Name the skills it reads or dispatches. Use tables for excusable patterns and quick comparisons.
30
+ 4. **Cut to the ceiling.** Body must end at 120 lines or fewer. Section-by-section trim: merge subsections, kill throat-clearing, convert prose to tables. `ponytail` and `caveman` instincts apply — the body is command output, not a report.
31
+ 5. **Disclose progressively.** If a section exceeds roughly 15-20 lines, move it to `references/<topic>.md`, drop a one-line pointer in the body, and keep the pointer actionable (what to read and why).
32
+ 6. **Check the anatomy list.** Each required section present, in order: title, When to use, Process, Rationalizations, Red flags, Verification.
33
+ 7. **Validate.** Run `bun scripts/validate-content.ts --check content/skills/<name>/SKILL.md` and leave it exiting 0.
34
+
35
+ ## Rationalizations
36
+
37
+ | Excuse | Rebuttal |
38
+ |--------|----------|
39
+ | "It's a guide, not a checklist" | A skill the agent cannot execute is decoration. Rewrite every paragraph as a step or a criterion. |
40
+ | "The detail is essential" | Then move it to `references/` and keep the body a decision tree, not a dump. |
41
+ | "More lines mean more coverage" | 120 lines enforce focus. Cover the decision, not the encyclopedia. |
42
+ | "Long description catches more triggers" | A description that matches everything loads on nothing specific and trains the agent to ignore the skill. |
43
+ | "Patterns are the same everywhere, I'll mirror another skill's text" | Wording must be original. Mirror the shape, never the sentences. |
44
+ | "It's fine for now, I'll validate later" | Validation is the last step of the write, not a follow-up task. |
45
+
46
+ ## Red flags
47
+
48
+ - Body over 120 lines or a description outside 20-500 chars.
49
+ - No "Use when..." trigger sentence, or a description that names no boundary.
50
+ - A section that reads as a lecture instead of steps the agent can run.
51
+ - Required sections missing or out of order.
52
+ - Text copied from another skill, superpowers, or agent-skills.
53
+ - A `references/` file that is unreferenced, or a body so crammed it needed none.
54
+ - An unvalidated file reported as done.
55
+
56
+ Any of these: revise the skill, re-run validation, and confirm both before reporting.
57
+
58
+ ## Verification
59
+
60
+ Evidence of a complete skill: the file passes `--check` with exit 0; `wc -l` on the body is at or under 120; the description triggers only its intended cases; every required section is present and original; and any overflow sits in a linked `references/` file.
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 existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, realpathSync, rmSync as rmSync2 } from "node:fs";
4
+ import { existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync2, realpathSync, rmSync as rmSync2 } from "node:fs";
5
5
  import { homedir as homedir2 } from "node:os";
6
6
  import { join as join7, resolve } from "node:path";
7
7
  import { pathToFileURL } from "node:url";
@@ -79,7 +79,9 @@ async function confirm(rl, question) {
79
79
  }
80
80
 
81
81
  // src/targets/claude.ts
82
- import { join } from "node:path";
82
+ import { existsSync, mkdirSync, copyFileSync } from "node:fs";
83
+ import { dirname, join } from "node:path";
84
+ import { fileURLToPath } from "node:url";
83
85
 
84
86
  // src/frontmatter.ts
85
87
  function parseFrontmatter(text) {
@@ -107,6 +109,8 @@ ${body}`;
107
109
  }
108
110
 
109
111
  // src/targets/claude.ts
112
+ var here = dirname(fileURLToPath(import.meta.url));
113
+ var HOOK_SRC = join(here, "..", "..", "hooks", "session-start.ts");
110
114
  var target = {
111
115
  id: "claude",
112
116
  label: "Claude Code",
@@ -126,6 +130,18 @@ var target = {
126
130
  if (data.tools)
127
131
  fm.tools = data.tools;
128
132
  return { relPath: `${data.name}.md`, text: stringifyFrontmatter(fm, body) };
133
+ },
134
+ postInstall({ scope, projectDir, home, dryRun }) {
135
+ const root = scope === "global" ? join(home, ".claude") : join(projectDir, ".claude");
136
+ const hookFile = join(root, "hooks", "session-start.ts");
137
+ if (dryRun)
138
+ return { written: [], notes: [] };
139
+ if (existsSync(HOOK_SRC) && !existsSync(hookFile)) {
140
+ mkdirSync(dirname(hookFile), { recursive: true });
141
+ copyFileSync(HOOK_SRC, hookFile);
142
+ return { written: [hookFile], notes: [] };
143
+ }
144
+ return { written: [], notes: [] };
129
145
  }
130
146
  };
131
147
 
@@ -178,7 +194,7 @@ var target3 = {
178
194
  };
179
195
 
180
196
  // src/targets/generic.ts
181
- import { existsSync, writeFileSync } from "node:fs";
197
+ import { existsSync as existsSync2, writeFileSync } from "node:fs";
182
198
  import { join as join4 } from "node:path";
183
199
  function makeGeneric(opts) {
184
200
  const { id, label, rulesDir, bootstrapFile, bootstrapPointer } = opts;
@@ -214,7 +230,7 @@ ${body}` };
214
230
  const notes = [];
215
231
  const written = [];
216
232
  const file = join4(projectDir, bootstrapFile);
217
- if (!existsSync(file)) {
233
+ if (!existsSync2(file)) {
218
234
  if (!dryRun)
219
235
  writeFileSync(file, `${bootstrapPointer}
220
236
  `);
@@ -233,7 +249,7 @@ var target4 = makeGeneric({
233
249
  label: "Gemini",
234
250
  rulesDir: ".gemini/mugiwara",
235
251
  bootstrapFile: "GEMINI.md",
236
- bootstrapPointer: "Mugiwara crew installed in .gemini/mugiwara/ — read .gemini/mugiwara/mugiwara-workflow.md to run the pipeline."
252
+ bootstrapPointer: "Mugiwara crew installed in .gemini/mugiwara/ — read .gemini/mugiwara/mugiwara-workflow.md to run the pipeline inline in the main conversation."
237
253
  });
238
254
 
239
255
  // src/targets/codex.ts
@@ -242,7 +258,7 @@ var target5 = makeGeneric({
242
258
  label: "Codex",
243
259
  rulesDir: ".codex/mugiwara",
244
260
  bootstrapFile: "AGENTS.md",
245
- bootstrapPointer: "Mugiwara crew installed in .codex/mugiwara/ — read .codex/mugiwara/mugiwara-workflow.md to run the pipeline."
261
+ bootstrapPointer: "Mugiwara crew installed in .codex/mugiwara/ — read .codex/mugiwara/mugiwara-workflow.md to run the pipeline inline in the main conversation."
246
262
  });
247
263
 
248
264
  // src/targets/windsurf.ts
@@ -290,20 +306,20 @@ var targets = { claude: target, opencode: target2, copilot: target3, gemini: tar
290
306
  var TARGET_IDS = Object.keys(targets);
291
307
 
292
308
  // src/installer.ts
293
- import { existsSync as existsSync2, mkdirSync, readFileSync, readdirSync, writeFileSync as writeFileSync2, copyFileSync, rmSync } from "node:fs";
294
- import { dirname, join as join5 } from "node:path";
309
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync, writeFileSync as writeFileSync2, copyFileSync as copyFileSync2, rmSync } from "node:fs";
310
+ import { dirname as dirname2, join as join5 } from "node:path";
295
311
  import { homedir } from "node:os";
296
312
  var CONTENT_DIR = join5(import.meta.dirname, "..", "content");
297
- var pkg = JSON.parse(readFileSync(join5(import.meta.dirname, "..", "package.json"), "utf8"));
313
+ var pkg = JSON.parse(readFileSync2(join5(import.meta.dirname, "..", "package.json"), "utf8"));
298
314
  var VERSION = pkg.version;
299
315
  function collectContent() {
300
316
  const skillNames = readdirSync(join5(CONTENT_DIR, "skills"), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
301
317
  const skills = skillNames.map((name) => {
302
- const { data, body } = parseFrontmatter(readFileSync(join5(CONTENT_DIR, "skills", name, "SKILL.md"), "utf8"));
318
+ const { data, body } = parseFrontmatter(readFileSync2(join5(CONTENT_DIR, "skills", name, "SKILL.md"), "utf8"));
303
319
  return { name, data, body };
304
320
  });
305
321
  const agents = readdirSync(join5(CONTENT_DIR, "agents")).filter((f) => f.endsWith(".md")).map((f) => {
306
- const { data, body } = parseFrontmatter(readFileSync(join5(CONTENT_DIR, "agents", f), "utf8"));
322
+ const { data, body } = parseFrontmatter(readFileSync2(join5(CONTENT_DIR, "agents", f), "utf8"));
307
323
  return { name: f.replace(/\.md$/, ""), data, body };
308
324
  });
309
325
  return { skills, agents };
@@ -316,8 +332,8 @@ function installTo(target10, opts) {
316
332
  const backupRoot = join5(scope === "global" ? home : projectDir, ".mugiwara");
317
333
  const result = { written: [], skipped: [], backedUp: [], notes: [] };
318
334
  const writeOne = (absPath, text) => {
319
- if (existsSync2(absPath)) {
320
- if (readFileSync(absPath, "utf8") === text) {
335
+ if (existsSync3(absPath)) {
336
+ if (readFileSync2(absPath, "utf8") === text) {
321
337
  result.skipped.push(absPath);
322
338
  return;
323
339
  }
@@ -329,13 +345,13 @@ function installTo(target10, opts) {
329
345
  const ts = new Date().toISOString().replace(/[:.]/g, "-");
330
346
  const backupFile = join5(backupRoot, "backup", ts, absPath.replace(/[^a-zA-Z0-9]+/g, "_"));
331
347
  if (!dryRun) {
332
- mkdirSync(dirname(backupFile), { recursive: true });
333
- copyFileSync(absPath, backupFile);
348
+ mkdirSync2(dirname2(backupFile), { recursive: true });
349
+ copyFileSync2(absPath, backupFile);
334
350
  }
335
351
  result.backedUp.push(absPath);
336
352
  }
337
353
  if (!dryRun) {
338
- mkdirSync(dirname(absPath), { recursive: true });
354
+ mkdirSync2(dirname2(absPath), { recursive: true });
339
355
  writeFileSync2(absPath, text);
340
356
  }
341
357
  result.written.push(absPath);
@@ -360,7 +376,7 @@ function installTo(target10, opts) {
360
376
  function removeInstalled(manifest, { dryRun = false } = {}) {
361
377
  const removed = [];
362
378
  for (const f of manifest.files) {
363
- if (existsSync2(f)) {
379
+ if (existsSync3(f)) {
364
380
  if (!dryRun)
365
381
  rmSync(f);
366
382
  removed.push(f);
@@ -368,10 +384,10 @@ function removeInstalled(manifest, { dryRun = false } = {}) {
368
384
  }
369
385
  if (!dryRun) {
370
386
  for (const f of manifest.files) {
371
- let d = dirname(f);
372
- while (existsSync2(d) && readdirSync(d).length === 0) {
387
+ let d = dirname2(f);
388
+ while (existsSync3(d) && readdirSync(d).length === 0) {
373
389
  rmSync(d, { recursive: true });
374
- const parent = dirname(d);
390
+ const parent = dirname2(d);
375
391
  if (parent === d)
376
392
  break;
377
393
  d = parent;
@@ -382,16 +398,16 @@ function removeInstalled(manifest, { dryRun = false } = {}) {
382
398
  }
383
399
 
384
400
  // src/manifest.ts
385
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "node:fs";
386
- import { dirname as dirname2, join as join6 } from "node:path";
401
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
402
+ import { dirname as dirname3, join as join6 } from "node:path";
387
403
  function manifestPath({ scope, projectDir, home }) {
388
404
  return scope === "global" ? join6(home, ".mugiwara", "manifest.json") : join6(projectDir, ".mugiwara", "manifest.json");
389
405
  }
390
406
  function readManifest(file) {
391
- return existsSync3(file) ? JSON.parse(readFileSync2(file, "utf8")) : null;
407
+ return existsSync4(file) ? JSON.parse(readFileSync3(file, "utf8")) : null;
392
408
  }
393
409
  function writeManifest(file, data) {
394
- mkdirSync2(dirname2(file), { recursive: true });
410
+ mkdirSync3(dirname3(file), { recursive: true });
395
411
  writeFileSync3(file, JSON.stringify(data, null, 2) + `
396
412
  `);
397
413
  }
@@ -433,7 +449,7 @@ async function resolveOptions(flags) {
433
449
  scope = await choose(rl, "Install scope?", ["global (user-wide)", "project (this repo)"]) === 0 ? "global" : "project";
434
450
  }
435
451
  const projectDir = resolve(str(flags.project) ?? process.cwd());
436
- if (scope === "project" && !existsSync4(projectDir))
452
+ if (scope === "project" && !existsSync5(projectDir))
437
453
  throw new Error(`Project dir not found: ${projectDir}`);
438
454
  let targetIds = str(flags.target)?.split(",").map((s) => s.trim()) ?? null;
439
455
  if (targetIds && targetIds.includes("all"))
@@ -541,7 +557,7 @@ function skills() {
541
557
  const dir = join7(CONTENT_DIR, "skills");
542
558
  const names = readdirSync2(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
543
559
  const rows = names.map((name) => {
544
- const { data } = parseFrontmatter(readFileSync3(join7(dir, name, "SKILL.md"), "utf8"));
560
+ const { data } = parseFrontmatter(readFileSync4(join7(dir, name, "SKILL.md"), "utf8"));
545
561
  return [name, data.description ?? ""];
546
562
  });
547
563
  const w = Math.max(...rows.map((r) => r[0].length)) + 2;
@@ -0,0 +1,72 @@
1
+ # Adoption Guide
2
+
3
+ How to take the crew into your workflow without fighting it.
4
+
5
+ ## Pick your harness
6
+
7
+ The crew ships native skills + agents where the harness supports them, and
8
+ markdown rule files everywhere else.
9
+
10
+ | Situation | Pick |
11
+ |-----------|------|
12
+ | You live in Claude Code or opencode | Native install — agents + skills + (Claude) session hook |
13
+ | You want the full crew pipeline | Claude Code, opencode |
14
+ | You want skills-only, any tool | `npx skills add ionivetech/mugiwara` (agentskills.io layout) |
15
+ | You only use one niche tool | Its per-harness guide (index → install by harness) |
16
+
17
+ Native targets (Claude Code, opencode, Copilot) register the 15 agents directly.
18
+ Rule-based targets (Gemini, Codex, Cursor, Windsurf, Cline, Kilo, Antigravity)
19
+ get the same 32 skills as markdown rules plus a bootstrap pointer, so the crew
20
+ is still steered even where subagents don't exist.
21
+
22
+ ## Pick your mode
23
+
24
+ Modes live in `.mugiwara/config` (project) or `~/.mugiwara/config` (global):
25
+
26
+ ```
27
+ mode=guided
28
+ branch=feature/{type}-{issue}-{slug}
29
+ commit=conventional
30
+ ```
31
+
32
+ | Level | What it asks you |
33
+ |-------|------------------|
34
+ | `guided` | Plan GO, branch, commits, ambiguities, check-ins — everything |
35
+ | `semi` | Plan GO only; branch/commits/ambiguities self-answer and log |
36
+ | `auto` | Nothing, unless a high-risk task exists (auto-GO is gated) |
37
+
38
+ State-mutating tests against shared state (real DB writes, network, browsers)
39
+ always need your explicit consent — in every mode. That consent is not a knob.
40
+
41
+ Missing config on read = `guided`. A flip applies from the next wave, never
42
+ mid-wave.
43
+
44
+ ## Fit the crew to your workflow
45
+
46
+ - **Trivial one-liners** don't need the crew — Luffy routes them straight to
47
+ execution.
48
+ - **Medium features** run the standard pipeline: triage → plan → execute →
49
+ checkpoint → quality → gates → review → closure.
50
+ - **High-stakes work** (money, security, data, public API) always gets the full
51
+ pipeline, including Skeptic's adversarial pass and Brook's heal loop.
52
+ - **Repos the crew has touched before** read the lessons ledger at triage, so
53
+ every mission stands on the previous ones.
54
+
55
+ ## The execution model, in one sentence
56
+
57
+ The crew runs **inline in your main conversation**; subagents are used only for
58
+ independent `[PARALLEL]` task batches and background checks. You see every wave
59
+ as it happens. See [execution-model.md](execution-model.md).
60
+
61
+ ## What the crew will never do
62
+
63
+ - Merge a PR, or deploy. It pushes the branch and hands you the verdict file —
64
+ PR review is the terminal gate.
65
+ - Auto-react to review comments or CI.
66
+ - Let a wave pass on a spoken claim — evidence or it didn't happen.
67
+ - Work around a blocker silently — everything lands in the ledger.
68
+
69
+ ## Going further
70
+
71
+ - [Developer onboarding](developer-onboarding.md) if you want to contribute.
72
+ - [Comparison](comparison.md) if you're weighing mugiwara against alternatives.
@@ -0,0 +1,72 @@
1
+ # Agent Anatomy
2
+
3
+ Every mugiwara agent is a portable markdown file that names a crew member's
4
+ persona, rules, and output contract. Agents are harness-native where supported
5
+ (Claude Code, opencode) and markdown rule files elsewhere.
6
+
7
+ ## File structure
8
+
9
+ ```
10
+ agents/<name>.md
11
+ ```
12
+
13
+ ```markdown
14
+ ---
15
+ name: chopper-checkpoint
16
+ description: Dispatch after each execution wave to audit results against the plan - re-runs every acceptance criterion, verifies commit hygiene and parallel-file safety, classifies failures honestly, appends ledger rows, and issues a Definition-of-Done verdict. Auditor only; never fixes code.
17
+ skills: mugiwara-checkpoint
18
+ ---
19
+
20
+ # Chopper — Checkpoint (Auditor)
21
+
22
+ ## Role
23
+ ...
24
+ ```
25
+
26
+ ## Frontmatter
27
+
28
+ | Field | Required | Notes |
29
+ |-------|----------|-------|
30
+ | `name` | yes | lowercase, hyphen-separated; matches the file name |
31
+ | `description` | yes | ≥20 chars; what this agent does and when to summon it |
32
+ | `skills` | no | the crew skills this member holds, comma-separated |
33
+
34
+ Harness-specific agents (opencode) may add `mode`, `permission`, `model`, etc.
35
+ in their own installation copy — the content stays portable.
36
+
37
+ ## The body — house style
38
+
39
+ Agents follow a fixed skeleton so every member reads the same way:
40
+
41
+ 1. **Role** — one paragraph: what the member does and the boundary it never
42
+ crosses ("Auditor, not fixer", "never implements code").
43
+ 2. **Experience** — a one-line persona so the model adopts the right instincts
44
+ ("QA lead who has caught 'works on my machine' for 20 years").
45
+ 3. **When dispatched** — which wave of `mugiwara-workflow` and with what inputs.
46
+ 4. **Rules** — numbered, each an action bound to its reason, deferring to the
47
+ held skill for the full protocol.
48
+ 5. **Output** — where the artifact lands (`.mugiwara/results/...`) and how it
49
+ routes.
50
+ 6. **Red flags** — behaviors that mean the member stopped doing its job.
51
+
52
+ ## Agent vs skill
53
+
54
+ - A **skill** is the reusable playbook ("how to audit a wave").
55
+ - An **agent** is the persona that applies it ("Chopper is the auditor; Chopper
56
+ never fixes code").
57
+
58
+ One agent holds many skills (Zoro holds `mugiwara-execution`, `mugiwara-git`,
59
+ `mugiwara-mode`, `mugiwara-testcases`, `mugiwara-backend`). When the crew runs
60
+ inline, the main thread loads the member's skills and embodies the persona.
61
+
62
+ ## Validation
63
+
64
+ Agents are validated alongside skills on check-in (name, description length,
65
+ sync between `content/` and the repo-root plugin copies). Run:
66
+
67
+ ```bash
68
+ bun run validate
69
+ bun run validate --check-sync
70
+ ```
71
+
72
+ See [developer-onboarding.md](developer-onboarding.md).
package/docs/agents.md ADDED
@@ -0,0 +1,51 @@
1
+ # The Crew — 15 Agents
2
+
3
+ Every agent is a focused specialist. The main thread embodies each role inline
4
+ using its skill; you can also summon any member directly. "Dispatch" below
5
+ means "route the mission to this role."
6
+
7
+ | Agent | Crew member | Role | Summon for |
8
+ |-------|-------------|------|------------|
9
+ | `using-mugiwara` | Front Door | Router — classifies and routes, never implements | "how do I use mugiwara?", any new mission |
10
+ | `luffy-orchestrator` | Luffy | Captain — 5-way triage, check-ins, decisions, closure | mission start, wave boundaries, escalations |
11
+ | `usopp-brainstorm` | Usopp | Critical friend — interrogates, researches, no rubber-stamps | vague ideas, direction, options |
12
+ | `nami-planner` | Nami | Planner — interview-first, full-context scan, scaled plans | turning an idea into an execution plan |
13
+ | `zoro-execution` | Zoro | Executor — inline sequential tasks, parallel worker batches, evidence per task | executing an approved plan |
14
+ | `chopper-checkpoint` | Chopper | Auditor — verify-everything, deduped re-runs, failure ledger | auditing a wave's results |
15
+ | `sanji-quality` | Sanji | Quality — discover real tooling, format/lint/test | after checkpoint passes |
16
+ | `franky-gates` | Franky | Gates — coverage, build, Definition of Done, binary verdicts | after quality checks |
17
+ | `robin-reviewer` | Robin | Reviewer — doubt-driven diff review, breaking-change map first | after gates pass |
18
+ | `jinbe-security` | Jinbe | Security — STRIDE, OWASP, secrets, injection, dependencies | security audit of a diff |
19
+ | `brook-healing` | Brook | Healer — reads the ledger, root-cause fixes, ≤3 cycles | any wave produced failures |
20
+ | `skeptic-verifier` | Skeptic | Adversarial verifier — doubts every output, does NOT validate | high-stakes verdicts, plans, reviews |
21
+ | `eval-runner` | Eval Runner | Harness tester — task suites, judge-agent comparison | verifying mugiwara itself works |
22
+ | `resume-coordinator` | Resume Coordinator | Resumer — rebuilds state from `.mugiwara/`, continues never restarts | context loss, new session mid-mission |
23
+ | `memory-keeper` | Memory Keeper | Institutional memory — surfaces past lessons, captures new ones | mission start + closure |
24
+
25
+ ## How to summon
26
+
27
+ Say a crew member's name in your request:
28
+
29
+ ```
30
+ > Chopper, audit the last wave against the plan
31
+ > Nami, plan this out
32
+ ```
33
+
34
+ Luffy still records the route and its reason, and direct calls do not skip
35
+ check-ins. The harness stays coherent either way.
36
+
37
+ ## Who never does what
38
+
39
+ - **Luffy** never implements code.
40
+ - **Chopper** never fixes findings — reports them.
41
+ - **Skeptic** never validates — doubts.
42
+ - **Robin/Jinbe** never implement — findings to Brook.
43
+ - Crew members never dispatch each other. Workers are subagents, never crew.
44
+
45
+ ## The crew ships whole
46
+
47
+ Every install gets all 15 agents and all 32 skills. No project-type selection —
48
+ the harness routes each task to the right specialist.
49
+
50
+ See [skills.md](skills.md) for the 32 techniques, or
51
+ [workflow.md](workflow.md) for the pipeline.
@@ -0,0 +1,43 @@
1
+ # Claude Code Setup
2
+
3
+ Claude Code is a fully supported target — native skills + agents + SessionStart
4
+ hook.
5
+
6
+ ## Install via the marketplace
7
+
8
+ ```bash
9
+ /plugin marketplace add ionivetech/mugiwara
10
+ /plugin install mugiwara
11
+ ```
12
+
13
+ ## Install via CLI (global or per project)
14
+
15
+ ```bash
16
+ # global Claude Code install
17
+ npx @ionivetech/mugiwara@latest --global --target claude --yes
18
+
19
+ # project install
20
+ npx @ionivetech/mugiwara@latest --project ./my-app --target claude --yes
21
+ ```
22
+
23
+ **Update** — re-install from the marketplace (or `mugiwara update` via CLI).
24
+
25
+ **Uninstall** — `/plugin uninstall mugiwara`, or `mugiwara uninstall` via CLI.
26
+
27
+ ## What you get
28
+
29
+ - 32 skills in `~/.claude/skills/` (global) or `.claude/skills/` (project).
30
+ - 15 agents in `~/.claude/agents/` or `.claude/agents/`.
31
+ - A SessionStart hook that announces the crew and auto-activates the workflow —
32
+ a non-trivial request runs the pipeline by itself. `/using-mugiwara` is an
33
+ optional explicit router if you want to hand-route a mission.
34
+
35
+ ## Use it
36
+
37
+ ```
38
+ > add dark mode to the settings page
39
+ ```
40
+
41
+ The crew runs inline in your main conversation; subagents only for parallel
42
+ batches. At closure the crew pushes the branch and hands you the PR verdict
43
+ file with a ready PR summary block — you open the PR, in every mode.
@@ -0,0 +1,26 @@
1
+ # Codex Setup
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ codex plugin marketplace add ionivetech/mugiwara
7
+ codex plugin add mugiwara@mugiwara
8
+ ```
9
+
10
+ Or via the CLI:
11
+
12
+ ```bash
13
+ npx @ionivetech/mugiwara@latest --project ./my-app --target codex --yes
14
+ ```
15
+
16
+ **Update** — `codex plugin update mugiwara`. **Uninstall** — `codex plugin remove mugiwara`.
17
+
18
+ ## What you get
19
+
20
+ - 32 skills as markdown rules in `.codex/mugiwara/`.
21
+ - An `AGENTS.md` bootstrap pointer (created if missing).
22
+
23
+ ## Notes
24
+
25
+ Codex is a **project-only** target. Agents are skills-only here — the crew
26
+ pipeline runs through the rule files.