Skip to content

Repository files navigation

Engram

Version control for AI memory

Version, test, review, and replay what an AI knows — the way GitHub does for code.

Live demo → engram-vcs.vercel.app · Comparison · Knowledge graph


The problem

Companies are giving AIs long-term memory. But once an AI remembers things, nobody can see what it knows, test whether it's still correct, review a change before it ships, or undo a bad update. Memory becomes an invisible, unversioned blob — and when it's wrong, it's wrong silently, in production.

The idea

Engram treats an AI's memory like a codebase:

  • Version — every change to memory is a commit.
  • Diff — see exactly what a change added, changed, or superseded.
  • Test — write assertions about what the AI should know, and run them against any snapshot.
  • Review — catch contradictions before they ship.
  • Replay — rewind to any point in time and ask the AI what it believed then.

The demo in one paragraph

A company changes its remote-work policy from 3 days to 5 days a week. Engram shows the change as a reviewable diff. Its memory tests then catch a downstream contradiction — a payroll rule still assumes 3 days — and flag it as do not deploy. We fix it, merge, and ask the AI: now it answers correctly. Then we replay history to prove it said "3 days" before the change and "5 days" after.

Walk it end-to-end here → engram-vcs.vercel.app/demo

Why the comparison matters

The /compare page runs the same question against three kinds of memory side by side:

Approach What it does Problem
No memory Stateless LLM Forgets everything between turns
Generic memory Dumps raw history into context Contradictions pile up, no way to review or undo
Engram Versioned, tested, reviewable memory One is trustworthy

Architecture

Engram is built around Cognee, not as a replacement for it:

  • SQLite = system of record. Facts are versioned rows (subject, predicate, object, source, commit_id, status). A commit is a version marker; a diff between commits is computed in SQL. All versioning lives here.
  • Cognee = system of intelligence. The active facts at a commit are fed to Cognee so it can reason over the knowledge graph and answer questions. (On serverless, where Cognee isn't installed, endpoints fall back to a text-based LLM path.)
  • FastAPI backend exposes the API.
  • Next.js frontend (App Router, React 19) is the dashboard.
┌────────────┐     versioned facts      ┌────────────┐
│  SQLite    │ ───────────────────────► │  Cognee    │
│ (record)   │                          │ (reasoning)│
└─────┬──────┘                          └─────┬──────┘
      │            FastAPI  (main.py)         │
      └──────────────────┬────────────────────┘
                         │  REST
                 ┌───────▼────────┐
                 │  Next.js UI    │
                 └────────────────┘

Data model

facts:   id, subject, predicate, object, source, commit_id, status('active'|'superseded'), created_at
commits: id, message, created_at

A fact is a triple, e.g. (subject="RemoteWorkPolicy", predicate="allows", object="5 days per week").

API surface (FastAPI)

Area Endpoints
Health / state GET /health, GET /active, POST /merge
History GET /commits, GET /commit/{id}, GET /history, GET /fact-history
Facts GET /facts?commit=N, POST /commit
Change review GET /diff?from=A&to=B, GET /impact?commit=N, GET /contradictions?commit=N
Reasoning POST /ask, GET /graph?commit=N, POST /cognee/build, POST /cognee/ask
Replay GET /replay?commit=N
Tests GET /tests, POST /tests/run?commit=N
Comparison POST /compare/all (+ /compare/no-memory, /compare/generic, /compare/engram)
Ingestion POST /ingest, POST /ingest-document

Running locally (Windows / PowerShell)

The backend must be run with the venv interpreter, not a global python.

Backend (from the repo root):

.\venv\Scripts\python.exe seed.py                                   # build a fresh demo DB
.\venv\Scripts\python.exe -m uvicorn main:app --host 127.0.0.1 --port 8000

Frontend (from frontend/):

npm install
npm run dev        # http://localhost:3000

The frontend reads NEXT_PUBLIC_API_BASE for the backend URL and falls back to http://localhost:8000 in dev.

Deployments

Piece URL
App https://engram-vcs.vercel.app
API https://engram-api-rho.vercel.app

Tech stack

Next.js 16 · React 19 · TypeScript · FastAPI · SQLite · Cognee · Gemini · Vercel


Engram — because memory you can't review is memory you can't trust.

About

Engram - version control for AI memory. Version, test, review, and replay what an AI knows, the way GitHub does for code.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages