hindsight
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
hindsight
A graph that remembers what your code did to you.
Built for the Relate by Neo4j Hackathon 2026 — theme: Context, Connected. Judges: a pre-built graph is committed, so you can query it in one command without building anything — see Inspect the graph. DEMO.md lists every claim with the command that reproduces it, and VERIFIED.md carries a citation for every statement made about Relate.
hindsight builds a graph of a TypeScript repository — symbols, calls, tests, commits — in Relate, an embedded graph database, so a coding agent can answer questions that retrieval cannot:
What breaks if I change this? Which tests actually exercise this symbol? Have we broken this before, and what fixed it?
The last one is why it is called hindsight.
Why a graph
Ask a vector store "what breaks if I change Context.text?" and it returns things that
look like Context.text. Ask hindsight, on the real hono
codebase:
$ make query SYM=splitPath FILE=src/utils/url.ts
blast radius of splitPath (src/utils/url.ts:8)
13 production callers · 120 tests will exercise it · 43 test helpers · 74.3ms
1 hop — 2 production callers
src/router/trie-router/node.ts:86 search
src/utils/url.ts:16 splitRoutingPath
2 hops — 4 production callers
src/helper/route/index.ts:107 basePath
src/router/trie-router/node.ts:28 insert
src/router/trie-router/router.ts:15 match
src/utils/mount.ts:14 getPathPrefixLength
3 hops — 4 production callers
src/middleware/combine/index.ts:157 except
src/middleware/method-not-allowed/index.ts:59 methodNotAllowed
src/router/trie-router/router.ts:9 add
src/utils/mount.ts:53 createMountedRequest
4 hops — 3 production callers
src/hono-base.ts:386 defaultReplaceRequest
src/middleware/combine/index.ts:162 conditions
src/middleware/mount/index.ts:22 defaultReplaceRequest
tests reaching it: 120A string-splitting utility, and changing it reaches the router, three middlewares and
hono-base — four calls away, through files that never mention splitPath. Grep will not
find that. Embedding similarity will not find it. A traversal finds it in 61 milliseconds,
because the answer lives in how the code connects, not in how it reads.
Three buckets, not two, and the distinction is load-bearing: the 13 production callers
are what you have to think about, the 120 tests are what will catch you if you get it
wrong, and the 43 test helpers — describe blocks and fixture builders — are neither.
Counting helpers as tests inflated the figure by a third.
The whole graph of hono — 11,373 nodes, 25,403 relationships, 31k LOC of source and 1,500 commits of history — builds in about 15 seconds and loads in under one.
TypeScript only. Parsing is ts-morph over .ts, .tsx and .mts. Pointed at a
JavaScript codebase it produces an empty graph rather than a partial one.
Read the caller count as a lower bound. The parser resolves 28.1% of call sites to an
internal definition; 15.2% go to dependencies, and 51.2% the TypeScript checker cannot
resolve (dynamic dispatch, built-ins, type-only positions). Those are dropped rather than
guessed, so the graph under-reports rather than inventing. node parser/parse.mjs prints
the breakdown on every run.
Related MCP server: Integra CodeMemory
Trust: where every edge comes from
A graph is only worth as much as its worst edge. Nothing here is inferred by a language model; every edge is produced by a deterministic tool, and anything less than certain is labelled as such.
Edge | Source | Confidence |
|
| measured |
| TypeScript AST | measured |
|
| measured |
| the test's own resolved call graph |
|
| a test observed going red, then green, by |
|
|
|
|
Two rules follow from this, and they are enforced, not aspirational:
An unresolvable call is dropped, not guessed. A missing edge is recoverable; a wrong one silently corrupts every answer built on top of it.
TOUCHEDlands on a File, never a Symbol. Git knows which files a commit changed. Symbol line numbers come from HEAD and have drifted for any older commit, so a Commit→Symbol edge would be a guess dressed as a measurement.A symbol's identity includes its start line. Two classes in one file can each define
read(); keying on(file, name)merged them and the survivor inherited the other's callers. On hono that silently merged 703 ids, one of them holding 179 declarations.There is no runtime-coverage importer. An earlier one read Istanbul statement indices as line numbers and stamped
measuredon code that never ran. It was deleted rather than patched. EveryCOVERSedge here isstatic, and says so.
make gate fails the build if an evidence edge reaches the store without a confidence
property, if any Relate API call is used that is not documented in VERIFIED.md, or if an
LLM client is ever imported into the ingest path. It checks the store, not just the source
text.
See it run
make demo # plays the whole thing, ~74 seconds, no typing
make record # the same, captured to ~/Videos/hindsight-demo.mp4Inspect the graph without building anything
A pre-built store of hono is committed as
demo-store/ — 11,373 nodes and 25,403 relationships, 896K. Clone the repo and query it:
pip install --target ./pylib "relate-db>=1.2,<2"
make inspect SYM=splitPath FILE=src/utils/url.tsOr go straight at it with Relate and your own Cypher, with none of this project's code in the way:
relate --json -d ./demo-store "MATCH (n) RETURN count(n) AS nodes"
relate --json -d ./demo-store \
"MATCH (:Symbol {name:'splitPath'})<-[:CALLS*1..4]-(c:Symbol)
RETURN DISTINCT c.file, c.name LIMIT 20"Everything in the README is checkable that way. make graph rebuilds the same graph from
source into hono-store/; demo-store/ is a frozen snapshot so a rebuild never churns
the repo.
Quickstart
Requires Node 18+ and Python 3.9+.
make setup # npm + pip dependencies
make target # clone hono into .targets/ (the demo repo)
make graph # parse, mine history, derive coverage, mine break/fix, load
make query SYM=splitPath FILE=src/utils/url.ts
make test # unit tests
make gate # the quality gateAgainst your own repository:
make graph REPO=/path/to/your/repo STORE=./myrepo-store
make query SYM=yourSymbol STORE=./myrepo-storeNo server, nothing to deploy — Relate runs in-process. The store is a directory, not a
single .rl file, and that is deliberate: Relate allows concurrent read-only readers
against a directory store but returns storage locked for a single file, so a .rl store
would make every MCP call fail while an ingest is running.
Use it from a coding agent
hindsight ships an MCP server. .mcp.json wires it into Claude Code; point
HINDSIGHT_STORE at your store directory (not a .rl file — see the lease note below).
Tool | Answers |
| what breaks if I change this |
| which named tests reach it (all |
| has this broken before, and what fixed it |
| log what actually happened |
| what is in the store |
Relate ships its own MCP server too, but it exposes Cypher. An agent does not want Cypher; it wants the three questions that need a graph.
Point it at your own project
hindsight lives in one checkout and serves any number of repositories, one store each. From the hindsight directory:
make link REPO=~/code/my-project STORE=~/.hindsight/stores/my-projectThat builds the graph at STORE and writes ~/code/my-project/.mcp.json pointing at it,
with every path already absolute. Restart your agent in the project and the five tools
answer about your code.
When your code changes, re-run the same line. The config does not change, and the rebuild swaps atomically, so an agent that is already connected keeps answering until it reconnects. For automatic refresh, add it to a post-commit hook:
echo 'make -C /abs/path/to/hindsight link REPO=~/code/my-project STORE=~/.hindsight/stores/my-project >/dev/null 2>&1 &' \
>> ~/code/my-project/.git/hooks/post-commit
chmod +x ~/code/my-project/.git/hooks/post-commitThe two paths are the only choices: REPO is the project you are coding in, STORE is
where its graph lives. One store per repository — pointing two projects at one store
merges their graphs and makes blast radius span both.
If you would rather write the config yourself, make mcp-config STORE=... PROJECT=...
prints it to stdout instead of installing it, and make graph builds the store alone.
What to add to your project's .gitignore. Only two files ever appear in your
project; the intermediate fact files are written into the hindsight checkout, which
ignores them already.
# hindsight
.hindsight-outcomes.jsonl # per-developer journal, not shared state
.mcp.json # contains absolute paths; see below
*-store/ # only if you keep the graph inside the project.mcp.json is a judgement call. The paths in it are absolute, so a committed copy breaks
for every other developer and for CI. Ignore it, and commit a mcp.json.example with
placeholder paths if your team wants the config shared.
Keeping the store outside the project — STORE=~/.hindsight/stores/your-project — avoids
the third line entirely and keeps a regenerable, several-hundred-kilobyte directory out of
your working tree. The parent directories are created for you, and ~ works on the
make command line because your shell expands it before make runs.
~ also works inside .mcp.json, because the server expands it — but nothing else in
that file does, so keep the path to agent/server.py fully absolute.
REPO and STORE can live anywhere: inside or outside your home directory, on different
filesystems from each other, and in paths containing spaces. They do not need to be near
the hindsight checkout or near each other.
Prefer absolute paths, or ~. A relative STORE works but means two different
directories depending on who reads it: make graph STORE=./x resolves ./x against the
hindsight checkout, because that is where make runs, while the MCP server resolves it
against wherever your agent starts it — usually your project root. The mismatch surfaces
as a confusing "no such database".
Rather than reason about it, let hindsight write the config:
make mcp-config STORE=~/.hindsight/stores/your-project PROJECT=~/code/your-projectThat prints a complete .mcp.json with every path already absolute, and tells you on
stderr how to build the store if it does not exist yet.
On the single-writer lease. Relate refuses a second writable open, so the server holds the store read-only — which means you can re-ingest while the agent keeps running. This works only for a directory store; see above.
record_outcome therefore appends to a JSONL journal rather than writing to the graph.
HINDSIGHT_JOURNAL sets its path; the file and its directory are created on the first
call, and one line is appended per call:
{"ts":"2026-11-30T14:12:00Z","symbol":"connect","fileHint":"","outcome":"broke",
"detail":"changed the url format, listUsers started failing","selfReported":true}outcome is one of broke, fixed or verified. Note selfReported rather than a
confidence label: an agent saying a change worked is a claim, not an observation. Only
scripts/watch.py, which actually runs the suite, writes measured edges.
Nothing reads the journal back yet. It is an append-only record for a human to read;
folding it into the graph is future work. If you never call record_outcome, the file is
never created and you can ignore HINDSIGHT_JOURNAL entirely.
Platform note
Relate's prebuilt Node native library requires glibc 2.39 (Ubuntu 24.04 era). The
Python wheel is manylinux2014 (glibc 2.17) and works much further back. That is why
Python owns the store and Node owns the parsing: it is a packaging-policy difference, not
a language preference. On a current machine either works. VERIFIED.md has the measured
matrix.
Project layout
parser/ Node + ts-morph — symbol and call extraction
parse.mjs the parser
ingest/ Python — git history, coverage, and the Relate loader
store/ the queries
docs/ facts-schema.md — the parser/ingester contract
phase0/ runnable evidence for every claim in VERIFIED.md
VERIFIED.md every Relate fact, with a citation
PLAN.md the build planLicense
Apache-2.0
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides graph-native code intelligence for coding agents, enabling them to navigate repositories through compact SQLite-backed symbol graphs and retrieve full source only for relevant symbols.-
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to explore TypeScript, JavaScript, and Prisma projects through local symbol, call, and model-usage graphs, while recalling persistent project-scoped decisions and returning focused source context.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to query a local structural code graph for focused context, inspect relationships and impact, and carry recorded mistakes into later sessions.24 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to query a local SQLite-backed structural code graph for bounded, relevant context such as source entities, relationships, call paths, impact analysis, and recorded project mistakes before reading full files.24 npmMIT