Codebase Memory Mcp 标志

Codebase Memory Mcp

社区
vincentkoc
codebase-memory-mcp

通过受保护的 CLI 确定规范的 Git 检出目录,为 codebase-memory-mcp 图谱建立索引并验证;根据请求打开浏览器查看器,并安全审查重复的 worktree 缓存。用户提到 codebase memory MCP、依赖关系图、search_graph、trace_path、index_repository、worktree 索引或过大的图谱缓存时使用。

概览

发布者vincentkoc
代码仓库dotskills
技能名称codebase-memory-mcp
星标数
112
复刻数
9
附带文件
5
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 5 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 vincentkoc 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Codebase Memory Mcp AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/vincentkoc/dotskills/tree/main/skills/codebase-memory-mcp
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vincentkoc/dotskills.git /tmp/dotskills
mkdir -p .claude/skills
cp -r /tmp/dotskills/skills/codebase-memory-mcp .claude/skills/codebase-memory-mcp
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Codebase Memory Mcp,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Codebase Memory Mcp。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Codebase Memory Mcp 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Codebase Memory MCP

Purpose

Bring up codebase-memory-mcp for the owning Git checkout and prove the graph is usable before relying on it for code discovery. Keep linked worktrees on the owner's graph instead of creating one graph per branch.

When to use

  • Initialize, re-index, refresh, or troubleshoot a repository graph.
  • Use search_graph, trace_path, get_code_snippet, or query_graph.
  • Verify that a repository is indexed before graph-backed exploration.
  • Open the existing dependency graph in a browser when requested.
  • Audit or prune duplicate linked-worktree indexes without deleting cache files directly.

Workflow

  1. Verify the repository and binary.
    • git rev-parse --show-toplevel
    • git status -sb
    • command -v codebase-memory-mcp
    • codebase-memory-mcp --version
  2. Resolve the canonical owning checkout.
    • scripts/codebase-memory-graph.sh canonical --repo "$(git rev-parse --show-toplevel)"
    • Linked worktrees resolve through their absolute Git common directory to the one checkout that owns it.
    • Separate clones remain separate projects.
    • Independent roots under ~/.codex/worktrees, ~/GIT/_Worktrees, any .worktrees component, /tmp, or /private/tmp are never indexed. Linked worktrees under those paths may only rewrite to one existing nonreserved owner.
    • Never independently index ~/GIT/_Synthetic or repositories marked by .git/gwt-synthetic.json. This indexing rule grants no cleanup authority.
    • Missing, invalid, bare, ambiguous, ownerless, reserved-owner, or NUL-containing repositories fail closed.
  3. Prefer exposed MCP graph tools for discovery.
    • If the tool is absent, the service times out/closes its transport, or no usable project exists, report that surface once and continue ordinary code work with bounded rg and direct reads. Do not retry without changed service evidence. Graph availability is not a prerequisite for ordinary inspection or repair.
    • Installer or client configuration must separately disable the MCP index_repository tool because it cannot enforce the canonical indexing boundary. For Codex installs, render the private disabled_tools configuration accordingly.
    • When indexing is requested and the graph is missing, run scripts/codebase-memory-graph.sh index --repo "$(git rev-parse --show-toplevel)" --mode full. Do not start indexing or daemon repair as an incidental prerequisite to another task.
    • Use search_graph, trace_path, and get_code_snippet before broad text scans.
  4. Use the helper for CLI indexing.
    • scripts/codebase-memory-graph.sh init --repo "$(git rev-parse --show-toplevel)" --mode full
    • The helper always sends the canonical owning checkout to index_repository.
    • Use --mode fast for a smoke index.
    • Installer integrations render scripts/codebase-memory-gateway.py.tmpl with an approved pinned backend path. Replace @@PYTHON_PATH_SHEBANG@@ with the raw absolute interpreter path and replace @@PYTHON_PATH_JSON@@, @@BACKEND_PATH_JSON@@, and @@RESOLVER_PATH_JSON@@ with JSON string literals containing the exact absolute interpreter, backend, and codebase_memory_cache.py paths. The rendered gateway has no upgrade logic and uses execve for pass-through.
    • The gateway guards raw CLI calls only. Zero-argument MCP stdio startup intentionally passes through to the approved backend, so the gateway is not an MCP tool-filtering proxy and does not replace the separate disabled_tools control.
    • The public CLI accepts a tool name and at most one JSON object. It normalizes --json and --progress before checking index_repository; index calls always require an explicit JSON repo_path. File, stdin, worker, prefixed-command, and vendor-installer forms fail closed. Default output and explicit --json output keep their upstream formats.
    • Installation defaults are auto_index=false, auto_watch=false, and ui_enabled=false. Ordinary MCP/CLI calls do not enable the viewer or reset an operator's explicit setting. Initialize the UI default with codebase-memory-mcp config set ui_enabled false; ui is not a supported backend config key.
    • Ordinary MCP clients share one session-managed daemon. Bare daemon start remains denied because it implicitly enables the UI. The explicit browser command daemon start --open [--port=N] is allowed; daemon status remains read-only.
  5. Verify the graph.
    • codebase-memory-mcp cli list_projects
    • scripts/codebase-memory-graph.sh schema --repo "$(git rev-parse --show-toplevel)"
    • Run one focused graph query before declaring success.
  6. Open the viewer only when requested.
    • scripts/codebase-memory-graph.sh start-ui --repo "$(git rev-parse --show-toplevel)" resolves the owner, enables the viewer, and uses native daemon start --open. It does not index or create tmux sessions.
    • The preference is shared and persists across daemon restarts. Ordinary loading leaves it unchanged, so another agent cannot close an explicitly opened viewer. A fresh installation starts with it off.
    • scripts/codebase-memory-graph.sh stop-ui restores ui_enabled=false without stopping the shared daemon or other sessions. Closing a browser tab alone does not disable the listener.
    • Use the guarded CLI helper for indexing; the browser's indexing endpoint does not enforce this skill's Git-owner/worktree policy. Opening an existing graph does not authorize indexing additional roots.
  7. Audit cache cleanup before applying it.
    • Freeze a host-specific manifest: scripts/codebase-memory-graph.sh cache-audit --manifest /secure/path/cbm-cache.json
    • Built-in reserved roots are ~/.codex/worktrees, ~/GIT/_Worktrees, /tmp, /private/tmp, and any exact .worktrees path component. The audit records normalized lexical and resolved boundary evidence; .worktrees component matching is case-insensitive on Darwin.
    • Missing roots under a reserved boundary are reserved_missing_root candidates. Live valid graphs whose physical canonical root and Git common directory remain reserved are reserved_live_root candidates, including shallow, promisor, and partial clones. Dangling symlinks, bare repositories, non-Git roots, and invalid reserved mappings block as live_root_unmapped.
    • Other missing roots are protected unless the audit names an explicit narrow --ephemeral-prefix.
    • Reserved aliases or linked worktrees that resolve to a nonreserved owner retain duplicate cleanup rules. They require a mapped, registered, final-protected healthy full canonical graph; candidate graphs, reserved graphs, shallow/promisor/partial owners, missing alternate graphs, and ambiguous owners cannot preserve them.
    • When legacy home symlinks name the same physical checkout, preserve the exact canonical graph and treat only the symlink-named graph as a duplicate. Preserve a sole symlink-named graph.
    • Review the manifest, then dry-run it: scripts/codebase-memory-graph.sh cache-prune --manifest /secure/path/cbm-cache.json
    • Manifests with host blockers fail closed by default. After reviewing every relationship, explicitly add --allow-blocked-manifest to preflight and prune only independent candidates while preserving all protected and blocked projects.
    • To retain an exact manifest candidate at runtime, repeat --protect-candidate NAME on cache-prune. Each named candidate must still exist in the unchanged snapshot and pass its root, prefix, classification, canonical mapping, and clone-health rules. It remains in the expected snapshot but is excluded from cache inventory, holder sweeps, DB integrity preflight, final holder probes, and deletion.
    • Runtime candidate protection does not bypass host blockers; add --allow-blocked-manifest independently when blockers were reviewed. Unknown, duplicate, or non-candidate names fail before preflight.
    • Apply only the unchanged manifest: scripts/codebase-memory-graph.sh cache-prune --manifest /secure/path/cbm-cache.json --apply
    • Dry-run and apply freeze regular DB/WAL/SHM fingerprints for every eligible candidate in manifest order, rejecting a missing or size-mismatched DB, nonregular files, and nonzero WAL. Existing absolute paths are swept with /usr/sbin/lsof -nP -F0pfn -f -- in deterministic, NUL-parsed batches before any SQLite open and again after every exact mode=ro&immutable=1 quick_check; global fingerprint equality is required between phases. An absent or zero-byte WAL and a stable regular SHM are allowed. Use prune-only --lsof-timeout-seconds SECONDS to override the 300-second holder timeout within the guarded 30-900 range.
    • Batch holder sweeps are point-in-time checks: they do not prevent a legacy index or server surface from reopening a graph after the check. Unprivileged lsof may not see root-owned or other-user holders, so pruning trusts the point-in-time visibility available to the cache owner; running as root provides stronger holder visibility. Apply processes eligible candidates in manifest order, at most eight per deletion batch and within the same 128 KiB path budget. Each batch revalidates the snapshot and live fingerprints, performs one holder sweep, proves post-sweep fingerprint equality, then revalidates every remaining candidate relationship immediately before the first delete child. The batch launches only codebase-memory-mcp cli delete_project children and verifies registrations plus DB/WAL/SHM absence before continuing; spawn errors, timeouts, nonzero exits, retained registrations, residue, drift, or ambiguous state stop future batches and report launched, verified-deleted, failed, and ambiguous names and bytes.
    • Before applying any manifest containing reserved_live_root, deploy the reserved-root indexing prevention and quiesce every legacy index/server surface outside this helper. The helper reports this operational precondition but does not probe or kill processes.
    • Deletion uses codebase-memory-mcp cli delete_project only. Never remove project databases directly.
  8. Report exact proof.
    • Indexed project name.
    • Node and edge counts when available.
    • Browser URL and verified listener state when the viewer was requested.
    • For cleanup: manifest path and digest, manifest/eligible/preflighted candidate totals, runtime protected names/reasons/bytes, required operational preconditions, before/after project and byte totals, deleted project names, and any stop condition.
    • Missing binaries, unavailable MCP tools, or incomplete proof.

Inputs

  • Repository path.
  • Index mode: fast, moderate, full, or cross-repo-intelligence.
  • Optional browser/status listener port; default 9749.
  • For cache maintenance: a host-local manifest path, optional explicit ephemeral prefixes, and optional exact runtime protected candidate names.

Outputs

  • Indexed and queryable repository graph.
  • Explicitly opened browser viewer, or disabled viewer with agent sessions preserved.
  • A dry-run cache manifest or guarded CLI-only deletion report.
  • Exact status, schema, and proof summary.

Flow

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Codebase Memory Mcp AI 技能有什么作用?

通过受保护的 CLI 确定规范的 Git 检出目录,为 codebase-memory-mcp 图谱建立索引并验证;根据请求打开浏览器查看器,并安全审查重复的 worktree 缓存。用户提到 codebase memory MCP、依赖关系图、search_graph、trace_path、index_repository、worktree 索引或过大的图谱缓存时使用。

为什么在 TypingMind 中使用 Codebase Memory Mcp?

因为您只需安装一次,就能搭配任何模型使用。Codebase Memory Mcp 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Codebase Memory Mcp?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/vincentkoc/dotskills/tree/main/skills/codebase-memory-mcp。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Codebase Memory Mcp?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Codebase Memory Mcp 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Codebase Memory Mcp 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Codebase Memory Mcp AI 技能免费吗?

是的。vincentkoc 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇