codebase-memory

codebase-memory is a skill for Claude Code, Codex from escapeboy/ai-prompts. It costs 98 tokens per session (1,183 once invoked), scanned A, original, MIT.

A read-only knowledge graph for exploring a codebase's structure. It can show functions, callers, dependencies, call paths, dead code, and the likely impact of a change after the project has been indexed.

In plain words
What is it for?
Use it to find who calls a function, what it calls, map dependencies, inspect architecture, identify unused code, and assess a refactor's reach.
Why use it?
It answers structural questions more directly than searching through large amounts of source text. This helps when you need to understand an unfamiliar part of a project or trace how a change spreads.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to find who calls a function, what it calls, map dependencies, inspect architecture, identify unused code, and assess a refactor's reach.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/escapeboy/ai-prompts/codebase-memory
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 escapeboy/ai-prompts --skill codebase-memory
Clone the repo
git clone --depth 1 https://github.com/escapeboy/ai-prompts

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/escapeboy/ai-prompts/codebase-memory/github.svg)](https://agentmods.dev/skills/escapeboy/ai-prompts/codebase-memory)
Your own site
<a href="https://agentmods.dev/skills/escapeboy/ai-prompts/codebase-memory"><img src="https://agentmods.dev/badge/skills/escapeboy/ai-prompts/codebase-memory/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

Your own site · 80×15
<a href="https://agentmods.dev/skills/escapeboy/ai-prompts/codebase-memory"><img src="https://agentmods.dev/badge/skills/escapeboy/ai-prompts/codebase-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,183 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.
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.00098 $0.01183
Opus 5.5 $0.00039 $0.00473
Sonnet 5.5 $0.00020 $0.00237
Haiku 4.5 $0.00010 $0.00118

Measured 8d ago against content hash 324cca6c1de8, 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 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 8d ago.

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.

01-global-optimization/skills/codebase-memory/SKILL.md · 92 lines

How it starts

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

Codebase Memory — Knowledge Graph Tools

Graph tools return precise structural results in ~500 tokens vs ~80K for grep.

When to Use (and When NOT to)

Use the graph Use something simpler instead
Who calls X / what X calls / blast radius of a change An exact string, error message or config key → search_code or Grep
Architecture overview of an unfamiliar area Non-code files (JSON, YAML, Markdown) → Read
Dead code, fan-in / fan-out, refactor candidates Editing by symbol → Serena (replace_symbol_body, rename_symbol); the graph is read-only
Cross-service HTTP / async edges A whole-codebase audit with many agents → code-research, which builds on this

Requires the codebase-memory-mcp server and an indexed project (index_repository).

Quick Decision Matrix

Question Tool call
Who calls X? trace_path(direction="inbound")
What does X call? trace_path(direction="outbound")
Full call context trace_path(direction="both")
Find by name pattern search_graph(name_pattern="...")
Dead code search_graph(max_degree=0, exclude_entry_points=true)
Cross-service edges query_graph with Cypher
Impact of local changes detect_changes()
Risk-classified trace trace_path(risk_labels=true)
Text search search_code or Grep

Exploration Workflow

  1. list_projects — check if project is indexed
  2. get_graph_schema — understand node/edge types
  3. search_graph(label="Function", name_pattern=".*Pattern.*") — find code
  4. get_code_snippet(qualified_name="project.path.FuncName") — read source

Tracing Workflow

  1. search_graph(name_pattern=".*FuncName.*") — discover exact name
  2. trace_path(function_name="FuncName", direction="both", depth=3) — trace
  3. detect_changes() — map git diff to affected symbols

Quality Analysis

  • Dead code: search_graph(max_degree=0, exclude_entry_points=true)
  • High fan-out: search_graph(min_degree=10, relationship="CALLS", direction="outbound")
  • High fan-in: search_graph(min_degree=10, relationship="CALLS", direction="inbound")

Read the full file on GitHub · 92 lines

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. 8d ago First seen · 92 lines · 0 tokens per session scan A 324cca6c1de8

Subscribe to this mod's changes

codebase-memory is a skill published in the GitHub repository escapeboy/ai-prompts (91 stars, last pushed 9d ago), licensed MIT. It adds 98 tokens to every session and 1,183 once invoked, about $0.0004 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-10-08.

Related

Other skills, from other repositories

mem0-status

Diagnoses mem0 connectivity, API key validity, and memory read/write functionality. Use when memory operations fail, searches return empty, addmemory errors occur, or to verify the plugin is working correctly.

mem0ai/mem0 · 44 tokens

inspector-workbench

Runs Inspector UI work on the standalone Threads state lab so the agent can see the overlay. Use when a CopilotKit employee asks an agent to fix, polish, add, or debug Inspector UI, chrome, panes, overlay actions, launcher, Home, Threads, Playground, Memory, or any visual behavior in @copilotkit/web-inspector. Don't…

CopilotKit/CopilotKit · 112 tokens

potpie-debug-memory

Use while debugging or troubleshooting failures, flaky tests, incidents, production alerts, CI failures, local dev setup issues, repeated bugs, prior fixes, failed attempts, and verification history.

potpie-ai/potpie · 41 tokens

md-audit

Read-only code quality audit — scan the current working directory for common issues (bugs, dead code, security hotspots, missing error handling) and return a prioritised findings report. No files are edited. Use when asked to "audit the code", "quick audit", "find issues", "code scan", or "what's wrong with this…

chaitanyagiri/munder-difflin · 85 tokens

code-understand

Map the load-bearing files, symbols, callers, and dependencies of an unfamiliar codebase before making changes. Use for architecture orientation, impact analysis, what-would-break questions, or finding callers. Uses CodeGraph when available and a dependency-free builtin fallback.

Ar9av/obsidian-wiki · 55 tokens

browserwing-admin

Manage and operate BrowserWing — an intelligent browser automation platform. Install dependencies, configure LLM, create/manage/execute automation scripts, use AI-driven exploration to generate scripts, browse the script marketplace, and troubleshoot issues.

MemTensor/MemOS · 47 tokens