Skip to main content
Glama
README.md
<div align="center">
  <img src="https://raw.githubusercontent.com/zhiyuanvision-lang/KeepFix/main/packages/vscode/images/icon.png" width="84" height="84" alt="KeepFix Logo" />
  <h1>Bugfix Regression Guard · KeepFix</h1>
  <p><strong>守护每一处历史 Bug 修复不被 AI 编程智能体在重构与清理中顺手误删</strong></p>
  <p><em>Keep every bug fix alive: stop AI coding agents from deleting load-bearing edge-case guards during refactors</em></p>

  <p>
    <a href="https://www.zhiyuanv.com/keepfix.html"><img src="https://img.shields.io/badge/🌐_官方网站与指南-KeepFix-e03d22?style=for-the-badge" alt="Official Website" /></a>
    <a href="https://open-vsx.org/extension/inkmap/keepfix-vscode"><img src="https://img.shields.io/open-vsx/v/inkmap/keepfix-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=inkmap.keepfix-vscode"><img src="https://img.shields.io/visual-studio-marketplace/v/inkmap.keepfix-vscode?style=for-the-badge&label=VS%20Code&color=0284c7" alt="VS Code Marketplace" /></a>
    <a href="https://www.npmjs.com/package/keepfix-mcp"><img src="https://img.shields.io/npm/v/keepfix-mcp?style=for-the-badge&label=npm%20MCP&color=cb3837" alt="npm keepfix-mcp" /></a>
  </p>

  <p>
    <a href="#简体中文"><strong>简体中文</strong></a> · <a href="#english"><strong>English</strong></a> · <a href="https://www.zhiyuanv.com/keepfix.html"><strong>产品主页</strong></a>
  </p>
</div>

---

<a id="简体中文"></a>

## 为什么需要 KeepFix?

让 Agent 重构代码、开发新功能时,它只看局部上下文,极易把几周前专门修线上边缘故障的几行防御代码(Safari 日期兼容、浮点舍入、弱网重连防抖、并发锁顺序)当成“冗余逻辑”顺手删掉,老 Bug 于是反复复活。

KeepFix 为关键历史修复建立护栏,记在 `.keepfix/seals.jsonl` 里,不往源码里加任何注释:

- **自动采集**:修完 Bug 由 Agent 结印;老项目一键扫描 Git 历史,挖出存活至今的关键 `fix` 提交作为候选。
- **事前预防**:Agent 准备修改含护栏的文件时,注入一句不到 60 token 的提醒。
- **事后核对**:按 `git diff` 毫秒级核对。行号平移、Prettier/Black/rustfmt/gofmt 格式化、文件重命名都不报警;防御代码被删就当场报出原故障背景、缺失的代码和对应 diff。
- **等价重构**:Agent 用 `rebind` 说明理由并换新指纹,由你在面板里确认或驳回。

支持 TypeScript/JavaScript、Python、Rust、Go、C/C++,其他文本文件(Shell、SQL、YAML)按通用规则核对。

## 安装

| 宿主 | 方式 |
| :--- | :--- |
| Claude Code(完整:钩子 + MCP + 面板) | `npx -y keepfix-mcp@latest install --claude` |
| Claude Code(仅技能) | 插件市场添加本仓库:`/plugin marketplace add zhiyuanvision-lang/KeepFix` |
| Cursor | `npx -y keepfix-mcp@latest install --cursor`,或在 Open VSX 安装扩展 |
| VS Code | 扩展市场搜索 **KeepFix** |
| Antigravity | 下载 Release 里的 `keepfix-antigravity-<版本>.zip`,解压后运行 `node install.mjs` |
| DeepSeek Harness | 插件 `dsh-keepfix` |
| 任意 MCP 客户端 | `npx -y keepfix-mcp@latest mcp` |
| Git pre-commit | `npx -y keepfix-mcp@latest install --git-hook` |

## 诚实边界

- 护栏核对的是“关键防御代码还在不在”,不运行测试,也不证明逻辑正确。
- 护栏片段如果只出现在字符串或文档字符串里,目前也会被当成仍然存在;同一文件里别处有一模一样的代码时,删掉其中一处也可能不报。我们在回归语料里跟踪这些情况。
- 100% 在本机运行,不上传源码。

7 天免费试用,之后 KeepFix Pro 一次买断 ¥29.9 / $15,不限设备数。

---

<a id="english"></a>

## Why KeepFix?

Coding agents only see local context. Weeks after you fixed a Safari date bug, a float rounding error or a lock-order race, an agent "simplifies" those odd-looking lines away and the old bug is back.

KeepFix pins those fixes in `.keepfix/seals.jsonl` (nothing is added to your source):

- **Capture**: the agent seals a fix right after making it; on an existing project, scan Git history for surviving `fix:` commits.
- **Prevent**: before editing a guarded file the agent gets a one-line reminder (< 60 tokens).
- **Check**: every `git diff` is checked against the guards. Line shifts, Prettier/Black/rustfmt/gofmt and renames are not alarms; a deleted guard is reported with the original reason, the missing code and the diff.
- **Equivalent rewrites**: the agent rebinds a guard with a reason, you confirm or reject it in the panel.

Languages: TypeScript/JavaScript, Python, Rust, Go, C/C++; other text files (shell, SQL, YAML) with generic rules.

## Install

| Host | How |
| :--- | :--- |
| Claude Code (hooks + MCP + panel) | `npx -y keepfix-mcp@latest install --claude` |
| Claude Code (skill only) | `/plugin marketplace add zhiyuanvision-lang/KeepFix` |
| Cursor | `npx -y keepfix-mcp@latest install --cursor`, or the extension on Open VSX |
| VS Code | Search **KeepFix** in the Marketplace |
| Antigravity | Unzip `keepfix-antigravity-<version>.zip` from the Release and run `node install.mjs` |
| DeepSeek Harness | Plugin `dsh-keepfix` |
| Any MCP client | `npx -y keepfix-mcp@latest mcp` |
| Git pre-commit | `npx -y keepfix-mcp@latest install --git-hook` |

## Honest limits

- KeepFix checks that the load-bearing code is still there. It does not run your tests or prove the logic correct.
- A guard snippet that survives only inside a string or docstring still counts as present, and an identical line elsewhere in the same file can hide a deletion. These cases are tracked in the regression corpus.
- Runs 100% locally; no source code is uploaded.

7-day free trial, then KeepFix Pro: one-time ¥29.9 / $15, any number of devices.