能力标签
AI代码记忆
🔌
MCP工具

AI代码记忆

基于 Python · 让 AI 助手直接操作你的系统与工具
英文名:selvedge
⭐ 8 Stars 💻 Python 📄 MIT 🏷 AI 7.5分
7.5AI 综合评分
ai-agent代码追溯代码记忆
✦ AI Skill Hub 推荐

AI代码记忆 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。

📚 深度解析

AI代码记忆 是一款基于 MCP(Model Context Protocol)标准协议的 AI 工具扩展。MCP 协议由 Anthropic 开发并开源,旨在建立 AI 模型与外部工具之间的标准化通信接口,目前已被 Claude Desktop、Claude Code、Cursor 等主流 AI 工具采纳。

通过安装 AI代码记忆,你的 AI 助手将获得额外的工具调用能力,可以用自然语言直接操控该工具的功能,无需学习复杂的命令行语法。MCP 工具的核心价值在于"一次配置,永久增强"——配置完成后,每次与 AI 对话时都可以无缝调用这些工具。

在技术实现上,MCP 工具通过标准的 JSON-RPC 协议与 AI 客户端通信,工具的功能以"工具列表"的形式暴露给 AI 模型,AI 可以按需调用。AI代码记忆 提供了结构化的工具调用接口,使 AI 模型能够精确地理解和使用每个功能点,显著降低 AI 在工具使用上的错误率。

与传统的 API 集成相比,MCP 工具的优势在于无需编写代码——用户只需在配置文件中添加几行 JSON,即可让 AI 获得全新能力。AI Skill Hub 将 AI代码记忆 评为 AI 评分 7.5 分,属于同类工具中的优质选择。

📋 工具概览

AI代码记忆 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

GitHub Stars
⭐ 8
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
7.5 分
工具类型
MCP工具
Forks

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

AI代码记忆 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

📌 核心特色
  • 通过标准 MCP 协议与 Claude、Cursor 等主流 AI 客户端深度集成
  • 提供结构化工具调用接口,显著降低 AI 集成复杂度
  • 支持 Claude Desktop 和 Claude Code 无缝接入,开箱即用
  • 可与其他 MCP 工具组合叠加,构建完整 AI 工作站
  • 轻量无侵入设计,不影响现有系统架构
🎯 主要使用场景
  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/masondelan/selvedge

# 方式二:手动配置 claude_desktop_config.json
{
  "mcpServers": {
    "ai----": {
      "command": "npx",
      "args": ["-y", "selvedge"]
    }
  }
}

# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
📋 安装步骤说明
  1. 确认已安装 Node.js(v18 或以上版本)
  2. 打开 Claude Desktop 或 Claude Code 的 MCP 配置文件
  3. 按「交给 Agent 安装 → Claude Desktop」标签中的 JSON 配置填入 mcpServers 字段
  4. 保存配置文件并重启 Claude 客户端
  5. 重启后,在对话中即可使用本工具
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 安装后在 Claude 对话中直接使用
# 示例:
用户: 请帮我用 AI代码记忆 执行以下任务...
Claude: [自动调用 AI代码记忆 MCP 工具处理请求]

# 查看可用工具列表
# 在 Claude 中输入:"列出所有可用的 MCP 工具"
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
// claude_desktop_config.json 配置示例
{
  "mcpServers": {
    "ai____": {
      "command": "npx",
      "args": ["-y", "selvedge"],
      "env": {
        // "API_KEY": "your-api-key-here"
      }
    }
  }
}

// 保存后重启 Claude Desktop 生效
📑 README 深度解析 真实文档 完整度 61/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="docs/wordmark.svg" alt="selvedge" width="480"> </p>

<p align="center"> <a href="https://selvedge.sh"><strong>selvedge.sh</strong></a> &nbsp;·&nbsp; <a href="https://pypi.org/project/selvedge/"><strong>PyPI</strong></a> &nbsp;·&nbsp; <a href="https://github.com/masondelan/selvedge"><strong>GitHub</strong></a> </p>

<p align="center"> <a href="https://github.com/masondelan/selvedge/actions/workflows/test.yml"><img src="https://github.com/masondelan/selvedge/actions/workflows/test.yml/badge.svg" alt="Tests"></a> <a href="https://pypi.org/project/selvedge/"><img src="https://img.shields.io/pypi/v/selvedge?cacheSeconds=3600" alt="PyPI"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> </p>

Long-term memory for AI-coded codebases. A git blame for AI agents — but for the why, not just which line which model touched. Captured live, by the agent, as the change happens.

Selvedge is a local MCP server. AI coding agents (Claude Code, Cursor, Copilot) call it as they work to log structured change events with reasoning. Your data stays in a SQLite file under .selvedge/ next to your code.

---

Six months ago, your AI agent added a column called user_tier_v2. You don't know why. git blame points to a commit from claude-code with a generated message that says "Update schema." The session that made the change is long gone — and so is the prompt that produced it.

With Selvedge, you run this instead:

$ selvedge blame user_tier_v2

  user_tier_v2
  Changed     2025-10-14 09:31:02
  Agent       claude-code
  Commit      3e7a991
  Reasoning   User asked to add a grandfathering flag for legacy free-tier
              users during the pricing migration. Stores the original tier
              so we can backfill discounts without touching billing history.

That reasoning was captured by the agent in the moment — written into Selvedge from the same context that produced the change. Not inferred from the diff afterward by a second LLM. Not a hand-typed commit message.

---

---

What's new in v0.3.6

Two themes in one release as a one-time exception to the single-theme cadence: stay-current (background PyPI version check) and retention basics (selvedge prune for the tool_calls table). Drop-in upgrade for anyone on 0.3.5.

What's new in v0.3.5

The recovery-basics release. v0.3.1 made the runtime safe; v0.3.2 made problems visible; v0.3.5 ships the minimum viable "what happens when something has gone wrong" surface. Drop-in upgrade for anyone on 0.3.4.

selvedge verify — DB-correctness gate with two exit tiers. Walks the store and reports each check as PASS / WARN / FAIL. Must-fail conditions (SQLite corruption, schema mismatch against the declared MIGRATIONS, empty entity_path, unknown change_type in the store, unparseable timestamps, malformed tool_calls rows) exit non-zero. Should-warn conditions (singleton changeset_id groups, events past the 60-minute backfill window with no git_commit) print warnings but exit 0 by default. Pass --strict to escalate warnings to failures — the tiering means selvedge verify can drop into CI on day one without || true. --json for machine output.

selvedge backup — online SQLite snapshot via VACUUM INTO. Default destination .selvedge/backups/selvedge-YYYYMMDD-HHMMSS.db, kept out of git because selvedge init now appends .selvedge/backups/ to the project .gitignore (and the first selvedge backup run on an existing repo appends it the same way — idempotent). Hardcoded keep_last=7 for this release; the setting becomes backup_keep_last in .selvedge/config.toml when that file lands in v0.3.10. --output <path> overrides the default and is excluded from rotation so ad-hoc destinations aren't swept up. Two backups in the same second don't collide.

Doctor — Last backup row. INFO when the newest backup is ≤7 days old, WARN when older, FAIL when no backups exist and the events table has ≥10,000 rows (the threshold where no-backups becomes a real data-loss exposure rather than a CI/scratch DB).

Doctor — Schema version now FAILs on downgrade. When schema_migrations contains a version not declared in the current MIGRATIONS tuple, the row fails rather than silently passing — surfaces "this DB was last opened by a newer Selvedge" before any write attempts schema work it doesn't understand.

See CHANGELOG.md for the full list including the 24 new tests across test_verify.py, test_backup.py, and the test_doctor.py extension.

---

Quickstart

pip install selvedge
cd your-project
selvedge setup

That's it. selvedge setup is an interactive wizard: it detects which AI tools you have (Claude Code, Cursor, Copilot), writes the MCP entry into each one's config, drops the canonical agent-instructions block into your project's prompt file (CLAUDE.md / .cursorrules / copilot-instructions.md), runs selvedge init, and installs the post-commit hook. Every modified file gets a .bak written next to it before any change reaches disk. Re-running is a no-op.

For CI bootstrap or devcontainer.json postCreateCommand:

selvedge setup --non-interactive --yes

Configuration

MethodFormatExample
Env varSELVEDGE_DB=/path/to/dbPer-session override
Project initselvedge initCreates .selvedge/selvedge.db in CWD
Global fallback~/.selvedge/selvedge.dbUsed if no project DB found

---

CLI reference

selvedge init [--path PATH]               Initialize in project
selvedge status                           Recent activity summary
selvedge diff ENTITY [--limit N]          Change history for entity
selvedge blame ENTITY                     Most recent change + context
selvedge history [--since SINCE]          Browse all history
              [--entity ENTITY]
              [--project PROJECT]
              [--changeset CS]
              [--summarize]
              [--limit N]
selvedge changeset [CHANGESET_ID]         Show events in a changeset
                  [--list]                or list all changesets
                  [--project NAME]
                  [--since SINCE]
selvedge search QUERY [--limit N]         Full-text search
selvedge stats [--since SINCE]            Tool call coverage report (per-tool, per-agent)
selvedge doctor [--json]                  Health check: DB path, schema, hook, MCP wiring
selvedge install-hook [--path PATH]       Install git post-commit hook
                     [--window MIN]       (default 60 minutes)
selvedge backfill-commit --hash HASH      Backfill git_commit on recent events
                        [--window MIN]    (default 60 minutes)
selvedge import PATH                      Import migration files (SQL / Alembic)
              [--format auto|sql|alembic]
              [--project NAME]
              [--dry-run]
selvedge export [--format json|csv]       Export history to JSON or CSV
              [--since SINCE]
              [--entity ENTITY]
              [--output FILE]
selvedge log ENTITY CHANGE_TYPE           Manually log a change
             [--diff TEXT]                CHANGE_TYPE: add, remove, modify,
             [--reasoning TEXT]           rename, retype, create, delete,
             [--agent NAME]               index_add, index_remove, migrate
             [--commit HASH]
             [--project NAME]
             [--changeset CS]

All read commands support --json for machine-readable output.

Relative time in --since: - 15m → last 15 minutes (m = minutes) - 24h → last 24 hours - 7d → last 7 days - 5mo → last 5 months (mo or mon = months) - 1y → last year

Unparseable inputs (e.g. --since yesterday) exit with a clear error rather than silently returning empty results. ISO 8601 timestamps are also accepted and normalized to UTC.

---

Cross-reference against git commits

python scripts/coverage_check.py --since 30d ```

The coverage script compares your git log against Selvedge events and shows which commits have associated change events. Low coverage usually means the system prompt needs strengthening — see docs/fallbacks.md for guidance.

---

How Selvedge compares

There's a fast-growing "git blame for AI agents" category. Here's where Selvedge fits — and where it deliberately doesn't.

Reasoning sourceGranularityMechanismGroupingStorage
**Selvedge****Captured live**, by the agent in the same context that produced the change**Entity** — DB column, table, env var, dep, API route, function**MCP server** — agent calls it as work happens**Changesets** — named feature/task slugs across many entitiesSQLite, zero deps
AgentDiff**Inferred post-hoc** by Claude Haiku from the diff at session endLineGit pre/post-commit hookNoneJSONL on disk
OriginCaptured at commit timeLineGit hookNoneLocal
Git AIAttribution metadataLineGit hook + Agent Trace allianceNoneGit notes
BlamePromptPrompt-onlyLineGit hookNoneLocal

Why "captured live" matters. AgentDiff and Origin generate reasoning after the change is made, by feeding the diff back to a second LLM call. Selvedge's reasoning is the agent's own intent, written from the same context window that produced the change — no inference, no hallucinated explanations, and an empty reasoning field is itself a useful signal (the agent didn't have one).

Why "entity-level" matters. Most tools attribute lines. Selvedge attributes things you actually search for: users.email, env/STRIPE_SECRET_KEY, api/v1/checkout, deps/stripe. The first question after git blame is usually "what's the history of this column", not "what's the history of lines 40–48 of users.py".

Why "changesets" matter. A Stripe billing rollout touches the users table, two new env vars, three new API routes, one dependency, and four functions across the codebase. Tag every event with changeset:add-stripe-billing and you can pull the entire scope back later — even if the original PR was broken into eight smaller ones over a month.

Selvedge ↔ Agent Trace. Agent Trace (Cursor + Cognition AI, RFC Jan 2026, backed by Cloudflare, Vercel, Google Jules, Amp, OpenCode, and git-ai) is an emerging open standard for AI code attribution traces. Selvedge isn't a competitor to it — it's a compatible producer. The design for selvedge export --format agent-trace is at docs/agent-trace-interop.md. Agent Trace is the wire format. Selvedge is the live capture + query layer that emits it.

---

Claude Code plugin marketplace (alternative)

If you're a Claude Code user and want to install Selvedge through the official plugin marketplace flow, run these inside Claude Code after pip install selvedge:

/plugin marketplace add masondelan/selvedge
/plugin install selvedge@selvedge

The plugin system wires the MCP server into Claude Code, but it does not install the Python package for you — `pip install selvedge first, otherwise the selvedge-server` command won't exist on your PATH and the plugin can't start. For the full setup (post-commit hook, project CLAUDE.md instructions block, etc.), selvedge setup is still the recommended path; the plugin marketplace install is just the lightweight Claude-Code-only entry point.

Verify the wiring — open a second terminal in the same project:

selvedge watch

Make any change in your AI tool — add a column, rename a function, add an env var. selvedge watch should print the new event within a second of the agent calling log_change. If nothing arrives, run selvedge doctor for a single-command health check that tells you which step is silently broken.

Query your history:

selvedge status                        # recent activity + missing-commit count
selvedge diff users                    # all changes to the users table
selvedge diff users.email              # changes to a specific column
selvedge blame payments.amount         # what changed last and why
selvedge history --since 30d           # last 30 days of changes
selvedge history --since 15m           # last 15 minutes ('m' = minutes)
selvedge changeset add-stripe-billing  # all events for a feature/task
selvedge search "stripe"               # full-text search
selvedge stats                         # log_change coverage report (per-agent)
selvedge import migrations/            # backfill from migration files
selvedge export --format csv           # dump history to CSV

<details> <summary><b>Manual install</b> — if you'd rather wire it up yourself</summary>

If you don't want to run the wizard, the four manual steps it automates:

1. Initialize in your project

cd your-project
selvedge init

2. Add to your Claude Code config

~/.claude/config.json:

{
  "mcpServers": {
    "selvedge": {
      "command": "selvedge-server"
    }
  }
}

For Cursor: ~/.cursor/mcp.json. For Copilot: .github/copilot-instructions.md (different format — see selvedge prompt --help).

3. Tell your agent to use it

selvedge prompt --install CLAUDE.md

This installs the canonical agent-instructions block, sentinel-bracketed (` / `) so future --install calls update the bracketed region without disturbing anything else in the file. Or pipe it:

selvedge prompt | tee -a CLAUDE.md

4. Install the post-commit hook

selvedge install-hook

That's the same four steps the wizard runs.

</details>

---

🎯 aiskill88 AI 点评 A 级 2026-05-26

一个有趣的AI代码记忆工具

📚 实用指南(长尾问题)
适合谁
  • 使用 Cursor 编辑器、希望提升 AI 编程效率的开发者
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
  • Cursor rules 控制在 80 行内,否则模型上下文成本会显著上升
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • CLI:直接 npm install -g / pip install,命令行调用
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
selvedge 中文教程selvedge 安装报错怎么办selvedge MCP 配置selvedge Agent 工作流selvedge 与同类工具对比selvedge 最佳实践selvedge 适合谁用

⚡ 核心功能

👥 适合谁
  • 使用 Cursor 编辑器、希望提升 AI 编程效率的开发者
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
  • Cursor rules 控制在 80 行内,否则模型上下文成本会显著上升
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • Python 依赖冲突:建议用 venv / uv 隔离环境

👥 适合人群

Claude Desktop / Claude Code 用户AI 工具开发者需要扩展 AI 能力的专业人士自动化工程师

🎯 使用场景

  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +标准化 MCP 协议,生态互联性强
  • +与 Claude 官方生态无缝对接
  • +即插即用,配置简单快捷
⚠️ 不足
  • 依赖 Claude 客户端,非 Claude 用户无法使用
  • MCP 协议仍在持续演进,接口可能变更
  • 需要一定的配置步骤
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

selvedge 是一款Python开发的AI辅助工具。开源MCP工具:Long-term memory for AI-coded codebases. A git blame for AI agents — but for the。⭐8 · Python 主要应用场景包括:AI代码库管理。
💡 AI Skill Hub 点评

经综合评估,AI代码记忆 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。

⬇️ 获取与下载
⬇ 下载源码 ZIP

✅ MIT 协议 · 可免费商用 · 直接从 aiskill88 服务器下载,无需跳转 GitHub

📚 深入学习 AI代码记忆
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 selvedge
原始描述 开源MCP工具:Long-term memory for AI-coded codebases. A git blame for AI agents — but for the。⭐8 · Python
Topics ai-agent代码追溯代码记忆
GitHub https://github.com/masondelan/selvedge
License MIT
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/masondelan/selvedge 🌐 官方网站  https://selvedge.sh

收录时间:2026-05-26 · 更新时间:2026-05-30 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。