Skip to main content

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:

  1. org.db — Knowledge graph nodes/edges (primary, ADR-151)
  2. sessions.db — Legacy call_graph_* tables (backward compatibility)

Note: call_graph.db exists 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)

MetricValue
Functions Indexed7,066
Call Edges2,565
Files Indexed577
Python Functions7,011
TypeScript Functions25
JavaScript Functions30

Legacy Tables (sessions.db)

MetricValue
Functions13,379
Edges91,700
Memory Links0

Data Location

org.db Knowledge Graph (Primary)

Function and call data stored as knowledge graph nodes and edges:

EntityKG Node TypeCount
Functionsfunction7,066
Filesfile577
RelationshipKG Edge TypeCount
Function callsCALLS2,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

ToolPurpose
index_fileIndex a source file into the call graph
index_directoryIndex all files in a directory
get_callersFind all functions that call a given function
get_calleesFind all functions called by a given function
call_chainFind call paths between two functions
memory_linked_searchSearch with session history context
call_graph_statsDatabase statistics

coditect-impact-analysis

ToolPurpose
analyze_impactBlast radius analysis for a function change
analyze_file_impactImpact analysis for an entire file
find_decisionsFind ADRs related to code
assess_riskCalculate change risk score
impact_statsSystem 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)



Generated: 2026-02-19 Task: J.21.5.2