OpenParable
Skip to content
← Back to skills

Codebase Memory Reference

Research
codebase-memory-reference

Codebase Memory Reference is an Agent Skill for research published in the DmNote-App/DmNote repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

This skill should be used when the user asks about "codebase-memory-mcp tools", "graph query syntax", "Cypher query examples", "edge types", "how to use search_graph", "query_graph examples", or needs reference documentation for the codebase knowledge graph tools.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/DmNote-App/DmNote/blob/HEAD/.claude/skills/codebase-memory-reference/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/codebase-memory-reference, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Codebase Memory MCP — Tool Reference

Tools (14 total)

ToolPurpose
index_repositoryParse and ingest repo into graph (only once — auto-sync keeps it fresh)
index_statusCheck indexing status (ready/indexing/not found)
list_projectsList all indexed projects with timestamps and counts
delete_projectRemove a project from the graph
search_graphStructured search with filters (name, label, degree, file pattern)
search_codeGrep-like text search within indexed project files
trace_call_pathBFS call chain traversal (exact name match required). Supports risk_labels=true for impact classification.
detect_changesMap git diff to affected symbols + blast radius with risk scoring
query_graphCypher-like graph queries (200-row cap)
get_graph_schemaNode/edge counts, relationship patterns
get_code_snippetRead source code by qualified name
read_fileRead any file from indexed project
list_directoryList files/directories with glob filter
ingest_tracesIngest OpenTelemetry traces to validate HTTP_CALLS edges

Edge Types

TypeMeaning
CALLSDirect function call within same service
HTTP_CALLSSynchronous cross-service HTTP request
ASYNC_CALLSAsync dispatch (Cloud Tasks, Pub/Sub, SQS, Kafka)
IMPORTSModule/package import
DEFINES / DEFINES_METHODModule/class defines a function/method
HANDLESRoute node handled by a function
IMPLEMENTSType implements an interface
OVERRIDEStruct method overrides an interface method
USAGERead reference (callback, variable assignment)
FILE_CHANGES_WITHGit history change coupling
CONTAINS_FILE / CONTAINS_FOLDER / CONTAINS_PACKAGEStructural containment

Node Labels

Project, Package, Folder, File, Module, Class, Function, Method, Interface, Enum, Type, Route

Qualified Name Format

<project>.<path_parts>.<name> — file path with / replaced by ., extension removed.

Examples:

  • myproject.cmd.server.main.HandleRequest (Go)
  • myproject.services.orders.ProcessOrder (Python)
  • myproject.src.components.App.App (TypeScript)

Use search_graph to discover qualified names, then pass them to get_code_snippet.

Cypher Subset (for query_graph)

Supported:

  • MATCH with node labels and relationship types
  • Variable-length paths: -[:CALLS*1..3]->
  • WHERE with =, <>, >, <, >=, <=, =~ (regex), CONTAINS, STARTS WITH
  • WHERE with AND, OR, NOT
  • RETURN with property access, COUNT(x), DISTINCT
  • ORDER BY with ASC/DESC
  • LIMIT
  • Edge property access: r.confidence, r.url_path, r.coupling_score

Not supported: WITH, COLLECT, SUM, CREATE/DELETE/SET, OPTIONAL MATCH, UNION

Common Cypher Patterns

# Cross-service HTTP calls with confidence
MATCH (a)-[r:HTTP_CALLS]->(b) RETURN a.name, b.name, r.url_path, r.confidence LIMIT 20

# Filter by URL path
MATCH (a)-[r:HTTP_CALLS]->(b) WHERE r.url_path CONTAINS '/orders' RETURN a.name, b.name

# Interface implementations
MATCH (s)-[r:OVERRIDE]->(i) RETURN s.name, i.name LIMIT 20

# Change coupling
MATCH (a)-[r:FILE_CHANGES_WITH]->(b) WHERE r.coupling_score >= 0.5 RETURN a.name, b.name, r.coupling_score

# Functions calling a specific function
MATCH (f:Function)-[:CALLS]->(g:Function) WHERE g.name = 'ProcessOrder' RETURN f.name LIMIT 20

Regex-Powered Search (No Full-Text Index Needed)

search_graph and search_code support full Go regex, making full-text search indexes unnecessary. Regex patterns provide precise, composable queries that cover all common discovery scenarios:

search_graph — name_pattern / qn_pattern

PatternMatchesUse case
.*Handler$names ending in HandlerFind all handlers
(?i)authcase-insensitive "auth"Find auth-related symbols
get|fetch|loadany of three wordsFind data-loading functions
^on[A-Z]names starting with on + uppercaseFind event handlers
.*Service.*ImplService...Impl patternFind service implementations
^(Get|Set|Delete)CRUD prefixesFind CRUD operations
.*_test$names ending in _testFind test functions
.*\\.controllers\\..*qn_pattern for directory scopingScope to controllers dir

search_code — regex=true

PatternMatchesUse case
TODO|FIXME|HACKmulti-pattern scanFind tech debt markers
(?i)password|secret|tokencase-insensitive secretsSecurity scan
func\\s+TestGo test functionsFind test entry points
api[._/]v[0-9]API version referencesFind versioned API usage
import.*from ['"]@scoped npm importsFind package imports

Combining Filters for Surgical Queries

# Find unused auth handlers
search_graph(name_pattern="(?i).*auth.*handler.*", max_degree=0, exclude_entry_points=true)

# Find high fan-out functions in the services directory
search_graph(qn_pattern=".*\\.services\\..*", min_degree=10, relationship="CALLS", direction="outbound")

# Find all route handlers matching a URL pattern
search_code(pattern="(?i)(POST|PUT).*\\/api\\/v[0-9]\\/orders", regex=true)

Critical Pitfalls

  1. search_graph(relationship="HTTP_CALLS") does NOT return edges — it filters nodes by degree. Use query_graph with Cypher to see actual edges.
  2. query_graph has a 200-row cap before aggregation — COUNT queries silently undercount on large codebases. Use search_graph with min_degree/max_degree for counting.
  3. trace_call_path needs exact names — use search_graph(name_pattern=".*Partial.*") first to discover names.
  4. direction="outbound" misses cross-service callers — use direction="both" for full context.

Decision Matrix

QuestionUse
Who calls X?trace_call_path(direction="inbound")
What does X call?trace_call_path(direction="outbound")
Full call contexttrace_call_path(direction="both")
Find by name patternsearch_graph(name_pattern="...")
Dead codesearch_graph(max_degree=0, exclude_entry_points=true)
Cross-service edgesquery_graph with Cypher
Impact of local changesdetect_changes()
Risk-classified tracetrace_call_path(risk_labels=true)
Text searchsearch_code or Grep