Local code search that understands how your code is connected
+48% NDCG@10, +128% MRR@10 vs grep across 300 benchmark queries
Structural graph indexing Β· zero network Β· single SQLite file Β· ~18ΞΌs query latency
Docs Β· Benchmarks Β· Research Β· Discussions
|
GraphIQ turns a repository into a searchable code graph: symbols, files, calls, imports, type flow, error surfaces, comments, constants, and the relationships between them. Substring search finds what you typed. GraphIQ finds what the code is connected to. Ask for |
query
|
lexical seeds
|
structural graph
/ | \
calls imports constants
\ | /
ranked symbols
|
graphiq index /path/to/project
graphiq search "rate limit middleware"Or wire it into an editor/agent harness:
graphiq setup --project /path/to/project
Use graphiq setup --harness cursor or any supported harness name to target one integration.
Homebrew
brew tap aaf2tbz/graphiq
brew install graphiqInstall script (Recommended Method
curl -fsSL https://raw.githubusercontent.com/aaf2tbz/graphiq/main/install.sh | bashFrom source
git clone https://github.com/aaf2tbz/graphiq.git
cd graphiq
cargo build --releaseInstalls graphiq, graphiq-mcp, and graphiq-bench.
|
BM25 FTS5 handles exact symbol names, identifiers, file paths, and decomposed camelCase/snake_case terms. |
Seed results expand through calls, imports, constants, type edges, error surfaces, and local neighborhoods. |
Eight query families tune scoring for symbols, natural language, relationships, errors, files, constants, and architecture questions. |
BM25 name match + graph walk + structural aliases + family weights
| | | |
+----------------+------------------+--------------------+
|
stable ranked results
|
The result is a compact local index with the codebase's structure baked in, so agents can search by intent without shipping your source to a remote embedding service.
Current v3.1 benchmarks cover 300 queries across signetai, esbuild, and tokio. Full methodology lives in docs/benchmarks.md.
| Codebase | Grep NDCG@10 | GraphIQ NDCG@10 | Grep MRR@10 | GraphIQ MRR@10 |
|---|---|---|---|---|
| signetai | 0.143 | 0.286 (+100%) | 0.144 | 0.450 (+213%) |
| esbuild | 0.200 | 0.318 (+59%) | 0.145 | 0.551 (+280%) |
| tokio | 0.193 | 0.192 (-1%) | 0.330 | 0.411 (+25%) |
| Overall | 0.179 | 0.265 (+48%) | 0.206 | 0.471 (+128%) |
| Query shape | Result vs grep | Signal |
|---|---|---|
| Relationship queries | 3.9x | Graph traversal finds connected symbols substring search misses |
| Natural language queries | 2.0x | Identifier decomposition plus family-aware scoring |
| Error/debug queries | 1.2x | Error surfaces and shared constants become searchable structure |
| Exact symbol queries | tied | BM25 is already excellent when names are known |
graphiq-mcp exposes 14 JSON-RPC tools over stdio:
| Tool | Use it for |
|---|---|
briefing | Project overview and starting context |
search | Ranked symbol search with filters |
context | Source plus structural neighborhood |
blast | Forward/backward impact analysis |
interrogate | Deep symbol inspection |
topology | Local code topology |
why | Ranking explanation |
explain | Natural-language symbol explanation |
dead_code | Unreachable symbols grouped by file |
constants | Numeric/string constant lookup |
status | Index stats and health |
doctor | Artifact validation |
index | Manual reindex |
upgrade_index | Rebuild stale artifacts |
Claude Code Β· Claude Desktop Β· OpenCode Β· Codex CLI Β· Cursor Β· Windsurf Β· Gemini CLI Β· Hermes Agent Β· Aider
Configure all supported harnesses
graphiq setup --project /path/to/projectConfigure one harness only
graphiq setup --harness cursorRun the MCP server with file watching
graphiq-mcp /path/to/project --watchThe MCP server lazily builds its in-memory index on first search and detects/recreates corrupted databases automatically.
| Layer | Examples |
|---|---|
| Symbols | functions, methods, classes, interfaces, traits, structs, enums, modules |
| Structure | calls, imports, type flow, references, constants, containment |
| Context | comments, signatures, file paths, sibling symbols, error surfaces |
| Maintenance | dead code, blast radius, topology, index health |
Query
β Query Family Router (8 families)
β Seed Generation (BM25 FTS5 β per-term expansion β graph walk β numeric bridges)
β Scoring (IDF coverage + name overlap + neighbor fingerprints + specificity scaling + structural aliases)
β Ranked results
The full architecture is documented in How GraphIQ works.
Full parsing: TypeScript, TSX, JavaScript, JSX, Rust, Python, Go, Java, C, C++, Ruby, YAML, TOML, JSON, HTML, CSS
File tracking: Kotlin, Swift, C#, PHP, Lua, Dart, Scala, Haskell, Elixir, Zig, GraphQL, Protobuf, Shell, SQL, Markdown, XML, SCSS, CMake, Dockerfile, Makefile, Meson
| Mode | Latency |
|---|---|
| Cold CLI (first run) | ~5β10s |
| Warm CLI (cached) | ~50ms |
| In-process (MCP) | ~18ΞΌs |
Index size for a ~20K symbol codebase: ~6.5MB.
How GraphIQ works Β· Benchmarks Β· Research notes
git clone https://github.com/aaf2tbz/graphiq.git
cd graphiq
cargo build --release
cargo testcd apps/desktop
npm install
npm run devBuild an installable desktop package with:
cd apps/desktop
npm run packageThe packaged app is written to apps/desktop/release/.
cargo bench
graphiq index .
graphiq search "query family router"Requirements: Rust 1.75+, macOS or Linux.
GraphIQ is available as an installable agent skill on skills.sh.
npx skills add aaf2tbz/graphiqInstalls the GraphIQ skill into Claude Code, Cursor, OpenCode, Codex, Windsurf, and 40+ other agents.
curl -fsSL https://raw.githubusercontent.com/aaf2tbz/graphiq/main/install.sh | bash -s -- uninstallMIT.
[GitHub](https://github.com/aaf2tbz/graphiq) Β· [Homebrew](https://github.com/aaf2tbz/homebrew-graphiq) Β· [skills.sh](https://skills.sh/aaf2tbz/graphiq/graphiq) Β· [crates.io](https://crates.io/crates/graphiq) Β· [discussions](https://github.com/aaf2tbz/graphiq/discussions) Β· [issues](https://github.com/aaf2tbz/graphiq/issues)