
patchwork — Codebase Conventions for AI Agents
io.github.SaiNarayana-B由 GitHub 账号 SaiNarayana-B 发布v0.1.7更新于 Oct 24, 2026
Scan any codebase, generate CONVENTIONS.md, expose conventions as MCP tools for AI agents.
发布方自己的服务:Codebase
概览
扫描本地代码库,挖掘其编码约定,并通过 MCP 工具提供给 AI 代理,使其遵循项目真实风格。
- 可以做什么
- patchwork 通过 AST 解析(tree-sitter)并结合配置文件与 git 历史分析源码,检测命名、导入、结构、错误处理、测试、API 与 git 约定,并给出置信度和真实示例。它会生成 CONVENTIONS.md(或 AGENTS.md,或追加到 CLAUDE.md),也可作为 MCP 服务器运行,提供 patchwork_scan、patchwork_naming、patchwork_structure、patchwork_stack、patchwork_errors、patchwork_testing、patchwork_git 和 patchwork_check 等八个工具。此外还提供 scan、update、diff、show、watch 命令以及 Python API。
- 适用场景
- 当 AI 编码助手总是编造与项目不符的命名、文件布局、错误处理或提交风格时使用。它适合希望代理读取代码库真实约定、而不是依赖手写且很快过时的风格指南的团队。
- 运行要求
- 作为本地 stdio 进程在用户机器上运行(仅桌面端)。需用 pip 安装 PyPI 包 patchwork-conventions,需要 Python;Go、Rust、Java 的完整 AST 支持来自 'full' 附加包。未声明任何账号、API 密钥、环境变量或请求头,也不需要网络访问。
安装
在 SourceWeft 中
- 打开 控制台中的 patchwork — Codebase Conventions for AI Agents,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
patchwork
Mine your codebase. Generate CONVENTIONS.md. Stop AI agents from making up your style.
[PyPI] [License: MIT] [Python 3.9+] [agent-skills] [MCP]
Every team that uses AI coding assistants hits the same wall: Claude writes getUserById in a codebase that uses get_user_by_id. Cursor creates components/userCard.tsx in a project that uses user-card.tsx. The agent invented a response shape that doesn't match the rest of the API.
You write a CLAUDE.md manually. It goes stale in two weeks. You write it again.
patchwork automates this. It scans your actual source code using AST analysis and detects what your team really does — not what you think you do.
What it detects
Quick start
That's it. You'll get a CONVENTIONS.md like this:
Why not argus or sourcebook?
Commands
Claude Code integration
Option 1: CONVENTIONS.md (recommended)
Option 2: Append to CLAUDE.md
Option 3: MCP server
Claude Code — add to ~/.claude.json (or run claude mcp add interactively):
Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Cursor — add to .cursor/mcp.json in your project root:
Then your AI agent can use 8 on-demand tools:
Option 4: Claude Code skill (SKILL.md)
Copy SKILL.md from this repo to ~/.claude/skills/patchwork/SKILL.md to get /patchwork slash commands.
Watch mode (CI/auto-update)
Python API
Supported languages
Install full language support:
How it works
All analysis is 100% local — no API calls, no telemetry, no data leaves your machine.
Performance
On a 1,000-file TypeScript monorepo:
- Without tree-sitter: ~0.8s
- With tree-sitter (full AST): ~2.1s
On a 500-file Python project:
- ~1.1s
Results are deterministic — same codebase always produces the same output.
Contributing
Pull requests welcome. See CONTRIBUTING.md.
License
MIT — free for personal and commercial use.
Topics
claude-code · agent-skills · mcp · context-engineering · hallucination-detection · code-conventions · static-analysis · tree-sitter · developer-tools · ai-coding
来源:README.md,提交 595de70
工具
0版本历史
1- v0.1.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Codebase 集成
Codebase
design.codebase官方发布者
让 AI 助手构建、预览和更新 Web 应用,下载源代码,并在用户允许时发布。
Reactable Codebase Readiness Assessments
由 GitHub 账号 reactable-io 发布
远程 MCP 服务器,在 AI 代理中按 12 个维度为代码库打分,并给出问题发现、修复提示与重新评估。

Codebase Doctor
由 GitHub 账号 subhajitlucky 发布
只读的代码库审计工具,让编程助手扫描仓库中的密钥、依赖漂移、RLS 与鉴权问题,并给出带覆盖范围说明的审查结论。

Dsh Codebase Chat
由 GitHub 账号 shinzarou-eng 发布
一个本地优先的 MCP 服务器,可针对代码库给出带引用的回答,并生成审计与报告。

Codebase Chat
由 GitHub 账号 shinzarou-eng 发布
本地优先的代码库智能 MCP 服务器,让助手基于整个仓库进行问答、搜索、审计并安全修改代码,答案附带文件与行号引用。