Skip to content

Knowledge Graph

Lucerna extracts a directed relationship graph from the AST alongside chunks. Edges are stored in a LanceDB table and can be traversed with the graph traversal API or the lucerna graph CLI command.

TypeMeaning
CALLSA function/method calls another function/method
IMPORTSA file’s import block references another module
DEFINESThe import chunk maps to each named declaration in the file
EXTENDSA class extends another class
IMPLEMENTSA class implements an interface
USESA chunk references a type or variable defined elsewhere

The SymbolResolver resolves import edges across files, handling TypeScript path aliases (tsconfig paths + extends) and relative imports. Unresolved symbols (e.g. third-party packages) are stored as dangling edges with no target chunk.

Every edge has a stable ID computed from projectId + sourceChunkId + targetChunkId + type. Duplicate edges are upserted rather than duplicated.