metatron
Metatron is a self-hosted system that captures a codebase's real implementation decisions — preferred patterns, rejected approaches, edge cases, internal conventions — as structured priors, and serves them to coding agents over MCP (Model Context Protocol). The goal: an agent writes code like a senior engineer who already knows the codebase
Metatron studies your codebase and extracts the decisions behind it, patterns, conventions, rejected approaches, then serves them to AI coding assistants via MCP so agents write code that actually fits your project.
Metatron is a self-hosted tool that studies a codebase and extracts the decisions behind it: which patterns the team prefers, which approaches were tried and rejected, what the internal conventions are, and where the edge cases hide. It stores those decisions as structured records and then makes them available to AI coding assistants via MCP, which stands for Model Context Protocol. The idea is that an AI agent connected to Metatron can write code that fits the existing codebase instead of rediscovering its rules from scratch on every task.
The workflow has three main steps. First, you run an ingest command that analyzes your repository. It reads structural signals like imports, decorators, base classes, and commit history, but does not send raw source code to any external model. It uses the Anthropic API to turn those signals into a set of candidate decisions. Second, you review the candidates yourself and approve the ones that are accurate. Nothing becomes part of the canonical knowledge base without human sign-off. Third, you run a serve command that makes the approved decisions available to your coding agent over MCP.
There is also a feedback loop. As an agent works on your code, it can report gaps in what Metatron knows. A separate refine-feedback step processes those reports and generates new candidates, which again go through your review before they become canonical. This is meant to capture conventions that can only be seen through how the codebase is used rather than how it is written.
Metatron stores everything in a SQLite database on your own machine. Each repository gets its own database file, so you can hand a colleague a single file and they can immediately connect their coding agent to the decisions you have already curated. The tool compares itself to code search tools like Copilot, which find code by text similarity, and code graph tools, which map how files and functions connect. Metatron's focus is different: it tries to capture the intent and reasoning behind code, not just the code itself.
You can install it via pip, the uv package manager, or Docker. The Docker image includes a prebuilt multi-architecture version and can be pointed at directly in your agent's MCP configuration. The ingest and feedback-refinement steps require an Anthropic API key; the serve command runs fully locally with no API calls needed.
Where it fits
- Connect your AI coding assistant to your codebase's unwritten rules so it stops reinventing patterns you've already settled on.
- Capture team conventions and rejected approaches in a portable file you can hand to a new colleague or open-source contributor.
- Let an AI agent report gaps in its understanding of your code, then review and approve those insights before they become canonical.
- Keep AI-generated code consistent across a long project by giving the agent a live memory of past decisions.