# patchwork — Codebase Conventions for AI Agents [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/SaiNarayana-B/patchwork  
**GitHub Stars:** 0  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents

## Description
Scan any codebase, generate CONVENTIONS.md, expose conventions as MCP tools for AI agents.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "patchwork-codebase-conventions-for-ai-agents": {
    "command": "uvx",
    "args": ["patchwork-conventions"]
  }
}
```

## Documentation

## 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:

```bash
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.

_Full upstream README: https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents/readme_

