Patchwork — Codebase Conventions for AI Agents logo

Patchwork — Codebase Conventions for AI Agents

Scans codebases, generates convention files, and exposes detected patterns through eight MCP tools for AI coding agents.

Install Patchwork — Codebase Conventions for AI Agents

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "patchwork-codebase-conventions-for-ai-agents": {
      "command": "uvx",
      "args": [
        "patchwork-conventions"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx patchwork-conventions

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

patchwork — Codebase Conventions for AI Agents scans a project and turns observed coding patterns into CONVENTIONS.md or agent-readable MCP results. It uses project configuration, file discovery, AST parsing, and language-specific miners to detect naming, structure, imports, errors, tests, APIs, Git practices, and tooling. The MCP interface provides eight focused tools over stdio or HTTP, including checks for proposed names. Use it when agents need repository-specific conventions instead of manually maintained guidance.

Use cases

  • Generate a CONVENTIONS.md file from an existing repository
  • Check proposed identifiers against observed naming patterns
  • Query project structure before creating files or directories
  • Review testing and error-handling practices before writing code
  • Keep convention documentation updated while a codebase changes

Key features

  • AST-based convention mining with confidence scores
  • Naming, import, structure, testing, API, and error-pattern detection
  • Git commit, branch, and co-change analysis
  • CONVENTIONS.md, AGENTS.md, and CLAUDE.md output
  • Eight MCP tools over stdio or HTTP
  • Language filtering and optional full AST support

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

25/29 checks healthy over the last 112d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 11d ago via OSV.dev · patchwork-conventions (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit5mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Patchwork — Codebase Conventions for AI Agents works

What patchwork — Codebase Conventions for AI Agents MCP server does

patchwork — Codebase Conventions for AI Agents examines a codebase and records conventions that are already present in the project. Its scanner covers naming for functions, classes, variables, constants, files, and tests; import styles; directory and test organization; error handling; testing practices; API patterns; Git history; and the detected technology stack.

The command-line scanner can write a CONVENTIONS.md file, generate AGENTS.md, append findings to CLAUDE.md, print Markdown, or return JSON. It can also update an existing report, show detected conventions, display a proposed diff, or watch for changes and regenerate the output. A check command is available through the MCP interface for validating a proposed name.

How it works

The scanner first reads project configuration such as package.json, pyproject.toml, go.mod, and Cargo.toml. It discovers files while respecting .gitignore and skipping common dependency directories. For supported languages, tree-sitter parses source files into syntax trees. Individual miners then extract naming, imports, structure, error handling, testing, API, and Git patterns.

Detected categories include confidence scores, examples from the codebase, and counter-examples where the repository is inconsistent. Git analysis also considers commit messages, branch names, and files that commonly change together. The process does not require an LLM.

Python, TypeScript, and JavaScript have full AST support. Go, Rust, and Java require the optional full installation for AST support. Ruby, PHP, C#, and C++ use regex-based fallback analysis. The scanner accepts language filters and can target a specified project path.

Setup and configuration

Install the package from PyPI with:

Terminal
pip install patchwork-conventions

Run patchwork scan from a project directory, or provide a path such as patchwork scan /path/to/project. Install the optional language bundle with pip install 'patchwork-conventions[full]' when AST support is needed for Go, Rust, or Java.

Start the MCP service with patchwork serve --stdio for a stdio connection, or patchwork serve --port 3742 for HTTP mode. Claude Code, Claude Desktop, and Cursor examples pass the project path as an argument to the serve command. Claude Code can also use the generated CONVENTIONS.md, an appended CLAUDE.md, or the repository's SKILL.md copied into its skills directory.

Tools and capabilities

The MCP server exposes eight tools:

  • patchwork_scan returns a complete conventions overview.
  • patchwork_naming reports naming patterns before new identifiers are written.
  • patchwork_structure describes source roots, directory organization, and test layout.
  • patchwork_stack reports frameworks, package managers, linters, formatters, type checkers, build tools, and scripts.
  • patchwork_errors reports error-handling and logging patterns.
  • patchwork_testing reports testing frameworks, assertions, mocking, coverage, and fixtures.
  • patchwork_git reports commit and branch conventions.
  • patchwork_check validates a proposed name against detected conventions.

These tools let an agent query patchwork — Codebase Conventions for AI Agents before adding identifiers, files, libraries, tests, error paths, or commit messages.

Limitations and notes

Results describe patterns found in the scanned repository, so mixed conventions can produce lower confidence or counter-examples. AST coverage varies by language, and several languages rely on regex fallback analysis. The project is released under the MIT license.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Patchwork — Codebase Conventions for AI Agents

patchwork — Codebase Conventions for AI Agents is an MCP server that scans a project’s source code and exposes detected conventions through eight tools. It connects an AI coding agent to naming, structure, stack, error, testing, Git, scan, and proposed-name checks.

Install it with `pip install patchwork-conventions`. Run `patchwork scan` in a project directory, or install the optional `full` extra for AST support for Go, Rust, and Java.

Start it with `patchwork serve --stdio` and add the command plus the project path to Claude Code’s MCP configuration, or use `claude mcp add` interactively. Claude Code can also read a generated `CONVENTIONS.md` file.

Configure the server with the `patchwork serve` command, the project path, and the `--stdio` argument.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPatchwork — Codebase Conventions for AI Agents AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/patchwork-codebase-conventions-for-ai-agents?style=directory)](https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents)
HTML Embed
<a href="https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents"><img src="https://allmcps.com/api/badge/patchwork-codebase-conventions-for-ai-agents?style=directory" alt="Patchwork — Codebase Conventions for AI Agents on AllMCPs" /></a>