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 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 |
--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> | 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 |
--high | Deprecated stub — alias of the retired --model-policy high; prints the same deprecation warning |
# 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-interactiveFor 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> | Deprecated stub — accepted for script compatibility, has no effect, and prints a deprecation warning pointing at moai profile setup |
# 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 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 worktreesmoai cc and moai glm launch Claude Code with an explicitly selected backend. Legacy CG configurations require migration before launch.
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
Flags common to both 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 | Passed through to Claude Code unchanged; the launcher adds neither, so /chrome can attach unless you pass --no-chrome |
The
autopermission mode is not available on GLM (a third-party provider) — it is supported only inmoai cc.
moai cc looks for the session model in the order below and passes the first value it finds to Claude Code as --model.
- An explicit
--modelargument - The profile’s model (the value chosen in
moai profile setup) - The
ANTHROPIC_MODELenvironment variable (this launch only) - The
modelin the project’s.claude/settings.local.json(this project only) - The value saved with
/modelin that profile’s user-scopesettings.json— the launch prints a one-line notice such asmodel: opus (user /model) - If all of the above are empty, nothing is passed. The project’s
.claude/settings.jsonmodelpin 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.
| 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 # identicalThe 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 value | Today’s meaning |
|---|---|
| high | Session effort fallback high |
| medium | Session effort fallback medium |
| low | Session effort fallback low |
# 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 highThe 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.