Skip to main content

CLI Overview

UPDATED 2026-08-10 10 min read EDIT ON GITHUB ↗

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.

Command tree

bash
moai --help

The moai CLI is divided into three groups.

GroupCommandsDescription
Launchmoai cc · moai cg · moai glmStart a Claude Code session (choose the backend)
Projectmoai init · moai update · moai doctor · moai statusProject initialization, update, diagnostics, status
Toolsmoai 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.

bash
moai version
text
╭────────────────────────╮
│                        │
│    moai-adk v3.0.0     │
│                        │
│                        │
╰────────────────────────╯
 v3.0.0   none   built unknown

The 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.


moai init

Initializes a project. An interactive wizard configures language, Git automation, model policy, harness profile, and more.

bash
moai init [project-name] [OPTIONS]

Flags

FlagDescription
--non-interactiveSkip the interactive wizard (use flags and defaults)
--forceForce re-initialization of an existing project (backs up the current .moai/)
--no-hooksSkip Git hook installation
--allDeploy 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-lspEnable LSP integration (default: true)
--enforce-qualityEnforce quality gates (default: true)
--enable-designEnable 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)
--highDeprecated alias for --model-policy high

Examples

bash
# 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 medium

For detailed wizard steps, see the Initial Setup page.


moai update

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.

bash
moai update [OPTIONS]

Flags

FlagDescription
--checkOnly check whether a new version exists (no update)
-c, --configRe-run the configuration wizard (no template sync)
--forceForce update (skip version match, force backup+merge, overwrite archive drift)
--yesAuto-approve all confirmations (CI/CD mode)
--templates-onlySkip the binary update and sync templates only
--binarySkip template sync and update the binary only
--dry-runShow planned actions only, with no filesystem changes
--no-hooksSkip Git hook installation
--verboseShow all warnings (diagnostic mode)
--shell-envConfigure shell environment variables for Claude Code
--profile <high|medium|low>Override the model+effort profile (stored in llm.yaml profile)

Examples

bash
# 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-only

For the detailed update procedure, see the Update page.


moai doctor

Runs system diagnostics. It checks Git, the project structure, configuration files, and language-specific development tools.

bash
moai doctor [OPTIONS]

Flags

FlagDescription
-v, --verboseShow detailed tool versions and language-detection results
--fixSuggest 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)

Subcommands

CommandDescription
moai doctor sandboxDiagnose sandbox backend availability
moai doctor permissionDiagnose permission resolution
moai doctor hookShow the 30-hook-event coverage table
moai doctor config dumpDump the merged configuration with provenance
moai doctor config diff <tier-a> <tier-b>Compare two config tiers

Examples

bash
# Full diagnostics
moai doctor

# Detailed diagnostics
moai doctor --verbose

# Export diagnostic results
moai doctor --export diagnostics.json

moai status

Shows the project status at a glance. It displays whether the project is initialized, the SPEC count, and the number of configuration files.

bash
moai status

It is a read-only command with no flags. For detailed output, see the Project Status page.


moai inventory

A read-only command that shows a unified view of active sessions, worktrees, and harnesses.

bash
moai inventory [OPTIONS]

Flags

FlagDescription
--jsonStructured JSON output
--project-root <path>Project root path (default: current directory)

For the detailed JSON schema and usage examples, see the moai inventory page.


moai profile

Manages Claude Code configuration profiles. Each profile keeps independent model, language, and display settings.

bash
moai profile [COMMAND]

Subcommands

CommandDescription
moai profile listShow all available profiles
moai profile setupRun the interactive setup wizard
moai profile currentShow the currently active profile
moai profile delete <name>Delete the specified profile

Specify a profile at launch with the -p flag:

bash
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 profile

For more details, see the Profile Management page.


moai hook

A dispatcher that handles Claude Code hook events. It is called in the form moai hook <event> from the hook configuration in settings.json.

bash
moai hook <event>

Supported subcommands (42)

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 hook are the hook event types Claude Code defines; the 42 here are the subcommands moai hook accepts. They do not match because MoAI-specific internal actions exist as subcommands without a corresponding event.

EventDescription
session-startSession start
session-endSession end
pre-toolBefore tool execution (PreToolUse)
post-toolAfter tool execution (PostToolUse)
post-tool-failureAfter a tool execution failure
stopSession stop
stop-failureStop failure
compactBefore context compaction (PreCompact)
post-compactAfter context compaction
notificationSystem notification
subagent-startSubagent start
subagent-stopSubagent stop
user-prompt-submitUser prompt submitted
permission-requestPermission request
permission-deniedPermission denied
teammate-idleTeammate idle
task-completedTask completed
task-createdTask created
worktree-createWorktree created
worktree-removeWorktree removed
instructions-loadedInstructions loaded
config-changeConfiguration change
cwd-changedWorking directory changed
file-changedFile changed
elicitationMCP elicitation request
elicitation-resultMCP elicitation result

MoAI-specific subcommands are also included.

SubcommandDescription
stop-goalEvaluate the active session goal at turn end
pre-pushValidate commit messages against the convention
spec-statusAuto-update SPEC status on git commit
harness-classifyRun the harness classifier and record tier promotions
harness-observe · harness-observe-stop · harness-observe-subagent-stop · harness-observe-user-prompt-submitRecord harness usage logs

You do not run hooks directly — Claude Code’s settings.json calls them automatically.


moai worktree

Manages Git worktrees for parallel SPEC development.

bash
moai worktree <COMMAND> [ARGS]...

Subcommands

CommandDescription
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 cleanPrune stale references, clean up merged or abandoned worktrees
moai worktree recoverRecover the worktree registry
moai worktree snapshotCapture a working-tree state snapshot
moai worktree verifyVerify the working-tree state against the snapshot
moai worktree restoreRestore the working tree to the snapshot HEAD state

Entering a worktree is the launcher’s job. For listing, use git directly.

bash
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 worktrees

moai cc / moai cg / moai glm

Launch 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).

bash
moai cc [-p profile] [-- claude-args...]
moai glm [-p profile] [-- claude-args...]
moai cg [-p profile]
CommandLeaderWorkerstmux requiredUse case
moai ccClaudeClaudeNoHighest quality (single backend)
moai glmGLMGLMNoCost optimization (GLM only)
moai cgClaudeGLMRequiredQuality + 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.

bash
# 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 cg

For detailed CG mode guidance, see Introduction — Save tokens with GLM.

Launch flags

Flags common to all three launch commands.

FlagDescription
-p, --profile <name>Use a named Claude profile
--permission-mode <mode>Permission mode (default, acceptEdits, plan, auto, bypassPermissions, dontAsk)
-b, --bypassShortcut for --permission-mode bypassPermissions

moai cc additionally supports these flags.

FlagDescription
-c, --continueContinue the previous session
-m, --model <model>Override the model selection
--chrome / --no-chromeToggle the Chrome MCP

The auto permission mode is not available on GLM (a third-party provider) — it is supported only in moai cc or moai cg.

moai glm subcommands

CommandDescription
moai glm setup <api-key>Save the GLM API key
moai glm statusShow the current GLM credential status
moai glm toolsManage Z.AI MCP server tools (enable/disable)

moai goal

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.

bash
moai goal <COMMAND>
CommandDescription
moai goal arm <condition>Register and arm a goal on the active session
moai goal statusPrint the active session’s goal status
moai goal clearClear the active session’s goal

moai handoff

Manages the auto-resume handoff pending record for continuing a session across the /clear boundary.

bash
moai handoff <COMMAND>
CommandDescription
moai handoff saveSave the paste-ready resume body as a pending record
moai handoff clearRemove the pending handoff record

moai session

Manages the active-session coordination registry for multi-session race mitigation.

bash
moai session <COMMAND>
CommandDescription
moai session currentPrint the current orchestrator session UUID
moai session listList 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 purgeRemove stale entries (default: last heartbeat older than 30 minutes)
moai session doctorDiagnose why the session registry is empty

moai web

Launches the MoAI Web Console, a browser-based configuration editor.

bash
moai web [OPTIONS]
FlagDescription
--port <N>TCP port to bind on 127.0.0.1 (default: 3041)
--no-openDo not open the browser automatically
--no-reuseDo not reclaim the port from a stale moai instance

moai version

Shows the version, commit hash, and build date.

bash
moai version
moai --version    # identical

Model policy (performance tier)

MoAI-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.

TierCharacteristics
highHighest quality — max reasoning depth on the two rarest-invocation agents
medium (default)Balance of quality and cost — the knee of the cost/score curve
lowLowest cost per task — agentic agents drop to Opus low effort; Sonnet only on single-shot rows
bash
# Set at initialization
moai init my-project --model-policy high

# Reconfigure an existing project
moai update -c

The 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.


See also