@ionivetech/mugiwara 0.1.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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +488 -0
  3. package/content/agents/brook-healing.md +36 -0
  4. package/content/agents/chopper-checkpoint.md +41 -0
  5. package/content/agents/eval-runner.md +44 -0
  6. package/content/agents/franky-gates.md +35 -0
  7. package/content/agents/jinbe-security.md +41 -0
  8. package/content/agents/luffy-orchestrator.md +44 -0
  9. package/content/agents/memory-keeper.md +37 -0
  10. package/content/agents/nami-planner.md +42 -0
  11. package/content/agents/resume-coordinator.md +39 -0
  12. package/content/agents/robin-reviewer.md +40 -0
  13. package/content/agents/sanji-quality.md +36 -0
  14. package/content/agents/skeptic-verifier.md +39 -0
  15. package/content/agents/using-mugiwara.md +36 -0
  16. package/content/agents/usopp-brainstorm.md +36 -0
  17. package/content/agents/zoro-execution.md +39 -0
  18. package/content/skills/mugiwara-agent-security/SKILL.md +58 -0
  19. package/content/skills/mugiwara-backend/SKILL.md +90 -0
  20. package/content/skills/mugiwara-brainstorm/SKILL.md +53 -0
  21. package/content/skills/mugiwara-checkpoint/SKILL.md +62 -0
  22. package/content/skills/mugiwara-dynamic-workflow/SKILL.md +85 -0
  23. package/content/skills/mugiwara-eval/SKILL.md +82 -0
  24. package/content/skills/mugiwara-execution/SKILL.md +81 -0
  25. package/content/skills/mugiwara-frontend/SKILL.md +122 -0
  26. package/content/skills/mugiwara-gates/SKILL.md +50 -0
  27. package/content/skills/mugiwara-git/SKILL.md +67 -0
  28. package/content/skills/mugiwara-healing/SKILL.md +62 -0
  29. package/content/skills/mugiwara-lessons/SKILL.md +57 -0
  30. package/content/skills/mugiwara-observability/SKILL.md +54 -0
  31. package/content/skills/mugiwara-orchestration/SKILL.md +55 -0
  32. package/content/skills/mugiwara-planning/SKILL.md +98 -0
  33. package/content/skills/mugiwara-quality/SKILL.md +39 -0
  34. package/content/skills/mugiwara-resume/SKILL.md +49 -0
  35. package/content/skills/mugiwara-review/SKILL.md +86 -0
  36. package/content/skills/mugiwara-security/SKILL.md +87 -0
  37. package/content/skills/mugiwara-ship/SKILL.md +58 -0
  38. package/content/skills/mugiwara-workflow/SKILL.md +90 -0
  39. package/dist/mugiwara.js +602 -0
  40. package/package.json +29 -0
  41. package/scripts/install.ps1 +14 -0
  42. package/scripts/install.sh +17 -0
  43. package/src/args.ts +31 -0
  44. package/src/cli.ts +187 -0
  45. package/src/frontmatter.ts +20 -0
  46. package/src/installer.ts +118 -0
  47. package/src/manifest.ts +29 -0
  48. package/src/prompt.ts +37 -0
  49. package/src/targets/antigravity.ts +10 -0
  50. package/src/targets/claude.ts +25 -0
  51. package/src/targets/cline.ts +10 -0
  52. package/src/targets/codex.ts +10 -0
  53. package/src/targets/copilot.ts +26 -0
  54. package/src/targets/gemini.ts +10 -0
  55. package/src/targets/generic.ts +43 -0
  56. package/src/targets/index.ts +14 -0
  57. package/src/targets/kilo.ts +10 -0
  58. package/src/targets/opencode.ts +25 -0
  59. package/src/targets/windsurf.ts +10 -0
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: mugiwara-checkpoint
3
+ 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.
4
+ ---
5
+
6
+ # Checkpoint (Chopper)
7
+
8
+ Auditor, not fixer. Trust nothing; verify everything. Output is an audit report, not a code change.
9
+
10
+ ## Verify-everything gate
11
+
12
+ Subagents lie. No evidence = not complete. A "done" claim is a starting point, never a result. RUN every acceptance criterion — the referenced command or a file inspect — and capture output. Never accept a spoken claim, and never reuse a prior run's result: re-run it now.
13
+
14
+ ## Audit protocol
15
+
16
+ For every task in the completed wave, in order:
17
+
18
+ 1. **Per-task audit table.** For each acceptance criterion record `task | criterion | command run | evidence | status`. Evidence is output or a file path — never a paraphrase.
19
+ 2. **Commit hygiene.** Run `git show --stat` on each task commit: it must touch ONLY the files the task declared. Undeclared files added or declared files missing = fail.
20
+ 3. **Parallel-conflict check.** Run `git diff --name-only` across parallel task commits: no file may be touched by 2 tasks. A shared file means the parallel claim was false.
21
+ 4. **Honest classification.** Classify every failure truthfully as code or env. Never file a code failure as `env`. If you cannot prove it is env (reproduce on a clean checkout), it is code.
22
+
23
+ ## Failure ledger
24
+
25
+ Append each failing criterion as one row to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`:
26
+
27
+ `| wave | task | symptom | attempted | help-needed |`
28
+
29
+ Category goes in `symptom` or `help-needed` as context. Categories: `test-fail` (test/lint/build command fails), `missing-impl` (criterion unverifiable, artifact absent), `parallel-conflict` (concurrent tasks modified shared state), `env` (environment, proven), `regression` (previously passing check now fails). Reuse the existing blocker ledger; create it only if absent.
30
+
31
+ ## Definition of Done check
32
+
33
+ Verdict per axis — `correctness`, `quality`, `integration`, `docs`, `ship-readiness` — each with evidence, then one wave verdict. Any FAIL axis → wave verdict FAIL.
34
+
35
+ ## Auditor only
36
+
37
+ Never edit code. Findings only. Any urge to fix a finding means the audit has stopped being an audit.
38
+
39
+ ## Output
40
+
41
+ Audit report to `.mugiwara/results/YYYY-MM-DD-<mission>-audit.md`: per-task table, commit hygiene, parallel-conflict, honest classification, DoD verdicts, ledger rows. PASS → next wave. FAIL → report + ledger to Brook (Wave 8).
42
+
43
+ ## Common rationalizations
44
+
45
+ - "The test passed last run." → Re-run it now; a stale result is not evidence.
46
+ - "It's just an env issue." → Prove it on a clean checkout; unproven env is code.
47
+ - "One small fix would clear it." → You are the auditor, not the healer. Report it.
48
+
49
+ ## Iron Law
50
+
51
+ TRUST NOTHING; VERIFY EVERYTHING. No evidence, no pass — and the evidence must be produced by your own re-run, not borrowed from the executor.
52
+
53
+ ## Red flags
54
+
55
+ - A criterion marked pass from a claim or a prior run, without re-running the check.
56
+ - Parallel tasks' shared-file conflict assumed safe without `git diff --name-only`.
57
+ - A code failure filed as `env` to soften the report.
58
+ - Commits containing undeclared files, or missing declared files.
59
+ - A DoD axis passed with no evidence.
60
+ - Any urge to edit code instead of reporting the finding.
61
+
62
+ All mean: the audit is incomplete. Finish it before issuing the verdict.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: mugiwara-dynamic-workflow
3
+ description: Use when a mission or subproblem has many independent subtasks, needs comparison, or risks agent bias - pick the right dynamic workflow pattern - fan-out-and-synthesize, tournament, loop-until-done, classify-and-act, generate-and-filter.
4
+ ---
5
+
6
+ # Dynamic Workflow Patterns (Luffy)
7
+
8
+ Six primitives for missions too big or too biased for one linear pass. Choose the pattern BEFORE executing; record the choice in the plan doc. A mission may chain patterns (e.g. classify, then fan out, then tournament the outputs).
9
+
10
+ ## Classify-and-act
11
+
12
+ 1. Sort inputs into intent categories first, THEN route each category to its handler.
13
+ 2. Never act before classifying — Luffy's Wave 0 triage is this pattern applied to the mission.
14
+ 3. Unknown category → hold for judgment; never guess-assign.
15
+
16
+ ## Fan-out-and-synthesize
17
+
18
+ 1. Split work into independent tasks; run each in a parallel subagent.
19
+ 2. Prove disjointness first: each task touches distinct files or interfaces. No shared writes, no shared state.
20
+ 3. A synthesizer merges results into ONE output with source attribution per part.
21
+ 4. Conflicts resolve by evidence (re-run, inspect), never by vote count.
22
+
23
+ ## Tournament / pairwise judgment
24
+
25
+ 1. Ranking or selecting (options, designs, PRs) → compare in PAIRS, not all-at-once.
26
+ 2. Fresh judge per match; match verdict only, no absolute scoring.
27
+ 3. Winner advances; keep runner-up reasoning in the report.
28
+ 4. Counters self-preferential bias: no judge argues for its own entry.
29
+
30
+ ## Loop-until-done
31
+
32
+ 1. Repeat one unit until a stopping criterion with evidence: test pass, threshold reached, user sign-off.
33
+ 2. Bound the loop: max N (default 3). Exceeding N → escalate, never loop forever.
34
+ 3. Record every iteration's evidence in `.mugiwara/results/`.
35
+
36
+ ## Generate-and-filter
37
+
38
+ 1. Produce many candidates first — no filtering during generation.
39
+ 2. Filter against HARD constraints, then rank survivors.
40
+ 3. Never filter before generating; never rank on soft preference before hard constraints.
41
+
42
+ ## Adversarial verification
43
+
44
+ 1. Every output gets a skeptic pass (dispatch `skeptic-verifier`): find what is wrong, do NOT validate.
45
+ 2. Counters agentic laziness, self-preferential bias, goal drift.
46
+ 3. Findings classified; loop bounded at 3 cycles.
47
+
48
+ ## Selection guide
49
+
50
+ - One route, unknown intent → classify-and-act
51
+ - Many independent tasks, merge later → fan-out-and-synthesize
52
+ - Rank or select among peers → tournament
53
+ - Repetition with a stopping rule → loop-until-done
54
+ - Many candidates, hard bar → generate-and-filter
55
+ - Any high-stakes output about to ship → adversarial verification
56
+
57
+ ## Failure modes fixed
58
+
59
+ - Agentic laziness: generate-and-filter + adversarial verification
60
+ - Self-preferential bias: tournament + adversarial verification
61
+ - Goal drift: loop bounds + adversarial verification
62
+ - Conflated judgments / order effects: tournament pairs
63
+ - Premature filtering / culled solutions: generate-and-filter
64
+
65
+ ## Pattern table
66
+
67
+ | Pattern | Use when | Output |
68
+ |---------|----------|--------|
69
+ | classify-and-act | intent unknown, routes diverse | category → handler map + actions |
70
+ | fan-out-and-synthesize | independent subtasks | one merged output, source-attributed |
71
+ | tournament | rank / select peers | champion + runner-up reasoning |
72
+ | loop-until-done | repeat until criterion | iterations + final evidence |
73
+ | generate-and-filter | candidates + hard bar | ranked survivors |
74
+ | adversarial verification | output / verdict ships | findings report, bounded |
75
+
76
+ ## Red flags
77
+
78
+ - Fan-out without a disjointness proof.
79
+ - A synthesizer merging by vote instead of evidence.
80
+ - A judge scoring absolutely instead of pairwise.
81
+ - An unbounded loop.
82
+ - Filtering before generating.
83
+ - A skeptic pass that "validates" instead of doubting.
84
+
85
+ All mean: stop, re-pick the pattern, record the change in the plan doc.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: mugiwara-eval
3
+ description: Use when verifying that a mugiwara skill, agent, or the whole crew actually works - write a task suite, run it with a judge agent, rubric-compare, and report pass/fail per case.
4
+ ---
5
+
6
+ # Eval (Self-Test)
7
+
8
+ Skills rot silently. A skill that was never tested is a claim, not a capability. This is the harness's own test harness: write a task suite, run each case, score with a fresh judge against a rubric, report pass/fail.
9
+
10
+ ## Why
11
+
12
+ - Skill instructions drift from what agents actually do when followed.
13
+ - Untested means unverified: "it reads fine" is not "it works".
14
+ - The eval is the contract; the skill bends to it, never the reverse.
15
+
16
+ ## Task suite format
17
+
18
+ One case per skill-behavior at `evals/cases/<skill>-<case>.json`:
19
+
20
+ ```json
21
+ {
22
+ "name": "rubric-threshold-honesty",
23
+ "skill": "mugiwara-eval",
24
+ "task": "The prompt to run through the skill's workflow.",
25
+ "fixtures": ["evals/cases/fixtures/plan.md"],
26
+ "rubric": ["a pass threshold is stated before scoring", "a pass needs explicit evidence"],
27
+ "expected": "What pass looks like: all rubric items met, each with evidence."
28
+ }
29
+ ```
30
+
31
+ - `name` unique per suite; `skill` matches the skill directory name.
32
+ - `task` is the prompt run as-is — no extra guidance bolted on.
33
+ - `rubric` = checked items; `expected` = the shape of a pass. `fixtures` optional, repo-relative paths.
34
+
35
+ ## Judge-agent protocol
36
+
37
+ Rubric comparison, not gold-answer matching (SWE-bench-style suites + rubric judges):
38
+
39
+ 1. Run the case: host executes `task` with the skill under test loaded.
40
+ 2. Dispatch a FRESH judge — never the implementer. Counters self-preferential bias.
41
+ 3. Judge scores each `rubric` item pass/fail with evidence; no absolute scores.
42
+ 4. Compare against the rubric's explicit pass threshold (all items, or ≥ N with none critical).
43
+ 5. Ranking or selection → pairwise/tournament judging (`mugiwara-dynamic-workflow`), not all-at-once.
44
+
45
+ ## Loop
46
+
47
+ run → judge → fail → fix the SKILL (never the eval) → re-run.
48
+
49
+ 1. Write cases before trusting a skill or changing it.
50
+ 2. Run the suite; judge honestly.
51
+ 3. A failing case means the skill's instructions are wrong or incomplete. Fix the skill.
52
+ 4. A passing case gives no license to change the skill casually — re-run on change.
53
+ 5. Never weaken the eval to clear a failure; that falsifies the test.
54
+
55
+ ## Bound
56
+
57
+ - Run the suite per release and on every skill change.
58
+ - Report a pass/fail table to `.mugiwara/results/<mission>-eval.md`: case, judge, verdict, evidence, threshold.
59
+ - Failing cases → rows in `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md` (category `eval-fail`).
60
+ - Keep the suite in sync with the skill dirs: at minimum one case per skill.
61
+
62
+ ## Scope
63
+
64
+ Test the SKILL, not the host agent. Host behavior is the host's problem. The eval checks that the skill's instructions, when followed, produce the intended workflow. Never assert on agent behavior, model quirks, or tooling the skill does not own.
65
+
66
+ ## Common rationalizations
67
+
68
+ - "I wrote it, it must work." → Fresh judge, always.
69
+ - "The case passed last release." → Re-run; skills drift between runs.
70
+ - "The eval is too strict." → Tighten the skill, never the rubric.
71
+ - "It's an agent problem." → If following the skill causes it, it's the skill's.
72
+
73
+ ## Red flags
74
+
75
+ - The implementer judging its own case's skill.
76
+ - A rubric with no pass threshold.
77
+ - A case whose `task` leaks the expected answer.
78
+ - Fixing the eval instead of the skill to clear a failure.
79
+ - A suite run with no pass/fail report written.
80
+ - A suite that no longer matches the skill's current behavior.
81
+
82
+ All mean: the run is not a valid check. Stop, re-run with a fresh judge, write the report.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: mugiwara-execution
3
+ description: Use when executing an approved wave-structured plan. Opens a todo list first, builds a task graph, dispatches independent tasks concurrently, one task per commit, and verifies every acceptance criterion with evidence before reporting done.
4
+ ---
5
+
6
+ # Execution (Zoro)
7
+
8
+ Execute the plan exactly. No silent reordering, no skipping steps, no "close enough".
9
+
10
+ ## Ask before working
11
+
12
+ Before touching any code, ASK THE USER:
13
+
14
+ 1. **Auto branch?** — should Zoro create a dedicated branch for the mission (recommended: yes, so `main` stays clean) or work on the current branch?
15
+ 2. **Auto commit?** — should Zoro commit after every task automatically, or only stage/commit at explicit checkpoints the user controls?
16
+
17
+ Record both answers in the plan doc (`.mugiwara/plans/`) and in `.mugiwara/results/<mission>-todos.md`. Default when the user does not answer: work on the current branch and commit per task — but never branch or commit in a way that surprises the user. If the user says no auto-commit, still run every acceptance check and leave the diff staged or presented for approval instead.
18
+
19
+ ## Todo list first
20
+
21
+ Before touching code:
22
+
23
+ 1. Create `.mugiwara/results/<mission>-todos.md` — one checkbox per task, derived from the plan.
24
+ 2. Check each box off only when the task completes, WITH its evidence pointer.
25
+ 3. Re-check the whole list after each task and after each batch; unmarked boxes mean the mission is not done.
26
+
27
+ ## Wave execution
28
+
29
+ 1. Read the plan doc fully before touching code.
30
+ 2. Build the task graph from `[PARALLEL]`/`[SEQUENTIAL]` markers and depends-on fields.
31
+ 3. Contradictory graph (cycle, missing dependency) → escalate to Luffy. Do not guess.
32
+ 4. Independent tasks → dispatch concurrently, one task per subagent (host's native task/subagent mechanism). Chains → strictly sequential; a task starts only when its dependencies report done with evidence.
33
+ 5. Two tasks must never edit the same file concurrently. The plan should prevent this; if it doesn't, serialize them and note the deviation.
34
+
35
+ ## Delegation format
36
+
37
+ Every subagent delegation prompt includes all six fields:
38
+
39
+ - TASK — the task body, verbatim from the plan.
40
+ - EXPECTED OUTCOME — what "done" looks like, concrete and checkable.
41
+ - REQUIRED TOOLS — commands and files the subagent will need.
42
+ - MUST DO — the steps in order, including the TDD failing-test-first step.
43
+ - MUST NOT DO — boundaries: files not to touch, configs not to weaken, no silent workarounds.
44
+ - CONTEXT — interfaces consumed/produced, related tasks, mission workspace paths.
45
+
46
+ A delegation prompt shorter than ~30 lines is too short — beef it up. Thin prompts cause thin results.
47
+
48
+ ## One task, one commit
49
+
50
+ 1. Follow the task's steps in order — TDD included: write the failing test first, run it (fail), implement, run again (pass).
51
+ 2. Verify every acceptance criterion; capture command output as evidence.
52
+ 3. Commit the task alone: only the files that task declared. No task commingles with its neighbors.
53
+ 4. Report done (with evidence) or blocked (with reason).
54
+
55
+ ## Blockers → issues ledger
56
+
57
+ Blocked → write one row to `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md`:
58
+
59
+ | wave | task | symptom | attempted | help-needed |
60
+
61
+ Then escalate to Luffy. Never work around a blocker silently.
62
+
63
+ ## Frontend tasks
64
+
65
+ Any task touching UI markup, styling, or components applies `mugiwara-frontend` in the same pass.
66
+
67
+ ## Report
68
+
69
+ After each wave: task table (status, evidence pointer, deviations) → hand to Chopper.
70
+
71
+ ## Red flags
72
+
73
+ - Tasks silently reordered from the plan.
74
+ - A step skipped because it "seemed unnecessary".
75
+ - Done reported without evidence ("close enough").
76
+ - Two tasks editing the same file concurrently.
77
+ - A blocker worked around silently instead of escalated.
78
+ - The task's TDD order inverted (implementation before the failing test).
79
+ - A commit containing files beyond its declared task.
80
+
81
+ All mean: stop, realign to the plan, or escalate to Luffy.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: mugiwara-frontend
3
+ description: Use for any frontend implementation or redesign task - converting Figma/images to code or restyling UI. Match the repo's existing standard first, audit-first for redesigns, design-system extraction before markup, taste and a11y baked in, bans generic AI-slop patterns and rationalizations. Framework-agnostic.
4
+ ---
5
+
6
+ # Frontend (Anti-Slop)
7
+
8
+ Interfaces built under this skill must not look templated.
9
+
10
+ ## Existing repo standard first
11
+
12
+ When the repo already has frontend, learn and follow ITS standard before writing anything new; match its components and patterns before creating anything. Greenfield with no existing UI: skip to the design-system extraction below.
13
+
14
+ - Component library (MUI/Tailwind/shadcn/etc) — a new button must look like the repo's buttons, not the internet's.
15
+ - File conventions, naming, folder structure, CSS strategy.
16
+ - Lint, format, and test scripts; run them, match their style.
17
+ - Design tokens already in the theme/config: palette, type, spacing, radii, shadows.
18
+ - Existing page patterns: how pages compose sections, layout, and state.
19
+
20
+ ## Redesigns: audit first
21
+
22
+ Before changing existing UI: capture current layout, spacing scale, type scale, palette, and component inventory. Fix real problems; do not restyle what works.
23
+
24
+ ## Design-system extraction (before markup)
25
+
26
+ Read tokens from the stack's design system BEFORE writing markup — CSS variables, Tailwind config, theme file, or the reference's specs. Extract: spacing scale, type scale (sizes/weights/line-heights), palette with roles, radii, shadows, motion language. Name tokens semantically (not `c3`, `font-large` — `surface-muted`, `display-weight`); store them where the stack keeps design tokens. No tokens extracted, no markup written.
27
+
28
+ ## From Figma / image references
29
+
30
+ 1. Extract tokens FIRST (see above), then reproduce structure faithfully: hierarchy, alignment, whitespace ratios. Do not "improve" the layout unasked.
31
+ 2. New one-off components still follow the design system — a one-off is not a license to invent a second system.
32
+
33
+ ## Taste: positive design judgment
34
+
35
+ Beyond banning slop, build with intent:
36
+
37
+ - Hierarchy and rhythm: one primary action per view, one clear focal point, consistent spacing rhythm.
38
+ - Restraint: fewer, more considered elements; whitespace is a tool.
39
+ - Typography discipline: 1-2 typefaces, deliberate scale, weight for emphasis not decoration, line length 45-75ch.
40
+ - Color discipline: palette with roles (surface/text/action/state), contrast AA minimum, never pure-black-on-pure-white for text-heavy surfaces.
41
+ - Consistency: the same thing looks the same everywhere; no three ways to render a button.
42
+ - Intentionality: every element earns its place; if you cannot say why it is there, remove it.
43
+ - State design: hover, focus, active, disabled, loading, error, and empty states designed, not forgotten.
44
+
45
+ ## Banned AI-default patterns (the slop list)
46
+
47
+ - Centered hero trio: headline + subtitle + two buttons, dead center, gradient text.
48
+ - Row of 3-4 identical feature cards with icon-circle + title + two lines.
49
+ - Purple/indigo gradient everything; glassmorphism everywhere; emoji as icons.
50
+ - Placeholder content where real product copy exists.
51
+ - Stock hero illustrations when the design specifies otherwise.
52
+
53
+ If the brief genuinely calls for one of these, execute it well — but the default is: don't.
54
+
55
+ ## Craft bar
56
+
57
+ - Typography: deliberate scale, weight contrast, line-length control.
58
+ - Spacing: consistent scale, breathing room, aligned grids.
59
+ - Motion: subtle and purposeful (hover/scroll states), respects `prefers-reduced-motion`.
60
+ - Responsive: every layout verified at mobile/tablet/desktop breakpoints.
61
+ - A11y baseline: semantic landmarks, contrast AA, visible focus states, alt text.
62
+
63
+ ## Accessibility (non-negotiable)
64
+
65
+ - Semantic landmarks (header/nav/main/footer), a single h1, logical heading order.
66
+ - Contrast AA: 4.5:1 text, 3:1 large text/UI.
67
+ - Focus: visible focus ring, logical tab order, skip-link, no focus trap without an escape.
68
+ - Keyboard: every interaction operable without a mouse; nothing reachable only via hover.
69
+ - Forms: every input labeled (placeholder is not a label); errors and success announced; `aria-describedby` for help text; validation never color-only.
70
+ - ARIA: native elements before ARIA; `aria-live` for dynamic updates; roles honest.
71
+ - Images: alt text (empty `alt=""` for decorative), never `alt="image"`.
72
+ - `prefers-reduced-motion` respected.
73
+ - Touch targets at least 44px.
74
+
75
+ ## Testability
76
+
77
+ Add stable `data-testid` attributes to interactive elements, following the repo's testing convention (getByRole/getByTestId). Never test by CSS class or by text that changes.
78
+
79
+ ## Performance
80
+
81
+ - No layout thrash: batch DOM reads and writes.
82
+ - No jank: keep heavy work off the scroll path; animate only transform/opacity.
83
+ - Assets: no giant images or font payloads; lazy-load below the fold; no whole icon library for two icons.
84
+ - No re-render storms: memoize heavy computation, stable keys, no work in render.
85
+ - Measure before optimizing; do not guess the bottleneck.
86
+
87
+ ## Frontend security
88
+
89
+ - Never render user content via `dangerouslySetInnerHTML`/`v-html` unless sanitized.
90
+ - Escape user input in every template; no injection through the client.
91
+ - No secrets in client code — API keys and tokens in the client are public.
92
+ - Validate/sanitize anything from URL params, storage, or APIs before use.
93
+ - `rel="noopener"` on `target="_blank"` links; validate URLs before navigating.
94
+
95
+ ## Verify
96
+
97
+ Compare the result against the reference side by side; list remaining deltas before calling it done. Not done while deltas are unlisted or unresolved.
98
+
99
+ ## Red flags
100
+
101
+ - "I'll match the repo later" — the repo standard is the first step, not a cleanup.
102
+ - "It's accessible enough" — a11y is a checklist; unchecked boxes are not done.
103
+ - "Tests can find it" — no data-testid means the UI is not testable.
104
+ - "Optimize when it's slow" — perf regressions ship measured later, rarely.
105
+ - "It's client-side, so no security review" — the client is public by definition.
106
+
107
+ ## Common Rationalizations
108
+
109
+ | Excuse | Reality |
110
+ |--------|---------|
111
+ | "The brief calls for a hero trio." | A brief calling for slop is a constraint, not a license — the default stays don't; execute well only if the design truly demands it. |
112
+ | "It's just a landing page." | Still verified for responsive and a11y — a small page is not exempt. |
113
+ | "It's a one-off component." | A one-off still follows the design system's tokens and patterns. |
114
+ | "Good enough." | Not done until compared against the reference with remaining deltas listed. |
115
+ | "It looks right." | Verified at every breakpoint or it is not verified. |
116
+ | "Everyone ships this card row." | Popularity is not design; if it's on the slop list, it stays banned. |
117
+ | "Tokens later." | Tokens extracted before markup, or the layout gets rebuilt. |
118
+ | "Our repo is messy, I'll use my own style." | You match the repo standard first, then you may propose raising it. |
119
+ | "It's accessible enough." | The a11y checklist is all-or-nothing; unchecked boxes are not done. |
120
+ | "The user won't use a keyboard." | Every interaction must be keyboard-operable; "users won't" is not a design decision. |
121
+
122
+ If the rationalization wins, name it in the report as a known delta — not as silence.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: mugiwara-gates
3
+ description: Use after quality checks to enforce the quality gates - coverage (new >=90%, modified >=80%), build exit 0, and the Definition of Done. Binary verdicts with evidence, no negotiation, no silent pass when tooling is missing.
4
+ ---
5
+
6
+ # Gates (Franky)
7
+
8
+ Gates are binary: pass or fail, with evidence. No negotiation.
9
+
10
+ ## Coverage gate
11
+
12
+ 1. Measure coverage with the project's existing tooling (jest --coverage, pytest --cov, go test -cover, cargo tarpaulin, etc.).
13
+ 2. Thresholds: NEW files >= 90%, MODIFIED files >= 80%. Identify new/modified via git diff against the mission's base.
14
+ 3. No coverage tooling exists → the gate CANNOT pass silently: report the gap, propose the minimal tooling addition, ask the user to add it or waive the gate explicitly. Record their decision.
15
+
16
+ ## Build gate
17
+
18
+ Run the project's build (or typecheck for interpreted stacks). Must exit 0. Capture the tail of output.
19
+
20
+ ## Definition of Done standing gate
21
+
22
+ A fixed cross-project bar, distinct from per-task acceptance criteria. Verdict PASS only when all hold:
23
+
24
+ - Correctness — the work does what the plan specifies.
25
+ - Quality — lint/format/unit checks clean, configs unweakened.
26
+ - Integration — the work fits the existing system (build/typecheck green).
27
+ - Docs — user-facing and internal docs updated where the change requires it.
28
+ - Ship-readiness — no blocker rows left open in the issues ledger.
29
+
30
+ ## Verdict
31
+
32
+ PASS only when coverage AND build AND DoD all pass with evidence. Write the verdict to `.mugiwara/results/` listing thresholds measured, build exit, and each DoD item.
33
+
34
+ - PASS → Robin/Jinbe (Wave 7).
35
+ - Any FAIL → list exactly which files are under threshold and by how much, or which DoD item failed → Brook (Wave 8).
36
+
37
+ ## Iron Law
38
+
39
+ GATES ARE BINARY. PASS or FAIL, each backed by evidence. No negotiation, no "almost passes".
40
+
41
+ ## Red flags
42
+
43
+ - Missing coverage tooling turned into a silent pass.
44
+ - A PASS verdict with no captured evidence.
45
+ - Coverage measured against the wrong base (not the mission's diff).
46
+ - A FAIL negotiated downward to pass because the fix "isn't worth it".
47
+ - A gate waived without an explicit user decision recorded.
48
+ - A PASS on coverage and build while a DoD item fails.
49
+
50
+ All mean: the gate has not actually run. Report the gap or the fail, honestly.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: mugiwara-git
3
+ description: Use when committing, splitting commits, or debugging via git history during execution or healing. Atomic commits, save-points, style detection, bisect.
4
+ ---
5
+
6
+ # Git Discipline (Zoro, Brook)
7
+
8
+ Git hygiene keeps the mission reversible: one logical change per commit, a save-point before risky work, and history you can bisect.
9
+
10
+ ## Atomic commits
11
+
12
+ 1. One logical change per commit. A rename, a refactor, and its feature are three commits.
13
+ 2. Each commit must compile and pass the relevant checks — never commit a broken tree.
14
+ 3. Commit when a unit of work passes its acceptance criteria, not at arbitrary time points.
15
+ 4. Staging is exact: `git add` specific files and paths, never `git add -A` sweeping an unrelated commit.
16
+
17
+ ## Save-point pattern
18
+
19
+ 1. Before any risky or large operation (refactor, migration, merge), commit the current working state as a save-point even if incomplete.
20
+ 2. A save-point message names the intent, e.g. `checkpoint: before renderer migration`.
21
+ 3. Save-points make rollback one command: `git reset --hard <save-point>`. Verify with a diff before resetting.
22
+
23
+ ## Multi-commit splitting
24
+
25
+ 1. A large task becomes multiple commits, one per logical step in the plan.
26
+ 2. Split boundaries follow the plan's tasks: no commit spans two plan tasks, no plan task is left partially committed.
27
+ 3. Commit each step the moment it is green; never batch a whole wave into one commit.
28
+
29
+ ## Commit message conventions
30
+
31
+ 1. Imperative mood subject, capitalized, <= 50 chars: `Add route guard for /api`.
32
+ 2. Scoped subject when scope is not obvious: `feat(auth): enforce session TTL`.
33
+ 3. Body (after a blank line) explains WHY, not what. What is visible in the diff; why is not.
34
+ 4. Match the repo's existing style — detect it before writing messages (below).
35
+
36
+ ## Style detection
37
+
38
+ 1. Inspect existing history before the first commit: `git log --oneline -20`.
39
+ 2. Copy the observed conventions: prefix style (`feat:`/`fix:` vs plain), subject case, body usage, subject length.
40
+ 3. No commits in the repo yet → adopt conventional commits and note it in the plan.
41
+
42
+ ## Debugging via history
43
+
44
+ 1. `git bisect start`, then `git bisect bad <current>` and `git bisect good <known-good>` to find the regression commit. Log the bad commit range in the result.
45
+ 2. `git blame -L <file>` to find which commit introduced a line, then read that commit's message and diff.
46
+ 3. Pickaxe `git log -S <string>` to find when a symbol appeared or vanished.
47
+ 4. `git log -- <file>` to trace a file's evolution before touching it.
48
+
49
+ ## Never commit secrets
50
+
51
+ 1. Scan before every commit: `.env*`, keys, tokens, passwords, private keys, credentials in code or comments.
52
+ 2. A secret already committed → treat as compromised: rotate it, purge it from history, file a security finding.
53
+ 3. Respect `.gitignore`; never force-add an ignored file without a recorded reason.
54
+
55
+ ## Iron Law
56
+
57
+ EVERY COMMIT IS REVERSIBLE AND EXPLAINABLE. If you cannot name the logical change and why, the commit is not ready.
58
+
59
+ ## Red flags
60
+
61
+ - A commit mixing refactor and feature, or failing to compile.
62
+ - `git add -A` sweeping unrelated files into a commit.
63
+ - A save-point skipped before a risky operation.
64
+ - Writing commit messages in a style the repo's history does not use.
65
+ - A secret reaching a commit, or a force-added ignored file.
66
+
67
+ All mean: stop, unstage or reset, and re-stage exactly what belongs together.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: mugiwara-healing
3
+ description: Use when earlier waves produced failures - test failures, gate failures, review findings, security findings. Reads the .mugiwara/issues ledger first, stop-the-line triage per failure, prove-it before fixing, minimal root-cause fixes, ledger updated with evidence.
4
+ ---
5
+
6
+ # Healing (Brook)
7
+
8
+ Fix what failed, minimally, and prove it. One clean retry per cycle.
9
+
10
+ ## Read the ledger first
11
+
12
+ Brook's inputs: `.mugiwara/issues/YYYY-MM-DD-<mission>-blockers.md` rows + quality report (Sanji), gate verdict (Franky), review findings (Robin), security report (Jinbe). Process each ledger row — every row is one healing unit. Rows are appended by any agent that hit a blocker; never skip a row.
13
+
14
+ ## Stop-the-Line triage (per failure)
15
+
16
+ 1. PRESERVE evidence: save the failing output/state before touching anything.
17
+ 2. Reproduce: re-run the failure, confirm it is real and current.
18
+ 3. Localize: layer map of where it sits (config/test/code/env); use `git bisect` when a regression window is unclear.
19
+ 4. Reduce: shrink to the minimal case that still fails.
20
+ 5. Fix the ROOT cause — grep all callers before patching; never patch only the symptom path.
21
+ 6. Guard with a regression test that fails without the fix.
22
+ 7. Verify end-to-end: run the failed check, capture output.
23
+
24
+ Never push past a failing test — a red test stops the line until it is green or escalated.
25
+
26
+ ## Prove-It pattern
27
+
28
+ Before fixing a bug: write the failing test that reproduces it, watch it fail, then fix until green. Red → code → green, in that order. A fix with no reproducing test is unproven.
29
+
30
+ ## Triage matrix
31
+
32
+ | Failure | Action |
33
+ |---------|--------|
34
+ | lint/format error | auto-fix (formatter when supported), re-run |
35
+ | type error / simple test fail | minimal diff at ROOT CAUSE — grep all callers before patching; never fix only the symptom path |
36
+ | flaky / env failure | mark `env`, do not patch code, note for rerun |
37
+ | blocker security/review finding | smallest safe diff; add or extend the test that catches it |
38
+ | architectural finding / high-risk change | DO NOT auto-fix — prepare fix/rollback plan, escalate to Luffy → human |
39
+
40
+ ## Rules
41
+
42
+ 1. One fix = smallest diff resolving the finding. No drive-by refactors.
43
+ 2. Every code fix ships with the failed check now passing (run it, capture output).
44
+ 3. Never delete or weaken tests/configs to make a failure disappear.
45
+ 4. After healing: update the ledger — mark each healed row with evidence; keep unfixed rows for escalation.
46
+ 5. Cycle counter: after this wave the flow returns to Wave 4 (Chopper) for re-audit. Same failure surviving 3 heal cycles → stop, escalate with full history.
47
+
48
+ ## Output
49
+
50
+ Fixed list (finding → commit → evidence), escalated list (finding → plan → owner), updated ledger → back to Wave 4 (Chopper).
51
+
52
+ ## Red flags
53
+
54
+ - Patching the symptom path instead of the root cause (fix at the shared function, not the one caller that surfaced).
55
+ - A fix shipped without a reproducing test (Prove-It skipped).
56
+ - A test or config deleted or weakened to silence a failure.
57
+ - A drive-by refactor riding along with a fix.
58
+ - A code failure marked `env` to close the ledger.
59
+ - A ledger row processed with no evidence recorded.
60
+ - The same failure healing past 3 cycles without escalation.
61
+
62
+ All mean: the fix is not real. Stop, find the root cause, or escalate with full history.