Skip to Content
Getting StartedCLI Reference

CLI Reference

Reference all commands and options of the MoAI-ADK command-line interface.

Command List

moai --help

Output Example:

MoAI-ADK - Agentic Development Kit for Claude Code Usage: moai [command] Available Commands: init Interactive project setup (auto-detects language/framework/methodology) doctor System health diagnosis and environment verification status Project status summary including Git branch, quality metrics, etc. update Update to the latest version (with automatic rollback support) worktree Manage Git worktrees for parallel SPEC development hook Claude Code hook dispatcher glm Switch to GLM backend (cost-effective) or update API key claude Switch to Claude backend (Anthropic API) version Display version, commit hash, and build date Flags: -h, --help help for moai -v, --version version for moai
CommandDescription
moai initInitialize project (auto-detects language/framework/methodology)
moai doctorSystem diagnostics and environment verification
moai statusProject status summary (Git branch, quality metrics, etc.)
moai updateUpdate to the latest version (with automatic rollback support)
moai worktreeManage Git worktrees (parallel SPEC development)
moai hookClaude Code hook dispatcher
moai glmSwitch to GLM backend (--team: GLM Worker mode)
moai claude, moai ccSwitch to Claude backend
moai cgEnable CG mode — Claude leader + GLM teammates (tmux required)
moai versionDisplay version, commit hash, and build date

moai init

Initialize a project.

moai init [PATH] [OPTIONS]

Options

OptionDescription
-y, --non-interactiveNon-interactive mode (use defaults)
--mode [personal|team]Project mode
--locale [ko|en|ja|zh]Preferred language (default: en)
--language TEXTProgramming language (auto-detect if specified)
--forceForce re-initialization without confirmation

Examples

# Initialize new project moai init my-project # Korean, team mode moai init my-project --locale ko --mode team # Python project moai init --language python

moai update

Update MoAI-ADK to the latest version.

moai update [OPTIONS]

Options

OptionDescription
--path PATHProject path (default: current directory)
--forceForce update without backup
--checkCheck version only (no update)
--projectSync project templates only
--templates-onlySync templates only (skip package upgrade)
--yesAuto confirm (CI/CD mode)
-c, --configEdit project config (same as initial setup wizard)
--mergeAuto merge (preserve user changes)
--manualManual merge (create guide)

Examples

# Check for updates moai update --check # Force update moai update --force # Auto merge moai update --merge

Important: --force option does not create backups. User changes may be lost.


moai doctor

Run system diagnostics.

moai doctor [OPTIONS]

Options

OptionDescription
-v, --verboseShow detailed tool versions and language detection
--fixSuggest fixes for missing tools
--export PATHExport to JSON file
--check TEXTCheck only specific tool
--check-commandsDiagnose slash command loading issues
--shellDiagnose shell and PATH configuration (WSL/Linux)

Examples

# Full diagnostics moai doctor # Verbose diagnostics moai doctor --verbose # Suggest fixes moai doctor --fix

moai glm

Switch to GLM backend or update API key.

moai glm [OPTIONS] [API_KEY]

Options

OptionDescription
--teamStart GLM Worker mode (Opus leader + GLM-5 teammates)
--helpShow help

Usage

# Switch to GLM backend moai glm # Update API key moai glm <api-key> # Start GLM Worker mode (cost-effective team development) moai glm --team # Get API key from z.ai # https://z.ai/subscribe?ic=1NDV03BGWU

GLM Worker Mode

Using the --team option starts the cost-effective GLM Worker mode:

  • Configuration: Opus model leader agent + GLM-5 model teammate agents
  • Benefit: 70% cost savings compared to Claude, equivalent performance
  • Use Case: Optimize token costs for large-scale team-based development

Profile-based Login (v2.7.0+)

moai glm, moai cc, and moai cg are now true login commands with persistent profile support. Profiles are stored at ~/.moai/claude-profiles/.

  • Interactive profile setup wizard on first run
  • Profiles persist across sessions
  • Switching from moai glm to moai cg automatically resets GLM settings

moai claude

Switch to Claude backend (Anthropic API).

$ moai claude # Or shorthand $ moai cc

moai cg

Enable CG Mode (Claude + GLM Hybrid). The leader uses Claude API while teammates use GLM API via tmux session-level environment isolation.

moai cg

How It Works

  1. Injects GLM config into tmux session environment
  2. Removes GLM env from settings — leader pane uses Claude API
  3. Sets CLAUDE_CODE_TEAMMATE_DISPLAY=tmux — teammates inherit GLM env in new panes

Usage

# 1. Save GLM API key (once) moai glm sk-your-glm-api-key # 2. Enable CG mode (must be in tmux) moai cg # 3. Start Claude Code in the SAME pane claude # 4. Run team workflow /moai --team "your task description"

Important Notes

ItemDescription
tmux RequiredMust run inside a tmux session. Set VS Code terminal default to tmux for convenience.
Leader Start LocationMUST start Claude Code in the same pane where moai cg was run.
Session Endsession_end hook automatically clears tmux session env.

Mode Comparison

CommandLeaderWorkerstmux RequiredCost SavingsUse Case
moai ccClaudeClaudeNo-Maximum quality
moai glmGLMGLMRecommended~70%Cost optimization
moai cgClaudeGLMRequired~60%Quality + cost balance

Display Modes

ModeDescriptionCommunicationLeader/Worker Separation
in-processDefault modeSendMessageSame env
tmuxSplit-pane displaySendMessageSession env isolation

New in v2.7.1: CG mode is now the default team mode. When using --team, the system runs in CG mode automatically.


moai status

Check project status.

moai status

Output Example:

╭────── Project Status ──────╮ │ Mode personal │ │ Locale unknown │ │ SPECs 1 │ │ Branch main │ │ Git Status Modified │ ╰────────────────────────────╯

Output Information:

  • Mode: Work mode (personal, team, manual)
  • Locale: Language setting
  • SPECs: Number of active SPECs
  • Branch: Current branch
  • Git Status: Git status (Clean, Modified)

moai worktree

Manage Git worktrees for parallel SPEC development.

moai worktree [OPTIONS] COMMAND [ARGS]...

Subcommands

CommandDescription
moai worktree newCreate new worktree
moai worktree listList active worktrees
moai worktree switchSwitch to a worktree
moai worktree goNavigate to worktree directory
moai worktree syncSync with upstream
moai worktree removeRemove worktree
moai worktree cleanClean up stale worktrees
moai worktree recoverRecover from existing directory

moai worktree new

Create a new worktree.

moai worktree new [OPTIONS] SPEC_ID

Options

OptionDescription
-b, --branch TEXTUser branch name
--base TEXTBase branch (default: main)
--repo PATHRepository path
--worktree-root PATHWorktree root path
-f, --forceForce create even if exists
--glmUse GLM LLM settings
--llm-config PATHUser LLM config file path

Examples

# Create worktree for SPEC-001 moai worktree new SPEC-001 # Specify user branch moai worktree new SPEC-001 --branch feature-auth # Change base branch moai worktree new SPEC-001 --base develop

moai worktree list

List active worktrees.

moai worktree list [OPTIONS]

Options

OptionDescription
--format [table|json]Output format
--repo PATHRepository path
--worktree-root PATHWorktree root path

moai worktree remove

Remove a worktree.

moai worktree remove [OPTIONS] SPEC_ID

Options

OptionDescription
-f, --forceForce remove uncommitted changes
--repo PATHRepository path
--worktree-root PATHWorktree root path

worktree Workflow


moai hook

Claude Code hook dispatcher for MoAI-ADK events.

moai hook <event>

Supported Events (16)

EventDescription
PreToolUseBefore tool execution
PostToolUseAfter tool execution
NotificationSystem notifications
StopSession end
SubagentStopSubagent stop
UserPromptSubmitUser prompt submission
PreCompactBefore context compaction
PostCompactAfter context compaction
PermissionRequestPermission request
PostToolFailureAfter tool execution failure
SubagentStartSubagent start
TeammateIdleTeammate idle
TaskCompletedTask completed
WorktreeCreateWorktree creation
WorktreeRemoveWorktree removal
modelModel selection

Examples

# Run PreToolUse hook moai hook PreToolUse # Run PostToolUse hook moai hook PostToolUse # Run UserPromptSubmit hook moai hook UserPromptSubmit

Task Metrics Logging

MoAI-ADK automatically captures Task tool metrics during development sessions.

Log File

  • Location: .moai/logs/task-metrics.jsonl
  • Format: JSONL (JSON Lines)

Captured Metrics

MetricDescription
Token usageInput/output token count
Tool callsList of tools used and call count
DurationTask execution time
Agent typeType of agent executed

Usage

  • Session analysis and performance optimization
  • Agent efficiency analysis
  • Token consumption tracking and cost management

The PostToolUse hook automatically logs metrics when a Task tool completes.


Model Policy Settings

MoAI-ADK assigns optimal AI models to agents based on your Claude Code subscription plan.

Policy Tiers

PolicyPlan🟣 Opus🔵 Sonnet🟡 Haiku
HighMax $200/mo2314
MediumMax $100/mo4195
LowPlus $20/mo01216

Configuration

# During project initialization (interactive wizard) moai init my-project # Reconfigure existing project moai update -c # Manual configuration (.moai/config/sections/user.yaml) # model_policy: high | medium | low

Note: The default policy is High. After running moai update, you will be prompted to configure settings with moai update -c.


Environment Variables

VariableDescription
MOAI_API_KEYAPI key (Claude/GLM)
MOAI_MODEExecution mode (development/production)
MOAI_LOCALELanguage setting (ko/en/ja/zh)
MOAI_WORKTREE_ROOTWorktree root path

See Also

Last updated on