codebase-memory-mcp

codebase-memory-mcp is a skill for Codex from vincentkoc/dotskills. It costs 72 tokens per session (2,777 once invoked), scanned A, original, MIT.

A workflow for using codebase-memory-mcp, a tool that builds a searchable graph of a Git repository. It resolves the correct checkout, checks that the graph works, and manages linked worktrees and duplicate indexes.

In plain words
What is it for?
Use it to initialize, refresh, verify, search, or troubleshoot a repository graph, trace code paths, retrieve snippets, and audit duplicate worktree caches.
Why use it?
It helps agents find and trace code reliably without indexing the same repository worktree multiple times or relying on an unverified graph.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: reads ~/.codex paths; mentions Codex.

Good fit Use it to initialize, refresh, verify, search, or troubleshoot a repository graph, trace code paths, retrieve snippets, and audit duplicate worktree caches.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vincentkoc/dotskills/codebase-memory-mcp
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add vincentkoc/dotskills --skill codebase-memory-mcp
Clone the repo
git clone --depth 1 https://github.com/vincentkoc/dotskills

Made for: Codex.

Its marketplace also offers this one on its own, as the plugin codebase-memory-mcp — /plugin install codebase-memory-mcp after adding the marketplace above.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codebase-memory-mcp

README.md
[![agentmods](https://agentmods.dev/badge/skills/vincentkoc/dotskills/codebase-memory-mcp/github.svg)](https://agentmods.dev/skills/vincentkoc/dotskills/codebase-memory-mcp)
Your own site
<a href="https://agentmods.dev/skills/vincentkoc/dotskills/codebase-memory-mcp"><img src="https://agentmods.dev/badge/skills/vincentkoc/dotskills/codebase-memory-mcp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for codebase-memory-mcp

Your own site · 80×15
<a href="https://agentmods.dev/skills/vincentkoc/dotskills/codebase-memory-mcp"><img src="https://agentmods.dev/badge/skills/vincentkoc/dotskills/codebase-memory-mcp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,777 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 33
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.02777
Opus 5.5 $0.00029 $0.01111
Sonnet 5.5 $0.00014 $0.00555
Haiku 4.5 $0.00007 $0.00278

Measured 9d ago against content hash 9daf64525feb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

codebase-memory-mcp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/codebase_memory_cache.py, scripts/codebase-memory-graph.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/codebase-memory-mcp/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

Read the full file on GitHub · 132 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago Changed · +9 lines · +10 tokens per session 9daf64525feb
  2. 1mo ago Changed · +3 lines f0a8529f4778
  3. 1mo ago Changed · +30 lines 5927b3409b27
  4. 1mo ago First seen · 90 lines · 62 tokens per session scan A 7b3fd7be7dd6

Subscribe to this mod's changes

codebase-memory-mcp is a skill published in the GitHub repository vincentkoc/dotskills (109 stars, last pushed 3d ago), licensed MIT. It adds 72 tokens to every session and 2,777 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

data-sync

Sync and archive data from messaging platforms (WhatsApp, Discord, Slack, Twitter/X, Google) into Moltis memory as daily digest summaries. Orchestrates crawl tools and writes structured markdown to the memory system.

moltis-org/moltis · 46 tokens

waku-memory

Connect Waku Memory, hosted cross-agent memory in Claude Code, Codex, Grok Bot, Hermes. Export Waku skills.

ShenSeanChen/waku-agent · 30 tokens

continuous-attention

Use when the user asks to keep watching an external state, notify them when something changes or a condition is met, remember fresh external state across turns, or manage an existing Context Binding or Event Subscription.

Peiiii/nextclaw · 44 tokens

shared-memory

Durable memory across sessions — a model of who the user is, not a log of what was done. Three-tier store (core + long-term + episodic staging) via the ling-mem daemon. Same semantics in Linggen, Claude Code, Codex, and OpenClaw.

linggen/skills · 64 tokens

llm-wiki

Karpathy's LLM Wiki — build and maintain a persistent, interlinked markdown knowledge base. Ingest sources, query compiled knowledge, and lint for consistency.

moltis-org/moltis · 37 tokens

stella

Self-knowledge for stella, the self-hosted AI assistant. Use when users ask about configuration, setup, onboarding, providers, models, agents, channels, webhooks, memory, schedules, workflows, goals, workers, skills, plugins, session compaction, notifications, self-update, multi-user behavior, or how stella works.…

CherryHQ/stella · 106 tokens