CLI Overview
A high-level overview of every command and flag of moai (the Go binary) that you run in the terminal. It is a completely different tool from /moai (the slash subcommand) that you type in the Claude Code chat — this page covers only the terminal CLI.
For the detailed per-command reference (flags, subcommands, examples), see the CLI Reference section.
moai --helpThe moai CLI is divided into three groups.
| Group | Commands | Description |
|---|---|---|
| Launch | moai cc · moai cg · moai glm | Start a Claude Code session (choose the backend) |
| Project | moai init · moai update · moai doctor · moai status | Project initialization, update, diagnostics, status |
| Tools | moai profile · moai inventory · moai hook · moai worktree · moai spec · moai harness · … | Configuration, inventory, hooks, worktrees, and other tools |
Use moai version to check the currently installed version.
moai version╭────────────────────────╮
│ │
│ moai-adk v3.0.0 │
│ │
│ │
╰────────────────────────╯
v3.0.0 none built unknownThe line below the box banner shows <version> <commit hash> built <build time> in order. When built without ldflags (e.g. via go install), the commit shows none and the build time shows unknown.
Initializes a project. An interactive wizard configures language, Git automation, model policy, harness profile, and more.
moai init [project-name] [OPTIONS]| Flag | Description |
|---|---|
--non-interactive | Skip the interactive wizard (use flags and defaults) |
--force | Force re-initialization of an existing project (backs up the current .moai/) |
--no-hooks | Skip Git hook installation |
--all | Deploy all catalog items (core + optional packs + harness-generated) |
--mode <ddd|tdd> | Development methodology (default: tdd) |
--language <lang> | Primary programming language |
--framework <name> | Framework name (default: auto-detect or “none”) |
--name <name> | Project name (default: directory name) |
--root <path> | Project root directory (default: current directory) |
--git-mode <manual|personal|team> | Git workflow mode (default: manual) |
--git-provider <github|gitlab> | Git provider |
--project-mode <personal|team> | Project mode (default: personal) |
--enable-lsp | Enable LSP integration (default: true) |
--enforce-quality | Enforce quality gates (default: true) |
--enable-design | Enable the design workflow (default: true) |
--profile <high|medium|low> | Model+effort profile — stored in llm.yaml profile (selects the profile matrix column). The legacy value max is accepted as input and normalized to high |
--model-policy <high|medium|low> | Legacy performance tier — stored in llm.yaml performance_tier (alias when profile is absent) |
--high | Deprecated alias for --model-policy high |
# Initialize a new project (interactive wizard)
moai init my-project
# Install into an existing folder
cd my-existing-project
moai init
# Non-interactive (CI/CD)
moai init --non-interactive --project-mode personal --model-policy mediumFor detailed wizard steps, see the Initial Setup page.
Updates MoAI-ADK to the latest version. Run without flags, it refreshes both the binary and the templates, and your custom assets are preserved automatically.
moai update [OPTIONS]| Flag | Description |
|---|---|
--check | Only check whether a new version exists (no update) |
-c, --config | Re-run the configuration wizard (no template sync) |
--force | Force update (skip version match, force backup+merge, overwrite archive drift) |
--yes | Auto-approve all confirmations (CI/CD mode) |
--templates-only | Skip the binary update and sync templates only |
--binary | Skip template sync and update the binary only |
--dry-run | Show planned actions only, with no filesystem changes |
--no-hooks | Skip Git hook installation |
--verbose | Show all warnings (diagnostic mode) |
--shell-env | Configure shell environment variables for Claude Code |
--profile <high|medium|low> | Override the model+effort profile (stored in llm.yaml profile) |
# Default update (binary + templates)
moai update
# Only check whether a new version exists
moai update --check
# Re-run the configuration wizard
moai update -c
# Sync templates only
moai update --templates-onlyFor the detailed update procedure, see the Update page.
Runs system diagnostics. It checks Git, the project structure, configuration files, and language-specific development tools.
moai doctor [OPTIONS]| Flag | Description |
|---|---|
-v, --verbose | Show detailed tool versions and language-detection results |
--fix | Suggest fixes for missing tools |
--export <path> | Export diagnostic results to a JSON file |
--check <tool> | Check a specific tool only (e.g., git, go, config) |
| Command | Description |
|---|---|
moai doctor sandbox | Diagnose sandbox backend availability |
moai doctor permission | Diagnose permission resolution |
moai doctor hook | Show the 30-hook-event coverage table |
moai doctor config dump | Dump the merged configuration with provenance |
moai doctor config diff <tier-a> <tier-b> | Compare two config tiers |
# Full diagnostics
moai doctor
# Detailed diagnostics
moai doctor --verbose
# Export diagnostic results
moai doctor --export diagnostics.jsonShows the project status at a glance. It displays whether the project is initialized, the SPEC count, and the number of configuration files.
moai statusIt is a read-only command with no flags. For detailed output, see the Project Status page.
A read-only command that shows a unified view of active sessions, worktrees, and harnesses.
moai inventory [OPTIONS]| Flag | Description |
|---|---|
--json | Structured JSON output |
--project-root <path> | Project root path (default: current directory) |
For the detailed JSON schema and usage examples, see the moai inventory page.
Manages Claude Code configuration profiles. Each profile keeps independent model, language, and display settings.
moai profile [COMMAND]| Command | Description |
|---|---|
moai profile list | Show all available profiles |
moai profile setup | Run the interactive setup wizard |
moai profile current | Show the currently active profile |
moai profile delete <name> | Delete the specified profile |
Specify a profile at launch with the -p flag:
moai cc -p work # Run Claude with the work profile
moai glm -p cost-save # Run GLM with the cost-save profile
moai cg -p team # Run CG mode with the team profileFor more details, see the Profile Management page.
A dispatcher that handles Claude Code hook events. It is called in the form moai hook <event> from the hook configuration in settings.json.
moai hook <event>The moai hook dispatcher provides 42 subcommands, combining the standard Claude Code hook events and MoAI-specific internal actions. All names are kebab-case. Below are the representative events.
Hook-event count and subcommand count are different numbers. The 30 reported by
moai doctor hookare the hook event types Claude Code defines; the 42 here are the subcommandsmoai hookaccepts. They do not match because MoAI-specific internal actions exist as subcommands without a corresponding event.
| Event | Description |
|---|---|
session-start | Session start |
session-end | Session end |
pre-tool | Before tool execution (PreToolUse) |
post-tool | After tool execution (PostToolUse) |
post-tool-failure | After a tool execution failure |
stop | Session stop |
stop-failure | Stop failure |
compact | Before context compaction (PreCompact) |
post-compact | After context compaction |
notification | System notification |
subagent-start | Subagent start |
subagent-stop | Subagent stop |
user-prompt-submit | User prompt submitted |
permission-request | Permission request |
permission-denied | Permission denied |
teammate-idle | Teammate idle |
task-completed | Task completed |
task-created | Task created |
worktree-create | Worktree created |
worktree-remove | Worktree removed |
instructions-loaded | Instructions loaded |
config-change | Configuration change |
cwd-changed | Working directory changed |
file-changed | File changed |
elicitation | MCP elicitation request |
elicitation-result | MCP elicitation result |
MoAI-specific subcommands are also included.
| Subcommand | Description |
|---|---|
stop-goal | Evaluate the active session goal at turn end |
pre-push | Validate commit messages against the convention |
spec-status | Auto-update SPEC status on git commit |
harness-classify | Run the harness classifier and record tier promotions |
harness-observe · harness-observe-stop · harness-observe-subagent-stop · harness-observe-user-prompt-submit | Record harness usage logs |
You do not run hooks directly — Claude Code’s settings.json calls them automatically.
Manages Git worktrees for parallel SPEC development.
moai worktree <COMMAND> [ARGS]...| Command | Description |
|---|---|
moai worktree sync [branch-name] | Sync a worktree with the base branch |
moai worktree done <branch-name> | Remove a branch’s worktree, optionally deleting the branch |
moai worktree remove <path> | Remove the worktree at the given path |
moai worktree clean | Prune stale references, clean up merged or abandoned worktrees |
moai worktree recover | Recover the worktree registry |
moai worktree snapshot | Capture a working-tree state snapshot |
moai worktree verify | Verify the working-tree state against the snapshot |
moai worktree restore | Restore the working tree to the snapshot HEAD state |
Entering a worktree is the launcher’s job. For listing, use git directly.
moai cc -w feat-login # start working in a worktree (created if missing)
moai cc -w feat-login --spawn # open it in a new tmux window, keeping the current session
git worktree list # list worktreesLaunch commands that start Claude Code while choosing the backend. All three support the -p <profile> flag to specify a profile. Passing arguments after -- straight through to Claude Code is supported only by moai cc and moai glm (moai cg does not support it).
moai cc [-p profile] [-- claude-args...]
moai glm [-p profile] [-- claude-args...]
moai cg [-p profile]| Command | Leader | Workers | tmux required | Use case |
|---|---|---|---|---|
moai cc | Claude | Claude | No | Highest quality (single backend) |
moai glm | GLM | GLM | No | Cost optimization (GLM only) |
moai cg | Claude | GLM | Required | Quality + cost balance (hybrid) |
moai cg activates CG mode (a Claude leader + GLM teammates). It must be run inside a tmux session, and it injects the GLM environment variables into the tmux session while the leader pane uses the Claude API. moai cg starts Claude Code directly in the current pane after setup, so there is no separate claude launch step.
# 1. Save your GLM API key (once)
moai glm setup sk-your-glm-api-key
# 2. Activate CG mode (run inside tmux — Claude Code starts directly in the current pane)
moai cgFor detailed CG mode guidance, see Introduction — Save tokens with GLM.
Flags common to all three launch commands.
| Flag | Description |
|---|---|
-p, --profile <name> | Use a named Claude profile |
--permission-mode <mode> | Permission mode (default, acceptEdits, plan, auto, bypassPermissions, dontAsk) |
-b, --bypass | Shortcut for --permission-mode bypassPermissions |
moai cc additionally supports these flags.
| Flag | Description |
|---|---|
-c, --continue | Continue the previous session |
-m, --model <model> | Override the model selection |
--chrome / --no-chrome | Toggle the Chrome MCP |
The
autopermission mode is not available on GLM (a third-party provider) — it is supported only inmoai ccormoai cg.
| Command | Description |
|---|---|
moai glm setup <api-key> | Save the GLM API key |
moai glm status | Show the current GLM credential status |
moai glm tools | Manage Z.AI MCP server tools (enable/disable) |
Registers, queries, and clears a condition-based autonomous goal loop for the current session. It is evaluated at the end of each turn until the condition is met.
moai goal <COMMAND>| Command | Description |
|---|---|
moai goal arm <condition> | Register and arm a goal on the active session |
moai goal status | Print the active session’s goal status |
moai goal clear | Clear the active session’s goal |
Manages the auto-resume handoff pending record for continuing a session across the /clear boundary.
moai handoff <COMMAND>| Command | Description |
|---|---|
moai handoff save | Save the paste-ready resume body as a pending record |
moai handoff clear | Remove the pending handoff record |
Manages the active-session coordination registry for multi-session race mitigation.
moai session <COMMAND>| Command | Description |
|---|---|
moai session current | Print the current orchestrator session UUID |
moai session list | List active sessions (filterable with --filter-spec) |
moai session register <session_id> <spec_id> <phase> | Register a session in the registry |
moai session deregister <session_id> | Remove a session from the registry (idempotent) |
moai session heartbeat <session_id> | Update the session’s last_heartbeat |
moai session purge | Remove stale entries (default: last heartbeat older than 30 minutes) |
moai session doctor | Diagnose why the session registry is empty |
Launches the MoAI Web Console, a browser-based configuration editor.
moai web [OPTIONS]| Flag | Description |
|---|---|
--port <N> | TCP port to bind on 127.0.0.1 (default: 3041) |
--no-open | Do not open the browser automatically |
--no-reuse | Do not reclaim the port from a stale moai instance |
Shows the version, commit hash, and build date.
moai version
moai --version # identicalMoAI-ADK provides a performance-tier system that assigns the optimal AI model to each agent — the starting point of Tokenomics. It is set via the performance_tier field in llm.yaml, chosen with the --model-policy flag or the initialization wizard.
| Tier | Characteristics |
|---|---|
| high | Highest quality — max reasoning depth on the two rarest-invocation agents |
| medium (default) | Balance of quality and cost — the knee of the cost/score curve |
| low | Lowest cost per task — agentic agents drop to Opus low effort; Sonnet only on single-shot rows |
# Set at initialization
moai init my-project --model-policy high
# Reconfigure an existing project
moai update -cThe profile (profile: high/medium/low) selects the active column of the profile matrix, determining each agent’s model+effort. For the detailed per-agent mapping, see the Profile Matrix page.