MCPcopy Index your code
hub / github.com/NickCirv/engram

github.com/NickCirv/engram @v4.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.5.0 ↗ · + Follow
983 symbols 3,319 edges 221 files 171 documented · 17% updated 15d agov4.5.0 · 2026-06-21★ 1379 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

engramx — the universal context spine for AI coding tools (v4.5.0 'Reach')

Engram makes your AI coding agent stop re-reading the same files — and stop repeating mistakes your repo already fixed.

One install. 8 IDEs. Your agent works from a structural map of your repo instead of re-reading whole files — so sessions run longer before the context wall — and bi-temporal mistakes are auto-captured from your git revert history, so it stops repeating fixes that already failed. Context packets run ~50–90% smaller per file (structural size, not a bill saving — run engram bench on yours). Local SQLite, zero cloud, Apache 2.0.

Try in 30 seconds (no install) ▶

engram — 24-second showcase (click to open the live HTML player)

Install Page · Live Demo · Scene Table · rendered with Hyperframes

Install · Quickstart · Dashboard · Benchmark · IDE Integrations · HTTP API · ECP Spec · Contributing

CI npm engramx npm engramx-continue OpenVSX engram-vscode License Node Tests 53-89% per-file structural reduction Zero native deps engram makes zero LLM calls


Try in 30 seconds (no install)

engram v4.0 demo — bi-temporal mistakes auto-captured from git revert (30 seconds)

Play the live recording · or get the raw cast at docs/demos/v4-skill-pack.cast (asciinema play) · or generate it yourself with v4-skill-pack-demo.sh

Or paste this into your terminal — same flow, no global install, no commitment. Creates a throwaway repo with a reverted bug, then runs engram against the public npm registry:

mkdir -p /tmp/engram-demo && cd /tmp/engram-demo && \
  git init -q && git commit --allow-empty -q -m "init" && \
  echo "export const buggy = () => null;" > src.ts && \
  git add -A && git commit -q -m "feat: add buggy helper returning null causing form crashes" && \
  git revert --no-edit HEAD > /dev/null && \
  npx --yes engramx@4.5.0 init . && \
  npx --yes engramx@4.5.0 mistakes

You should see, within 30 seconds, the bi-temporal pre-mortem engram auto-captured from your revert:

⚠️  1 mistake(s) recorded:

⚠ Mistake #1 — 2026-05-19
  ┌─ then you believed: feat: add buggy helper returning null causing form crashes
  ├─ found false:       2026-05-19
  └─ truth now:         Reverted in <sha> (2026-05-19)
     ref:        src.ts
     applies to: git revert touching src

That's the rave moment — engram remembering what your AI agent forgot, surfaced before the next edit. Multiply this across your actual repo's revert history, and it works on every Claude Code session automatically.

When you're ready: scroll to Install for the global install path.


Why this exists, May 2026

Three things broke at the same time. Cursor went usage-based and people started getting $1,400 surprise bills. Anthropic tightened Claude Code limits, then quietly tested removing it from the $20 Pro plan. Half the AI coding crowd migrated from one tool to the other, hit the new ceiling within a week, and started looking for any way to make a session last longer.

Engramx is what makes the session last longer. It indexes your codebase into a local SQLite knowledge graph once. Then it intercepts file reads at the agent boundary and replaces them with a structural summary the agent already has the working memory for. Same edit, same diff, same code shipped — fewer tokens consumed in the round trip.

On engramx's own repo the per-file structural context reduction is ~89% (89.5% in the latest bench/real-world.ts run, size-guarded so it never counts a file engram wouldn't shrink). Across eight real OSS repos it ranges roughly 50–90% — highest on large-file Python/Go codebases, lower on many-small-file projects (bench/real-world.ts reproduces it on any project you point it at). This is a structural context-packet reduction measured per file, not an agent-loop cost saving, and it varies by repo. Independent migration guides (dev.to/56kode, SpectrumAI Lab) cite engram for the strongest measured structural reduction in the category.

Works in 8 IDEs and counting — Claude Code, Cursor, Cline, Continue.dev, Aider, Windsurf, Zed, OpenAI Codex CLI. One install, one graph, every tool benefits. Apache 2.0. Local SQLite. Nothing leaves your machine.

v4.5.0 "Reach" — 2026-06-21. New: the sub-agent broker now points a spawned agent at the files most likely related to the one it is working on — graph-adjacent files first (real call/import edges), then same-directory siblings and test↔implementation counterparts — so it can skip the grep-around discovery step (tiered so a real graph hit is never displaced by a weaker path guess; de-duplicated; never-worse). And the resolver now displaces redundant context across providers (de-dupe + blend-rank + discard) instead of concatenating it, with the Stop line reporting ~N redundant tokens displaced. An intercepted Read's enriched packet is served only when it is strictly smaller than the raw file, else it falls back to the graph-only summary. Both are structural — never a bill/cost claim. Still: local SQLite, nothing leaves your machine.

v4.3 "Proof" shipped 2026-06-05 — engram's saving is now real and provable. Run engram measure in your own repo to see the honest structural context-token reduction on your code — every disclosure computed live: it's a ceiling, here's the recall, here's the intercept rate, "structural tokens, not your bill." Run npm run bench:recall for the reproducible proof that engram surfaces the files a change actually touches (recall@10 33% on engram's own repo, decomposed honestly: candidate generation reaches 43%, the PageRank ranker adds +3.2pp over random-within-candidate; 10.4% blind chance).

New this release: a never-worse gate on Grep (engram passes through whenever its packet isn't actually smaller — sized to your grep's exact cwd/path/glob scope), Bash-grep interception (the shell-only IDEs — Aider, Codex CLI, Cline — now get the call-site packet too), a sub-agent context broker (a tight ~100-token ranked slice into each spawned Claude Code sub-agent — the one regime prompt caching can't help), and a compaction ledger (a "previously read" list injected at /compact so the agent doesn't re-explore). Every number is a measured fact or a labelled bet — no cost claims; a structural context reduction, not a bill saving (engram's net over prompt caching ≈ 0). 1149 tests. See CHANGELOG.md, docs/COMPARISON.md (vs the other local code-graph tools — ranking isn't unique, the combination is), and docs/FRONTIER.md.

v4.3.1 (patch) — 2026-06-06: a two-swarm execution audit hardened the release. Fixes: the engram cost digest no longer prints an unqualified dollar/"% saved" figure (it now carries the structural-not-a-bill-saving caveat); bench/stats state "Nx LARGER — passes through" instead of a backwards "0.2x smaller" on tiny repos; the incremental reindex now rebuilds cross-file calls edges (no graph drift between full re-indexes) and does so in ~1ms via an mtime-keyed refs cache instead of re-parsing every file on each edit; the MCP server reports its real version; doctor flags a disabled kill-switch; gen --task <bad> errors cleanly. No new features, no behaviour change to the honest claim.

v4.3.2 (patch) — 2026-06-06: fixes a broken MCP-setup command in this README — the config block now uses npx -y -p engramx engram-serve <path> (the previous engramx serve had no such subcommand, so MCP clients failed with "unknown command 'serve'"). Also: gen-ccs now exports a structural fallback on fresh repos instead of an empty file; TS interface/type/enum declarations are extracted as first-class graph nodes; the git co-change miner no longer emits a self-edge for distinct files sharing a basename; provider warmup probes no longer keep the process alive a few seconds after a session starts. Adds llms-install.md for agent-driven setup. No behaviour change to the honest claim.

Earlier release notes (v4.2 "Loop", June 3)

v4.2 "Loop" shipped 2026-06-03 — engram closed the agent's investigation loop. The original Context Spine goal was to collapse the whole grep → read → read loop, not just the single file read. v4.2 shipped a Grep interception that answers a content-mode symbol search from the reference graph with the actual file:line: code call sites — smaller than the raw grep (init is 573 vs 9,317 tokens on engram's own repo) while showing the real usage — and same-session read dedup that returns a pointer instead of re-serving an unchanged file the agent already read. Both are recall-safe (an rg -n escalation; byte-unchanged + PreCompact/SessionStart reset guards) and gated so they only fire when they genuinely save tokens. (v4.1 "Compass" — PageRank-ranked graph + callers/callees/impact traversal.)

Earlier release notes (v3.4 "Universal Spine", May 2)

v3.4 "Universal Spine" shipped 2026-05-02 — multi-IDE detector covers 8 tools, Anthropic Claude Code plugin submitted to the official directory (in review), VS Code / Cursor extension live as nickcirv.engram-vscode on OpenVSX, engramx-continue on npm, Cline integration documented. Cost Lens telemetry from v3.3.0 feeds a weekly Markdown digest at ~/.engram/cost-report-YYYY-Www.md. 1007 tests, CI green on Ubuntu + Windows × Node 20 + 22.

Earlier release notes (v3.0 "Spine", April 24)

EngramX v3.0 "Spine" shipped 2026-04-24 — the biggest release before v3.4. The spine is extensible: any MCP server becomes an EngramX provider via a 10-line plugin file. Pre-mortem mistake-guard warns before you repeat a bug. Bi-temporal mistake memory — refactored-away mistakes stop firing. Anthropic Auto-Memory bridge reads Claude Code's own consolidated memory. SSE-streaming packets render progressively. engram gen dual-emits AGENTS.md + CLAUDE.md by default.


Install in 30 seconds

Three paths depending on where you want engram to live. All three install the same engram; you can stack them.

1. CLI (recommended starting point — works in every supported IDE)

npm install -g engramx
cd ~/your-project
engram setup

engram setup auto-detects every supported IDE on your machine (Claude

Extension points exported contracts — how you extend this code

IContextProvider (Interface)
(no doc) [2 implementers]
adapters/continue/src/index.ts
MarkerAnalysis (Interface)
* Analyze the marker state of a file's contents so we can decide how to * merge in a new engram section without corrupt
src/autogen.ts
MinimalHookPayload (Interface)
* Minimum validated shape of a hook payload as delivered to `dispatchHook`. * The dispatcher checks these fields exist
src/intercept/dispatch.ts
JsonRpcRequest (Interface)
(no doc)
adapters/zed/index.ts
WatchOptions (Interface)
(no doc)
src/watcher.ts
McpTool (Interface)
(no doc)
src/serve.ts
DashboardOptions (Interface)
(no doc)
src/dashboard.ts
InitResult (Interface)
(no doc)
src/core.ts

Core symbols most depended-on inside this repo

get
called by 138
src/types/sql.js.d.ts
close
called by 119
src/types/sql.js.d.ts
init
called by 89
src/core.ts
getStore
called by 64
src/core.ts
description
called by 62
adapters/continue/src/index.ts
set
called by 59
src/intelligence/cache.ts
parseGrepBashCommand
called by 48
src/intercept/handlers/bash.ts
upsertNode
called by 43
src/graph/store.ts

Shape

Function 711
Interface 159
Method 97
Class 16

Languages

TypeScript99%
Python1%

Modules by API surface

src/graph/store.ts42 symbols
src/server/http.ts28 symbols
src/intelligence/cache.ts28 symbols
src/core.ts23 symbols
bench/session-level.ts20 symbols
src/commands/measure-session.ts19 symbols
src/miners/ast-miner.ts16 symbols
src/intercept/installer.ts16 symbols
src/types/sql.js.d.ts15 symbols
src/providers/resolver.ts15 symbols
adapters/continue/src/index.ts15 symbols
src/providers/mcp-client.ts14 symbols

For agents

$ claude mcp add engram \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact