CLI Reference
Complete reference for all Moatlog CLI commands.
moatlog init
Usage: moatlog init [--force] [--agent cursor|claude-code|all]
Scaffold hooks, MCP config, rules, and .moatlog/.
| Flag | Type | Default | Description |
|---|---|---|---|
--force | boolean | false | Overwrite existing scaffold files |
--agent | cursor | claude-code | all | auto | Which agent hooks to scaffold. auto always scaffolds Cursor; also scaffolds Claude Code when .claude/ exists or claude is on PATH |
$ moatlog initmoatlog status
Usage: moatlog status [--verbose]
Hooks status and moat strength.
| Flag | Type | Default | Description |
|---|---|---|---|
--verbose | boolean | false | Show window quality breakdown (high / low / meta). Also accepted as --detail |
$ moatlog statusmoatlog distill
Usage: moatlog distill [days]
Compress events into moat.json.
| Argument | Type | Default | Description |
|---|---|---|---|
days | number | 30 | How many days of event logs to include |
$ moatlog distillmoatlog report
Usage: moatlog report [--by-agent]
Show what your agent has been doing.
| Flag | Type | Default | Description |
|---|---|---|---|
--by-agent | boolean | false | Group report output by agent |
With --by-agent, hot files are grouped under each agent name and session count.
$ moatlog reportmoatlog check-moat
Usage: moatlog check-moat [days]
Validate moat.json exists and is fresh.
| Argument | Type | Default | Description |
|---|---|---|---|
days | number | 30 | Event log window to compare against moat.json generatedAt |
$ moatlog check-moatmoatlog doctor
Usage: moatlog doctor
Health check for hooks, MCP, moat.json, permissions.
$ moatlog doctormoatlog merge
Usage: moatlog merge [--branch <branch>] [--dry-run] [--no-llm]
Merge another branch's moat.json into the current one.
| Flag | Type | Default | Description |
|---|---|---|---|
--branch | string | main | Branch to merge from |
--dry-run | boolean | false | Show what would change without writing moat.json |
--no-llm | boolean | false | Deterministic pass only; surface conflicts as text |
--help | boolean | false | Show help |
Reads base, ours, and theirs moat.json from git (three-way when a common ancestor exists; two-way otherwise). Unresolved conflicts can be sent to cursor, claude, or ANTHROPIC_API_KEY for automatic resolution unless --no-llm is set.
$ moatlog merge$ moatlog merge --help
moatlog merge — merge another branch's moat.json into the current one
Usage:
moatlog merge [--branch <branch>] [--dry-run] [--no-llm]
Options:
--branch <branch> Branch to merge from (default: main)
--dry-run Show what would change without writing moat.json
--no-llm Deterministic pass only; surface conflicts as text
--help Show this helpOn success, prints a summary from formatMergeSummary (e.g. merged: N new files from theirs, N files with summed counts, N new prompt windows — no conflicts, moat.json updated) and saves .moatlog/moat.json unless --dry-run is set.
moatlog eval
Usage: moatlog eval [--threshold <n>] [--limit <n>] [--baseline] [--json]
Offline retrieval quality report.
| Flag | Type | Default | Description |
|---|---|---|---|
--threshold | number | 2 | Minimum file count for a window to be included |
--limit | number | all qualifying | Max windows to evaluate |
--baseline | boolean | false | Also run naive hot-file baseline for comparison |
--json | boolean | false | Output full results as JSON |
--help | boolean | false | Show help |
$ moatlog eval --baselinemoatlog clean
Usage: moatlog clean [--all] [--keep N]
Delete old event logs (keeps 30 days).
| Flag | Type | Default | Description |
|---|---|---|---|
--all | boolean | false | Delete all event logs |
--keep | number | 30 | Keep last N days of event logs |
$ moatlog cleanmoatlog mcp
Usage: moatlog mcp
Start the MCP server.
Runs the @moatlog/mcp server on stdio with the project root as cwd. Cursor and Claude Code invoke this via .cursor/mcp.json — you rarely run it manually.
$ moatlog mcpEnvironment variables
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Used by moatlog merge for LLM conflict resolution when neither cursor nor claude CLI is detected on PATH. |
Common workflows
# verify setup after moatlog init
moatlog doctor
# check moat health before committing
moatlog check-moat
moatlog distill
# after a git merge conflict on moat.json
moatlog merge --branch main
# measure retrieval quality
moatlog eval --baseline
# team member joining an existing repo with moat.json
moatlog init
moatlog distill
moatlog status