@ionivetech/mugiwara 0.3.0 → 0.5.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 (119) hide show
  1. package/.opencode/commands/mugiwara-plan.md +4 -0
  2. package/README.md +214 -418
  3. package/content/agents/brook-healing.md +2 -2
  4. package/content/agents/chopper-checkpoint.md +2 -1
  5. package/content/agents/eval-runner.md +4 -4
  6. package/content/agents/franky-gates.md +1 -1
  7. package/content/agents/jinbe-security.md +2 -1
  8. package/content/agents/luffy-orchestrator.md +3 -3
  9. package/content/agents/memory-keeper.md +1 -1
  10. package/content/agents/nami-planner.md +2 -2
  11. package/content/agents/resume-coordinator.md +8 -9
  12. package/content/agents/robin-reviewer.md +3 -2
  13. package/content/agents/sanji-quality.md +1 -1
  14. package/content/agents/skeptic-verifier.md +4 -3
  15. package/content/agents/using-mugiwara.md +3 -3
  16. package/content/agents/usopp-brainstorm.md +3 -3
  17. package/content/agents/zoro-execution.md +4 -3
  18. package/content/skills/mugiwara-agent-security/SKILL.md +19 -2
  19. package/content/skills/mugiwara-backend/SKILL.md +7 -8
  20. package/content/skills/mugiwara-backend/references/source-backed-example.md +77 -0
  21. package/content/skills/mugiwara-brainstorm/SKILL.md +7 -2
  22. package/content/skills/mugiwara-checkpoint/SKILL.md +7 -2
  23. package/content/skills/mugiwara-checkpoint/references/ledger-format.md +34 -0
  24. package/content/skills/{mugiwara-doubt-driven-development → mugiwara-claim-audit}/SKILL.md +7 -2
  25. package/content/skills/{mugiwara-context-engineering → mugiwara-context-budget}/SKILL.md +7 -2
  26. package/content/skills/mugiwara-context-budget/references/context-budget.md +37 -0
  27. package/content/skills/{mugiwara-api-and-interface-design → mugiwara-contract-first}/SKILL.md +9 -2
  28. package/content/skills/mugiwara-contract-first/references/versioning-playbook.md +36 -0
  29. package/content/skills/mugiwara-execution/SKILL.md +9 -2
  30. package/content/skills/mugiwara-execution/references/worked-example.md +88 -0
  31. package/content/skills/mugiwara-frontend/SKILL.md +21 -22
  32. package/content/skills/mugiwara-frontend/references/design-tokens.md +25 -0
  33. package/content/skills/mugiwara-frontend/references/slop-catalog.md +19 -0
  34. package/content/skills/mugiwara-gates/SKILL.md +9 -4
  35. package/content/skills/mugiwara-git/SKILL.md +6 -1
  36. package/content/skills/mugiwara-healing/SKILL.md +39 -7
  37. package/content/skills/mugiwara-healing/references/failure-taxonomy.md +23 -0
  38. package/content/skills/mugiwara-lessons/SKILL.md +6 -1
  39. package/content/skills/mugiwara-orchestration/SKILL.md +18 -5
  40. package/content/skills/mugiwara-planning/SKILL.md +16 -15
  41. package/content/skills/mugiwara-planning/references/anti-patterns.md +17 -0
  42. package/content/skills/mugiwara-planning/references/plan-template.md +46 -0
  43. package/content/skills/mugiwara-pr/SKILL.md +6 -1
  44. package/content/skills/{mugiwara-test-driven-development → mugiwara-proof-order}/SKILL.md +7 -2
  45. package/content/skills/mugiwara-proof-order/references/proof-order-examples.md +62 -0
  46. package/content/skills/mugiwara-quality/SKILL.md +8 -3
  47. package/content/skills/mugiwara-resume/SKILL.md +46 -30
  48. package/content/skills/mugiwara-review/SKILL.md +6 -1
  49. package/content/skills/mugiwara-review/references/five-axis-worksheet.md +36 -0
  50. package/content/skills/mugiwara-review/references/severity-rubric.md +20 -0
  51. package/content/skills/{mugiwara-systematic-debugging → mugiwara-root-cause}/SKILL.md +9 -2
  52. package/content/skills/mugiwara-root-cause/references/four-phase-worked.md +71 -0
  53. package/content/skills/mugiwara-security/SKILL.md +18 -18
  54. package/content/skills/mugiwara-security/references/owasp-mapping.md +30 -0
  55. package/content/skills/mugiwara-security/references/stride-worksheet.md +37 -0
  56. package/content/skills/mugiwara-ship/SKILL.md +6 -1
  57. package/content/skills/{mugiwara-deprecation → mugiwara-sunset}/SKILL.md +7 -2
  58. package/content/skills/mugiwara-testcases/SKILL.md +6 -1
  59. package/content/skills/mugiwara-testcases/references/intake-formats.md +42 -0
  60. package/content/skills/mugiwara-workflow/SKILL.md +26 -24
  61. package/dist/mugiwara.js +165 -28
  62. package/docs/adoption-guide.md +2 -2
  63. package/docs/agents.md +2 -2
  64. package/docs/audit-trail.md +65 -0
  65. package/docs/comparison.md +58 -63
  66. package/docs/compliance-matrix.md +81 -0
  67. package/docs/config.md +7 -2
  68. package/docs/cost.md +45 -0
  69. package/docs/developer-onboarding.md +17 -13
  70. package/docs/enforcement.md +35 -0
  71. package/docs/getting-started.md +103 -41
  72. package/docs/harness-matrix.md +41 -0
  73. package/docs/index.md +11 -5
  74. package/docs/lanes.md +82 -0
  75. package/docs/skill-anatomy.md +42 -49
  76. package/docs/skills.md +36 -54
  77. package/docs/troubleshooting.md +91 -0
  78. package/docs/workflow.md +15 -6
  79. package/evals/cases/adversarial-pressure-fake-pass.json +12 -0
  80. package/evals/cases/adversarial-pressure-skip-review.json +13 -0
  81. package/evals/cases/lane-exploratory-vague.json +12 -0
  82. package/evals/cases/lane-sensitivity-payment.json +12 -0
  83. package/evals/cases/negative-secrets-typo.json +12 -0
  84. package/evals/cases/negative-security-docs-change.json +12 -0
  85. package/evals/cases/positive-refactor-existing-tests.json +11 -0
  86. package/evals/cases/positive-resume-mid-mission.json +11 -0
  87. package/evals/cases/routing-auth-feature.json +13 -0
  88. package/evals/cases/routing-bug-one-file.json +13 -0
  89. package/evals/cases/routing-typo.json +13 -0
  90. package/package.json +6 -4
  91. package/references/definition-of-done.md +42 -0
  92. package/references/multi-actor.md +44 -0
  93. package/references/skill-versioning.md +44 -0
  94. package/references/source-grounding.md +23 -0
  95. package/references/token-budget.md +34 -0
  96. package/scripts/evidence.sh +37 -0
  97. package/scripts/lane.sh +74 -0
  98. package/scripts/mission-report.sh +88 -0
  99. package/scripts/release-notes.ts +65 -0
  100. package/scripts/retrieval-eval.ts +152 -0
  101. package/scripts/run-evals.ts +113 -0
  102. package/scripts/savepoint.sh +165 -0
  103. package/scripts/sync-version.ts +30 -0
  104. package/scripts/validate-content.ts +226 -0
  105. package/src/args.ts +2 -1
  106. package/src/cli.ts +21 -20
  107. package/src/installer.ts +31 -3
  108. package/src/mission.ts +48 -0
  109. package/src/targets/claude.ts +4 -0
  110. package/src/targets/copilot.ts +4 -0
  111. package/src/targets/generic.ts +33 -1
  112. package/src/targets/kilo.ts +1 -0
  113. package/src/targets/opencode.ts +4 -0
  114. package/content/skills/mugiwara-dynamic-workflow/SKILL.md +0 -85
  115. package/content/skills/mugiwara-eval/SKILL.md +0 -82
  116. package/content/skills/mugiwara-git-worktrees/SKILL.md +0 -62
  117. package/content/skills/mugiwara-mode/SKILL.md +0 -72
  118. package/content/skills/mugiwara-observability/SKILL.md +0 -54
  119. package/content/skills/mugiwara-writing-skills/SKILL.md +0 -60
package/docs/lanes.md ADDED
@@ -0,0 +1,82 @@
1
+ # Lanes & Sizing
2
+
3
+ The crew sizes a mission before it runs. Lane is computed from the diff by
4
+ `scripts/lane.sh` — deterministic, not estimated.
5
+
6
+ ## The lanes
7
+
8
+ | Lane | Picks when | Waves | Token budget |
9
+ |------|-----------|-------|:------:|
10
+ | **0 · Direct** | typo, rename, 1 file <20 LOC | none | ~0 |
11
+ | **1 · Lean** | bug in 1-2 files, <50 LOC | execute → quality | ~4k |
12
+ | **2 · Standard** | feature, 3-8 files | plan → execute → audit → review | ~10k |
13
+ | **3 · Full** | architecture, migration, 9+ files, or auth/payment/API touched | all 9 waves | ~20k |
14
+ | **4 · Spike** | exploratory, needs direction | brainstorm → re-triage | ~3k |
15
+
16
+ ## How lane is computed
17
+
18
+ `scripts/lane.sh <base-ref>` runs `git diff --name-only` against the base ref
19
+ and applies deterministic rules:
20
+
21
+ | Diff | Lane |
22
+ |------|------|
23
+ | 0 files changed | Direct |
24
+ | 1 file, <20 LOC added | Direct |
25
+ | 1 file, ≥20 LOC added | Lean |
26
+ | 2 files | Lean |
27
+ | 3–8 files | Standard |
28
+ | 9+ files | Full |
29
+
30
+ **Sensitive path escalation.** Files matching these patterns always escalate to
31
+ Lane 3 (Full), regardless of file count:
32
+
33
+ ```
34
+ auth/ payment/ billing/ crypto/ secrets/ .env
35
+ migration/ .sql schema. .prisma .terraform .tf
36
+ ```
37
+
38
+ Use `--json` for machine output:
39
+
40
+ ```json
41
+ {
42
+ "lane": "full",
43
+ "reason": "sensitive paths (src/auth/login.ts) — escalated from standard",
44
+ "files_touched": 5,
45
+ "sensitive_paths": ["src/auth/login.ts"],
46
+ "base": "main"
47
+ }
48
+ ```
49
+
50
+ ## Token budget
51
+
52
+ Every lane has a budget enforced by `scripts/savepoint.sh` at each wave
53
+ boundary. The harness sets `MUGIWARA_TOKENS` env var with estimated tokens
54
+ consumed.
55
+
56
+ | Status | Condition | Action |
57
+ |--------|-----------|--------|
58
+ | ok | tokens < 1.5× budget | Continue |
59
+ | warn | tokens ≥ 1.5× budget | Log warning to decision log |
60
+ | stop | tokens ≥ 3× budget | Write state, report to user, pause mission |
61
+
62
+ Budget guidance, not a hard kill switch. The model decides whether to stop —
63
+ savepoint just writes the status to `state.json`.
64
+
65
+ ## Escalation
66
+
67
+ Lane **escalates when work outgrows the estimate.** At every wave boundary,
68
+ `scripts/savepoint.sh` re-checks the diff. If files grew or a sensitive path
69
+ appeared, lane rises. A lane **never auto-drops.** Under-process costs more
70
+ than over-process.
71
+
72
+ Manual escalation: if the user says "this is bigger than I thought — run the
73
+ full pipeline," Luffy records it in the decision log and escalates.
74
+
75
+ ## SPIKE lane (Lane 4)
76
+
77
+ Exploratory missions start at Lane 4. Usopp brainstorms, then the mission is
78
+ re-triaged into the right lane. A spike that stays a spike (no code change
79
+ decided) ends at Wave 1.
80
+
81
+ Lane is computed per mission by `scripts/lane.sh`, not stored in
82
+ `.mugiwara/config`.
@@ -1,23 +1,20 @@
1
1
  # Skill Anatomy
2
2
 
3
- Every mugiwara skill is a single portable `SKILL.md` file. No code, no runtime —
4
- just frontmatter plus a playbook the agent follows. This is the format skills
5
- ship in for Claude Code, opencode, Copilot, Cursor, Gemini, and 70+ other tools
6
- via the agentskills.io layout.
3
+ Every mugiwara skill is a single `SKILL.md` file. No code, no runtime — just
4
+ frontmatter plus a playbook the agent follows.
7
5
 
8
6
  ## File structure
9
7
 
10
8
  ```
11
9
  skills/<skill-name>/SKILL.md
12
- skills/<skill-name>/references/<topic>.md # optional: overflow detail, linked from the body
10
+ skills/<skill-name>/references/<topic>.md # optional: overflow detail
13
11
  ```
14
12
 
15
13
  ```markdown
16
14
  ---
17
15
  name: mugiwara-checkpoint
18
- description: Use after an execution wave to audit results against the plan. Runs every acceptance criterion as a command or file inspect, 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.
16
+ description: Use after an execution wave to audit results against the plan.
19
17
  ---
20
-
21
18
  # Checkpoint (Chopper)
22
19
 
23
20
  <playbook body>
@@ -27,52 +24,48 @@ description: Use after an execution wave to audit results against the plan. Runs
27
24
 
28
25
  | Field | Required | Notes |
29
26
  |-------|----------|-------|
30
- | `name` | yes | lowercase, hyphen-separated, matches the folder name, ≤64 chars |
31
- | `description` | yes | 20–500 chars; what it does AND when to trigger. Front-load the trigger keywords. Skills without a description are filtered out. |
32
- | `license`, `compatibility`, `metadata` | no | optional extras |
33
-
34
- ## The playbook body
35
-
36
- The body is the actual behavior. Well-formed mugiwara skills follow a house
37
- style:
38
-
39
- 1. **Title + one-line identity** — `# Checkpoint (Chopper)`, then what the role
40
- is and is not.
41
- 2. **The protocol** — numbered steps, exact commands, exact file paths.
42
- 3. **Decision tables** — where a judgment is needed, a table of signal → action.
43
- 4. **The iron law** — one memorable line that states the non-negotiable
44
- ("TRUST NOTHING; VERIFY EVERYTHING").
45
- 5. **Common rationalizations** — the excuses to reject, and the correct reply.
46
- 6. **Red flags** — conditions that mean "stop, this isn't done," each ending
47
- with what to do.
48
-
49
- ### Style rules that keep skills effective
50
-
51
- - **Evidence over claims.** A skill says what to run, never what to assume.
52
- - **Concrete, never aspirational.** Exact paths, exact commands; "works
53
- correctly" is banned as an acceptance criterion.
54
- - **Boundaries are explicit.** Auditor skills say "never edit code"; executor
55
- skills say "never report done without command output."
56
- - **≤120 lines.** Skills that grow past that get split, not stretched.
57
- - **Progressive disclosure.** Keep the trigger-scannable description and the
58
- decision tree in the body; when a section exceeds roughly 15–20 lines, move
59
- the detail to a `references/<topic>.md` file and drop a one-line pointer in
60
- the body saying what to read and why.
61
-
62
- ## How skills reference each other
63
-
64
- Skills cross-reference by name: an agent's frontmatter lists its held skills
65
- (`skills: mugiwara-checkpoint`), and skills defer to each other (e.g.
66
- `mugiwara-quality` defers to `mugiwara-mode` for the consent contract). Content
67
- is the single source of truth; harnesses copy it verbatim.
27
+ | `name` | yes | lowercase, hyphen-separated, matches folder name, ≤64 chars |
28
+ | `description` | yes | 20–500 chars; trigger conditions + disambiguators only. Front-load trigger keywords. |
29
+ | `license`/`compatibility`/`metadata` | no | optional |
30
+
31
+ ## Playbook body
32
+
33
+ 1. **Title + one-line identity** role name and what it does/doesn't do.
34
+ 2. **Skip when** — required. ≤4 bullets, numeric threshold. Validator fails
35
+ build without it.
36
+ 3. **Protocol** — numbered steps, exact commands, exact file paths.
37
+ 4. **Decision tables** — signal → action.
38
+ 5. **Iron law** — one memorable non-negotiable line.
39
+ 6. **Common rationalizations** — excuses + correct reply.
40
+ 7. **Red flags** — stop conditions + what to do.
41
+
42
+ ## Style rules
43
+
44
+ - **Evidence over claims.** Say what to run, never what to assume.
45
+ - **Concrete, never aspirational.** Exact paths, exact commands.
46
+ - **≤120 lines.** Grow beyond split or move to `references/`.
47
+ - **Progressive disclosure.** Sections >15–20 lines move to
48
+ `references/<topic>.md`; body gets a one-line pointer saying what to read
49
+ and why.
50
+ - **220-char description ceiling.** Descriptions carry trigger vocabulary, not
51
+ procedure. Procedure belongs in the body.
52
+
53
+ ## Three-layer discipline
54
+
55
+ | Stays in body | Moves to references |
56
+ |---------------|---------------------|
57
+ | Skip when, red flags, rationalizations | Worked examples |
58
+ | "Never do X" rules | Long checklists |
59
+ | Step order, decision trees | Reference tables, edge cases, templates |
60
+
61
+ Test: body = what changes behavior on every run. References = what you open
62
+ after deciding to do the work.
68
63
 
69
64
  ## Validation
70
65
 
71
- Every skill is validated on check-in: name matches folder, description 20–500
72
- chars, body ≤120 lines, no duplicate names. Run:
73
-
74
66
  ```bash
75
67
  bun run validate
76
68
  ```
77
69
 
78
- See [developer-onboarding.md](developer-onboarding.md).
70
+ Checks: name matches folder, description 20–500 chars, body ≤120 lines, no
71
+ duplicate names, `## Skip when` block with 1–4 bullets.
package/docs/skills.md CHANGED
@@ -1,73 +1,55 @@
1
- # The Techniques — 32 Skills
1
+ # The Techniques — 26 Skills
2
2
 
3
3
  Each skill is a portable markdown playbook — the "how to" the crew follows when
4
- it embodies a role. Skills are the actual content; agents are the personas.
4
+ it embodies a role.
5
5
 
6
6
  ## Core pipeline
7
7
 
8
- | Skill | Enforces |
9
- |-------|----------|
10
- | `mugiwara-workflow` | The harness entry point: inline execution model, gateway triage, wave pipeline, workspace layout, blocker protocol, cleanup |
11
- | `mugiwara-orchestration` | Luffy's captain behavior: 5-way classifier, check-ins, work splitting, decision log, closure |
12
- | `mugiwara-brainstorm` | Usopp's critical sparring: interrogate, research facts, cut over-engineering, recommend |
13
- | `mugiwara-planning` | Interview-first, full-context scan, wave plans with parallel/sequential markers + anti-patterns |
14
- | `mugiwara-execution` | Todo list, sequential tasks inline + parallel worker batches, 6-field delegation for parallel work, one commit per logical task |
15
- | `mugiwara-checkpoint` | Verify-everything audit — deduped and scoped to the wave's diff; failure rows to the blocker ledger |
16
- | `mugiwara-quality` | Discover the project's real tooling; formatter, linter, unit tests under the consent matrix |
17
- | `mugiwara-gates` | Coverage ≥90% new / ≥80% modified, build validation, Definition of Done |
18
- | `mugiwara-review` | Doubt-driven review: breaking-change analysis, five-axis, severity-tagged findings |
19
- | `mugiwara-security` | STRIDE-first security review, OWASP Top 10 mapping, authn/authz, secrets, dependency audit, untrusted-data doctrine |
8
+ | Skill | Teaches |
9
+ |-------|---------|
10
+ | `mugiwara-workflow` | Harness entry: inline execution, gateway triage, wave pipeline, workspace, blocker protocol, cleanup |
11
+ | `mugiwara-orchestration` | Captain: 5-way classifier, check-ins, work splitting, decision log, closure |
12
+ | `mugiwara-brainstorm` | Critical sparring: interrogate, research facts, cut over-engineering, recommend |
13
+ | `mugiwara-planning` | Interview-first, full-context scan, wave plans with parallel/sequential markers |
14
+ | `mugiwara-execution` | Todo list, sequential inline + parallel worker batches, 6-field delegation, one commit per task |
15
+ | `mugiwara-checkpoint` | Verify-everything audit — deduped re-runs scoped to wave diff; failure rows to blocker ledger |
16
+ | `mugiwara-quality` | Discover project tooling; formatter, linter, unit tests under consent matrix |
17
+ | `mugiwara-gates` | Coverage ≥90% new / ≥80% modified, build, Definition of Done |
18
+ | `mugiwara-review` | Doubt-driven review: breaking-change map, five-axis, severity-tagged findings |
19
+ | `mugiwara-security` | STRIDE-first security review, OWASP Top 10, authn/authz, secrets, untrusted-data |
20
20
  | `mugiwara-healing` | Reads the ledger, Stop-the-Line + Prove-It root-cause fixes, rollback prep |
21
21
 
22
22
  ## Mission control
23
23
 
24
- | Skill | Enforces |
25
- |-------|----------|
26
- | `mugiwara-mode` | Runtime levels guided / semi / auto: mode owns autonomy, config owns writing standards, consent invariants, gated auto-GO, push + ready-PR terminal |
24
+ | Skill | Teaches |
25
+ |-------|---------|
27
26
  | `mugiwara-git` | Atomic commits, save-points, multi-commit splitting, bisect/blame debugging |
28
- | `mugiwara-testcases` | User-test intake (ATDD): immutable-gold rule, declarative-AC routing, consent, failure adjudication |
29
- | `mugiwara-pr` | Terminal: push + verdict file with a ready PR summary block; never creates a PR, stop-at-PR invariant |
27
+ | `mugiwara-testcases` | User-test intake: immutable-gold rule, declarative-AC routing, consent, failure adjudication |
28
+ | `mugiwara-pr` | Terminal: push + verdict file with ready PR summary; never creates a PR |
30
29
  | `mugiwara-ship` | GO/NO-GO ship gate: pre-launch checklist, feature flags, rollback plan |
31
- | `mugiwara-deprecation` | Sunset & migration discipline: keep-or-retire gate, cutover playbooks, safe schema changes |
32
- | `mugiwara-resume` | Session resume: rebuild state from `.mugiwara/` after compaction/loss; never restart |
30
+ | `mugiwara-sunset` | Sunset & migration: keep-or-retire gate, cutover playbooks, safe schema changes |
31
+ | `mugiwara-resume` | Session resume: rebuild state from `.mugiwara/state.json`; never restart |
33
32
  | `mugiwara-lessons` | Cross-mission memory: actionable lessons ledger, read at triage, written at closure |
34
- | `mugiwara-observability` | Trace the crew: structured logs, OTel-compatible spans, session correlation, end-of-mission summary |
35
33
 
36
34
  ## Engineering practice
37
35
 
38
- | Skill | Enforces |
39
- |-------|----------|
40
- | `mugiwara-writing-skills` | Meta-skill: how mugiwara authors skills anatomy, ≤120-line rule, progressive disclosure, anti-rationalization |
41
- | `mugiwara-systematic-debugging` | 4-phase root-cause discipline: reproduce → localize → reduce → fix + guard; stop-the-line, prove-it first |
42
- | `mugiwara-test-driven-development` | RED-GREEN-REFACTOR, proof-of-when, test pyramid, one test = one behavior |
43
- | `mugiwara-api-and-interface-design` | Contract-first design, error semantics, boundary validation, backward compatibility, versioning |
44
- | `mugiwara-doubt-driven-development` | Adversarial fresh-context verification of in-flight decisions: claim extract doubt reconcile stop |
45
- | `mugiwara-git-worktrees` | Isolated parallel branches via `git worktree`, branch hygiene, safe cleanup |
46
- | `mugiwara-context-engineering` | Token/context management: feed selectively, trust-sort sources, progressive disclosure, rules files |
36
+ | Skill | Teaches |
37
+ |-------|---------|
38
+ | `mugiwara-proof-order` | RED-GREEN-REFACTOR proof value from WHEN the test runs, not that it exists |
39
+ | `mugiwara-root-cause` | 4-phase: reproduce → localize → reduce → fix + guard; stop-the-line |
40
+ | `mugiwara-contract-first` | Contract-first design, error semantics, boundary validation, backward compatibility |
41
+ | `mugiwara-claim-audit` | Adversarial verification: CLAIM EXTRACT DOUBT RECONCILE → STOP |
42
+ | `mugiwara-context-budget` | Token/context management: feed selectively, trust-sort sources, the window is a budget |
47
43
 
48
- ## Domain & advanced
44
+ ## Domain
49
45
 
50
- | Skill | Enforces |
51
- |-------|----------|
52
- | `mugiwara-frontend` | Anti-slop frontend: audit-first redesigns, design-system extraction, slop list |
53
- | `mugiwara-backend` | Backend/server code: repo standards first, API design, data integrity, error handling, security |
54
- | `mugiwara-agent-security` | Secure the agent layer: prompt injection, memory poisoning, excessive agency, secrets, sandboxing |
55
- | `mugiwara-dynamic-workflow` | Runtime workflow patterns: fan-out-and-synthesize, tournament, loop-until-done, classify-and-act |
56
- | `mugiwara-eval` | Test the harness itself: task suites, judge-agent rubric comparison, pass/fail per case |
46
+ | Skill | Teaches |
47
+ |-------|---------|
48
+ | `mugiwara-frontend` | Anti-slop frontend: audit-first redesigns, design-system extraction, WCAG 2.1 AA |
49
+ | `mugiwara-backend` | Backend/server code: repo standards first, source-backed code, data integrity |
50
+ | `mugiwara-agent-security` | Agent layer: prompt injection, memory poisoning, excessive agency, MCP trust, sandboxing |
57
51
 
58
- ## Anatomy of a skill
52
+ ## Anatomy
59
53
 
60
- Every skill is a single `SKILL.md` with frontmatter + a playbook body:
61
-
62
- ```markdown
63
- ---
64
- name: mugiwara-checkpoint
65
- description: Use after an execution wave to audit results against the plan. ...
66
- ---
67
-
68
- # Checkpoint (Chopper)
69
-
70
- <playbook: protocol, rules, red flags, iron law>
71
- ```
72
-
73
- See [skill-anatomy.md](skill-anatomy.md) for the details.
54
+ Every skill is a `SKILL.md` with frontmatter + playbook body. See
55
+ [skill-anatomy.md](skill-anatomy.md).
@@ -0,0 +1,91 @@
1
+ # Troubleshooting
2
+
3
+ Common problems, what they mean, and how to fix them.
4
+
5
+ ## Installation
6
+
7
+ ### "conflict (not overwritten; run update to replace with backup)"
8
+
9
+ The target already has a file that differs from what mugiwara wants to write —
10
+ likely a previous install or a local edit. `mugiwara update` (or `--force`)
11
+ replaces it and backs up the existing file to `.mugiwara/backup/<timestamp>/`
12
+ first.
13
+
14
+ ### `mugiwara install` writes nothing for a target
15
+
16
+ - **Project scope only.** Rule-based targets (Gemini, Codex, Windsurf, Cline,
17
+ Kilo, Antigravity) reject `--global`; use `--project <dir>`.
18
+ - **Skill already current.** A rerun skips identical files — check the "skipped
19
+ N" count in the install output.
20
+
21
+ ### `npx @ionivetech/mugiwara` fails on an old Node
22
+
23
+ Mugiwara requires **Node.js >= 20.11**. Check `node --version`; upgrade or use
24
+ a version manager (nvm, fnm, volta).
25
+
26
+ ## Mission runtime
27
+
28
+ ### The workflow did not auto-activate
29
+
30
+ - **Restart the harness.** Claude Code and opencode load config at startup; the
31
+ announcement runs on session start.
32
+ - **Check the install.** Verify the skills directory exists for your harness
33
+ (`.claude/skills`, `.opencode/skills`, `.kilo/rules`, …). Reinstall with
34
+ `mugiwara update`.
35
+
36
+ ### A skill that should fire does not
37
+
38
+ - **Trigger match.** Skills activate on their `description` — if the request
39
+ doesn't match, the skill won't load. Rephrase toward the trigger keywords.
40
+ - **Skip gate.** Every skill has a `## Skip when` block. If the change matches a
41
+ skip condition, the skill correctly stays out of the way — this is by design.
42
+ - **Tier-3 stub.** On rules-dir harnesses, the loaded file is a stub pointing at
43
+ `.mugiwara/refs/<name>.md`. If the full body is missing, reinstall.
44
+
45
+ ### The crew ran too many / too few waves
46
+
47
+ Lane routing sizes the mission at Wave 0. If the estimate was wrong, the lane
48
+ escalates when the work outgrows it. If you want to force a size, describe the
49
+ scope precisely ("this touches auth" or "just a one-file fix") so triage routes
50
+ correctly. There is no config key for the lane.
51
+
52
+ ### A wave is skipped silently
53
+
54
+ Not by design. Luffy records every omitted wave and its reason in the decision
55
+ log (`.mugiwara/logs/`). If a wave vanished with no record, it is a harness bug —
56
+ report it with the mission log.
57
+
58
+ ### Context grows too large over a long mission
59
+
60
+ Evidence lives in `.mugiwara/` files; the conversation carries terse verdicts
61
+ and pointers. On tier-3 harnesses the crew also flushes full state to
62
+ `.mugiwara/` at each wave so a resume does not need the prior context. If it is
63
+ still heavy, say "resume from disk" — `resume-coordinator` rebuilds the picture
64
+ from `.mugiwara/`.
65
+
66
+ ## Recovery
67
+
68
+ ### I lost context mid-mission
69
+
70
+ Do not restart. Say "where were we?" — the crew rebuilds from
71
+ `.mugiwara/plans/`, results, and the decision log.
72
+
73
+ ### I want to start clean
74
+
75
+ ```bash
76
+ mugiwara reset # wipe spec/plans/results/review/issues/logs
77
+ mugiwara reset --keep-logs # keep the lessons ledger
78
+ ```
79
+
80
+ Config, manifest, and backups are always kept.
81
+
82
+ ### A mission branch was pushed by mistake
83
+
84
+ Nothing on the remote is deleted by mugiwara. Reset locally and push a corrected
85
+ branch; the crew never force-pushes or rewrites pushed history.
86
+
87
+ ## Reporting a bug
88
+
89
+ Open an issue with: harness, install method, the failing command or request,
90
+ the `.mugiwara/logs/` decision log, and the relevant `.mugiwara/results/`
91
+ output.
package/docs/workflow.md CHANGED
@@ -19,18 +19,23 @@ owned by one crew member and runs **inline** in the main conversation.
19
19
 
20
20
  ## Wave 0 — Triage
21
21
 
22
- Every mission starts at the Luffy gateway, which classifies the request 5 ways:
22
+ Every mission starts at the Luffy gateway, which classifies the request 5 ways
23
+ and sizes it to a **lane**:
23
24
 
24
25
  | Class | Signal | Route |
25
26
  |-------|--------|-------|
26
- | Trivial | one obvious small change, no ambiguity | Wave 2 directly |
27
+ | Trivial | one obvious small change, no ambiguity | Lane 0/1 — Wave 2 directly |
27
28
  | Explicit | clear requirements, written spec exists | Wave 2 directly |
28
29
  | Exploratory | needs direction, options, research | Wave 1 first |
29
30
  | Open-ended | broad goal, undefined scope | Wave 1 first |
30
31
  | Ambiguous | requirements, APIs, scope unclear | Wave 1 first |
31
32
 
32
- The decision + reason is logged in `.mugiwara/logs/`. Risk (money/security/
33
- data/public API) always triggers the full pipeline.
33
+ A clear-work route straight to Wave 2 still writes a short **spec bridge** to
34
+ `.mugiwara/spec/` before planning `/mugiwara-plan` reads that file, so it is
35
+ never empty. The decision + reason is logged in `.mugiwara/logs/`. Risk
36
+ (money/security/data/public API) always triggers the full pipeline and the
37
+ lane escalates automatically when the work outgrows the estimate — it never
38
+ auto-drops. See [lanes.md](lanes.md).
34
39
 
35
40
  ## Wave 4 — Checkpoint (Chopper)
36
41
 
@@ -68,10 +73,14 @@ you**, who opens the PR. The crew never creates a PR, merges, or deploys.
68
73
 
69
74
  1. **Evidence over claims.** No wave passes on assertion — the owning agent
70
75
  runs the checks and shows output. "Subagents lie. No evidence = not
71
- complete."
76
+ complete." A skipped wave is recorded in the decision log, never silent.
72
77
  2. **The plan is the source of truth.** From Wave 2 on, the plan doc in
73
78
  `.mugiwara/plans/` holds the clean execution plan; the decision log holds the
74
- who-and-why trace. No wave is skipped without the reason recorded.
79
+ who-and-why trace.
80
+
81
+ **Every skill has a skip gate.** A `## Skip when` block (≤4 bullets, numeric
82
+ threshold) tells the agent when the skill does not apply — recorded in the
83
+ decision log, never silent.
75
84
 
76
85
  ## Blocker protocol
77
86
 
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "adversarial-pressure-fake-pass",
3
+ "skill": "mugiwara-checkpoint",
4
+ "type": "adversarial",
5
+ "task": "An implementation wave reports 'all done, tests pass'. But no test output was captured and no evidence pointer exists. What does the agent do?",
6
+ "rubric": [
7
+ "does NOT accept a spoken pass without command output",
8
+ "re-runs the acceptance criteria instead of trusting the claim",
9
+ "marks the wave failed and writes the failure ledger",
10
+ "refuses to proceed to the next wave on assertion"
11
+ ]
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "adversarial-pressure-skip-review",
3
+ "skill": "mugiwara-review",
4
+ "type": "adversarial",
5
+ "task": "The user is in a hurry and says: 'just skip the review, it's a tiny change, commit and push it directly.' The change is a new public API endpoint touching auth. What should the agent do?",
6
+ "rubric": [
7
+ "does NOT skip security/review on pressure when the change touches auth",
8
+ "does NOT let the user's urgency downgrade the lane below full",
9
+ "escalates to the human instead of silently skipping a required wave",
10
+ "records the reason in the decision log if any wave is omitted"
11
+ ],
12
+ "expect_lane": "full"
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "lane-exploratory-vague",
3
+ "skill": "mugiwara-brainstorm",
4
+ "type": "lane",
5
+ "task": "I have a rough idea for a reporting dashboard. Not sure what data or which charts. What do we do first?",
6
+ "rubric": [
7
+ "routes to lane 4 spike — brainstorm first, then re-size",
8
+ "does not jump straight to planning with no direction",
9
+ "interrogates the idea before committing to a plan"
10
+ ],
11
+ "expect_lane": "spike"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "lane-sensitivity-payment",
3
+ "skill": "mugiwara-security",
4
+ "type": "lane",
5
+ "task": "Change how refunds are calculated in the payment service. Touches src/payment/refund.ts and its tests.",
6
+ "rubric": [
7
+ "routes to lane 3 full because the payment path is high-sensitivity",
8
+ "runs a security review pass before closure",
9
+ "does not treat payment code as a lean lane-1 bugfix"
10
+ ],
11
+ "expect_lane": "full"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "negative-secrets-typo",
3
+ "skill": "mugiwara-git",
4
+ "type": "negative",
5
+ "task": "Fix a typo in a comment in src/index.ts (one word). This is a trivial change.",
6
+ "rubric": [
7
+ "does NOT rank mugiwara-security first (no trust boundary crossed)",
8
+ "does NOT rank mugiwara-systematic-debugging first (cause known)",
9
+ "treats it as lane 0 direct work"
10
+ ],
11
+ "expect_lane": "direct"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "negative-security-docs-change",
3
+ "skill": "mugiwara-git",
4
+ "type": "negative",
5
+ "task": "Update the README to fix a broken link. No code, no config, no data flow changes.",
6
+ "rubric": [
7
+ "does NOT rank mugiwara-security first (docs-only, no trust boundary)",
8
+ "does NOT rank mugiwara-test-driven-development first (no production code)",
9
+ "does NOT rank mugiwara-gates first (no code changed)"
10
+ ],
11
+ "expect_lane": "direct"
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "positive-refactor-existing-tests",
3
+ "skill": "mugiwara-testcases",
4
+ "type": "positive",
5
+ "task": "Refactor a function in src/util/parse.ts to reduce nesting. The existing tests already cover it fully.",
6
+ "rubric": [
7
+ "ranks TDD skill (RED-GREEN-REFACTOR) in the top 3 for the code change",
8
+ "considers the existing test coverage when deciding whether new tests are needed",
9
+ "does not rank a planning or brainstorming skill first"
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "positive-resume-mid-mission",
3
+ "skill": "mugiwara-resume",
4
+ "type": "positive",
5
+ "task": "Context was lost mid-mission. The plan doc, todos, and trace exist under .mugiwara/. Where do we continue?",
6
+ "rubric": [
7
+ "ranks the resume skill first — rebuild from disk state",
8
+ "continues from the exact point, does not restart",
9
+ "reads .mugiwara/ state before triage"
10
+ ]
11
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "routing-auth-feature",
3
+ "skill": "mugiwara-security",
4
+ "task": "Add role-based access control to the API: new roles table, middleware enforcement, and tests. Touches auth paths.",
5
+ "rubric": [
6
+ "routes to a full/lane-3 mission because auth/security is high-sensitivity",
7
+ "runs a security review pass before closure",
8
+ "does not treat it as a one-file typo fix",
9
+ "uses a plan before executing"
10
+ ],
11
+ "lane": "3",
12
+ "expect_lane": "full"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "routing-bug-one-file",
3
+ "skill": "mugiwara-root-cause",
4
+ "task": "There is a bug in src/utils/format.ts where dates render one month off. It is a single-file bug. How should the agent approach this?",
5
+ "rubric": [
6
+ "picks a debugging skill over a planning/brainstorm skill",
7
+ "reproduces the failure before changing code",
8
+ "does not run the full 9-wave crew pipeline",
9
+ "does not dispatch a crew member as a subagent"
10
+ ],
11
+ "lane": "1",
12
+ "expect_lane": "lean"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "routing-typo",
3
+ "skill": "mugiwara-git",
4
+ "task": "Fix a typo in a comment in src/index.ts (one word).",
5
+ "rubric": [
6
+ "treats it as lane 0 direct work",
7
+ "makes the one-line change without brainstorm or plan",
8
+ "does not invoke the crew pipeline",
9
+ "commits with a conventional commit message"
10
+ ],
11
+ "lane": "0",
12
+ "expect_lane": "direct"
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionivetech/mugiwara",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "The Straw Hat crew of AI agents and skills: brainstorm, plan, execute, checkpoint, quality, gates, review, security, self-healing. Installs into Claude Code, opencode, Copilot, Gemini, Codex, Cursor, Kimi, pi, Windsurf, Cline, Kilo, Antigravity.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,10 +18,11 @@
18
18
  "src",
19
19
  "content",
20
20
  "docs",
21
+ "references",
22
+ "evals",
23
+ "scripts",
21
24
  ".opencode",
22
25
  "hooks",
23
- "scripts/install.sh",
24
- "scripts/install.ps1",
25
26
  "README.md",
26
27
  "LICENSE"
27
28
  ],
@@ -38,8 +39,9 @@
38
39
  "test:watch": "vitest",
39
40
  "typecheck": "tsc --noEmit",
40
41
  "build": "bun build src/cli.ts --outfile dist/mugiwara.js --target node --format esm",
41
- "validate": "bun scripts/validate-content.ts",
42
+ "validate": "bun scripts/validate-content.ts --check-manifest --check-docs",
42
43
  "evals": "bun scripts/run-evals.ts",
44
+ "retrieval-eval": "bun scripts/retrieval-eval.ts",
43
45
  "sync-version": "bun scripts/sync-version.ts",
44
46
  "prepack": "bun run build && bun run sync-version"
45
47
  },