Expand description
Tree-sitter based code indexing for smart contracts: call graphs and state graphs over Solidity, Rust (Anchor / CosmWasm) and Move (Aptos / Sui), plus agent-facing query tools.
Re-exports§
pub use builder::BuildResult;pub use builder::CodeGraphBuilder;pub use model::CodeGraph;pub use store::CodeGraphStore;pub use tools::CodegraphContext;
Modules§
- builder
- Builds a
CodeGraphfrom a project root: file discovery (gitignore aware), Move dialect detection per package, extraction, and by-name resolution of call sites and state references. Resolution is syntactic: same-module candidates win, a qualifier that names a module scopes the search, everything else stays ambiguous or external — explicitly. - extract
- Shared extraction machinery: the raw per-file representation every language extractor produces, the tree-sitter language registry (including the vendored Move grammars), and node helpers used by all extractors.
- model
- Language-neutral code graph model shared by every extractor: containers (contracts / modules), callables (functions / modifiers / entries), state items (storage variables / accounts / resources / objects) and the edges between them. Call edges resolved purely from syntax keep their ambiguity explicit instead of pretending precision the parser does not have.
- move_
lang - Move extraction, one extractor per dialect: Aptos Move (vendored
aptos-labs grammar; global storage accessed via
move_to/borrow_global*) and Sui Move (vendored tzakian grammar; objects withkeyflowing through function parameters). The dialects differ enough — syntax and storage model both — that sharing one extractor would hide more than it saves. - rust_
lang - Rust contract extraction over tree-sitter-rust. One module per file.
State is recognized for the two supported contract ecosystems:
Anchor (
#[account]structs, expanded throughContext<T>/#[derive(Accounts)]containers) and CosmWasm (Item/Mapstorage declarations with theirsave/load-style accesses). Plain Rust still gets modules, functions and call edges. - solidity
- Solidity extraction over tree-sitter-solidity: contracts / interfaces / libraries, callables (functions, constructor, modifiers, fallback/receive), state variables, inheritance, call sites and state-variable reads/writes. Writes through storage-pointer aliases are a known precision loss of the pure-syntax approach.
- store
- SQLite cache for prebuilt code graphs. The graph is stored as one
serialized snapshot per root keyed by an input fingerprint (relative
paths and sizes), so
llmy codegraph indexcan prebuild and the harness can load-or-rebuild cheaply. A stale fingerprint simply misses. - tools
- Agent-facing query tools over a built
CodeGraph: overview, per-module and per-callable source reading, call-edge lookups and state cross-references.