Thanks to visit codestin.com
Credit goes to github.com

Skip to content

aaf2tbz/graphiq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

193 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GraphIQ

GRAPHIQ

Local code search that understands how your code is connected

GitHub release MIT License Homebrew NDCG@10 +48% | MRR@10 +128% vs grep

+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



Local code search with structural memory

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 "rate limit middleware" and GraphIQ can land on rateLimitMiddleware, then follow the graph to TokenBucket, ThrottleConfig, and checkRateLimit even when those names do not share the same words.

      query
        |
   lexical seeds
         |
   structural graph
    /    |     \
 calls imports constants
    \    |     /
   ranked symbols

zero network Β· single SQLite file Β· no LLM required

⚑ Start in 20 seconds

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.

πŸ“¦ Install

Homebrew

brew tap aaf2tbz/graphiq
brew install graphiq

Install script (Recommended Method

curl -fsSL https://raw.githubusercontent.com/aaf2tbz/graphiq/main/install.sh | bash

From source

git clone https://github.com/aaf2tbz/graphiq.git
cd graphiq
cargo build --release

Installs graphiq, graphiq-mcp, and graphiq-bench.

Why it works

🎯 [01]
Lexical precision

BM25 FTS5 handles exact symbol names, identifiers, file paths, and decomposed camelCase/snake_case terms.

πŸ•ΈοΈ [02]
Graph recall

Seed results expand through calls, imports, constants, type edges, error surfaces, and local neighborhoods.

🧭 [03]
Query routing

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.

πŸ“ˆ Benchmark Signal

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
signetai0.1430.286 (+100%)0.1440.450 (+213%)
esbuild0.2000.318 (+59%)0.1450.551 (+280%)
tokio0.1930.192 (-1%)0.3300.411 (+25%)
Overall0.1790.265 (+48%)0.2060.471 (+128%)
Query shape Result vs grep Signal
Relationship queries3.9xGraph traversal finds connected symbols substring search misses
Natural language queries2.0xIdentifier decomposition plus family-aware scoring
Error/debug queries1.2xError surfaces and shared constants become searchable structure
Exact symbol queriestiedBM25 is already excellent when names are known

πŸ› οΈ Agent Tools

graphiq-mcp exposes 14 JSON-RPC tools over stdio:

Tools

ToolUse it for
briefingProject overview and starting context
searchRanked symbol search with filters
contextSource plus structural neighborhood
blastForward/backward impact analysis
interrogateDeep symbol inspection
topologyLocal code topology
whyRanking explanation
explainNatural-language symbol explanation
dead_codeUnreachable symbols grouped by file
constantsNumeric/string constant lookup
statusIndex stats and health
doctorArtifact validation
indexManual reindex
upgrade_indexRebuild stale artifacts

Supported Harnesses

Claude Code Β· Claude Desktop Β· OpenCode Β· Codex CLI Β· Cursor Β· Windsurf Β· Gemini CLI Β· Hermes Agent Β· Aider

Config / Setup

Configure all supported harnesses

graphiq setup --project /path/to/project

Configure one harness only

graphiq setup --harness cursor

Run the MCP server with file watching

graphiq-mcp /path/to/project --watch

The MCP server lazily builds its in-memory index on first search and detects/recreates corrupted databases automatically.

πŸ—‚οΈ What gets indexed

LayerExamples
Symbolsfunctions, methods, classes, interfaces, traits, structs, enums, modules
Structurecalls, imports, type flow, references, constants, containment
Contextcomments, signatures, file paths, sibling symbols, error surfaces
Maintenancedead code, blast radius, topology, index health

🧩 System Shape

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.

🌐 Languages

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

βš™οΈ Performance

ModeLatency
Cold CLI (first run)~5–10s
Warm CLI (cached)~50ms
In-process (MCP)~18ΞΌs

Index size for a ~20K symbol codebase: ~6.5MB.

πŸ“š Docs

How GraphIQ works Β· Benchmarks Β· Research notes

πŸ§ͺ Development

git clone https://github.com/aaf2tbz/graphiq.git
cd graphiq
cargo build --release
cargo test

Desktop App

cd apps/desktop
npm install
npm run dev

Build an installable desktop package with:

cd apps/desktop
npm run package

The packaged app is written to apps/desktop/release/.

cargo bench
graphiq index .
graphiq search "query family router"

Requirements: Rust 1.75+, macOS or Linux.

πŸ”Œ Agent Skill

GraphIQ is available as an installable agent skill on skills.sh.

npx skills add aaf2tbz/graphiq

Installs the GraphIQ skill into Claude Code, Cursor, OpenCode, Codex, Windsurf, and 40+ other agents.

🧼 Uninstall

curl -fsSL https://raw.githubusercontent.com/aaf2tbz/graphiq/main/install.sh | bash -s -- uninstall

License

MIT.


[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)

About

Use GraphIQ with agents to deeply search your projects, provide context with code, and reduce issues before they arrive. No Embeddings, No LLM, Single SQLite File.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors