codebase-memory

Query a codebase knowledge graph for call traces, dependencies, and structural analysis.

Updated May 9, 2020
One-click install
npx skills add https://github.com/avdi/purse --skill codebase-memory-avdi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codebase-memory
Source: https://github.com/avdi/purse/tree/main/home/dot_agents/skills/codebase-memory
Command: npx skills add https://github.com/avdi/purse --skill codebase-memory-avdi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Grepping a large codebase to answer structural questions like "who calls this function" or "what is dead code" is slow and token-expensive. This Skill uses a pre-indexed knowledge graph to return precise structural results in roughly 500 tokens instead of tens of thousands. ## Core Features & Use Cases - Call Tracing: Trace inbound, outbound, or bidirectional call chains for any function with trace_path, including risk-classified traces. - Structural Search: Find functions by name pattern, detect dead code via degree filters, and identify high fan-in/fan-out refactor candidates with search_graph. - Cross-Service Analysis: Run raw Cypher queries with query_graph to inspect HTTP_CALLS, ASYNC_CALLS, and other edge types across services. - Use Case: Before refactoring a shared handler, run search_graph to find its exact name, then trace_path(direction="both", depth=3) to map every caller and callee, and detect_changes() to map your git diff to affected symbols. ## Quick Start Ask the agent to check whether the project is indexed with list_projects, then trace who calls a specific function using the codebase knowledge graph.

Frequently Asked Questions about codebase-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find all callers of a function in a large codebase?

Use trace_path with direction set to inbound to list every caller of a function. First run search_graph with a name pattern to get the exact function name, since trace_path requires precise names.

How to detect dead code and unused functions with a knowledge graph?

Run search_graph with max_degree set to 0 and exclude_entry_points set to true. This returns functions with no inbound or outbound call edges that are not entry points, which are dead code candidates.

When should I use query_graph with Cypher instead of search_graph?

Use query_graph with Cypher when you need to inspect actual edges such as HTTP_CALLS, since search_graph only filters nodes by degree. Note that query_graph caps results at 200 rows, so use search_graph for counting.

Why does trace_path return no results for my function?

trace_path requires the exact function name, so a partial or misspelled name returns nothing. Run search_graph with a name_pattern first to discover the precise name, and verify the project is indexed with list_projects.

Does outbound tracing catch cross-service callers?

No, direction set to outbound misses cross-service callers. Use direction set to both, or write a Cypher query against HTTP_CALLS and ASYNC_CALLS edges to see cross-service relationships.