Skip to main content

moai doctor Diagnostics

UPDATED 2026-08-24 1 min read EDIT ON GITHUB ↗

moai doctor runs comprehensive system diagnostics. It checks Claude Code configuration, dependencies, project structure, language-specific development tools, and the environment, and can suggest fixes for detected issues.

Overview

bash
moai doctor [OPTIONS]

Flags

FlagDescription
-v, --verboseShow detailed diagnostic information (tool versions, language detection)
--fixSuggest fixes for detected issues
--exportExport diagnostics to a JSON file
--check <tool>Run a specific check only (e.g. git, go, config)

Subcommands

moai doctor provides subcommands that dive deeper into a specific area.

CommandDescription
moai doctor configConfiguration diagnostics — inspect merged settings with provenance
moai doctor hookShow the 27-event hook coverage table
moai doctor permissionDiagnose permission resolution
moai doctor sandboxSandbox backend availability diagnostics

moai doctor config in turn offers dump (dump merged settings) and diff <tier-a> <tier-b> (compare two settings tiers).

A full moai doctor run carries a Home Disk Usage entry. It reports how full the ~/.moai home directory is and is advisory: exceeding the threshold never blocks another command.

Reported itemContent
Total sizeThe total ~/.moai footprint plus its three largest entries
Per-profile breakdownThe size of each claude-profiles/<profile> with its category split
Release countHow many binaries remain in releases/, and the current version
Cleanable bytesThe estimate of what moai clean --home could actually delete
~/.claudeSize only — never a cleanup target on any path

When the cleanable estimate exceeds the threshold (a compiled default of 500 MB) the status turns WARN and recommends moai clean --home (dry-run by default). Below it, the status stays OK. When no ~/.moai exists at all, the check reports “nothing to report” and passes.

The estimate calls the same scanner moai clean --home uses, so the number doctor quotes and the list clean actually deletes cannot drift apart. Full detail: Home Directory Hygiene.

Exit codes

Scripts and CI wrappers calling moai doctor read the exit code, not the summary line.

Exit codeMeaning
0No failing check. Warnings are advisory and do not change the exit code
1One or more checks failed — the summary’s Fail N carried through

The Constitution Registry check does more than confirm the registry parses: it runs the same drift validation as moai constitution validate. Doctor therefore cannot report ok on a checkout where validate fails. Bypassing with MOAI_CONSTITUTION_SKIP_VALIDATE=1 returns doctor to its structural verdict.

Examples

bash
# Full diagnostics
moai doctor

# Detailed diagnostics
moai doctor --verbose

# Export diagnostics
moai doctor --export diagnostics.json

# Diagnose a specific area
moai doctor hook          # hook coverage table
moai doctor permission    # permission resolution
moai doctor sandbox       # sandbox backend

Related: Project Status · CLI Overview