ContextBridge
@tijuthomas5
Local-first code retrieval for AI agents — cuts codebase context from tens of thousands of tokens to a few hundred, with zero hallucinated file paths.
概览
What is ContextBridge?
ContextBridge is a local-first code retrieval layer for AI coding agents. It indexes codebase structure via Graphify output, then exposes MCP tools that any AI client (Claude Code, Codex, Cursor, etc.) can call to get ranked files, symbols, and dependency chains — optionally validated and re-ranked by a local LLM before reaching the cloud AI.
How to use ContextBridge?
Setup runs via platform-specific batch scripts (setup_context_bridge.bat on Windows, equivalents in setup/mac/ or setup/linux/). Edit the generated config.hybrid.json to point settings.discovery.* at your source folders, re-run setup, then start the server. By default ContextBridge runs SSE at http://127.0.0.1:8755/sse; set CONTEXT_BRIDGE_TRANSPORT=stdio for stdio transport. A dashboard is available at http://127.0.0.1:8795.
Key features of ContextBridge
- Keyword-first hybrid retrieval with guarded vector assist
- Optional local AI analysis that validates and re-ranks results
- Swappable profile plugins for project-specific ranking
- MCP tools:
search_context_hybrid,find_code_locations,get_module_summary,record_outcome, and more - Rerunnable safe setup that never overwrites existing configs
Use cases of ContextBridge
- Replace pasting 10–50 raw source files with a few hundred tokens of ranked context
- Ground AI agent decisions in exact file paths, symbols, and line hints
- Reduce token costs and noise by focusing on the 3–5 files that matter
- Decompose multi-topic prompts into compact, grounded search results
FAQ from ContextBridge
What does ContextBridge do compared to a reasoning engine?
ContextBridge is a codebase routing and retrieval tool, not a reasoning engine — it finds the right files, symbols, and connections but does not prove causality or choose the fix.
What dependencies are required?
ContextBridge indexes Graphify output (graph.json, GRAPH_REPORT.md, source-files.txt, scope-summary.md, manifest.json) plus /behavior/ docs. The optional local AI stage uses Ollama by default but also supports Anthropic, OpenAI, or OpenRouter.
What transport does ContextBridge use?
SSE transport on http://127.0.0.1:8755/sse is recommended for multiple clients to share one server. Stdio transport is supported by setting CONTEXT_BRIDGE_TRANSPORT=stdio before starting.
Where does my codebase data live?
All indexing is local — ContextBridge builds its index from local Graphify output and docs; raw source files are never indexed. The index is refreshed by re-running setup after each Graphify update.
Are there any limitations I should know?
Dashboard live stats can lag up to ~15 seconds, and history lists (recent events, missed files, failed queries) show only the most recent 1000 entries — both are intentional performance tradeoffs, not data loss.