Keelwright

AI Infrastructure

Synapse

A local code graph for AI agents. Fewer tokens spent finding the code that matters.

Intro

Synapse indexes your repositories with tree-sitter, stores a code graph in an embedded database on your machine, and serves ranked context to your IDE or agent over the Model Context Protocol (MCP). It ships as a single binary and runs on your machine.

Why I built it

I wanted to cut the tokens my LLMs spent finding code, first when they reviewed my work and later when they wrote it. I tried Graphify first. On my Swift app the savings were small, so I wrote my own.

What I measured

Three tests, all scripted, with no live agent. Tokens are estimated as characters divided by 4 over each command and its output. When a graph tool's answer is incomplete, the grep cost is added, because an agent would still need it. The grep commands were written knowing the answer, so grep is a best case. Numbers checked on November 3, 2026 against my benchmark notes and the v0.5.0 release page.

Test 1: one Swift app, 8 questions

A private Swift and SwiftUI app with 134 Swift files and 358 commits. Each question has a hand-written answer key.

Test 1 benchmark results
ToolComplete answersEstimated tokens to answer
grep and git8 of 813,125
Graphify 0.9.45, code-only3 of 814,724
Synapse, first run3 of 816,486
Synapse, after the fixes7 of 85,159

Where Synapse wins: callers across files cost grep 5,713 tokens and Synapse 218. A type's dependencies cost grep 4,751 and Synapse 324. Where grep wins: plain text patterns, such as which docs mention a name (17 tokens against 45) and a well-built git log for the most-changed file (138 against 549). Measured on Synapse main commit bcdf410.

Test 2: 60 questions on 9 private repos

Repos in JavaScript, TypeScript, React, Python and Next.js. The question subjects were chosen by fixed rules, the same in every repo, so none was hand-picked.

Test 2 benchmark results
ToolComplete answersEstimated tokens to answer
grep and git60 of 60221,856
Graphify 0.9.45, code-only32 of 60116,050
Synapse, first run24 of 60135,196
Synapse, after the fixes shipped in v0.5.053 of 6021,848

Seven questions are still incomplete: four co-change questions (Synapse weights recent history, the key counts all history), two path questions where my answer key is wrong and Synapse's "no path" is correct for one of them, and one explain question. I left the keys frozen and scored every tool against them. Measured on main commit d94e09f.

Test 3: 8 cross-service questions

Eight services that call each other over HTTP, with answer keys from the company's service manifest.

Test 3 benchmark results
ToolComplete answersEstimated tokens to answer
grep and git, with the env var names known8 of 8557
Graphify 0.9.45, code-only, merged graphs1 of 810,792
Synapse, first run0 of 8not applicable
Synapse, base-URL env vars declared in synapse.yaml8 of 81,570
Synapse, nothing declared3 of 81,437

Precision: in a random sample of 30 of the 144 cross-repo endpoint links, each checked by reading the client and route code, all 30 were correct at the route level. Recall is the weaker number: of 1,154 client calls found, 161 are linked (99 through declared variables, 62 by inference). Most of the rest are external APIs, tests, or calls whose path is built in another file. Grep is cheaper here because its commands already knew the env var names. Synapse's value is finding the links without that knowledge. Measured on main commit 99e6f00.

How to read these results

  • I wrote the questions, the answer keys and the fixes. An independent task set would be a better test.
  • The fixes were written after I saw these results, on the same questions. A run on repos I did not tune against is next.
  • The declared env vars came from the same service manifest as the answer keys.
  • All ten repos come from one company and share conventions.
  • No live agents and no exact tokenizer. Every token figure is an estimate.

What it does

Language support

Synapse language support
LanguageType edgesHTTP route and client linkingBenchmarked
SwiftYesNoYes
JavaScript, TypeScriptYesExpress, Hono, Next.js routes; fetch, axios, got, ky clientsYes
PythonYesFastAPI, Flask routes; httpx, requests clientsYes
Go, Java, Kotlin, Ruby, PHP, C, C++, C#Not yetNot yetNo

Install

Homebrew on macOS

brew install keelwright-hq/synapse/synapse

Go

Needs a C toolchain, because tree-sitter uses CGO.

go install github.com/keelwright-hq/synapse/cmd/synapse@latest

Prebuilt binaries for macOS (arm64, amd64) and Linux (amd64, arm64) are on the GitHub releases page. Linux binaries need glibc 2.34 or newer. Then run synapse version. If you installed both with go install and Homebrew, run which -a synapse and keep one.

Cross-service linking

Declare how other services reach each member in synapse.yaml:

version: 1
repos:
  - name: api
    path: ./api
    http:
      base_env: [API_URL]
      gateway_prefix: /api-svc
  - name: web
    path: ./web

With nothing declared, a call links only when exactly one other service matches. Ties are left unlinked on purpose. Then ask who calls a service:

synapse query services --workspace . --consumers-of api --sites 5

Status

Public beta, v0.5.0, Apache-2.0. I am looking for testers on real codebases, especially multi-repo ones and Go, Java and C# repos, which I have not benchmarked. If it misses something or links the wrong service, open an issue.

Hosted version

I am exploring a hosted option for teams, for example federation across many repos. If that would help you, tell me.

hello@keelwright.ca

Known limits

Related hubs