@ionivetech/mugiwara 0.5.0 → 0.5.2

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 (53) hide show
  1. package/.opencode/plugins/mugiwara.mjs +7 -11
  2. package/content/skills/mugiwara-context-budget/SKILL.md +1 -1
  3. package/content/skills/mugiwara-frontend/SKILL.md +1 -1
  4. package/content/skills/mugiwara-healing/SKILL.md +1 -1
  5. package/content/skills/mugiwara-orchestration/SKILL.md +1 -1
  6. package/content/skills/mugiwara-planning/SKILL.md +1 -1
  7. package/content/skills/mugiwara-proof-order/SKILL.md +1 -1
  8. package/content/skills/mugiwara-quality/SKILL.md +1 -1
  9. package/content/skills/mugiwara-review/SKILL.md +1 -1
  10. package/content/skills/mugiwara-root-cause/SKILL.md +1 -1
  11. package/content/skills/mugiwara-security/SKILL.md +1 -1
  12. package/content/skills/mugiwara-sunset/SKILL.md +1 -1
  13. package/content/skills/mugiwara-testcases/SKILL.md +1 -1
  14. package/content/skills/mugiwara-workflow/SKILL.md +1 -1
  15. package/dist/mugiwara.js +36 -4
  16. package/evals/cases/_no-skill.json +16 -0
  17. package/evals/cases/adversarial-pressure-fake-pass.json +21 -8
  18. package/evals/cases/adversarial-pressure-skip-review.json +19 -7
  19. package/evals/cases/lane-exploratory-vague.json +18 -6
  20. package/evals/cases/lane-sensitivity-payment.json +18 -6
  21. package/evals/cases/positive-refactor-existing-tests.json +21 -7
  22. package/evals/cases/positive-resume-mid-mission.json +20 -7
  23. package/evals/cases/routing-agent-security.json +25 -0
  24. package/evals/cases/routing-auth-feature.json +20 -7
  25. package/evals/cases/routing-backend.json +25 -0
  26. package/evals/cases/routing-bug-one-file.json +20 -7
  27. package/evals/cases/routing-claim-audit.json +25 -0
  28. package/evals/cases/routing-context-budget.json +25 -0
  29. package/evals/cases/routing-contract-first.json +25 -0
  30. package/evals/cases/routing-execution.json +25 -0
  31. package/evals/cases/routing-frontend.json +26 -0
  32. package/evals/cases/routing-gates.json +25 -0
  33. package/evals/cases/routing-git.json +25 -0
  34. package/evals/cases/routing-healing.json +25 -0
  35. package/evals/cases/routing-lessons.json +25 -0
  36. package/evals/cases/routing-orchestration.json +25 -0
  37. package/evals/cases/routing-planning.json +26 -0
  38. package/evals/cases/routing-pr.json +25 -0
  39. package/evals/cases/routing-proof-order.json +25 -0
  40. package/evals/cases/routing-quality.json +25 -0
  41. package/evals/cases/routing-ship.json +26 -0
  42. package/evals/cases/routing-sunset.json +25 -0
  43. package/evals/cases/routing-workflow.json +25 -0
  44. package/evals/floor.json +6 -0
  45. package/package.json +2 -1
  46. package/scripts/probe.ts +40 -0
  47. package/scripts/retrieval-eval.ts +178 -69
  48. package/scripts/run-evals.ts +56 -20
  49. package/scripts/savepoint.sh +5 -4
  50. package/src/targets/opencode.ts +40 -3
  51. package/evals/cases/negative-secrets-typo.json +0 -12
  52. package/evals/cases/negative-security-docs-change.json +0 -12
  53. package/evals/cases/routing-typo.json +0 -13
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-contract-first",
3
+ "skill": "mugiwara-contract-first",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "design the API contract for the new payment service", "top_k": 3 },
7
+ { "prompt": "define the interface and error semantics before implementing", "top_k": 3 },
8
+ { "prompt": "make sure this API change is backward compatible", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "write the implementation for the payment handler" },
12
+ { "prompt": "add a database migration for the new field" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Design the API contract for a new service before any implementation starts.",
18
+ "rubric": [
19
+ "defines the contract before any implementation",
20
+ "specifies error semantics and boundary validation",
21
+ "checks backward compatibility with existing consumers"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-execution",
3
+ "skill": "mugiwara-execution",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "execute the approved plan step by step", "top_k": 3 },
7
+ { "prompt": "implement the todo list from the plan", "top_k": 3 },
8
+ { "prompt": "carry out the tasks in parallel batches and commit each one", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "let's brainstorm the architecture first" },
12
+ { "prompt": "review the plan for gaps before we start" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Execute the approved plan: 3 parallel tasks covering auth middleware, database migration, and API handlers.",
18
+ "rubric": [
19
+ "processes the todo list sequentially",
20
+ "runs independent tasks in parallel batches",
21
+ "commits per logical task with evidence"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "routing-frontend",
3
+ "skill": "mugiwara-frontend",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "redesign the dashboard page with responsive layout", "top_k": 3 },
7
+ { "prompt": "make this form accessible with proper ARIA labels", "top_k": 3 },
8
+ { "prompt": "create a reusable button component from the design tokens", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "add a REST endpoint for the user dashboard data" },
12
+ { "prompt": "design the database schema for user settings" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Redesign the settings page component with responsive breakpoints and WCAG 2.1 AA compliance.",
18
+ "rubric": [
19
+ "matches existing repo component patterns",
20
+ "extracts design tokens from the existing system",
21
+ "implements responsive behavior",
22
+ "meets WCAG 2.1 AA accessibility standards"
23
+ ]
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-gates",
3
+ "skill": "mugiwara-gates",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "check if the coverage threshold is met before we merge", "top_k": 3 },
7
+ { "prompt": "verify the definition of done — build, lint, tests all pass", "top_k": 3 },
8
+ { "prompt": "verify coverage thresholds, build exit code, and definition of done", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "run the formatter and linter on the changed files" },
12
+ { "prompt": "review the diff for stylistic issues" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "The quality checks finished. Now verify if the coverage thresholds are met and the build passes.",
18
+ "rubric": [
19
+ "checks coverage thresholds with binary verdicts",
20
+ "verifies build exit code is zero",
21
+ "does not negotiate or weaken thresholds"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-git",
3
+ "skill": "mugiwara-git",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "commit these changes with atomic commits per logical unit", "top_k": 3 },
7
+ { "prompt": "split this diff into separate commits by topic", "top_k": 3 },
8
+ { "prompt": "find which commit introduced this bug using bisect", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "push the branch and open a pull request" },
12
+ { "prompt": "deploy the release to production" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Split the staged changes into atomic commits: one for the refactor, one for the new feature, one for the tests.",
18
+ "rubric": [
19
+ "creates atomic commits per logical change",
20
+ "detects the repo's commit style",
21
+ "does not push or open a PR"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-healing",
3
+ "skill": "mugiwara-healing",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "the previous execution wave failed, fix what is broken", "top_k": 3 },
7
+ { "prompt": "there are blockers in the ledger, triage and fix them", "top_k": 3 },
8
+ { "prompt": "the blocker ledger has entries, stop the line and fix them", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "execute the next wave in the plan" },
12
+ { "prompt": "add a new feature to the backlog" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "The test suite failed after the last wave. The blocker ledger has 3 entries. Fix the failures.",
18
+ "rubric": [
19
+ "reads the blocker ledger before taking action",
20
+ "applies stop-the-line triage",
21
+ "proves the fix before moving to next wave"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-lessons",
3
+ "skill": "mugiwara-lessons",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "capture what we learned from this mission", "top_k": 3 },
7
+ { "prompt": "read past lessons before starting the new mission", "top_k": 3 },
8
+ { "prompt": "update the cross-mission lessons ledger with new insights", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "log this error in the application monitoring system" },
12
+ { "prompt": "write a retrospective document for the team" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "The mission is complete. Capture lessons learned and append them to the cross-mission ledger.",
18
+ "rubric": [
19
+ "reads past lessons at triage",
20
+ "captures new lessons at closure",
21
+ "appends to the append-only ledger"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-orchestration",
3
+ "skill": "mugiwara-orchestration",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "triage this new feature request and decide the lane size", "top_k": 3 },
7
+ { "prompt": "classify this mission and coordinate the execution waves", "top_k": 3 },
8
+ { "prompt": "captain a new mission — classify, size, dispatch, check in", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "implement the feature described in the ticket" },
12
+ { "prompt": "write code for the database migration" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "A new mission request arrived. Classify it, size the lane, and dispatch the appropriate waves.",
18
+ "rubric": [
19
+ "performs 5-way classification before any action",
20
+ "sizes the lane based on sensitivity and scope",
21
+ "coordinates waves without implementing code"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "routing-planning",
3
+ "skill": "mugiwara-planning",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "turn this spec into an execution plan with parallel waves", "top_k": 3 },
7
+ { "prompt": "plan the implementation approach before writing any code", "top_k": 3 },
8
+ { "prompt": "break down the feature into tasks and estimate the effort", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "just write the code for this simple bug fix" },
12
+ { "prompt": "brainstorm different architecture options" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Turn the approved feature spec into a detailed execution plan with parallel-proof waves and context scan.",
18
+ "rubric": [
19
+ "interviews before planning",
20
+ "performs a full context scan",
21
+ "produces parallel-proof waves",
22
+ "scales the plan to the request scope"
23
+ ]
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-pr",
3
+ "skill": "mugiwara-pr",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "push this branch and prepare the pull request description", "top_k": 3 },
7
+ { "prompt": "write the PR summary with a verdict file", "top_k": 3 },
8
+ { "prompt": "prepare the branch for review, push it and generate PR material", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "merge this pull request into main" },
12
+ { "prompt": "create a release tag for this version" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "The mission is complete. Push the branch and prepare PR material including a verdict file.",
18
+ "rubric": [
19
+ "does a plain git push",
20
+ "generates a verdict file with ready PR summary",
21
+ "never creates the PR, merges, or deploys"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-proof-order",
3
+ "skill": "mugiwara-proof-order",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "write the test first before implementing the function", "top_k": 3 },
7
+ { "prompt": "use TDD — red green refactor for this feature", "top_k": 3 },
8
+ { "prompt": "prove the behavior with a failing test, then implement", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "run the existing unit test suite that was written last week" },
12
+ { "prompt": "run the acceptance tests defined by the user" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Implement a new utility function. Write the test first, then the implementation, then refactor.",
18
+ "rubric": [
19
+ "follows RED-GREEN-REFACTOR discipline",
20
+ "writes the test before the implementation",
21
+ "one test = one behavior"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-quality",
3
+ "skill": "mugiwara-quality",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "run eslint and prettier on the changed files", "top_k": 3 },
7
+ { "prompt": "format the code and run the linter before committing", "top_k": 3 },
8
+ { "prompt": "run the project test suite and check for lint errors", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "check if the coverage threshold is met" },
12
+ { "prompt": "review the diff for breaking changes" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "After the checkpoint passes, run the formatter, linter, and unit tests for the project.",
18
+ "rubric": [
19
+ "discovers the project's lint and format tooling",
20
+ "runs the unit test suite",
21
+ "never weakens or changes existing configs"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "routing-ship",
3
+ "skill": "mugiwara-ship",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "run the pre-launch checklist and give a go no-go decision", "top_k": 3 },
7
+ { "prompt": "prepare the staged rollout plan with a rollback strategy", "top_k": 3 },
8
+ { "prompt": "verify feature flags and ship checklist before deployment", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "push the branch to GitHub" },
12
+ { "prompt": "deploy the build artifact to the server" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "The mission is complete and all gates passed. Run the pre-launch checklist and give a GO/NO-GO.",
18
+ "rubric": [
19
+ "runs the pre-launch checklist",
20
+ "checks feature flags and staged rollout plan",
21
+ "requires a mandatory rollback plan",
22
+ "gives a binary GO/NO-GO verdict"
23
+ ]
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-sunset",
3
+ "skill": "mugiwara-sunset",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "remove the old v1 API endpoints and retire them safely", "top_k": 3 },
7
+ { "prompt": "delete the legacy payment module and migrate to v2", "top_k": 3 },
8
+ { "prompt": "deprecate this old endpoint and phase it out over two releases", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "add a new version of the payment API" },
12
+ { "prompt": "refactor the v2 endpoint handler for performance" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "Retire the legacy v1 payment endpoints. They have been replaced by v2 for 6 months.",
18
+ "rubric": [
19
+ "runs the keep-or-retire gate before any removal",
20
+ "plans a phased cutover with safe DB migrations",
21
+ "every removal has a tested way back"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "routing-workflow",
3
+ "skill": "mugiwara-workflow",
4
+ "trigger": {
5
+ "positive": [
6
+ { "prompt": "start a new mission for this feature — run the full pipeline", "top_k": 3 },
7
+ { "prompt": "run the complete workflow from triage to closure", "top_k": 3 },
8
+ { "prompt": "we have a non-trivial task, kick off the 9-wave pipeline", "top_k": 3 }
9
+ ],
10
+ "negative": [
11
+ { "prompt": "fix this one-line typo in the README" },
12
+ { "prompt": "just run the tests and close the mission" }
13
+ ]
14
+ },
15
+ "behavioral": [
16
+ {
17
+ "task": "A new non-trivial feature request arrived. Run the full mugiwara pipeline from triage to closure.",
18
+ "rubric": [
19
+ "starts with Luffy triage gateway",
20
+ "sequences through brainstorm/plan/execute/checkpoint/quality/gates/review/heal/closure waves",
21
+ "does not skip waves for non-trivial missions"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "rank1": 88.2,
3
+ "topk": 100,
4
+ "negatives": 100,
5
+ "updated": "2026-08-11"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionivetech/mugiwara",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",
@@ -43,6 +43,7 @@
43
43
  "evals": "bun scripts/run-evals.ts",
44
44
  "retrieval-eval": "bun scripts/retrieval-eval.ts",
45
45
  "sync-version": "bun scripts/sync-version.ts",
46
+ "gate": "bun run typecheck && bun run test && bun run build && bun scripts/validate-content.ts --check-manifest --check-docs && bun scripts/run-evals.ts && bun scripts/retrieval-eval.ts",
46
47
  "prepack": "bun run build && bun run sync-version"
47
48
  },
48
49
  "keywords": [
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bun
2
+ // Ad-hoc retrieval probe. Usage: bun scripts/probe.ts "your prompt here"
3
+
4
+ import { readdirSync, readFileSync, existsSync, statSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { parseFrontmatter } from '../src/frontmatter.ts';
7
+
8
+ const skillsDir = join(import.meta.dirname, '..', 'content', 'skills');
9
+ const STOP = ['the', 'and', 'for', 'use', 'when', 'that', 'with', 'this', 'from', 'its', 'not', 'are', 'has'];
10
+ const tok = (t: string) => t.toLowerCase().replace(/[^a-z0-9\s-]/g, ' ')
11
+ .split(/\s+/).filter(x => x.length > 1 && !STOP.includes(x));
12
+
13
+ const terms = new Map<string, number>();
14
+ const docs = new Map<string, Map<string, number>>();
15
+ for (const d of readdirSync(skillsDir).filter(d => statSync(join(skillsDir, d)).isDirectory())) {
16
+ const f = join(skillsDir, d, 'SKILL.md');
17
+ if (!existsSync(f)) continue;
18
+ const { data } = parseFrontmatter(readFileSync(f, 'utf8'));
19
+ const tf = new Map<string, number>();
20
+ for (const t of tok(data.description ?? '')) {
21
+ tf.set(t, (tf.get(t) || 0) + 1);
22
+ terms.set(t, (terms.get(t) || 0) + 1);
23
+ }
24
+ docs.set(d, tf);
25
+ }
26
+
27
+ const N = docs.size;
28
+ const prompt = process.argv.slice(2).join(' ');
29
+ const ranked = [...docs.keys()].map(d => {
30
+ let s = 0;
31
+ for (const t of tok(prompt)) {
32
+ const tf = docs.get(d)!.get(t) || 0;
33
+ if (tf) s += tf * Math.log(N / (terms.get(t) || 1));
34
+ }
35
+ return { d, s };
36
+ }).sort((a, b) => b.s - a.s);
37
+
38
+ console.log(`"${prompt}"\n`);
39
+ ranked.slice(0, 8).forEach((r, i) =>
40
+ console.log(` ${String(i + 1).padStart(2)}. ${r.d.padEnd(28)} ${r.s.toFixed(2)}`));