This skill orchestrates autonomous development tasks by routing requests to specialized agents, coordinating plan, run, sync, and fix workflows.
npx playbooks add skill modu-ai/moai-adk --skill moai
!git status --porcelain 2>/dev/null || true
!git branch --show-current 2>/dev/null || true
.moai/config/sections/*.yaml
---
Rules and constraints governing all workflows are always loaded from these sources. Do NOT duplicate their content here:
.moai/config/sections/delegation.yaml.moai/config/sections/delegation.yaml. For agent creation, use builder-harness subagent (artifact_type=agent).---
When dispatching a subcommand or workflow, the orchestrator records the routing decision to the append-only routing-ledger (.moai/state/routing-ledger.jsonl) via moai harness ledger record at dispatch time — the request text is piped via stdin and only a privacy-preserving digest is stored, never verbatim user text. As the routed pipeline reaches gate points, machine evidence is appended via moai harness ledger evidence (gate exits, audit verdicts, verify-log paths). Outcome is never supplied as an input; it is finalized from machine evidence only. This observation is opt-in and fail-open — it never blocks routing. NOTE: recording depends on the orchestrator actually invoking moai harness ledger record at dispatch; when the observability opt-in is ON but that record call is not emitted, the ledger stays empty — an un-recorded dispatch, NOT an opt-in-off no-op. Do not read an empty routing-ledger as 'opt-in disabled'.
---
$ARGUMENTS
[HARD] Route the Raw User Input above using the strict priority order below. Extract the FIRST WORD of the input for subcommand matching. All text after the subcommand keyword is CONTEXT to be passed to the matched workflow — it is NOT a routing signal and MUST NOT influence which workflow is selected.
--team: Force agent-team of the Phase 4 4-mode catalog (.claude/rules/moai/workflow/orchestration-mode-selection.md §A), subject to its capability gate--solo: Force serial (sub-agent — single sequential agent per phase)orchestration-mode-selection.md §B.1 (machine source: workflow.yaml auto_selection) and are not restated hereThe --team / --solo flags are forced overrides onto the catalog; the flag-free default resolves through the catalog decision tree (§B) and its capability gates. The --mode dispatch axis is a separate axis — see the crosswalk in orchestration-mode-selection.md §G.1 (correspondence, not merge).
[HARD] Extract the FIRST WORD from the Raw User Input section above. If it matches any subcommand below (or its alias), route to that workflow IMMEDIATELY. Do NOT analyze the remaining text for routing — it is context for the matched workflow:
[HARD] Mixed-language guard: FIRST-WORD subcommand matching applies only when (a) the input is pure ASCII/Latin, OR (b) the message is prefixed with a literal /moai slash form. When the message contains non-Latin script (Korean/Japanese/Chinese/etc.) beyond the first token, do NOT route immediately on the leading English word — treat it as a possible embedded loanword and fall through to Priority 3 semantic classification of the ENTIRE message. Rationale: CJK technical writing embeds English loanwords such as 'goal', 'run', 'fix', 'plan' at sentence start; immediate first-word routing misfires on them.
.moai/project/codemaps/moai harness Go-binary Cobra subcommand tree; the slash command is the documented user-facing entry point/moai goal "<condition>") or an approved auto mission (/moai goal --auto "<mission>") with approve, run, status, revoke, and resume lifecycle verbsOnly if Priority 1 did not match: Check if the Raw User Input contains a pattern matching SPEC-XXX (such as SPEC-AUTH-001). If found, route to the run workflow automatically. The SPEC-ID becomes the target for DDD/TDD implementation.
Only if BOTH Priority 1 AND Priority 2 did not match: Classify the intent of the ENTIRE Raw User Input as natural language. This priority is NEVER reached when the first word matches a known subcommand.
[HARD] The cue words listed below are English exemplars, NOT literal-match requirements. Classify intent semantically for any conversation_language — a Korean, Japanese, Chinese, or other-language request expressing the same intent routes identically. Do not require the literal English tokens to appear.
--security scope)If the intent remains ambiguous after all priority checks, use AskUserQuestion to present the top 2-3 matching workflows and let the user choose.
If the intent is clearly a development task with no specific routing signal, default to the moai workflow (plan -> run -> sync pipeline) for full autonomous execution.
---
Purpose: Create comprehensive specification documents using GEARS format with Research-Plan-Annotate cycle.
Phases: Deep Research (research.md) -> SPEC Planning -> Annotation Cycle (1-6 iterations) -> SPEC Creation -> Independent Review (plan-auditor)
Agents: manager-spec (primary), Explore (research), plan-auditor (quality gate), manager-git (conditional)
Skills: moai-workflow-spec, moai-foundation-thinking (per delegation.yaml)
Flags: --branch, --resume SPEC-XXX, --issue (opt-in; default skips GitHub Issue creation per the late-branch opt-in policy)
For detailed orchestration: Read workflows/plan.md
Purpose: Implement SPEC requirements through configured development methodology.
Agents: manager-develop (cycle_type=ddd|tdd per quality.yaml, primary), manager-git
Skills: moai-workflow-tdd, moai-workflow-ddd (per delegation.yaml; cycle_type-selected) + domain moai-ref-* injected per mission
Flags: --resume SPEC-XXX, --team (experimental — Agent Teams re-allowed; see Execution Mode Flags)
For detailed orchestration: Read workflows/run.md
Purpose: Synchronize documentation with code changes and prepare pull requests.
Agents: manager-docs (primary), sync-auditor (quality gate), manager-git
Skills: moai-workflow-project (per delegation.yaml)
Modes: auto, force, status, project. Flags: --auto-merge, --merge (deprecated alias of --auto-merge), --skip-mx
For detailed orchestration: Read workflows/sync.md
Purpose: Lightweight pre-commit quality check running lint, format, type-check, and tests in parallel. Also integrated into run (Phase 15) and sync (Phase 1) workflows as automatic pre-checks.
Agents: Direct execution (no agent delegation)
Flags: --fix, --staged, --file PATH
Integration: Automatically invoked by run workflow (Phase 15) and sync workflow (Phase 1) with --fix behavior.
For detailed orchestration: Read workflows/gate.md
Purpose: Create and run E2E tests across web, mobile, and desktop applications with project-type auto-detection, CLI-first toolchain selection (Playwright, Maestro, Playwright-Electron, WebdriverIO + tauri-service), and token-minimized execution.
Agents: e2e-tester (primary — detection, journey mapping, script creation, execution, recording)
Skills: moai-foundation-quality, moai-ref-testing-pyramid (per delegation.yaml)
Flags: --tool, --platform, --record, --url, --journey, --headless, --browser, --timeout, --retry
For detailed orchestration: Read workflows/e2e.md
Purpose: Preserve condition-declared goal loops while exposing a distinct approved autonomous-mission lifecycle.
Condition goal: /moai goal "<condition>" (register + arm), status [--all], clear, render.
Auto mission: /moai goal --auto "<mission>", followed by approve, run, status, revoke, or resume.
Flags: --auto selects mission_mode=auto; it does not mean progression_mode=autonomous. Shared metadata flags include --session and --json.
Progression mode: autonomous (default) vs. semi-autonomous — chosen at Implementation Kickoff Approval; the gate stays mandatory in both modes.
For detailed orchestration: Read workflows/goal.md
<!-- moai:contract-mode-start id="contract-signing-router" -->
Where workflow.autonomy.mode: contract — the Kickoff approval named here is the contract signature checked by moai contract kickoff-check; the progression mode is chosen when a goal is armed after that check passes. See .claude/rules/moai/workflow/contract-autonomy.md § The signing gate.
<!-- moai:contract-mode-end -->
Purpose: Carry captured work through Capture, Clarify, Organize, Reflect, and Engage, and hold what the operator wants to work on next. backlog has no owning session, so admission to the board is always an operator act — this is that surface.
Verbs — slash surface: /moai todo "<description>" (append), bare /moai todo (list). CLI only: moai todo next (print queued cards; moai todo next <n> [--spec <SPEC-ID>] marks one picked — the pick itself is presented through AskUserQuestion), moai todo done <n> (remove).
GTD stages: capture, clarify, organize, reflect, engage, plus answer for a gate-blocked card. Captured items stay separate from the established development queue until an explicitly approved Engage publishes one.
Compatibility: /moai gtd and moai gtd are the compat alias of the canonical /moai todo and moai todo — same database, same card identities, same ordering, archive, and restore path.
State: ~/.moai/db/<project-key>/todo/backlog.db — home-scoped, project-keyed, not committed, a SQLite database every mutation takes a cross-process lock over. A backlog.json beside an existing database is an export or a legacy leftover; the read verbs report that distinction. Before migration, a legacy JSON-only queue remains readable.
Database paths — never guess:
Find the database files with moai paths; never guess them.
Forbidden guessed paths: ~/.moai/todo.db, ~/.moai/backlog.db, ~/.moai/db/todo.db, ~/.moai/db/factory.db, ~/.moai/db/<key>/backlog.db, <root>/.moai/state/backlog.db, <root>/.moai/state/factory.db, <root>/.moai/state/factory/factory.db.
Never sqlite3-open a guessed path: opening a missing file creates an empty one.
Direct reads only on a snapshot copy of .db, .db-wal, and .db-shm together.
Prefer the CLI: moai todo list --json, moai factory status.
The pick is the operator's: never preselect, never reorder by inferred priority (the --auto cycle's own candidate ranking is the one auto-scoped ranking exception — selection order only), never auto-populate from TODO comments or issues.
Enablement: when workflow.todo.enabled is false in .moai/config/sections/workflow.yaml, do NOT route to this workflow by inference — a backlog-shaped phrase the operator did not name a subcommand for is answered directly instead of being queued. The gate binds AUTOMATIC routing only: an explicit /moai todo or /moai todo "<description>" still runs normally, exactly as it does when the key is absent or true. The flag suppresses guidance, not the feature — the queue verbs stay registered and every one of them keeps working, so refusing or silently ignoring a named invocation is a defect, not the intended behavior.
For detailed orchestration: Read workflows/gtd.md
Purpose: Autonomously detect and fix LSP errors, linting issues, and type errors.
Agents: manager-develop (cycle_type=autofix), Agent(general-purpose) with domain whitelist (fixes)
Skills: moai-workflow-ddd (per delegation.yaml) + domain moai-ref-* injected per mission
Flags: --dry, --sequential, --level N, --resume, --team (experimental — Agent Teams re-allowed; see Execution Mode Flags)
For detailed orchestration: Read workflows/fix.md
Purpose: Repeatedly fix issues until completion conditions are satisfied or max iterations reached.
Agents: manager-develop (cycle_type=autofix), Agent(general-purpose) with domain whitelist
Skills: moai-workflow-loop (per delegation.yaml) + domain moai-ref-* injected per mission
Flags: --max N, --auto-fix, --seq
For detailed orchestration: Read workflows/loop.md
Purpose: Scan codebase and add @MX code-level annotations for AI agent context.
Agents: Explore (scan), Agent(general-purpose) with backend scope (annotation)
Flags: --all, --dry, --priority P1-P4, --force, --team (experimental — Agent Teams re-allowed; see Execution Mode Flags)
For detailed orchestration: Read workflows/mx.md
Purpose: Multi-perspective code review with security, performance, quality, and UX analysis.
Agents: sync-auditor (review), Agent(general-purpose) with security scope
Skills: moai-foundation-quality, moai-ref-owasp-checklist (per delegation.yaml; per-perspective ref skills injected per lens)
Flags: --staged, --branch, --security, --team (experimental — Agent Teams re-allowed; see Execution Mode Flags)
For detailed orchestration: Read workflows/review.md
Purpose: Identify and safely remove unused code with test verification.
Agents: manager-develop, Agent(general-purpose) with refactoring scope
Skills: moai-workflow-ddd (per delegation.yaml)
Flags: --dry, --safe-only, --file PATH
For detailed orchestration: Read workflows/clean.md
Purpose: Scan codebase and generate architecture documentation.
Agents: Explore, manager-docs
Flags: --force, --area AREA
For detailed orchestration: Read workflows/codemaps.md
Purpose: Full autonomous research -> plan -> annotate -> run -> sync pipeline.
Phases: Parallel Exploration (research.md) -> SPEC Generation -> Annotation Cycle -> Implementation -> Sync
Agents: Explore, manager-spec, plan-auditor (quality gate), manager-develop, manager-docs, manager-git, sync-auditor (quality gate)
Skills: moai-workflow-spec, moai-workflow-tdd (per delegation.yaml) + domain moai-ref-* injected per mission
Flags: --loop, --max N, --branch, --pr, --resume SPEC-XXX, --team (experimental — Agent Teams re-allowed; see Execution Mode Flags), --solo, --issue (opt-in; default skips GitHub Issue creation per the late-branch opt-in policy)
For detailed orchestration: Read workflows/moai.md
Purpose: Generate project documentation by analyzing the existing codebase.
Agents: Explore, manager-docs, Agent(general-purpose) with devops scope (optional)
Skills: moai-workflow-project (per delegation.yaml)
Output: product.md, structure.md, tech.md in .moai/project/
For detailed orchestration: Read workflows/project.md
Purpose: Collect user feedback and create GitHub issues.
Agents: orchestrator-direct (records feedback via gh CLI)
For detailed orchestration: Read workflows/feedback.md
This single harness subcommand dispatches to ONE of two workflows based on the FIRST token of $ARGUMENTS (argument-based routing — no second command is introduced). Apply the routing rule before any workflow-specific logic:
status / apply / rollback / disable) → route to the existing harness learning lifecycle workflow (Branch A below). This path is unchanged.list / edit / remove / doctor) → route to the harness-v4 lifecycle handler (Branch A.1 below). These enumerate / edit / atomically-remove harness-v4 entries and run the reference-integrity smoke gate (doctor) via the moai harness <verb> Go binary subcommand.Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.