Skip to main content

monocle

Start a review session in the current directory.
Monocle detects the Git repository root from the current working directory and opens the TUI. By default it starts a new session; use the session flags below to resume a previous one.

Flags

Session flags

--continue, --resume, and --session are mutually exclusive — only one may be used at a time.

monocle register

Register monocle with an agent. Depending on the integration mode, this either configures an MCP server with tools or installs skill files into the agent’s skill directory.

Arguments

Flags

Plan-mode hooks (Claude Code)

When registering Claude Code, monocle adds up to four hook entries to .claude/settings.json: The first two form the plan-review flow; opt out with --no-plan-hook. The last two form the per-turn review gate; opt out with --no-review-gate. Each subset can be toggled independently in the register wizard. If Monocle isn’t running, every hook exits silently so Claude’s default behavior kicks in — the hooks never hard-block the agent. The exit-plan and on-stop hooks block on the reviewer, but the engine bounds that wait so it fails fast (within ~10s) when no reviewer is actively engaged — only blocking longer when you’ve explicitly requested a pause. The 3600s settings.json timeout is just a backstop. This prevents the agent from appearing hung between turns when Monocle’s engine is still running but you’ve stepped away.

What the hooks do

  • Plan-mode hooks route ExitPlanMode through Monocle so any plan Claude produces needs your sign-off before it runs.
  • Turn-end review gate forcibly pauses Claude at the end of any turn that edited files, and waits for you to submit a review before the next turn starts.
Heads up: hooks don’t fire when Claude is launched with --dangerously-load-development-channels (the flag needed for MCP channel push notifications). If you rely on channels, the hook toggles are no-ops at runtime.

Integration modes

Agent config paths

The files written by register depend on the integration mode: MCP tools mode (default for Claude Code; default for Pi only when pi-mcp-adapter is already configured) Skills mode (default for OpenCode, Codex CLI, Gemini CLI)

monocle unregister

Remove monocle registration from an agent. This is the inverse of monocle register.

Arguments

Flags

For Pi, unregister removes Monocle’s MCP server entry, Monocle-managed prompt templates, and Monocle skills. It leaves the pinned npm:pi-mcp-adapter@2.9.0 package in Pi settings because other MCP servers may depend on the same adapter package.

monocle hooks

Handlers for agent lifecycle events. These subcommands are invoked by the agent’s hook runner, not by humans — they read a JSON payload on stdin and emit the agent’s expected decision JSON on stdout. monocle register wires them up automatically for Claude Code; this section documents the command surface for users who want to install them manually.

Common flags

Every hooks subcommand accepts the same flags: The --agent flag is required on every subcommand, even though claude is currently the only supported value. This keeps settings.json entries self-describing and makes future agents additive rather than breaking. Error-handling philosophy: these hooks degrade gracefully. If stdin is malformed, the engine socket is unreachable, or any intermediate call fails, the command exits 0 with no stdout so the agent falls back to its built-in behavior — the hook never hard-blocks the agent.

monocle serve

Run a headless monocle engine for the current repository. This process owns the socket, the SQLite database, and the review session; the monocle TUI, Desktop app, and future frontends connect as thin clients over the socket.
You don’t normally run monocle serve yourself — launching monocle auto-spawns one in the background for the current repo if none is running. Run it manually when you want the engine up without a UI (for example, to accept monocle review ... calls from agents before the TUI starts), or to inspect the engine from multiple frontends at once.

Flags

Idle shutdown

monocle serve exits automatically when every connected client has been gone for 60 seconds plus --idle-timeout. A TUI the user leaves idle still holds a socket open, so only a genuinely-abandoned serve exits. If the serve has already idled out when the user next runs monocle, autospawn brings up a fresh one — there’s nothing to clean up by hand.

monocle stop

Shut down a running monocle serve for the current repository. Reads the PID file written by serve, sends SIGTERM, and waits for clean exit. No-op when no serve is running.

Flags


monocle serve-mcp

Start the built-in MCP server over stdio. This exposes monocle’s review operations (review_status, get_feedback, send_artifact, add_files) as MCP tools that any stdio-compatible agent can call.
Use this command when your agent isn’t natively supported by monocle register. Add it as an MCP server in your agent’s config, pointing at monocle serve-mcp as the stdio command.

Flags

See agent setup for unsupported agents for a step-by-step walkthrough.

monocle --version

Print the installed monocle version and exit.