The core Python package for sin-context-bridge. Pure stdlib + optional
deps; safe to import on any Python 3.11+ install.
bridge.py—ContextBridgeorchestrator; the only class callers need.merger.py—merge_and_budget(): sort + dedup + budget fit.mcp_server.py— FastMCP server exposingsin_contextandsin_context_healthover stdio.sources/— one adapter per backend (SCKG, sin-brain, GitNexus, local SQLite). Each implements theSourceinterface fromsources/base.py.
scripts/sin_context_bridge.py(CLI + MCP entrypoint).tests/test_*.py(full coverage).
- All backends are soft — any one can be missing and the bridge still
works, as long as
local(always available) is in the source list. - The
SourceABC enforces ano-raisecontract: backends swallow their own errors and return[]. The bridge wraps even that in try/except as a second line of defense. ContextBridgeowns no state besides the source list. Safe to instantiate per request.
from lib.bridge import ContextBridge
from lib.merger import merge_and_budget
from lib.sources import ALL # full backend registry