Skip to main content

CLI Overview

UPDATED 2026-10-02 11 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 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
--enable-lspEnable LSP integration (default: true)
--enforce-qualityEnforce quality gates (default: true)
--enable-designEnable the design workflow (default: true)
--profile <high|medium|low>Deprecated stub — accepted for script compatibility, has no effect, and prints a deprecation warning pointing at moai profile setup
--model-policy <high|medium|low>Deprecated stub — accepted for script compatibility, has no effect, and prints a deprecation warning pointing at moai profile setup
--highDeprecated stub — alias of the retired --model-policy high; prints the same deprecation warning

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

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>Deprecated stub — accepted for script compatibility, has no effect, and prints a deprecation warning pointing at moai profile setup

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

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 glm

moai cc and moai glm launch Claude Code with an explicitly selected backend. Legacy CG configurations require migration before launch.

bash
moai cc [-p profile] [-- claude-args...]
moai glm [-p profile] [-- claude-args...]

moai cg has been retired. It exits with a migration diagnostic without starting Claude or GLM. It is not an alias for moai cc. Projects with llm.team_mode: cg must make an explicit migration choice before launching a session. CG retirement and migration

Launch flags

Flags common to both 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-chromePassed through to Claude Code unchanged; the launcher adds neither, so /chrome can attach unless you pass --no-chrome

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

Session model resolution (moai cc)

moai cc looks for the session model in the order below and passes the first value it finds to Claude Code as --model.

  1. An explicit --model argument
  2. The profile’s model (the value chosen in moai profile setup)
  3. The ANTHROPIC_MODEL environment variable (this launch only)
  4. The model in the project’s .claude/settings.local.json (this project only)
  5. The value saved with /model in that profile’s user-scope settings.json — the launch prints a one-line notice such as model: opus (user /model)
  6. If all of the above are empty, nothing is passed. The project’s .claude/settings.json model pin then decides the session model, and the launcher names that value and how to change it

The more specific and more recent choice wins. Claude Code applies steps 3 and 4 itself, so the launcher passes no --model and stays out of their way. Project settings outrank user-scope settings, so without step 5 a model picked with /model would be hidden behind the project pin. moai glm does not follow this rule: GLM needs the model as a slot alias, and a value picked with /model on an Anthropic account names a different model family that would route to the wrong slot.

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)

The former per-agent performance-tier system is retired. Since v3.2, subagents inherit the main session’s model and effort — pass neither model nor effort when spawning a subagent, and MoAI agent definitions declare neither. What remains of the model policy is one session-level choice: the Session model policy question in moai profile setup sets the default reasoning effort of the Claude session launched with the profile, used when no effort level is chosen.

Legacy valueToday’s meaning
highSession effort fallback high
mediumSession effort fallback medium
lowSession effort fallback low
bash
# Configure the session model policy (and everything else about a profile)
moai profile setup

# The retired per-agent flags print a deprecation warning and do nothing
moai init my-project --model-policy high

The old --model-policy, --profile, --high, --medium-alias, and --low flags are deprecated stubs: values are accepted for script compatibility, have no effect, and print a warning pointing at moai profile setup. For the session-level model and effort controls, see the Model Policy page; for how the matrix was retired, Profile Matrix.


See also