Call Graph Database Reference
Purpose: Code call graph analysis for impact assessment and code navigation
Storage: org.db (knowledge graph) + sessions.db (legacy tables)
MCP Servers: coditect-call-graph, coditect-impact-analysis
Task: J.21.5.2
Overview
The call graph system indexes function definitions and call relationships from source files. It is accessed through MCP (Model Context Protocol) servers rather than direct database queries. The data is stored across two databases:
- org.db — Knowledge graph nodes/edges (primary, ADR-151)
- sessions.db — Legacy
call_graph_*tables (backward compatibility)
Note:
call_graph.dbexists as an empty file at~/.coditect-data/context-storage/call_graph.db(0 bytes). It was intended as a standalone database but the call graph data was integrated into the knowledge graph (org.db) and legacy tables (sessions.db) instead.
Statistics (as of 2026-02-19)
Knowledge Graph (org.db — Primary)
| Metric | Value |
|---|---|
| Functions Indexed | 7,066 |
| Call Edges | 2,565 |
| Files Indexed | 577 |
| Python Functions | 7,011 |
| TypeScript Functions | 25 |
| JavaScript Functions | 30 |
Legacy Tables (sessions.db)
| Metric | Value |
|---|---|
| Functions | 13,379 |
| Edges | 91,700 |
| Memory Links | 0 |
Data Location
org.db Knowledge Graph (Primary)
Function and call data stored as knowledge graph nodes and edges:
| Entity | KG Node Type | Count |
|---|---|---|
| Functions | function | 7,066 |
| Files | file | 577 |
| Relationship | KG Edge Type | Count |
|---|---|---|
| Function calls | CALLS | 2,565 |
sessions.db Legacy Tables
-- Function definitions
CREATE TABLE call_graph_functions (
node_id TEXT PRIMARY KEY,
function_name TEXT NOT NULL,
file_path TEXT NOT NULL,
line_number INTEGER,
language TEXT
);
-- Call relationships
CREATE TABLE call_graph_edges (
id INTEGER PRIMARY KEY,
caller_id TEXT NOT NULL, -- References call_graph_functions.node_id
callee_id TEXT NOT NULL, -- References call_graph_functions.node_id
call_count INTEGER DEFAULT 1
);
-- Session memory links (context association)
CREATE TABLE call_graph_memory (
id INTEGER PRIMARY KEY,
node_id TEXT NOT NULL, -- References call_graph_functions.node_id
message_id INTEGER, -- References messages.id
context TEXT -- Association context
);
MCP Server API
The call graph is accessed through two MCP servers:
coditect-call-graph
| Tool | Purpose |
|---|---|
index_file | Index a source file into the call graph |
index_directory | Index all files in a directory |
get_callers | Find all functions that call a given function |
get_callees | Find all functions called by a given function |
call_chain | Find call paths between two functions |
memory_linked_search | Search with session history context |
call_graph_stats | Database statistics |
coditect-impact-analysis
| Tool | Purpose |
|---|---|
analyze_impact | Blast radius analysis for a function change |
analyze_file_impact | Impact analysis for an entire file |
find_decisions | Find ADRs related to code |
assess_risk | Calculate change risk score |
impact_stats | System statistics |
Usage Examples
# Via MCP (preferred)
# These are called as tool invocations, not direct Python
# Index a directory
mcp__coditect-call-graph__index_directory(dir_path="scripts/core/")
# Find callers of a function
mcp__coditect-call-graph__get_callers(function_name="get_org_db_path")
# Assess change risk
mcp__coditect-impact-analysis__assess_risk(function_name="publish")
Indexing
Files are indexed on demand or during /cx post-processing:
# Triggered by /cx (automatic)
# Indexes ~/.coditect/scripts by default
# Manual reindex via /cx
/cx --reindex-path /path/to/code
# Skip reindex
/cx --no-reindex
Supported languages: Python (.py), JavaScript (.js), TypeScript (.ts)
Related Documentation
- DATABASE-SCHEMA.md — Overview of all databases
- ER-DIAGRAMS.md — Visual ER diagrams (sessions.db section)
- DATA-DICTIONARY.md — Field-level documentation
- ADR-151 — Knowledge graph architecture
- CONTEXT-GRAPH-GUIDE.md — Context graph usage guide
Generated: 2026-02-19 Task: J.21.5.2