codegraph
Index source code into a local SQLite database and perform symbol lookups, call hierarchy analysis, dead code detection, and more—no LLM calls required.
Instructions
AST-based code indexing and symbol lookup tool. Parses source code with tree-sitter (via WASM, no external dependencies) and stores symbols/relationships in a local SQLite index (.codegraph.db). Operations: index(path) - Build or update the code index for a project directory. find(name) - Find symbol definitions by name (function, class, method). callers(name) - Find all callers of a function/method. callees(name) - Find all functions/methods called by a function. symbols(path) - List all symbols in a file (no index needed). methods(name) - List all methods of a class. inherits(name) - Show inheritance hierarchy of a class. stats(path) - Project index statistics (files, classes, functions, calls). importers(path, name) - Find files that import/include a given file. unused(path) - Find symbols defined but never called (dead code). call_tree(name, depth, direction) - Recursive call hierarchy (up=callers, down=callees). Supports: C/C++, Python, Go, C#, Rust, Java. Index is stored at project root as .codegraph.db (add to .gitignore). Respects .gitignore (including nested) and skips non-source dirs (venv, vendor, third_party, etc.). No LLM calls, no embeddings -- pure data lookup, zero token cost. Tip: Run index once at the start of a session, then use find/callers/call_tree to navigate. Re-run index after bulk edits to update changed files (incremental, fast). Powered by tree-sitter (MIT) via wazero (pure Go WASM runtime).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | Operation: index, find, callers, callees, symbols, methods, inherits, stats, importers, unused, call_tree,required | |
| path | No | Project directory path (for index) or file path (for symbols) | |
| name | No | Symbol name to search for (for find, callers, callees, methods, inherits, call_tree) | |
| language | No | Language hint: cpp, python, go, csharp, rust, java. Default: auto-detect from file extension | |
| workers | No | Number of parallel parse workers for index operation. Default: 4. Higher = faster but more memory (~7MB per worker) | |
| depth | No | Max recursion depth for call_tree. Default: 3, Max: 10 | |
| direction | No | Direction for call_tree: up (callers) or down (callees). Default: up |