Skip to main content

registree

test PyPI Python License: MIT

An anti-hallucination class registry for coding agents, served over MCP.

Coding agents guess constructor signatures from memory — a keyword that doesn't exist, a required argument left out — and you pay for the guess in a TypeError and a debugging round-trip. registree removes the guess: it walks your codebase with ast (never imports), builds a registry of every class definition, and serves it as MCP tools so the agent can verify the signature before writing the call.

Two principles run through every tool:

  • Names map to lists. A duplicated class name returns every definition; the server never silently picks the first match.
  • Honesty over confidence. An open-ended constructor (**kwargs, Pydantic extra=/alias=) reports its contract as unknowable, never as an empty list pretending to be an answer.

How it works

  1. Scan — an AST walk over your source tree extracts every class: constructor parameters (including **kwargs and positional-only), typed fields with defaults, inheritance, docstrings. Classification is transitive: a model routed through your project's own base class is still recognized as a Pydantic model.
  2. Serve — the registry is cached as JSON and exposed over MCP stdio. It maintains itself: generated on first use, regenerated whenever a scanned file is newer than the cache.
  3. Answer — the agent queries it at the moment of use, instead of guessing.

MCP tools

tool use it
get_signature before writing a constructor call — required args, accepted keywords, every definition of a duplicated name
verify_snippet after drafting code — checks constructor calls against the registry
search_classes when unsure of the exact class name
list_duplicates which names need an explicit import to disambiguate
get_usages before a rename — every usage, including through import aliases (X as XDB)
server_info server status and registry size

Install

No install needed with uv — MCP clients launch it with uvx. For direct CLI use:

uv tool install registree   # or: pip install registree

Requires Python 3.12+.

Wire it into your agent

Any MCP client, JSON config form:

{
  "mcpServers": {
    "registree": {
      "command": "uvx",
      "args": ["registree", "serve", "--root", "/path/to/your/project"]
    }
  }
}

Omitting --root serves the directory the client launches the server in, which for most MCP clients is the project root.

Agent compatibility

The MCP tools work with any MCP client — Claude Code, Claude Desktop, Cursor, Windsurf, Cline, Zed, VS Code Copilot agent mode, Gemini CLI, and anything else that speaks MCP over stdio. Structured tool output degrades gracefully for clients that only read text content.

The hook adapters (hook-check, hook-regen) target Claude Code's hook protocol, which can intercept a pending file edit and hand the model advisory feedback before the write lands — a deterministic checkpoint the MCP layer alone can't provide. See docs/claude-code.md.

That protocol is spreading: VS Code Copilot agent mode (Preview) reads the same format — same events, same stdin JSON, even .claude/settings.json — and the adapters tolerate its camelCase field names. Codex CLI and Gemini CLI use close-enough hook contracts that ports are straightforward. Agents whose hook systems can't intercept file edits pre-application (Cursor, Windsurf without model feedback, Zed with no hooks yet) still get the full MCP toolset — the hooks just add a deterministic layer where the platform supports one.

CLI

The same engine is available directly:

registree gen                 # build the registry
registree conflicts           # duplicate names: accepted layering vs smells
registree usages SomeClass    # every usage, alias-aware — run before renames
registree hook-check          # Claude Code PreToolUse adapter (advisory)
registree hook-regen          # Claude Code PostToolUse adapter (debounced)

registree conflicts exits non-zero only for duplicate names that are genuine smells — the accepted ORM/domain layered pair passes — so it is safe to wire into CI from day one.

The registry cache

Lives at .registree/registry.json by default — add .registree/ to your .gitignore. Every command that touches it accepts --registry-path to put it anywhere else; relative paths are anchored to the project root.

Development

uv sync            # creates .venv, installs deps + dev tools
uv run pytest      # includes a real stdio JSON-RPC handshake test
uv run mypy src tests
uv run ruff check .
uv run black --check .

Run the server directly (speaks MCP over stdio; exits on EOF):

uv run registree

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

registree-0.1.0.tar.gz (29.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

registree-0.1.0-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file registree-0.1.0.tar.gz.

File metadata

  • Download URL: registree-0.1.0.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for registree-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c6ef6ef64b5210b46c9e594035592135f474b836786b8c5f9c2e5c700e7629e
MD5 cd84260e11e33627913f4483b4f014f6
BLAKE2b-256 e47e2c7146571e43ce9125b802541a8a4b766a35ec852703ab726e1e19ae3ae8

See more details on using hashes here.

Provenance

The following attestation bundles were made for registree-0.1.0.tar.gz:

Publisher: publish.yml on aucontraire/registree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file registree-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: registree-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for registree-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb0cbf20e0bf042578a5a30611eaba00bbf72cee844b4113b71bd7e961e1a076
MD5 6bcc55f304bfa4fe0a5a5797cd2bda93
BLAKE2b-256 5f3d3dba98fdb3eccff427212844e9165e9229e3fb9068eaf5738a5590b70abc

See more details on using hashes here.

Provenance

The following attestation bundles were made for registree-0.1.0-py3-none-any.whl:

Publisher: publish.yml on aucontraire/registree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page