ClaimDiff
README.md
<div align="center">
<img src="https://raw.githubusercontent.com/zhiyuanvision-lang/ClaimDiff/main/packages/vscode/images/icon.png" width="84" height="84" alt="ClaimDiff Logo" />
<h1>Code Review & Diff · ClaimDiff</h1>
<p><strong>核对 AI 编程智能体「说做了什么」与「实际改了什么」——把冗长杂乱的 Git Diff 秒变可点击逐项核对的改动导读</strong></p>
<p><em>Verify what your AI coding agent says it built against the real git diff: clickable feature-to-hunk review guide with mismatch warnings</em></p>
<p>
<a href="https://www.zhiyuanv.com/claimdiff.html"><img src="https://img.shields.io/badge/🌐_官方网站与指南-ClaimDiff-e03d22?style=for-the-badge" alt="Official Website" /></a>
<a href="https://open-vsx.org/extension/claimdiff/claimdiff-vscode"><img src="https://img.shields.io/open-vsx/v/claimdiff/claimdiff-vscode?style=for-the-badge&label=Cursor%20%2F%20Open%20VSX&color=059669" alt="Open VSX" /></a>
<a href="https://marketplace.visualstudio.com/items?itemName=claimdiff.claimdiff-vscode"><img src="https://img.shields.io/visual-studio-marketplace/v/claimdiff.claimdiff-vscode?style=for-the-badge&label=VS%20Code&color=0284c7" alt="VS Code Marketplace" /></a>
<a href="https://www.npmjs.com/package/claimdiff-mcp"><img src="https://img.shields.io/npm/v/claimdiff-mcp?style=for-the-badge&label=npm%20MCP&color=cb3837" alt="npm claimdiff-mcp" /></a>
</p>
<p>
<a href="#简体中文"><strong>简体中文</strong></a> · <a href="#english"><strong>English</strong></a> · <a href="https://www.zhiyuanv.com/claimdiff.html"><strong>产品主页</strong></a> · <a href="https://www.zhiyuanv.com/software.html#claimdiff"><strong>Pro 定价与说明</strong></a>
</p>
</div>
---
<a id="简体中文"></a>
## 为什么用 AI 写代码的程序员都需要 ClaimDiff?
用 **Cursor、Claude Code、DeepSeek Harness、Antigravity** 写代码时,AI 动辄一次修改十几个文件、几百上千行代码,最后甩给你一段漂亮的「已完成总结」:
- **只看 AI 的文字汇报?** 经常遇到 AI **「嘴上说改了,代码根本没动」**,或者顺手 **「偷偷删改了不相关的逻辑却只字未提」**。
- **肉眼硬啃原始 `git diff`?** 跨十几个文件按字母顺序排列的零碎代码块,根本看不出哪几段改动对应哪个业务功能点。
**ClaimDiff 在本地把 AI 的总结与真实的 `git diff` 逐块交叉核对,生成一份「点击功能点 → 直达对应代码改动」的可交互审查导读,并对所有言行不一之处自动亮灯预警:**
| 审查维度 | **ClaimDiff(AI 改动核对导读)** | 肉眼直接翻 `git diff` | 仅看 AI 对话汇报 / 普通 PR 摘要 |
| :--- | :--- | :--- | :--- |
| **阅读主线与认知负担** | **按业务功能点聚合,点击任一功能直接展开对应 Diff 块** | 按文件名字母序平铺,跨文件逻辑碎成一地 | 只有自然语言自述,看不到底层真实代码证据 |
| **AI 漏改检测(说了没做)** | **自动标记无代码支撑的虚报功能点(`claimedButNoCode`)** | 需人脑逐条记忆并去几十个文件里翻找核实 | 完全无法发现 AI 幻觉汇报 |
| **AI 暗改检测(做了没说)** | **自动揪出没有任何功能点认领的未声明改动块(`unclassified`)** | 极易在几百行格式/重构噪音中漏看顺手暗改 | AI 没写进总结就彻底隐身 |
| **同文件偷改未声明函数** | **精准标出虽列了文件名、但未命中任何声明符号的改动块** | 看到文件名对了往往一滑而过 | 无法精确到函数与键值粒度 |
| **隐私安全与 Token 消耗** | **100% 纯本机运行不上传源码;向模型只返回一句话摘要** | 纯本地,但耗时费眼 | 云端 PR 机器人往往需上传代码仓库 |
> **诚实边界声明**:核对「对上了」只说明总结里声明的相关文件与符号确实发生了改动,**不代表代码逻辑本身没有 Bug**——ClaimDiff 帮你省去在十几个文件里大海捞针找改动的体力活,让你把精力集中在关键逻辑审查上。
---
## 安装与快速开始(30 秒上手)
### 方式一:命令行一键配置项目或安装插件
下方依次为 **Cursor 项目接入**、**Claude Code 项目接入**、**DeepSeek Harness 原生插件安装**(将钩子、MCP 服务与 `claimdiff` 技能自动写入环境,并将 `.claimdiff/` 加入 `.git/info/exclude` 不污染仓库):
```bash
npx -y claimdiff-mcp@latest install --cursor
npx -y claimdiff-mcp@latest install --claude
dsh plugin --profile web add dsh-claimdiff
```
### 方式二:按所在 IDE 与 AI 客户端安装使用
| 所在平台 | 安装渠道 | 触发与打开方式 |
| :--- | :--- | :--- |
| **VS Code / Cursor / Windsurf / VSCodium** | 扩展商店搜索 **`ClaimDiff`** 安装(`claimdiff.claimdiff-vscode`) | Agent 改完代码自动打开;或点击左侧 Git 源代码管理栏顶部的 **核对图标(`打开改动导读`)** |
| **Claude Code / Claude Desktop** | 执行 `/plugin marketplace add zhiyuanvision-lang/ClaimDiff` 再执行 `/plugin install claimdiff@claimdiff-marketplace`(或上方 `install --claude`) | Agent 完成改码后自动调用 `claimdiff` 技能写总结、核对并在对话内直接展开交互导读面板 |
| **DeepSeek Harness** | 插件页添加 `dsh-claimdiff` 或运行 `dsh plugin --profile web add dsh-claimdiff` | 在文档预览工具栏点击 **`ClaimDiff`** 按钮,右侧分栏直接打开当前 Git 仓库的改动导读 |
| **Google Antigravity** | 从 [GitHub Releases](https://github.com/zhiyuanvision-lang/ClaimDiff/releases) 下载 `claimdiff-antigravity-<版本>.zip` 安装 | 右侧辅助面板(Sidecar)直接打开 ClaimDiff 导读,点击改动块联动查看 |
| **任意终端 / 独立浏览器** | 无需安装扩展,直接在任意 Git 仓库目录执行 `npx -y claimdiff-mcp@latest open` | 在本机浏览器启动独立导读面板,随时核对工作区未提交改动或指定 Commit 区间 |
---
## 功能特性详解(三大核对防线)
### 1. 点击功能点 → 即刻对照真实 Git Diff 代码块
Agent 完成编码任务后,按规范将本次任务拆分为清晰的功能点写入 `.claimdiff/summary.md`(指明每个功能修改的相对路径与新增/改动的函数、类、路由或配置键名)。在 ClaimDiff 导读面板中点击任意功能点,右侧立即聚合展示支撑该功能的全部真实 Diff 改动块;在 VS Code / Cursor 中点击代码块还能一键跳转到源文件对应行。
### 2. 三重双向交叉校验,专治 AI「言行不一」
- **虚报预警(说了没改)**:总结里声称完成了某功能或改了某路径,但真实 `git diff` 里根本没有对应改动时,立即高亮告警。
- **暗改预警(改了没说)**:真实 `git diff` 中存在未被任何功能点(或「未归入功能点的改动」)认领的野生改动块时,单独归入未解释改动提醒你重点排查。
- **符号级细粒度核对**:哪怕文件在声明列表里,只要某处 Diff 块完全不包含为该文件声明的函数名/类名/键名,也会明确标出「文件已列、符号未声明」,杜绝顺手夹带私货。
### 3. 100% 纯本机隐私处理 & 极小模型上下文开销
- **源码零上传**:所有代码、Git Diff、`.claimdiff/` 总结与工作区路径 **100% 在本机进程内解析核对**,绝不上传任何云端服务器。
- **不挤占 Agent 上下文窗口**:`claimdiff_open` 返回给大模型的工具结果仅有一句话与几个统计数字,完整的改动块与核对明细由前端面板通过专用本地接口按需拉取,既省 Token 又不干扰后续对话。
---
## 配置与工作流示例
### 标准 MCP 客户端接入配置(`mcp.json`)
如果你希望在任意支持标准 MCP / MCP Apps 协议的客户端中手动挂载 ClaimDiff:
```json
{
"mcpServers": {
"claimdiff": {
"command": "npx",
"args": ["-y", "claimdiff-mcp@latest", "mcp"]
}
}
}
```
### 结构化改动总结示例(`.claimdiff/summary.md`)
安装 `claimdiff` 技能后,Agent 会在汇报前自动生成如下结构并调用 `claimdiff_check` 自检修正,最后调用 `claimdiff_open` 打开导读:
```markdown
## 功能点 1:登录接口滑动窗口限流
按用户 ID 统计窗口请求数,超限返回 429 状态码。
涉及改动:
- src/middleware/rateLimit.ts:新增 `slidingWindow`、`rateLimit`
- src/routes/auth.ts:在 `/login` 路由挂载限流中间件
## 未归入功能点的改动
- package.json:新增依赖 `ioredis`
```
---
## 🎁 3 天免登录免费试用 & Pro 终身买断
- **免费试用**:首次使用自动享有 **3 天全功能免登录免费试用**(无需注册账号,开箱即用)。
- **一次买断 · 多平台通用**:试用期满后支持一次性买断 **ClaimDiff Pro 终身版**(国内 `¥39.9` / 海外 `$19.9`,无按月自动续费,享 14 天无理由全额退款保障),同一账号可在 VS Code、Cursor、Claude Code、Antigravity、DeepSeek Harness 与命令行全平台通用。详见 [官方网站说明](https://www.zhiyuanv.com/software.html#claimdiff)。
---
<a id="english"></a>
## English Guide — Code Review & Diff · ClaimDiff
**Verify what your AI coding agent says it built against what it actually changed in `git diff`.**
When **Cursor, Claude Code, DeepSeek Harness, or Antigravity** edits a dozen files at once, ClaimDiff turns the agent's summary into an **interactive, clickable change guide** — click each claimed feature to inspect the exact diff hunks behind it, and get immediate warnings whenever the summary and the code disagree.
| Review Dimension | **ClaimDiff** | Reading Raw `git diff` | Trusting Agent Chat / Generic PR Bots |
| :--- | :--- | :--- | :--- |
| **Review Flow** | **Grouped by feature; click a feature to inspect its exact diff hunks** | Flat alphabetical file dump across 15+ files | Prose claims with no direct hunk verification |
| **Unimplemented Claims** | **Flags features whose claimed files/symbols have no matching diff** | Manual cross-checking from memory | Undetected agent hallucinations |
| **Silent / Unexplained Edits** | **Flags every diff hunk that no feature or "Other changes" section accounts for** | Easy to miss buried inside formatting noise | Completely invisible if omitted from summary |
| **Symbol-Level Check** | **Marks hunks in listed files that touch none of the declared function/class names** | Skipped once the filename looks familiar | Too coarse to catch side-effect edits |
| **Privacy & Token Cost** | **100% local on your machine; returns only 1 sentence + counts to the LLM** | Local, slow & fatiguing | Cloud PR bots often upload repo diffs |
> **Honest Scope**: A match means the claimed files and symbols were indeed modified — **not** that the logic is bug-free. ClaimDiff eliminates the mechanical scavenger hunt across files so you can focus human judgment on correctness.
### Quick Start
1. **Set up in a project (Cursor / Claude Code) or DeepSeek Harness**:
```bash
npx -y claimdiff-mcp@latest install --cursor
npx -y claimdiff-mcp@latest install --claude
dsh plugin --profile web add dsh-claimdiff
```
2. **IDE Extensions**: Search **`ClaimDiff`** (`claimdiff.claimdiff-vscode`) in the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=claimdiff.claimdiff-vscode) or [Open VSX Registry](https://open-vsx.org/extension/claimdiff/claimdiff-vscode) (Cursor / Windsurf / VSCodium).
3. **Claude Code Marketplace**: Run `/plugin marketplace add zhiyuanvision-lang/ClaimDiff` then `/plugin install claimdiff@claimdiff-marketplace`.
4. **Standalone CLI**: Run `npx -y claimdiff-mcp@latest open` inside any Git repository.
### Features
- **Clickable Feature-to-Hunk Navigation**: Jump from each claimed feature directly to its backing diff hunks (and straight to the file & line inside VS Code / Cursor).
- **Three-Way Mismatch Warnings**: Automatically flags `claimedButNoCode`, `claimedPathsNotInDiff`, `inListedFileButNotNamed`, and `unclassified` leftover hunks.
- **100% Local Privacy & Minimal Context Footprint**: Code, diffs, file paths, and summaries never leave your machine. See [LICENSE.md](LICENSE.md) for anonymous usage telemetry details.
- **3-Day Free Trial + One-Time Lifetime Pro**: 3-day full-featured free trial with no sign-in required, followed by a one-time purchase (`$19.9` / `¥39.9` lifetime across all supported hosts, 14-day full refund guarantee).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues