Installing
Quickstart
1
Initialize Mesa in your repo
- Creates
.mesa/config.yamland.mesa/rules/ - Offers to generate rules from your codebase, use our starter rules, or start from scratch
- Sets up Claude Code integration (MCP server & Claude Code slash commands and hooks)
- Stores your API key in
.env.localif provided
2
Generate rules or write your own
3
Run a review
Rules
Rules live in.mesa/rules/ as markdown files. Each rule defines what to check, which files it applies to, and how severe a violation is.
### Violations and ### Compliant sections provide code examples.
Claude Code integration
mesa init sets up three things for Claude Code automatically.
Stop hook
Every time Claude Code finishes writing code, Mesa reviews the uncommitted changes. If violations are found, Claude is blocked and asked to fix them before completing.MCP server
Mesa registers as an MCP server via.mcp.json. Claude Code discovers it on startup and gains access to Mesa’s tools for reviewing code, creating rules, and generating rules.
Slash commands
Available inside Claude Code aftermesa init:
Background review agent
This agent runs a second AI reviewer in the background while you work. Instead of calling an LLM API directly, it shells out to whatever coding agent you already have installed (Claude Code only supported now) and uses that agent’s existing subscription (Pro/Max/etc) without any setup.No API key needed. The background agent uses your installed coding agent’s own subscription. If you can run “claude” from your terminal, the agent works.
How it works
When enabled, the stop hook changes behavior:- After each Claude Code turn, the hook silently queues your changes for background review
- On the next turn, the hook checks for findings from the previous review
- If findings exist, they’re injected as recommendations the agent can fix or ignore, otherwise the user sees nothing.
Setup
Enable the daemon in.mesa/config.yaml:
Rules engine vs. background agent
You use one or the other via
daemon.enabled in your config — they don’t run simultaneously.
Configuration
.mesa/config.yaml is created by mesa init:
ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY) or from .env.local / .env files.

