魔法 — mahou is Japanese for "magic".
A portable set of opencode slash commands that enforce disciplined software engineering workflows — debugging, review, brainstorm, orchestration, and project lifecycle management.
No plugins, no MCP servers, no npm dependencies. Just markdown command files and reference docs.
- Background
- Install
- Usage
- Quick Reference
- Commands
- Workflows
- Architecture
- Repository Structure
- Contributing
- License
- Changelog
opencode ships built-in plan and build agents that do the work. mahou
commands enforce how the work is done — root cause before fix, verify before
report, design before code, ship after verify.
The framework operates across three layers:
- Project layer — initialize projects, research approaches, map existing codebases. Produces PROJECT.md, ROADMAP.md, and map.md for cross-feature context.
- Feature layer — brainstorm specs, orchestrate implementation, review code, verify against spec. The core build cycle with feedback loops.
- Lifecycle layer — resume sessions, ship PRs. Closes the loop between implementation and delivery.
Each command is a markdown file with YAML frontmatter. opencode reads the frontmatter to register the slash command, route it to an agent, and assign a model. The body becomes the command's prompt.
- Tool access is enforced at the agent level, not requested. The
agent:frontmatter routes read-only commands (ask,review,verify,secure,resume,ship,orchestrator) to themahou-readonlyagent, which deniesedit/writeand destructive bash at the tool level. Design/project commands (brainstorm,new-project,init,postmortem) run undermahou-planner, which denies every file write outside./.mahou/**. opencode's command frontmatter does not support atools:field — enforcement comes from these agents. - Role subagents carry their own enforcement. The orchestrator dispatches
implementer,spec-reviewer,code-quality-reviewer, andintegration-reviewersubagents; review dispatchesissue-verifier. Each is a real opencode agent with tool-level permission config (reviewers denyedit/write), not just a prompt template. The orchestrator's own agent restricts the Task tool to exactly these subagents viapermission.task. - Reference docs load via
@-includes. Command bodies use@{{MAHOU_HOME}}/skills/<name>/SKILL.mdto pull in technique guides. The same skills are also installed to~/.config/opencode/skills/for the native skill tool (on-demand, permission-gated per agent). - Zero structural token cost. Nothing auto-injects on every prompt. All context loads only when a command is invoked. Heavy data (web pages, large file reads) stays inside subagent disposable context.
- No runtime dependencies. Everything is static markdown, one TypeScript plugin (compaction persistence), and one TypeScript tool (vision fallback). Nothing is downloaded from the internet. No MCP servers, no telemetry.
- opencode installed and working
- That's it. No npm dependencies, no plugins, no MCP servers.
cd mahou
.\install.ps1cd mahou
chmod +x install.sh
./install.shAfter install, restart opencode for the new commands to appear.
mahou was previously named magic-pi-opencode. The installer does not remove
the old global files. If you upgraded, clean up the legacy install once:
# Windows (PowerShell)
Remove-Item "$env:USERPROFILE\.config\opencode\magic-pi" -Recurse -Force
Remove-Item "$env:USERPROFILE\.config\opencode\command\magic*.md" -Force# macOS / Linux (bash)
rm -rf ~/.config/opencode/magic-pi
rm -f ~/.config/opencode/command/magic*.mdExisting project artifacts live in ./.magic-pi/; rename the folder to
./.mahou/ so the rebranded commands can find them:
mv ./.magic-pi ./.mahou- Copies
commands/*.mdto~/.config/opencode/commands/, replacing{{MAHOU_HOME}}with the resolved absolute path (for@-include compatibility). - Copies
agents/to~/.config/opencode/agents/(permission-enforced agents),skills/to~/.config/opencode/skills/and~/.config/opencode/mahou/skills/(skill-tool discovery +@-include),plugins/to~/.config/opencode/plugins/, andtools/to~/.config/opencode/tools/. - Copies
references/to~/.config/opencode/mahou/references/(subagent prompt templates + scripts). - Cleans up legacy singular-dir installs (
~/.config/opencode/command/). - Nothing is downloaded from the internet. No dependencies required.
.\install.ps1 -Uninstall # Windows./install.sh --uninstall # Unix/mahou-new-project I want to build an e-commerce platform with React + Node + Postgres
/mahou-research --explore e-commerce architecture patterns
/mahou-brainstorm auth subsystem
/mahou-orchestrator ./.mahou/plans/<uuid>.md
/mahou-verify
/mahou-ship
If verify returns REPLAN, go back to brainstorm. If FIX_FORWARD, use
/mahou-debug.
If you already have a project and just want to build one feature:
/mahou-brainstorm I want to add a webhook system for real-time notifications
/mahou-orchestrator ./.mahou/plans/<uuid>.md
/mahou-verify
/mahou-ship
/mahou-resume
/mahou-orchestrator ./.mahou/plans/<uuid>.md ← resumes from last task
| Command | Purpose | Access |
|---|---|---|
/mahou |
List all mahou commands | read-only |
/mahou-new-project |
Initialize project — PROJECT.md + ROADMAP.md | full (.mahou/ only) |
/mahou-init |
Generate codebase map for existing projects | full (.mahou/ only) |
/mahou-research |
Internet research — explore, diagnose, or lookup | full (webfetch) |
/mahou-ask |
Answer questions / explain code without changes | read-only |
/mahou-debug |
Systematic root-cause debugging (4 phases) | full |
/mahou-review |
Code review of existing scope (discover, triage, verify, report) | read-only |
/mahou-brainstorm |
Design to spec to implementation plan | spec/plan writable |
/mahou-designer |
Design and ship production-grade frontend interfaces | full |
/mahou-orchestrator |
Execute a plan task-by-task via subagents with two-stage review | read-only (delegates) |
/mahou-ultracode |
Max-effort execution via large-scale parallel subagent waves | full |
/mahou-verify |
Verify implementation against spec — PASS, FIX_FORWARD, or REPLAN | read-only |
/mahou-secure |
Security verification of a change — PASS, FIX, or ESCALATE | read-only |
/mahou-resume |
Resume work from previous session with reconciliation | read-only |
/mahou-ship |
Push branch, create PR, filter .mahou/ artifacts | read-only + bash |
/mahou-postmortem |
Write a post-mortem for a resolved incident | .mahou/ only |
What it does: Answers questions and explains code without making any changes.
When to use: When you want to understand how code works, trace logic, or explore a codebase without risk of accidental edits.
Process: Direct answer — no phases. Reads the relevant code and explains
with specific file:line references. If the question is ambiguous, asks for
clarification first. If you ask it to make changes, it redirects you to
/mahou-debug, /mahou-brainstorm, or the build agent.
Tools & access: Read-only — read, bash, grep, glob. No edit or
write tools are available.
Examples:
/mahou-ask How does the retry logic in the HTTP client work?
/mahou-ask What does the PaymentService class depend on?
What it does: Systematic root-cause debugging. Finds and fixes the root cause, not the symptom.
When to use: Any technical issue — test failures, bugs, unexpected behavior, performance problems, build failures, integration issues.
Process: Four phases, each completed before the next:
- Root Cause Investigation — read error messages carefully, reproduce
consistently, check recent changes (
git diff,git log,git bisect), gather evidence at component boundaries, trace data flow backward to where bad values originate. - Pattern Analysis — find similar working code in the codebase, compare against the reference implementation, identify every difference.
- Hypothesis & Testing — form a single hypothesis, test the smallest possible change, verify before continuing. If it doesn't work, form a new hypothesis — don't stack fixes.
- Implementation — create a failing test case, implement a single fix at the root cause, verify with the verification-before-completion discipline (run the failing repro AND the relevant suite, report the evidence), then harden with defense-in-depth and a regression test.
If systematic investigation reveals a genuinely environmental/timing/external issue, document what was investigated, add graceful handling (retry, timeout, error message) and monitoring — but 95% of "no root cause" cases are incomplete investigation.
Iron law: No fixes without root cause investigation first. If you haven't completed Phase 1, you cannot propose fixes.
Tools & access: Full — read, write, edit, bash, grep, glob,
agent. Investigation (Phases 1-3) is read-only; fixes (Phase 4) use
edit/write.
Subagents: Dispatches explore subagents (read-only) for Phase 1-2
investigation — locating failing code paths, mapping data flow, finding
working examples. Runs independent research questions in parallel.
Examples:
/mahou-debug The auth tests are failing intermittently after the refactor
/mahou-debug Payment webhook returns 500 for amounts over $1000
What it does: Code review of an existing scope. Finds real issues, verifies them independently, and reports only what survives verification.
When to use: When you want to review a module, feature, directory, or PR.
For a single specific bug, use /mahou-debug instead.
Process: Four phases:
- Discovery — parse the scope, find relevant files, read each one, identify
key responsibilities and dependencies. Dispatches
exploresubagents for broad areas. Detects UI surfaces and loads UI critique methodology if applicable. - Triage — lists potential issues across categories: Correctness (logic bugs, race conditions, dead code), Security (injection, auth bypass, secrets), Performance (N+1 queries, memory leaks, quadratic algorithms), Architecture (circular dependencies, god modules, tight coupling), and UI/UX (interaction states, cognitive load, AI slop, accessibility) when UI is in scope. No style or formatting nits.
- Verification — for each issue, an independent
generalsubagent reads the actual code and returns CONFIRMED, REFUTED, or UNDETERMINED. Verifiers are read-only by instruction. Dispatched in parallel. UI issues use two-assessment synthesis (design review + code inspection). - Final Report — reports only confirmed issues with evidence and fix suggestions. Refuted and undetermined issues are listed separately.
Tools & access: Read-only — read, bash, grep, glob, agent. No
edit or write tools are available.
Examples:
/mahou-review src/services/payment/
/mahou-review Review the auth module for security issues
What it does: Turns a vague idea into a validated design spec and a detailed implementation plan through collaborative dialogue — without touching the codebase.
When to use: When designing a new feature or subsystem before implementation.
Process: A 13-step checklist:
- Explore project context — reads PROJECT.md, ROADMAP.md, prior dependent specs, research briefs, codebase map, relevant files, and recent commits.
- Scope check — flag if the request spans multiple independent subsystems.
- Ask clarifying questions, one at a time, multiple choice preferred.
- Propose 2-3 approaches with trade-offs.
- Present the design in sections, getting approval after each. Enumerate key states for UI features (default, empty, loading, error, success, edge cases). Run AI slop test for visual direction.
- Write the spec to
./.mahou/specs/<uuid>.md. Adaptive depth: compact form for clear requests, full structured form for ambiguous ones. - Spec self-review (unfilled tokens, consistency, scope, ambiguity).
- User reviews the spec.
- Write the implementation plan to
./.mahou/plans/<uuid>.md. - Plan self-review.
- User reviews the plan.
- Update ROADMAP.md — set feature status to planned.
- Hand off to
/mahou-orchestratoror the build agent.
Hard gate: No code, scaffolding, or implementation action until the design is presented AND approved. This applies to every request regardless of perceived simplicity.
Replan support: If returning from /mahou-verify with a REPLAN verdict,
appends to the spec's revision log (round N+1) without overwriting prior
rounds. Revises only affected sections.
Tools & access: Full tool access in frontmatter (read, write, edit,
bash, grep, glob, agent). The command's prompt enforces read-only
behavior on the codebase — it may ONLY use write/edit on spec, plan, and
ROADMAP documents under ./.mahou/.
Example:
/mahou-brainstorm I want to add a webhook system for real-time notifications
Output is spec and plan files under ./.mahou/, not code changes.
What it does: Executes an implementation plan task-by-task via subagents, with two-stage review after each task.
When to use: When you have a plan (typically from /mahou-brainstorm) and
the tasks are mostly independent. For a single focused change, use the build
agent instead.
Process: Per-task cycle:
- Baseline verification gate — before any task, run the test suite and
build once and record the result in state.json. A red baseline stops the
orchestration (routes to
/mahou-debug); implementing on a red baseline makes every later failure uninterpretable. - Capture the BASE_SHA (
git rev-parse HEAD). - Dispatch an implementer subagent with the full task text pasted into the prompt (the subagent never reads the plan file).
- Handle the implementer's status: DONE, DONE_WITH_CONCERNS,
BLOCKED, or NEEDS_CONTEXT. On external unknowns, dispatches a
research subagent with
webfetchaccess. - Dispatch a spec compliance reviewer — verifies the implementer built what was requested, nothing more, nothing less. Loop until it passes.
- Dispatch a code quality reviewer — verifies the implementation is clean, tested, and maintainable. Loop until Approved.
- Mark the task complete, update state.json and ROADMAP.md.
- Every N tasks (default 3): dispatch an integration reviewer to check seam bugs between tasks.
Review loops re-dispatch the same implementer with the receiving-code-review discipline (fix, don't argue; push back only with code evidence; re-verify; report deltas). Implementers must verify before reporting DONE — the verification-before-completion discipline.
After all tasks: a final code review for the entire implementation, then branch finish guidance.
Two-stage review: Spec compliance runs first (did they build what was asked?), then code quality (is it well-built?). The order is mandatory — code quality review does not start until spec compliance passes.
Tools & access: Read-only orchestrator — read, bash, grep, glob,
agent. No edit or write tools. Subagents handle all writes and commits.
May write to state.json and ROADMAP.md via bash.
Model selection: Uses ./.mahou/models.json (task/role -> model mapping) if
present; otherwise the session's model — the opencode default. See "Model
selection" below.
Example:
/mahou-orchestrator ./.mahou/plans/<uuid>.md
Integration: Upstream from /mahou-brainstorm (produces the plan).
Downstream to /mahou-verify after all tasks pass review.
What it does: Initializes a new project with deep context gathering, producing PROJECT.md (project context, architecture, conventions, decisions log) and ROADMAP.md (feature breakdown, dependencies, build order, status tracking).
When to use: Once per project, before any feature brainstorming. This creates the project layer that all subsequent features reference.
Tools & access: Full — read, write, bash, grep, glob, agent. Writes
ONLY to ./.mahou/PROJECT.md and ./.mahou/ROADMAP.md.
Example:
/mahou-new-project I want to build an e-commerce platform with React + Node + Postgres
What it does: Generates a codebase map (./.mahou/map.md) for an
existing project. Maps modules, responsibilities, dependencies, patterns,
and entry points. Does NOT generate AGENTS.md files (preserves zero
structural token cost).
When to use: Once per existing codebase, before working on features in
it. For new projects from scratch, use /mahou-new-project instead.
Tools & access: Full — read, write, bash, grep, glob, agent. Writes
ONLY to ./.mahou/map.md.
What it does: Internet-connected research using Yahoo/Bing search via
the native webfetch tool. Three modes:
--explore(default): broad comparative research. Dispatches 3-5 subagents in parallel, each fetching 2-3 pages. Returns a synthesized brief saved to./.mahou/research/<uuid>.md.--diagnose: narrow deep-dive. Dispatches 1 subagent for a specific question (3-5 pages). Returns a targeted answer saved to./.mahou/research/<uuid>.md.--lookup: quick factual lookup. Direct fetch in main context (1 page, inline answer, no file saved).
When to use: Before /mahou-brainstorm to research approaches, or
during /mahou-debug to check how upstream code works.
Tools & access: Full — read, bash, grep, glob, agent, webfetch.
Heavy fetching happens inside isolated subagents (explore/diagnose) to keep
main context lean.
Examples:
/mahou-research --explore compare Drizzle vs Prisma for Postgres
/mahou-research --diagnose why does SQLite WAL mode cause lock errors
/mahou-research --lookup what port does Express default to
What it does: Verifies implementation against spec. Dispatches verifier subagents per UAT criterion, synthesizes verdicts, and produces a routing verdict: PASS, FIX_FORWARD (route to /mahou-debug), or REPLAN (route to /mahou-brainstorm).
When to use: After /mahou-orchestrator completes all tasks for a
feature. This is the gate between implementation and shipping.
Tools & access: Read-only — read, bash, grep, glob, agent.
What it does: Restores session context after restart. Reads state.json, identifies the last in-progress task, runs git-diff reconciliation to detect manual changes, and routes back to the orchestrator.
When to use: After restarting opencode mid-orchestration.
Tools & access: Read-only — read, bash, grep, glob.
What it does: Pushes branch, creates PR with auto-generated body sourced
from spec, plan, state, and verification report. Filters .mahou/
planning artifacts from the PR diff.
When to use: After /mahou-verify returns PASS.
Process: Runs a test gate before pushing — the project's test suite
must pass or the ship stops and routes to /mahou-debug. Never push a red
branch.
Tools & access: Read-only + bash — read, bash, grep, glob.
What it does: Designs AND ships production-grade frontend interfaces to a studio bar — not prototypes. Runs the impeccable design discipline: read the room, shape before build, build to the bar, inspect and iterate, with the two-altitude AI slop test, absolute bans (side-stripe borders, gradient text, glassmorphism-as-default, hero-metric template, eyebrow labels), and brand/product registers. Critique is an intent inside the command (report-only unless asked to fix).
When to use: Frontend interface work — design, redesign, polish, or critique of websites, landing pages, dashboards, product UI. Not for backend-only work.
Tools & access: Full (designs AND builds). Runs on the session's model
(see "Model selection"). Loads mahou-design-craft skill for the craft and
critique framework.
Example:
/mahou-designer Redesign the settings page with a better information hierarchy
What it does: Max-effort execution for work too large for one context window: codebase-wide audits, large migrations, multi-file refactors, cross-checked research. Fans out subagent waves (≤16 concurrent) via the Task tool, runs adversarial verification passes, fix-until-green loops, and multi-angle planning, then returns one coordinated, verified answer.
When to use: 50+ files, 100+ items, whole-repo sweeps. For vague or
green-field projects it defers to /mahou-brainstorm or the plan agent first,
and confirms scope before fanning out writers.
Tools & access: Full. Loads mahou-ultracode-patterns skill for the wave
patterns and budget rules.
Example:
/mahou-ultracode Audit the entire codebase for missing auth checks and fix them
What it does: Security verification gate before shipping. Reviews the
change's diff against 7 categories (secrets, injection, authz, data exposure,
input validation, dependencies, crypto), verifies each triaged issue via
independent subagents (CONFIRMED / REFUTED / UNDETERMINED), and produces a
verdict: PASS (→ /mahou-ship), FIX (→ /mahou-debug), or ESCALATE (→
/mahou-brainstorm). Writes a report to ./.mahou/verify/secure-<uuid>.md.
When to use: After /mahou-verify returns PASS and the change is
security-sensitive (auth, payments, user data, secrets, network input).
Tools & access: Read-only via the mahou-readonly agent.
Example:
/mahou-secure <feature name or commit range>
What it does: Produces a post-mortem for a resolved bug or incident —
timeline, root cause analysis, the fix, defense-in-depth applied, and
monitoring follow-ups — written to ./.mahou/postmortems/<uuid>.md. The
codebase stays untouched.
When to use: After a bug is fixed and verified (typically after
/mahou-debug), to preserve the learning.
Tools & access: Runs under the mahou-planner agent — writes ONLY to
./.mahou/postmortems/ (tool-enforced).
Example:
/mahou-postmortem The intermittent auth test failure we just root-caused
Mahou never hardcodes a provider or model ID. Which model a command runs on resolves in this order:
- Project config — a repository can set its own default by adding an
opencode.jsonin the repo root with"model": "provider-id/model-id". It overrides everything below and is safe to commit. - Global config —
~/.config/opencode/opencode.json"model"is the machine-wide default. - Session — whatever model the current session uses (set via
/modelsoropencode run --model ...). With no config, opencode uses its own default.
For per-role model routing during orchestration, a repository can provide
.mahou/models.json (schema below; a local example lives at
.mahou/models.json.example). It maps task categories and subagent roles to
model IDs:
{
"default": "provider-id/model-id",
"roles": {
"implementer": "provider-id/model-id",
"spec-reviewer": "provider-id/model-id",
"code-quality-reviewer": "provider-id/model-id",
"integration-reviewer": "provider-id/model-id"
},
"tasks": {
"mechanical": "provider-id/model-id",
"standard": "provider-id/model-id",
"capable": "provider-id/model-id"
}
}- If
.mahou/models.jsonexists, the orchestrator (/mahou-orchestrator) and/mahou-ultracodeuse it to pick models for dispatch and reporting, falling back to itsdefaultfor anything unmapped. - If it does not exist, mahou falls back to the session's model — the opencode default. Mahou never invents a provider ID.
.mahou/models.jsonis machine-specific (provider IDs). The.mahou/directory is gitignored in this repo; keep the example local.
OpenCode applies model config at load time. A repo's model choice takes effect
when opencode starts in that repo (repo opencode.json) or when you set it
with /models in a session. Plugins have no config hook, so .mahou/models.json
cannot auto-switch the active model — when it calls for a different model than
the session is running, the orchestrator asks you to set it via /models
before dispatching subagents. Subagents inherit the dispatcher's model unless
an agent's config pins one.
When something is broken, reach for /mahou-debug. It runs the 4-phase
discipline end-to-end — investigation, pattern analysis, hypothesis, fix, and
hardening.
/mahou-debug The auth tests are failing intermittently after the refactor
Start with /mahou-brainstorm to design, write a spec, and produce an
implementation plan. Once the plan is approved, run /mahou-orchestrator to
execute it task-by-task with two-stage review per task.
/mahou-brainstorm I want to add a webhook system for real-time notifications
/mahou-orchestrator ./.mahou/plans/<uuid>.md
Run /mahou-review on a scope to find verified issues. Confirmed correctness
bugs go to /mahou-debug; architecture findings needing design go to
/mahou-brainstorm; surgical fixes use the build agent.
/mahou-review src/services/payment/
Start with /mahou-new-project to create the project layer, then
brainstorm/orchestrate/verify/ship each feature in dependency order.
/mahou-new-project I want to build an e-commerce platform with React + Node + Postgres
/mahou-research --explore e-commerce architecture patterns
/mahou-brainstorm auth subsystem
/mahou-orchestrator ./.mahou/plans/<uuid>.md
/mahou-verify
/mahou-ship
/mahou-brainstorm product catalog ← reads PROJECT.md + auth's spec
... repeat for each feature in ROADMAP build order ...
/mahou-verify
→ PASS: /mahou-ship
→ FIX_FORWARD: /mahou-debug (specific issue) → re-verify
→ REPLAN: /mahou-brainstorm (revises spec, appends revision log)
These rules must not be violated by any command or reference:
- Zero structural token cost — nothing auto-injects on every prompt;
everything loads via
@-include when invoked or inside subagent isolated context - Tool-level read-only enforcement — read-only commands route to the
mahou-readonlyagent (edit/writeand destructive bash denied at the tool level); write access outside./.mahou/is denied for planning commands via themahou-planneragent - No MCP, no npm, no plugins, no hooks, no telemetry — pure markdown + native tools (one optional TS plugin for compaction persistence and one optional TS tool for vision fallback; both degrade gracefully when absent)
- Subagent isolation for heavy work —
webfetchand large reads happen inexplore/generalsubagents - Feedback loops — every downstream command has PASS / FIX_FORWARD / REPLAN return edges
- State on disk —
state.jsonwritten via bash, read only when needed - UI principles gated behind UI detection — non-UI projects pay zero cost
- Append-only specs — replan appends revision log, doesn't overwrite
- Project layer above feature layer — PROJECT.md + ROADMAP.md link features into a coherent system
- No AGENTS.md auto-generation —
mahou-initproducesmap.mdonly
.mahou/
├── PROJECT.md ← project context, architecture, conventions, decisions log
├── ROADMAP.md ← feature breakdown, dependencies, build order, status
├── state.json ← enriched session state (orchestrator, for resume)
├── map.md ← codebase map (from /mahou-init, no AGENTS.md)
├── specs/ ← per-feature specs (linked from ROADMAP)
├── plans/ ← per-feature plans (linked from ROADMAP)
├── research/ ← research briefs (project-level + feature-level)
├── verify/ ← verification reports
└── postmortems/ ← post-mortems (Phase 2, directory reserved)
mahou/
├── install.ps1
├── install.sh
├── commands/ ← opencode slash commands (markdown + frontmatter)
│ ├── mahou.md
│ ├── mahou-ask.md
│ ├── mahou-brainstorm.md
│ ├── mahou-debug.md
│ ├── mahou-designer.md
│ ├── mahou-init.md
│ ├── mahou-new-project.md
│ ├── mahou-orchestrator.md
│ ├── mahou-postmortem.md
│ ├── mahou-research.md
│ ├── mahou-resume.md
│ ├── mahou-review.md
│ ├── mahou-secure.md
│ ├── mahou-ship.md
│ ├── mahou-ultracode.md
│ └── mahou-verify.md
├── agents/ ← permission-enforced agents (installed to opencode)
│ ├── ask.md # read-only side-chat agent
│ ├── mahou-readonly.md # read-only enforcement for review/verify/etc.
│ ├── mahou-planner.md # .mahou/-only writes for brainstorm/etc.
│ ├── implementer.md # subagent: one task, tests, commit
│ ├── spec-reviewer.md # subagent: spec compliance (read-only)
│ ├── code-quality-reviewer.md # subagent: code quality (read-only)
│ ├── integration-reviewer.md # subagent: seam checks (read-only)
│ └── issue-verifier.md # subagent: single-issue verification (read-only)
├── skills/ ← technique guides (SKILL.md, skill-tool discoverable)
│ ├── mahou-condition-waiting/
│ ├── mahou-defense-in-depth/
│ ├── mahou-design-craft/
│ ├── mahou-git-workflow/
│ ├── mahou-receiving-review/
│ ├── mahou-root-cause-tracing/
│ ├── mahou-ui-critique/
│ ├── mahou-ui-design/
│ ├── mahou-ultracode-patterns/
│ ├── mahou-verification-completion/
│ └── mahou-writing/
├── plugins/
│ └── mahou-compaction.ts # injects .mahou/state.json into compaction
├── tools/
│ └── describe-image.ts # auxiliary vision tool (non-vision models)
├── references/ ← subagent prompt templates + scripts
│ ├── code-quality-reviewer-prompt.md
│ ├── find-polluter.sh
│ ├── implementer-prompt.md
│ ├── integration-reviewer-prompt.md
│ ├── issue-verifier-prompt.md
│ ├── research-prompt.md
│ ├── spec-reviewer-prompt.md
│ └── verify-prompt.md
└── README.md
PRs are welcome. This is a configuration package, not a library — changes should preserve the design invariants listed in Architecture.
To contribute:
- Fork the repository
- Create a feature branch
- Make your changes — follow existing markdown conventions
- Ensure no design invariants are violated
- Submit a pull request
For questions or issues, please open a GitHub issue.
Share freely. This is a configuration package, not a library.
What changed since the previous mahou (Mahou V1, commit 3139f6a).
Commands — 4 new: /mahou-designer, /mahou-ultracode, /mahou-secure,
/mahou-postmortem — 15 workflow commands total plus /mahou.
Agents — 8 permission-enforced agents: ask, mahou-readonly,
mahou-planner, implementer, spec-reviewer, code-quality-reviewer,
integration-reviewer, issue-verifier. Enforcement moved from command
frontmatter to agent permission config (opencode ignores tools: in command
frontmatter). Read-only commands route to mahou-readonly (edit: deny,
destructive bash denied); planning commands to mahou-planner (writes only
under .mahou/).
Skills — 11 SKILL.md guides (renamed from the old references/ collection), including design-craft, ultracode-patterns, verification-completion, receiving-review, condition-waiting, defense-in-depth.
Plugin & tool — mahou-compaction plugin injects .mahou/state.json
into compaction prompts so orchestration survives context loss; describe-image
tool gives non-vision models a vision fallback via Cloudflare AI Gateway.
Orchestration discipline — baseline test gate before any task (red baseline
=> stop), two-stage review loop (spec compliance then code quality), evidence
requirements, <no_root_cause> reporting in /mahou-debug, test gate before
push in /mahou-ship, review "silence is better than noise".
Model routing — removed ALL hardcoded provider/model IDs from commands.
Model selection now resolves: .mahou/models.json in the current repository
(task/role -> model mapping) if present, otherwise the opencode default
(repo opencode.json -> global config -> session model). See "Model
selection (model orchestrator)" above. The repo ships .mahou/models.json.example
(local only) and never invents a provider ID.
Installer — install.sh / install.ps1 rewritten: installs commands/,
agents/, skills/, plugins/, tools/, references/; cleans up the legacy
command/ directory; substitutes {{MAHOU_HOME}}.
Docs — README rewritten and expanded; landing page (landing/) now lists
all 15 commands with layer tags; DEPLOY.md rewritten for the Next.js
landing app.