codebase-memory

A codebase knowledge graph that maps code structure, functions, calls, dependencies, and related relationships.

In plain words
What is it for?
Exploring architecture, finding callers and dependencies, tracing call chains, assessing change impact, and locating unused code.
Why use it?
It answers structural questions about a codebase without requiring you to inspect large amounts of source manually.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/lucassantana-dev/sharekit/codebase-memory
Any agent
npx skills add LucasSantana-Dev/sharekit --skill codebase-memory
Clone the repo
git clone --depth 1 https://github.com/LucasSantana-Dev/sharekit

Made for: Claude Code, Codex.

Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 933 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00098 $0.00933
Opus 5 $0.00049 $0.00466
Sonnet 5 $0.00020 $0.00187
Haiku 4.5 $0.00010 $0.00093

Measured yesterday against content hash e23868ccc441, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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.

sharekit-profile/.claude/skills/codebase-memory/SKILL.md · 73 lines

How it starts

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

Codebase Memory — Knowledge Graph Tools

Backed by the codebase-memory MCP server (~/.local/bin/codebase-memory-mcp, stdio). The server indexes codebases into a persistent tree-sitter AST knowledge graph (158 languages, sub-ms queries). Index a project before querying — see Workflow below.

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

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. If not indexed: index_repository(path="<repo>") then index_status — one-time, milliseconds for average repos
  3. get_graph_schema — understand node/edge types
  4. search_graph(label="Function", name_pattern=".*Pattern.*") — find code
  5. 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")

14 MCP Tools

index_repository, index_status, list_projects, delete_project, search_graph, search_code, trace_path, detect_changes, query_graph, get_graph_schema, get_code_snippet, get_architecture, manage_adr, ingest_traces

Read the full file on GitHub · 73 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. yesterday First seen · 73 lines · 98 tokens per session scan A e23868ccc441

Subscribe to this mod's changes

codebase-memory is a skill published in the GitHub repository LucasSantana-Dev/sharekit (1 stars, last pushed yesterday), licensed MIT. It adds 98 tokens to every session and 933 once invoked, about $0.0005 per session on Opus 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-31.