@ionivetech/mugiwara 0.2.0 → 0.4.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.
- package/.opencode/commands/mugiwara-execute.md +11 -0
- package/.opencode/commands/mugiwara-heal.md +11 -0
- package/.opencode/commands/mugiwara-mode.md +6 -0
- package/.opencode/commands/mugiwara-plan.md +15 -0
- package/.opencode/commands/mugiwara-review.md +11 -0
- package/.opencode/commands/mugiwara-security.md +11 -0
- package/.opencode/commands/mugiwara-ship.md +11 -0
- package/.opencode/commands/mugiwara.md +11 -0
- package/.opencode/plugins/mugiwara.mjs +126 -7
- package/README.md +338 -355
- package/content/agents/brook-healing.md +2 -2
- package/content/agents/luffy-orchestrator.md +3 -2
- package/content/agents/robin-reviewer.md +1 -1
- package/content/agents/skeptic-verifier.md +1 -1
- package/content/agents/using-mugiwara.md +5 -1
- package/content/agents/usopp-brainstorm.md +1 -1
- package/content/agents/zoro-execution.md +1 -1
- package/content/skills/mugiwara-agent-security/SKILL.md +5 -0
- package/content/skills/mugiwara-api-and-interface-design/SKILL.md +92 -0
- package/content/skills/mugiwara-backend/SKILL.md +5 -0
- package/content/skills/mugiwara-brainstorm/SKILL.md +5 -0
- package/content/skills/mugiwara-checkpoint/SKILL.md +5 -0
- package/content/skills/mugiwara-context-engineering/SKILL.md +64 -0
- package/content/skills/mugiwara-deprecation/SKILL.md +5 -0
- package/content/skills/mugiwara-doubt-driven-development/SKILL.md +70 -0
- package/content/skills/mugiwara-dynamic-workflow/SKILL.md +5 -0
- package/content/skills/mugiwara-eval/SKILL.md +5 -0
- package/content/skills/mugiwara-execution/SKILL.md +9 -0
- package/content/skills/mugiwara-frontend/SKILL.md +61 -59
- package/content/skills/mugiwara-frontend/references/checklist.md +37 -0
- package/content/skills/mugiwara-gates/SKILL.md +9 -0
- package/content/skills/mugiwara-git/SKILL.md +5 -0
- package/content/skills/mugiwara-git-worktrees/SKILL.md +67 -0
- package/content/skills/mugiwara-healing/SKILL.md +17 -0
- package/content/skills/mugiwara-lessons/SKILL.md +5 -0
- package/content/skills/mugiwara-mode/SKILL.md +18 -4
- package/content/skills/mugiwara-observability/SKILL.md +5 -0
- package/content/skills/mugiwara-orchestration/SKILL.md +32 -1
- package/content/skills/mugiwara-planning/SKILL.md +25 -26
- package/content/skills/mugiwara-pr/SKILL.md +22 -6
- package/content/skills/mugiwara-quality/SKILL.md +15 -0
- package/content/skills/mugiwara-resume/SKILL.md +5 -0
- package/content/skills/mugiwara-review/SKILL.md +5 -0
- package/content/skills/mugiwara-security/SKILL.md +51 -14
- package/content/skills/mugiwara-ship/SKILL.md +29 -1
- package/content/skills/mugiwara-systematic-debugging/SKILL.md +82 -0
- package/content/skills/mugiwara-test-driven-development/SKILL.md +89 -0
- package/content/skills/mugiwara-testcases/SKILL.md +5 -0
- package/content/skills/mugiwara-workflow/SKILL.md +14 -3
- package/content/skills/mugiwara-writing-skills/SKILL.md +65 -0
- package/dist/mugiwara.js +175 -51
- package/docs/adoption-guide.md +3 -3
- package/docs/agents.md +2 -2
- package/docs/claude-setup.md +9 -4
- package/docs/codex-setup.md +3 -1
- package/docs/comparison.md +166 -44
- package/docs/config.md +53 -0
- package/docs/copilot-setup.md +3 -1
- package/docs/cursor-setup.md +3 -1
- package/docs/developer-onboarding.md +17 -13
- package/docs/enforcement.md +38 -0
- package/docs/execution-model.md +33 -0
- package/docs/gemini-setup.md +4 -1
- package/docs/getting-started.md +16 -4
- package/docs/index.md +14 -3
- package/docs/lanes.md +40 -0
- package/docs/modes.md +22 -12
- package/docs/opencode-setup.md +9 -2
- package/docs/pr-summary.md +54 -0
- package/docs/skill-anatomy.md +16 -6
- package/docs/skills.md +17 -5
- package/docs/troubleshooting.md +91 -0
- package/docs/windsurf-setup.md +3 -1
- package/docs/workflow.md +15 -6
- package/evals/cases/adversarial-pressure-fake-pass.json +12 -0
- package/evals/cases/adversarial-pressure-skip-review.json +13 -0
- package/evals/cases/lane-exploratory-vague.json +12 -0
- package/evals/cases/lane-sensitivity-payment.json +12 -0
- package/evals/cases/negative-secrets-typo.json +12 -0
- package/evals/cases/negative-security-docs-change.json +12 -0
- package/evals/cases/positive-refactor-existing-tests.json +11 -0
- package/evals/cases/positive-resume-mid-mission.json +11 -0
- package/evals/cases/routing-auth-feature.json +13 -0
- package/evals/cases/routing-bug-one-file.json +13 -0
- package/evals/cases/routing-typo.json +13 -0
- package/hooks/hooks.json +15 -0
- package/hooks/session-start.ts +8 -0
- package/package.json +3 -1
- package/src/args.ts +2 -1
- package/src/cli.ts +16 -20
- package/src/installer.ts +31 -3
- package/src/mission.ts +25 -0
- package/src/targets/claude.ts +22 -1
- package/src/targets/codex.ts +1 -1
- package/src/targets/copilot.ts +4 -0
- package/src/targets/gemini.ts +1 -1
- package/src/targets/generic.ts +33 -1
- package/src/targets/kilo.ts +1 -0
- package/src/targets/opencode.ts +4 -0
|
@@ -1,46 +1,65 @@
|
|
|
1
1
|
---
|
|
2
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,
|
|
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, component architecture, state management, responsive behavior, and WCAG 2.1 AA baked in; bans generic AI-slop patterns and rationalizations. Framework-agnostic.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Frontend (Anti-Slop)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- Diff touches no UI code: backend, docs, config, or CLI-only change.
|
|
11
|
+
- No visual change, markup, styling, or frontend behavior in the mission.
|
|
12
|
+
|
|
8
13
|
Interfaces built under this skill must not look templated.
|
|
9
14
|
|
|
10
15
|
## Existing repo standard first
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
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.
|
|
17
|
+
Match the repo's standard before writing anything new; reuse its components and patterns. Greenfield with no UI: skip to design-system extraction.
|
|
18
|
+
- Component library (MUI/Tailwind/shadcn/etc) — a new button looks like the repo's buttons, not the internet's.
|
|
19
|
+
- File conventions, naming, folder structure, CSS strategy; lint/format/test scripts.
|
|
20
|
+
- Tokens already in the theme/config; existing page patterns — how pages compose sections and state.
|
|
19
21
|
|
|
20
22
|
## Redesigns: audit first
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Capture current layout, spacing/type scales, palette, and component inventory before changing existing UI. Fix real problems; do not restyle what works.
|
|
23
25
|
|
|
24
26
|
## Design-system extraction (before markup)
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Extract tokens from the stack's design system BEFORE markup — spacing scale, type scale, role-based palette, radii, shadows, motion language. Name them semantically (`surface-muted`, not `c3`); store where the stack keeps tokens. No tokens extracted, no markup written. Then turn tokens into a small primitive set (button, input, card, icon, layout helpers) before composing screens — reuse primitives everywhere; every bespoke component is debt on every screen.
|
|
29
|
+
|
|
30
|
+
## Component architecture
|
|
31
|
+
|
|
32
|
+
Compose, don't inherit. Small, single-purpose components; the tree mirrors the page, not a god-component.
|
|
33
|
+
- Boundaries: one component = one responsibility; extract on reuse; leaves stay presentational (no data fetching).
|
|
34
|
+
- Composition over configuration: children/slots beat dozens of props.
|
|
35
|
+
- Props: primitives and plain callbacks over object-shaped flags; 3+ boolean props = split the component.
|
|
36
|
+
- Naming by role (`ProductCard`, not `CardA`); variants over copy-paste.
|
|
37
|
+
|
|
38
|
+
## State management
|
|
39
|
+
|
|
40
|
+
Minimal state, local first; lift only what is shared.
|
|
41
|
+
- Server vs client state: never store a per-screen copy of API data; cache/refetch at a data layer; derive on render.
|
|
42
|
+
- Single source of truth per state, no duplicate mirrors; lift only when siblings share — context/store for app-wide state, not one screen.
|
|
43
|
+
- Loading, error, empty, success states designed, not an afterthought.
|
|
27
44
|
|
|
28
45
|
## From Figma / image references
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
2. New one-off components still follow the design system — a one-off is not a license to invent a second system.
|
|
47
|
+
Extract tokens first, then reproduce structure faithfully: hierarchy, alignment, whitespace ratios. Do not "improve" the layout unasked. A one-off is not a license for a second system.
|
|
32
48
|
|
|
33
49
|
## Taste: positive design judgment
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- Hierarchy and rhythm: one primary action per view, one clear focal point, consistent spacing rhythm.
|
|
51
|
+
- Hierarchy and rhythm: one primary action per view, one focal point, consistent spacing.
|
|
38
52
|
- Restraint: fewer, more considered elements; whitespace is a tool.
|
|
39
|
-
- Typography
|
|
40
|
-
- Color
|
|
53
|
+
- Typography: 1-2 typefaces, deliberate scale, weight for emphasis not decoration, 45-75ch lines.
|
|
54
|
+
- Color: role-based palette, contrast AA minimum, never pure-black-on-pure-white for text-heavy surfaces.
|
|
41
55
|
- 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
|
|
43
|
-
- State design: hover, focus, active, disabled, loading, error,
|
|
56
|
+
- Intentionality: every element earns its place; if you cannot say why, remove it.
|
|
57
|
+
- State design: hover, focus, active, disabled, loading, error, empty — designed, not forgotten.
|
|
58
|
+
- Craft: deliberate spacing grids; subtle motion respecting `prefers-reduced-motion`; verified at all breakpoints.
|
|
59
|
+
|
|
60
|
+
## Responsive behavior
|
|
61
|
+
|
|
62
|
+
Mobile-first: start at the smallest screen, add breakpoints as layout needs them. Default full-width stacked; columns only when there is room. Use the stack's breakpoints, not a parallel scale; fluid containers, type, and spacing. Verify at every breakpoint, including between them — 3 widths checked is not 12 checked.
|
|
44
63
|
|
|
45
64
|
## Banned AI-default patterns (the slop list)
|
|
46
65
|
|
|
@@ -52,71 +71,54 @@ Beyond banning slop, build with intent:
|
|
|
52
71
|
|
|
53
72
|
If the brief genuinely calls for one of these, execute it well — but the default is: don't.
|
|
54
73
|
|
|
55
|
-
##
|
|
74
|
+
## WCAG 2.1 AA accessibility
|
|
56
75
|
|
|
57
|
-
-
|
|
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.
|
|
76
|
+
Non-negotiable baseline. Full checklist: `references/checklist.md`.
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
- Keyboard: every interaction operable by keyboard alone; logical tab order; visible focus; no focus trap without escape.
|
|
79
|
+
- Semantics: native elements over ARIA; landmarks; logical heading order; buttons for actions, links for navigation.
|
|
80
|
+
- Contrast: 4.5:1 text, 3:1 large text/UI; never color-only meaning.
|
|
81
|
+
- Forms: every input labeled (placeholder is not a label); errors/success announced; `aria-describedby` help.
|
|
82
|
+
- Dynamic content: `aria-live` for changes; reduced-motion respected.
|
|
64
83
|
|
|
65
|
-
|
|
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.
|
|
84
|
+
## Testability and verification
|
|
74
85
|
|
|
75
|
-
|
|
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.
|
|
86
|
+
Add stable `data-testid` to interactive elements per the repo's testing convention. Never test by CSS class or by text that changes. Then compare the result against the reference side by side; list remaining deltas before calling it done.
|
|
78
87
|
|
|
79
88
|
## Performance
|
|
80
89
|
|
|
81
|
-
- No layout thrash: batch DOM reads
|
|
82
|
-
-
|
|
83
|
-
- Assets: no giant images or font payloads; lazy-load below the fold; no whole icon library for two icons.
|
|
90
|
+
- No layout thrash: batch DOM reads/writes; heavy work off the scroll path; animate only transform/opacity.
|
|
91
|
+
- Assets: no giant images/font payloads; lazy-load below the fold; no whole icon library for two icons.
|
|
84
92
|
- No re-render storms: memoize heavy computation, stable keys, no work in render.
|
|
85
93
|
- Measure before optimizing; do not guess the bottleneck.
|
|
86
94
|
|
|
87
95
|
## Frontend security
|
|
88
96
|
|
|
89
97
|
- Never render user content via `dangerouslySetInnerHTML`/`v-html` unless sanitized.
|
|
90
|
-
- Escape user input in every template; no
|
|
91
|
-
-
|
|
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
|
+
- Escape user input in every template; no secrets in client code; validate URL params/storage/API input.
|
|
99
|
+
- `rel="noopener"` on `target="_blank"`; validate URLs before navigating.
|
|
98
100
|
|
|
99
101
|
## Red flags
|
|
100
102
|
|
|
101
|
-
- "I'll match the repo later" — the repo standard is the first step, not
|
|
102
|
-
- "It's accessible enough" — a11y
|
|
103
|
+
- "I'll match the repo later" — the repo standard is the first step, not cleanup.
|
|
104
|
+
- "It's accessible enough" — the a11y checklist is all-or-nothing.
|
|
103
105
|
- "Tests can find it" — no data-testid means the UI is not testable.
|
|
104
106
|
- "Optimize when it's slow" — perf regressions ship measured later, rarely.
|
|
105
107
|
- "It's client-side, so no security review" — the client is public by definition.
|
|
108
|
+
- "New screen, new components" — primitives are the default; bespoke is the exception.
|
|
109
|
+
- "Global store for everything" — local state first; lift only what is shared.
|
|
106
110
|
|
|
107
111
|
## Common Rationalizations
|
|
108
112
|
|
|
109
113
|
| Excuse | Reality |
|
|
110
114
|
|--------|---------|
|
|
111
|
-
| "The brief calls for a hero trio." | A brief calling for slop is a constraint, not a license — the default stays don't
|
|
112
|
-
| "It's just a landing page." | Still verified for responsive and a11y
|
|
113
|
-
| "It
|
|
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. |
|
|
115
|
+
| "The brief calls for a hero trio." | A brief calling for slop is a constraint, not a license — the default stays don't. |
|
|
116
|
+
| "It's just a landing page." / "It's a one-off component." | Still verified for responsive and a11y; still follows the design system's tokens and patterns. |
|
|
117
|
+
| "Good enough." / "It looks right." | Not done until compared against the reference with deltas listed, at every breakpoint. |
|
|
116
118
|
| "Everyone ships this card row." | Popularity is not design; if it's on the slop list, it stays banned. |
|
|
117
119
|
| "Tokens later." | Tokens extracted before markup, or the layout gets rebuilt. |
|
|
118
|
-
| "Our repo is messy, I'll use my own style." |
|
|
119
|
-
| "
|
|
120
|
-
| "
|
|
120
|
+
| "Our repo is messy, I'll use my own style." | Match the repo standard first, then propose raising it. |
|
|
121
|
+
| "The user won't use a keyboard." / "Context for everything." | Every interaction keyboard-operable; server state belongs at a data layer, not a global store. |
|
|
122
|
+
| "It's a quick prop, no new component." | 3+ boolean props is the boundary — split the component. |
|
|
121
123
|
|
|
122
124
|
If the rationalization wins, name it in the report as a known delta — not as silence.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# WCAG 2.1 AA Frontend Checklist
|
|
2
|
+
|
|
3
|
+
Run before calling a view done. Every box must check; unchecked boxes are not done.
|
|
4
|
+
|
|
5
|
+
## Perceivable
|
|
6
|
+
|
|
7
|
+
- [ ] Text contrast 4.5:1; large text (18pt/24px or 14pt/18.66px bold) and UI components/graphics 3:1.
|
|
8
|
+
- [ ] No pure-black-on-pure-white text-heavy surfaces; text over images has a scrim or offset.
|
|
9
|
+
- [ ] `alt` on every image (empty `alt=""` when decorative; never `alt="image"`).
|
|
10
|
+
- [ ] No information conveyed by color alone; add icon/text/pattern.
|
|
11
|
+
- [ ] Captions/alternatives for media; no autoplaying audio without controls.
|
|
12
|
+
|
|
13
|
+
## Operable
|
|
14
|
+
|
|
15
|
+
- [ ] Full keyboard operation: every interactive element reachable and operable with Tab/Enter/Space/arrows.
|
|
16
|
+
- [ ] Visible focus indicator at every focus point (never `outline: none`).
|
|
17
|
+
- [ ] Logical tab order matching visual order; skip-link to main content on repeated navigation.
|
|
18
|
+
- [ ] No focus trap without an escape (Esc or a focusable close); focus returns after modals close.
|
|
19
|
+
- [ ] Touch targets at least 44x44px; target spacing where 44px is not possible.
|
|
20
|
+
- [ ] No flashing more than 3 times/second.
|
|
21
|
+
|
|
22
|
+
## Understandable
|
|
23
|
+
|
|
24
|
+
- [ ] Page has a `<title>` and a language attribute.
|
|
25
|
+
- [ ] Single `h1`; heading levels do not skip (h1→h3 without h2 is a defect).
|
|
26
|
+
- [ ] Every input has a programmatic label; placeholder alone is not a label.
|
|
27
|
+
- [ ] Form errors and success announced (via `aria-live`/`role="alert"`); help text via `aria-describedby`.
|
|
28
|
+
- [ ] Validation never color-only; `aria-invalid` marks errors.
|
|
29
|
+
- [ ] Navigation/meaning is not tied to hover-only or transient state.
|
|
30
|
+
|
|
31
|
+
## Robust
|
|
32
|
+
|
|
33
|
+
- [ ] Native HTML elements first; ARIA only where native semantics cannot express the widget.
|
|
34
|
+
- [ ] Honest roles; no `role="button"` on a link, no empty labels on interactive elements.
|
|
35
|
+
- [ ] Dynamic updates announced via `aria-live` with appropriate `polite`/`assertive`.
|
|
36
|
+
- [ ] `prefers-reduced-motion` respected; motion scales, never disables content.
|
|
37
|
+
- [ ] No interaction reachable only by mouse; nothing requires drag to operate.
|
|
@@ -5,6 +5,11 @@ description: Use after quality checks to enforce the quality gates - coverage (n
|
|
|
5
5
|
|
|
6
6
|
# Gates (Franky)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- No code changed: docs-only or README-only diff with zero production surface.
|
|
11
|
+
- Repo has no coverage tooling AND no test suite detected — record the skip, don't fake a verdict.
|
|
12
|
+
|
|
8
13
|
Gates are binary: pass or fail, with evidence. No negotiation.
|
|
9
14
|
|
|
10
15
|
## Coverage gate
|
|
@@ -21,6 +26,10 @@ When user acceptance criteria are declared, the coverage thresholds (90/80) appl
|
|
|
21
26
|
|
|
22
27
|
Run the project's build (or typecheck for interpreted stacks). Must exit 0. Capture the tail of output.
|
|
23
28
|
|
|
29
|
+
## Optional e2e gate (per `mugiwara-quality`)
|
|
30
|
+
|
|
31
|
+
Position: after quality checks, before the final gates below. Optional — it runs only when the quality wave triggered it (repo e2e setup AND changed-file e2e patterns, with consent by mode). Its outcome is recorded with evidence but never blocks PASS: a skipped or unrun e2e gate is logged, not a failure. The final verdict is still coverage + build + DoD.
|
|
32
|
+
|
|
24
33
|
## Definition of Done standing gate
|
|
25
34
|
|
|
26
35
|
A fixed cross-project bar, distinct from per-task acceptance criteria. Verdict PASS only when all hold:
|
|
@@ -5,6 +5,11 @@ description: Use when committing, splitting commits, or debugging via git histor
|
|
|
5
5
|
|
|
6
6
|
# Git Discipline (Zoro, Brook)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- No commits to make this wave — nothing staged, nothing to split or amend.
|
|
11
|
+
- User handles version control manually for this mission.
|
|
12
|
+
|
|
8
13
|
Git hygiene keeps the mission reversible: one logical change per commit, a save-point before risky work, and history you can bisect.
|
|
9
14
|
|
|
10
15
|
## Atomic commits
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mugiwara-git-worktrees
|
|
3
|
+
description: Use when running parallel branch work, keeping the main workspace clean, or reviewing a branch without switching. Isolated worktrees via git worktree add, branch hygiene, and safe cleanup.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Worktrees — Isolated Parallel Branches
|
|
7
|
+
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- Single-branch sequential work: no parallel branches running at once.
|
|
11
|
+
- Working tree stays clean and review happens on the current branch.
|
|
12
|
+
|
|
13
|
+
Worktrees give each branch its own checkout, so parallel missions, reviews, and experiments never fight over one working tree. Companion to mugiwara-git, not a replacement for commit discipline.
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
|
|
17
|
+
- Parallel independent tasks on separate branches that must progress without blocking each other.
|
|
18
|
+
- Keeping the main workspace clean: main checkout stays untouched while risky work lives in a worktree.
|
|
19
|
+
- Reviewing or verifying a branch without switching: open it in a worktree, inspect, discard.
|
|
20
|
+
- Any task so risky you want it physically separate from the current tree.
|
|
21
|
+
|
|
22
|
+
Prefer a worktree over `git stash` juggling — each branch gets a real checkout, not a rescue from the reflog.
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
|
|
26
|
+
1. Create the worktree bound to a new branch:
|
|
27
|
+
`git worktree add -b <branch> <path>` (e.g. `git worktree add -b feature/ABC-123-dark-mode ../dark-mode`).
|
|
28
|
+
2. Work entirely inside `<path>`: edit, commit, push there. Treat it as the only home of that branch.
|
|
29
|
+
3. Do not touch that branch from the main checkout, and vice versa. Two tasks never share one worktree.
|
|
30
|
+
4. Verify the work before it leaves the worktree: run the branch's checks and tests inside `<path>`.
|
|
31
|
+
5. Merge or rebase back into the main branch from the main checkout; push when done.
|
|
32
|
+
6. Clean up once the branch is merged or abandoned:
|
|
33
|
+
- `git worktree remove <path>` (add `--force` only if it has uncommitted changes you accept losing).
|
|
34
|
+
- `git worktree prune` to drop stale bookkeeping for worktrees removed outside git's book.
|
|
35
|
+
7. Check nothing is left behind: `git worktree list` should show only your active checkouts.
|
|
36
|
+
|
|
37
|
+
## Cleanup safety
|
|
38
|
+
|
|
39
|
+
- Remove only worktrees you created. Host-owned worktrees — ones the repo or another agent set up — are not yours to delete; leave them.
|
|
40
|
+
- Never remove a worktree that still has unmerged commits unless you have deliberately abandoned that branch.
|
|
41
|
+
- Remove the worktree, not the branch directory with `rm -rf`; bypassing git leaves stale metadata that `prune` then has to guess about.
|
|
42
|
+
- A worktree without a branch (`--detach`) is throwaway: verify, then remove with no branch to worry about.
|
|
43
|
+
|
|
44
|
+
## Rationalizations
|
|
45
|
+
|
|
46
|
+
| Rationalization | Why it fails |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| "I'll just switch branches, it's faster." | Uncommitted changes block checkout; one mistake mixes work from two tasks. |
|
|
49
|
+
| "I can work on both branches in one checkout." | Stash conflicts and forgotten checkouts lose or misattribute work. |
|
|
50
|
+
| "Removing a worktree is the same as deleting a folder." | `rm -rf` leaves git's worktree bookkeeping stale; `git worktree remove` stays consistent. |
|
|
51
|
+
| "Their worktree looks abandoned, I'll clean it up." | Host-owned state. If it looks dead, report it, never remove it. |
|
|
52
|
+
|
|
53
|
+
## Red flags
|
|
54
|
+
|
|
55
|
+
- A worktree path inside the repo's own directory tree — nested worktrees are confusing and error-prone.
|
|
56
|
+
- Deleting or force-removing a worktree whose branch has unpushed commits.
|
|
57
|
+
- The same branch checked out in two worktrees, or two tasks sharing one worktree.
|
|
58
|
+
- Touching or re-checking-out a host-owned worktree.
|
|
59
|
+
|
|
60
|
+
All mean: stop, verify branch state, and clean up only what belongs to your task.
|
|
61
|
+
|
|
62
|
+
## Verification
|
|
63
|
+
|
|
64
|
+
1. `git worktree list` shows exactly the checkouts you expect — yours, none stale.
|
|
65
|
+
2. After cleanup, the worktree path is gone and `git worktree prune` reports nothing to prune.
|
|
66
|
+
3. The main checkout shows no leftover files, locks, or artifacts from the removed worktree.
|
|
67
|
+
4. The removed branch's commits are either merged into main or deliberately abandoned — never stranded.
|
|
@@ -5,6 +5,11 @@ description: Use when earlier waves produced failures - test failures, gate fail
|
|
|
5
5
|
|
|
6
6
|
# Healing (Brook)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- No failures recorded: blocker ledger empty, all gates and reviews passed.
|
|
11
|
+
- User explicitly accepts a failure as-is and recorded the decision.
|
|
12
|
+
|
|
8
13
|
Fix what failed, minimally, and prove it. One clean retry per cycle.
|
|
9
14
|
|
|
10
15
|
## Read the ledger first
|
|
@@ -50,6 +55,18 @@ Before fixing a bug: write the failing test that reproduces it, watch it fail, t
|
|
|
50
55
|
4. After healing: update the ledger — mark each healed row with evidence; keep unfixed rows for escalation.
|
|
51
56
|
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.
|
|
52
57
|
|
|
58
|
+
## Worker subagents
|
|
59
|
+
|
|
60
|
+
Brook runs inline; the only dispatches are disposable WORKER subagents for genuinely parallel work. Three named workers:
|
|
61
|
+
|
|
62
|
+
- **reviewer-worker** — adversarial diff review of Brook's fixes from a fresh context (per `mugiwara-review`).
|
|
63
|
+
- **security-worker** — security pass over the fixes (per `mugiwara-security`).
|
|
64
|
+
- **re-run-check worker** — independently re-runs the failed checks and returns raw evidence (command output, exit codes), so the re-verify is not Brook re-confirming its own fix.
|
|
65
|
+
|
|
66
|
+
Flow: Brook aggregates worker findings → applies minimal root-cause fixes (triage matrix + Rules above) → dispatches a re-run-check worker to re-verify.
|
|
67
|
+
|
|
68
|
+
Workers are NOT crew members — disposable subagents, one narrow job, results return as a report. The crew itself always runs inline in the main thread, never Task-dispatched.
|
|
69
|
+
|
|
53
70
|
## Output
|
|
54
71
|
|
|
55
72
|
Fixed list (finding → commit → evidence), escalated list (finding → plan → owner), updated ledger → back to Wave 4 (Chopper).
|
|
@@ -5,6 +5,11 @@ description: Use at mission end or before starting work in a repo the crew has w
|
|
|
5
5
|
|
|
6
6
|
# Lessons (Mission Memory)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- Fresh repo, zero prior missions: no ledger exists and nothing to surface.
|
|
11
|
+
- Nothing learned worth keeping — no new lesson, no repeated failure pattern.
|
|
12
|
+
|
|
8
13
|
The crew's institutional memory. Every mission writes what it learned so the next mission starts ahead of it.
|
|
9
14
|
|
|
10
15
|
## The ledger
|
|
@@ -5,6 +5,11 @@ description: Use when reading or changing the runtime mode (guided / semi / auto
|
|
|
5
5
|
|
|
6
6
|
# Mode (guided / semi / auto)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- Mode unchanged this session: no config read or flip requested.
|
|
11
|
+
- Lane 0 direct work where autonomy level is irrelevant to the change.
|
|
12
|
+
|
|
8
13
|
The crew's autonomy level. Read once per wave at dispatch; a flip takes effect from the next wave, never mid-wave. Single source of truth for the mode contract — the consent invariants and the auto-GO gate live here; quality and testcases reference them.
|
|
9
14
|
|
|
10
15
|
## Levels
|
|
@@ -15,17 +20,18 @@ The crew's autonomy level. Read once per wave at dispatch; a flip takes effect f
|
|
|
15
20
|
| semi | present plan for user GO | auto | self-answer + log | log, no pause |
|
|
16
21
|
| auto | gated auto-GO | auto | self-answer + log | log, no pause |
|
|
17
22
|
|
|
18
|
-
Consent is an invariant in ALL levels — see below. Every level ends at push + ready PR + verdict; the crew never merges
|
|
23
|
+
Consent is an invariant in ALL levels — see below. Every level ends at push + ready PR + verdict (the user opens the PR); the crew never creates a PR, never merges, never deploys.
|
|
19
24
|
|
|
20
25
|
## Config
|
|
21
26
|
|
|
22
|
-
Two files,
|
|
27
|
+
Two files, four keys, `key=value` lines, optional `#` comments:
|
|
23
28
|
|
|
24
29
|
```
|
|
25
30
|
# .mugiwara/config (project) overrides ~/.mugiwara/config (global)
|
|
26
31
|
mode=guided
|
|
27
32
|
branch=feature/{type}-{issue}-{slug}
|
|
28
33
|
commit=conventional
|
|
34
|
+
base=main
|
|
29
35
|
```
|
|
30
36
|
|
|
31
37
|
| Key | Values | Default (no mugiwara branding) |
|
|
@@ -33,6 +39,14 @@ commit=conventional
|
|
|
33
39
|
| mode | guided / semi / auto | guided |
|
|
34
40
|
| branch | branch pattern | feature/{type}-{issue}-{slug} |
|
|
35
41
|
| commit | conventional / gitmoji / plain | conventional |
|
|
42
|
+
| base | PR summary target branch | main |
|
|
43
|
+
|
|
44
|
+
**Mode owns autonomy; config owns writing standards.** The mode key alone
|
|
45
|
+
decides whether branch/commit run automatically. The remaining keys shape HOW
|
|
46
|
+
artifacts are written — the `branch` naming pattern, the `commit` message
|
|
47
|
+
style, and `base` (the PR target named in the prepared PR summary per
|
|
48
|
+
`mugiwara-pr`). There is no autonomy key in config; a mode flip is the only
|
|
49
|
+
lever that changes behavior.
|
|
36
50
|
|
|
37
51
|
The `branch` value is a naming pattern, never executed: its placeholders (`{type}`/`{issue}`/`{slug}`) are filled from mission metadata and validated against a safe charset (alphanumerics, `-`, `_`) before any git command.
|
|
38
52
|
|
|
@@ -52,7 +66,7 @@ The plan proceeds past approval in `auto` ONLY with zero blocking ambiguities AN
|
|
|
52
66
|
|
|
53
67
|
## Terminal invariant
|
|
54
68
|
|
|
55
|
-
Every mode ends at: push the mission branch (per the `branch` key) → write the PR verdict file per `mugiwara-pr` → hand the branch + verdict to the user, who opens the PR. The crew never creates a PR, never merges, never deploys, never auto-reacts to review comments or CI in any mode. PR review is the terminal gate.
|
|
69
|
+
Every mode ends at: push the mission branch (per the `branch` key) → write the PR verdict file per `mugiwara-pr` (includes a ready PR summary; target per `base`) → hand the branch + verdict to the user, who opens the PR. The crew never creates a PR, never merges, never deploys, never auto-reacts to review comments or CI in any mode. PR review is the terminal gate.
|
|
56
70
|
|
|
57
71
|
## Rules
|
|
58
72
|
|
|
@@ -60,4 +74,4 @@ Every mode ends at: push the mission branch (per the `branch` key) → write the
|
|
|
60
74
|
2. Missing config on read = guided; the file is created only on a write.
|
|
61
75
|
3. State-mutating consent holds in every mode — auto never runs a state-mutating test against non-isolated / shared state without it.
|
|
62
76
|
4. Auto plan-GO is gated, never assumed.
|
|
63
|
-
5. The terminal is push + ready PR + verdict in every mode.
|
|
77
|
+
5. The terminal is push + ready PR + verdict in every mode — the crew never creates a PR.
|
|
@@ -5,6 +5,11 @@ description: Use when instrumenting, tracing, or debugging how the mugiwara crew
|
|
|
5
5
|
|
|
6
6
|
# Observability (Trace the Crew)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- Lane 0 direct work: no waves, no dispatches, nothing to trace.
|
|
11
|
+
- User explicitly declined tracing for this mission.
|
|
12
|
+
|
|
8
13
|
Make every mission replayable: one trace file, one line per dispatch, so you can see who ran what, how long, and where it failed.
|
|
9
14
|
|
|
10
15
|
## Trace log
|
|
@@ -5,6 +5,11 @@ description: Use to triage a new mission at the gateway, classify requests 5 way
|
|
|
5
5
|
|
|
6
6
|
# Orchestration (Luffy)
|
|
7
7
|
|
|
8
|
+
## Skip when
|
|
9
|
+
|
|
10
|
+
- No new mission to route: mid-wave continuation with the route already recorded.
|
|
11
|
+
- User drives the pipeline by hand via explicit stage commands.
|
|
12
|
+
|
|
8
13
|
Captain duties: triage, check-ins, work splitting, decisions, closure. Luffy coordinates — never implements code. You are embodied by the main thread; you RETURN decisions and verdicts to the conversation, you never dispatch another crew member yourself.
|
|
9
14
|
|
|
10
15
|
## Coordination files
|
|
@@ -31,6 +36,14 @@ Classify every incoming request:
|
|
|
31
36
|
|
|
32
37
|
Record decision + one-line reason at the top of the decision log (`.mugiwara/logs/YYYY-MM-DD-<mission>.md`). Risk (money/security/data/public API) → full pipeline; never shortcut without recording why. Any route without a recorded reason is a red flag.
|
|
33
38
|
|
|
39
|
+
## Lane routing (Wave 0, size before process)
|
|
40
|
+
|
|
41
|
+
Alongside the 5-way class, size the mission and pick a lane: Lane 0 (Direct) skips the pipeline entirely; Lane 1 (Lean) runs execute → quality; Lane 2 (Standard) runs plan → execute → checkpoint → review; Lane 3 (Full) runs all 9 waves; Lane 4 (Spike) runs brainstorm then re-sizes. Size from the diff: 1 file <20 LOC → Lane 0, 1-2 files → Lane 1, 3-8 files → Lane 2, 9+ files or auth/payment/migration paths → Lane 3, exploratory → Lane 4. Escalation only: a lane may rise mid-mission (diff grew, sensitive path touched, failures repeated), never drop. Record the chosen lane and its signal in the decision log.
|
|
42
|
+
|
|
43
|
+
## Spec bridge (Wave 0 → Wave 2)
|
|
44
|
+
|
|
45
|
+
Wave 1 (Usopp) writes the brainstorm output to `.mugiwara/spec/YYYY-MM-DD-<mission>.md` — the bridge Nami reads. A route straight to Wave 2 (Trivial / Explicit) skips Wave 1, so it MUST still write a spec file before planning: a short but complete statement of the goal, the acceptance criteria as given, and any constraints — taken from the user's request, not invented. Never start Wave 2 with `.mugiwara/spec/` empty: if no spec exists, write one from the request first (the `/mugiwara-plan` command reads this file). The spec is input to Nami, never the plan itself.
|
|
46
|
+
|
|
34
47
|
## Direct calls
|
|
35
48
|
|
|
36
49
|
The user may summon any crew member directly (e.g. "Nami, plan this"). Luffy still records the route plus the reason in the decision log so the harness stays coherent. Direct calls do not skip check-ins.
|
|
@@ -48,6 +61,10 @@ By mode (per `mugiwara-mode`): `guided` checks in with the user as today; `semi`
|
|
|
48
61
|
|
|
49
62
|
On drift: stop, diagnose with Chopper's ledger, decide continue / retry / escalate to human.
|
|
50
63
|
|
|
64
|
+
## Wave transitions (visibility)
|
|
65
|
+
|
|
66
|
+
Every wave opens with a visible main-thread banner `## Wave N — <crew> (<skill>)` and closes with the handoff line `→ Wave N+1 — <crew>` (Wave 9: `→ closure`). No wave starts without its banner. A wave intentionally omitted is never silent — record wave, owner, and reason in the decision log before moving on. The user must always see which crew runs now and who takes over next.
|
|
67
|
+
|
|
51
68
|
## Work splitting
|
|
52
69
|
|
|
53
70
|
When a wave has many independent tasks, instruct Zoro to parallelize — one task per WORKER subagent — and may split the mission into parallel tracks. Only `[PARALLEL]` sets are dispatched; sequential work stays inline. Never run more parallelism than the plan proves safe (check the dependency graph, no shared files). A `[PARALLEL]` task set with a hidden dependency edge is a red flag.
|
|
@@ -64,7 +81,21 @@ Recognize the in-session phrase `mugiwara mode <guided|semi|auto>`: write the pr
|
|
|
64
81
|
|
|
65
82
|
Gate — every task's acceptance criteria verified, every gate passed, findings resolved or explicitly deferred with an owner, blocker ledger reviewed, unused intermediate markdown files deleted. Write the closure report to `.mugiwara/results/YYYY-MM-DD-<mission>-closure.md`: mission summary, per-wave outcomes, deferred items, lessons learned. The plan doc stays untouched.
|
|
66
83
|
|
|
67
|
-
|
|
84
|
+
### Detailed closure summary (mandatory, inline)
|
|
85
|
+
|
|
86
|
+
Present a detailed summary to the user — never a one-liner:
|
|
87
|
+
|
|
88
|
+
- Mission summary — goal, mode, waves, task count.
|
|
89
|
+
- Per-wave outcome table — wave, tasks, status, evidence pointer.
|
|
90
|
+
- Gate verdicts — quality, gates (coverage/build/DoD), review + security findings with dispositions, e2e (run / skipped + why).
|
|
91
|
+
- Tests — unit/integration results; ATDD oracle verdict when user tests were declared.
|
|
92
|
+
- Risks / rollback — remaining risk and the rollback path (revert commit / feature flag).
|
|
93
|
+
- Deferred items + owner.
|
|
94
|
+
- Next steps — PR material pointer, anything the user must do.
|
|
95
|
+
|
|
96
|
+
### Terminal step (every mode, per `mugiwara-mode`)
|
|
97
|
+
|
|
98
|
+
Save-point commit → push the mission branch (per the config `branch` key, default `feature/{type}-{issue}-{slug}`) with plain `git push -u origin <branch>` → write `.mugiwara/results/YYYY-MM-DD-<mission>-pr-verdict.md` per the `mugiwara-pr` format (includes a ready PR summary block) → hand the branch + verdict file to the user, who opens the PR. The crew never creates a PR, never merges, never deploys, never auto-reacts to review comments or CI in any mode. On push failure (no auth / no remote), fall back to the local closure report and log the reason.
|
|
68
99
|
|
|
69
100
|
Lessons: at Wave 0 triage read `.mugiwara/logs/lessons.md` and surface relevant rows to the owning agent. At closure embody memory-keeper inline to append this mission's lessons to `.mugiwara/logs/lessons.md` — one row per real lesson, append-only, never overwrite.
|
|
70
101
|
|