CODESAGEZ // v2.0-PRODAST: Tree-sitter 0.22GRAPH: NetworkX 3.2LATENCY: <50ms
AST-Aware Graph-RAG Engine
Eliminates LLM hallucination on complex repositories by combining Tree-sitter abstract syntax trees with dense vector search. Performs 1-hop relational expansion across caller-callee call graphs to inject exact compilation contexts into Gemini 2.5 Flash.
>$codesage index --repo tiangolo/fastapi --depth 1
System Simulation
AST Pipeline & Subprocesses
CodeSageZ avoids thread starvation by using native async subprocesses for heavy I/O like git cloning, before handing off to Tree-sitter for AST graph generation and Gemini for dense vector embeddings.
Architecture Components:
Tree-sitter Parser
NetworkX Graph Builder
ChromaDB Upsert
[ _ ][ □ ][ X ]
CodeSageZ.exe
❯
[ SPECIFICATION MATRIX ]
System Subsystems & Invariants
TOTAL SUBSYSTEMS: 04 // PROTOCOL: v2.0
ID
Subsystem
Engine / Stack
Invariant
Verification
AST-01
AST Syntax Parsing
Parses source files into concrete syntax trees using native C-bindings. Extracts function signatures, class hierarchies, and decorator scopes.
Tree-sitter 0.22
Zero Parse Loss
GRP-02
Relational Call Graph
Constructs directed graphs linking caller and callee symbols. Expands seed vector matches with structural compiler context.
NetworkX 3.2 + SQLite
1-Hop Expansion
CON-03
SingleFlight Coalescer
Deduplicates concurrent identical RAG queries in-flight. Dispatches a single vector search and shares the result across all waiting callers.
Request Coalescing Lock
Zero Thundering Herd
VEC-04
Dense Vector Storage
Indexes 3072-dimensional embeddings locally. Zero IP leakage to public training sets with local lexical fallback.
ChromaDB HNSW Cosine
<50ms P95 Retrieval