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.
Relationship types
Section titled “Relationship types”| Type | Meaning |
|---|---|
CALLS | A function/method calls another function/method |
IMPORTS | A file’s import block references another module |
DEFINES | The import chunk maps to each named declaration in the file |
EXTENDS | A class extends another class |
IMPLEMENTS | A class implements an interface |
USES | A chunk references a type or variable defined elsewhere |
Cross-file resolution
Section titled “Cross-file resolution”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.
Edge IDs
Section titled “Edge IDs”Every edge has a stable ID computed from projectId + sourceChunkId + targetChunkId + type. Duplicate edges are upserted rather than duplicated.