Skip to main content
Glama

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: 120

A 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

CALLS

ts-morph symbol resolution — forward from each call site

measured

DEFINED_IN, IMPORTS

TypeScript AST

measured

TOUCHED

git log --name-only

measured

COVERS

the test's own resolved call graph

confidence: "static"

BROKE / FIXED_BY

a test observed going red, then green, by scripts/watch.py

confidence: "measured"

FIXES

fix: commits paired with the commit that last touched the same file

confidence: "heuristic"

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.

  • TOUCHED lands 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 measured on code that never ran. It was deleted rather than patched. Every COVERS edge here is static, 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.mp4

Inspect 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.ts

Or 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 gate

Against your own repository:

make graph REPO=/path/to/your/repo STORE=./myrepo-store
make query SYM=yourSymbol STORE=./myrepo-store

No 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

blast_radius(symbol, file_hint?, depth?)

what breaks if I change this

tests_covering(symbol, file_hint?)

which named tests reach it (all static)

prior_breakages(symbol, file_hint?)

has this broken before, and what fixed it

record_outcome(symbol, outcome, detail?)

log what actually happened

graph_summary()

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-project

That 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-commit

The 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-project

That 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 plan

License

Apache-2.0

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides 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.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables 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.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables 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 npm
      MIT