New
Apps 6,326Makers 6,305This week 13
Promote your app−30%
Engram screenshot 1
6views in
the last 30 days

Engram

SQLite of agent memory — single-file, embeddable, zero-config

Built with Claude/Gemini/Claude Code

by taipanbox · Unclaimed · from GBUnited Kingdom · added Oct 29, 2026
no ratings0 comments

Engram: Cognitive Memory Layer for AI Agents

The SQLite of agent memory: embeddable, local-first, cognitively grounded.

Engram architecture: observations flow into the memory core, which holds episodic memory, bitemporal semantic facts, and an entity graph, with optional LLM reflection and compression, and recall flowing back out to the agent

Engram gives an AI agent a persistent, provenance-tracked memory: raw episodic observations, bitemporal semantic facts that know when they were true, and an entity graph for associative recall, all in one embeddable .engram file with no server, no Docker, and no API key required to write a memory.


The problem

Every AI agent starts from zero. Ask it something it answered last week - it has no idea. Show it a document it already processed - it processes it again. Tell it Ivan moved to a new company - it still thinks Ivan works at the old one.

This happens because agents have no persistent memory. When the conversation ends, everything is gone.

The usual fix is to throw a vector database at the problem. Store text, embed it, search by similarity. That helps - but it's not enough. You still can't ask "what did the agent think in March?" or "where did this belief come from?" or "show me everything the agent knows about Ivan." A vector search finds similar text. It doesn't understand time, relationships, or importance.

Engram is memory done properly.


What Engram does

Engram gives your agent a persistent memory that works like a file - one .engram file on disk, no server required. You pip install it and start using it in two lines:

from engram import Engram

with Engram(path="./agent.engram") as mem:
    # Remember something
    mem.observe("Ivan moved from Acme to Globex last week", actors=["Ivan"])

    # Recall it later - even in a completely different session
    for r in mem.recall("where does Ivan work?", k=3):
        print(f"[{r.score:.2f}] {r.episode.content}")

No server to start. No API key for the store. No Docker. No configuration file.

Here is what Engram gives you that a plain vector database does not:

Remembers raw events - every observation is stored with who was involved, what tags apply, and how important it felt at the time. Search finds the right memories even when the query is phrased differently.

Understands facts - a background process (no LLM needed at write time) reads your observations and extracts structured knowledge: Ivan works at Globex, Alice is the CTO. These facts can be queried directly, updated when things change, and traced back to their source.

Knows what happened when - if Ivan changes jobs, the old fact is not deleted. It is closed with an end date. You can ask what the agent believed in March even if the truth has changed since.

Forgets wisely - memories that haven't been accessed in a while gradually become less important. Memories that matter (accessed often, emotionally significant) stay sharp. The agent doesn't accumulate noise forever.

Explains itself - for any fact, you can ask where it came from: which observation triggered it, which LLM run extracted it, with what confidence.

Works with multiple agents - several agents can share a single .engram file. Each has its own private observations; extracted facts and the relationship graph are shared between them.

Engram architecture: an agent observes and recalls against one SQLite file holding episodic, semantic and procedural memory with bitemporal facts, spreading activation and decay, exposed over MCP on stdio

The same service as its room on it-rat.com draws it, where the diagram sits next to a simulation you can scrub back and forth.


Where this fits in the stack

Engram is the memory plane of the TAIPANBOX agent-governance stack: it gives agents persistent, provenance-tracked memory, and its own reflection can route through TokenFuse.

flowchart TB
  Agent["AI agent (any framework)"] -->|"LLM call (base-URL swap)"| TF["TokenFuse proxy: spend + enforcement"]
  TF -->|"POST /v1/decide (PEP)"| WX["Wardryx: policy PDP"]
  WX -.->|"allow / deny / hold"| TF
  TF -->|"cheapest model, budget OK"| LLM[("LLM provider")]
  TF -->|"CallRecords"| CL["TokenFuse Cloud: control plane, incidents, replay, evidence, kill-switch"]
  VCX["Vouchryx: delegation proved, and endable"] -->|"short-lived token: act + cnf"| TF
  TF -.->|"polls /v1/revocations"| VCX
  VCX ==>|"delegation_issued / denied / revoked"| BUS
  TF ==>|"agent-event NDJSON"| BUS{{"agent-event bus + Agent Passport"}}
  WX ==> BUS
  Agent -->|"web fetch"| SCX["Scopyx: governed web egress"]
  SCX -->|"POST /v1/decide"| WX
  SCX ==>|"web_fetch / web_blocked"| BUS
  ENG["Engram: memory"] -->|"reflect via base_url"| TF
  ENG ==> BUS
  BUS ==> IDX["Idryx: identity graph, detectors, Agent-BOM"]
  IDX ==>|"identity_finding"| BUS
  BUS ==> QX["Qryx: crypto / PQC, passport + hash-chain scan"]
  QX ==>|"crypto events"| BUS
  BUS ==> VX["Verdryx: quality / drift"]
  VX ==>|"quality events"| BUS
  TF -->|"outcome-tagged traces"| VX
  MX["Mockryx: pre-prod safety rehearsal"] -->|"hostile scenarios"| TF
  MX ==>|"sim events"| BUS
  BILL[("cloud, SaaS and model bills")] --> CC["CostCrew: the bill, worked by a crew of agents"]
  CC ==>|"spend_spike / budget_threshold / crew moves"| BUS
  BUS ==> TRX["Trailryx: the record plane, sealed and packed"]
  BUS ==> HX["reads the log, mails you (heraldyx)"]
  HX -->|"one mail, a view and never an action"| OPS["your mailbox"]
  HX ==>|"alert_sent"| HJ[("heraldyx's own hash-chained journal, not this bus")]
  YOU(["you, in a browser over your own tunnel"]) --> GX[["Genaryx: the console over all of it"]]
  GX -->|"signed commands: the kill, an approval, a policy"| CL
  GX -->|"signed commands"| WX
  GX ==>|"console_command"| BUS
  GX -.->|"reads it"| IDX
  GX -.->|"reads it"| QX
  GX -.->|"reads it"| VX
  GX -.->|"reads it"| MX
  GX -.->|"reads it"| ENG
  GX -.->|"reads it"| SCX
  GX -.->|"reads it"| CC
  TFP["terraform-provider-taipan"] -->|"budgets + passports as code"| CL
  ASG[["agent-stack-go: shared Go contract"]] -.->|imported by| IDX
  ASG -.->|imported by| WX
  ASG -.->|imported by| MX
  ASG -.->|imported by| TFP
  ASG -.->|imported by| HX
  ASG -.->|imported by| QX
  SPEC[["agent-passport: the spec"]] -.->|governs| BUS
  • Consumes: agent observations (observe()).
  • Produces: source: engram events and why() provenance, opt-in via the Agent Passport agent-event envelope, schema taipanbox.dev/agent-event/v0.2.
  • Talks to: TokenFuse (reflection's LLM adapter can point base_url at TokenFuse); governed by the agent-passport agent:// scope.

The full stack is TokenFuse (spend), Wardryx (policy), Vouchryx (delegation), Engram (memory), Idryx (access), Qryx (crypto), Verdryx (quality), Mockryx (pre-prod), scopyx (governed web egress), CostCrew (the bill), Trailryx (the record) and heraldyx (the mail out), on the shared Agent Passport + agent-event contract (agent-stack-go / agent-passport), configured via terraform-provider-taipan and driven from Genaryx, the console over all of it.

Run the whole open stack locally with one command via stack-up; the stack's home on the web is it-rat.com.

Live infrastructure validation

Before any public launch, Engram's Anthropic adapter was run against a real Claude model on real Linux infrastructure: three independent runs, zero bugs, zero contradictions, every extracted fact carrying full why() provenance back to the observations it came from.

Engram reflection pipeline: 8 episodes in, 17 semantic facts out, 0 contradictions, full why() provenance on one belief

Full write-up and all numbers: VALIDATION.md.

Running it on a Kubernetes cluster

The whole stack was deployed as a five-node k3s cluster on Hetzner, AWS and GCP between 25 and 27 July 2026 (six clusters, all destroyed afterwards). The manifests, the traps and the evidence are public in stack-k8s. Engram is deliberately not a pod. The console speaks to engram-mcp over stdio, and a sidecar container cannot be another container's stdin, so the binary has to live inside the console image rather than beside it. That is why images/console.Dockerfile is a four-language build. Getting this wrong produces a cluster where the memory tab is permanently empty while every pod reports healthy. The store itself takes an ordinary ReadWriteOnce volume; single-file memory is an asset here, because there is nothing to cluster.

To be clear about scope: those runs verified the deployment shape and the service coming up correctly on three clouds. They did not exercise memory under load: the memory plane was deliberately left unseeded on those clusters, so there are no recall or reflection numbers from them, and none are claimed. The numbers in this file remain the ones to read.


What is Engram, technically?

The three memory kinds: episodic observations with vector and BM25 recall, bitemporal semantic facts, and the entity relationship graph

Engram is a cognitive memory layer for AI agents - a single local file (agent.engram) built on SQLite. It models three kinds of memory that mirror how human memory works:

Episodic memory - raw observations stored as they happen, with actors, tags, salience, and emotional weight. No LLM required at write time; a write takes a median of 8 ms on an Apple Silicon Mac (engram-bench latency, 200 writes, 2026-10-13).

Semantic memory - structured knowledge extracted from episodes via a background reflection loop: (subject, predicate, object) triples with full bitemporal validity. Every fact tracks when it was true in reality and when the system learned it - independently on two timelines. When Ivan switches jobs, the old fact is closed with valid_to, not deleted. You can query what the agent believed in March even if the truth has since changed.

Dynamic importance - each memory carries a living importance score based on the Ebbinghaus forgetting curve, reinforced by retrieval frequency and emotional weight. Memories below threshold decay and are pruned automatically during reflection. The agent forgets what doesn't matter; critical memories survive.

What you can actually do with it

  • Debug beliefs: when the agent says "Ivan works at Globex," call mem.why(fact_id) to see exactly which episode produced that belief, which reflection run extracted it, which model, and with what confidence.
  • Erase a person: forget_entity("Ivan") permanently removes all episodes, facts, and graph edges connected to Ivan - a proper GDPR right-to-be-forgotten.
  • Query the past: mem.recall("Ivan employer", as_of=datetime(2024, 3, 1)) returns what the agent knew at that exact point in time, not what it knows now.
  • Run multiple agents: a planner and a coder can share one file - each sees its own episodes, both benefit from shared extracted facts.
  • Plug into any MCP client: run engram-mcp --db ./agent.engram and Claude Desktop, Claude Code, or Cursor can remember, recall, why, and forget against the same store with zero integration code - see MCP Server in the API reference.

What the memory actually holds

A vector store answers one question: what text looks like this text. Engram answers the questions an agent asks after that one.

Capability What it is here
Hybrid recall BM25 over FTS5 and cosine over sqlite-vec, blended, so an exact term and a paraphrase both find the episode. The blend was swept rather than guessed
Bitemporal facts Every fact carries when it was true and when it was recorded, so as_of answers what was believed in March, not only what is believed now
Spreading activation Recall walks Hebbian-weighted edges out from what matched, so a query reaches what the match is connected to and not only what it resembles
Importance and decay An Ebbinghaus curve with Hebbian reinforcement: what is used stays sharp, what is untouched fades, and reflection prunes the bottom. The store stays useful instead of growing
Working memory A 7±2 scratchpad, Miller's number, for what the agent is holding right now as opposed to what it knows
Provenance Every observation records where it came from (user, tool or external) and whether it was written after its writer read untrusted content (quarantined), and recall returns both. Over MCP the server sets them, not the caller. why() answers where a belief came from, episode by episode, so a wrong answer can be traced to what produced it
Contradiction Reflection finds facts that disagree and records the disagreement rather than overwriting one with the other
Erasure forget() at episode, entity or fact level, and compress() burns the raw text on a schedule while the extracted facts stay, so a person can be removed without the history losing its shape
Many agents, one file agent_id is a partition key: each agent keeps its own episodes, shares the facts it chooses to, deletes only its own, and a scoped recall stays flat as the store grows

Everything above is one file. pip install, open it in two lines, no server, no Docker, no API key for the store itself, and no LLM call on the write path: writes land immediately and reflection runs later, in the background, when you ask for it.

It speaks MCP natively, so Claude Code, Claude Desktop or Cursor can remember, recall, why and forget against the same file with no integration code, and it plugs into LangChain and LlamaIndex where those are already in use.


How Engram works

Memory that doesn't forget the wrong things

Most tools either remember everything forever (noise accumulates) or forget everything when the session ends (nothing persists). Engram does neither.

Every memory gets an importance score. Memories you access often, or that carry emotional weight, stay sharp. Memories that sit untouched gradually fade. When the agent runs its background reflection pass, low-importance memories are pruned automatically. The result is a store that stays useful instead of bloating.

This is modelled on the Ebbinghaus forgetting curve - the same pattern that describes how humans forget - combined with Hebbian reinforcement from repeated retrieval.

Facts that know when they were true

When you just store text and search it, you lose track of time. "Ivan works at Acme" and "Ivan works at Globex" are just two strings - you don't know which is current, or what changed.

Engram extracts structured facts from your observations - triples like (Ivan, works_at, Globex) - and tracks two independent timelines for each:

  • When it was true in reality (valid_from / valid_to)
  • When the system learned it (recorded_at / superseded_at)

When Ivan changes jobs, the old fact is not deleted - it is closed with an end date. The new fact is added alongside it. You can query what the agent believed at any point in the past:

# What did the agent think about Ivan's employer in March?
mem.recall("Ivan employer", k=5, as_of=datetime(2024, 3, 1, tzinfo=UTC))

# Full fact history - every job Ivan ever had, with dates
mem.timeline("Ivan")

This two-timeline approach is standard in financial databases and audit systems, and Engram applies it to agent memory.

What a recall actually does

A recall runs two retrievers over one store: the query is embedded and searched by exact vec0 KNN with agent_id as a partition key and ts as a metadata column, and in parallel tokenised and searched by FTS5 BM25 with its terms joined by OR; each pool is min-max normalised and blended 0.5 cosine to 0.5 BM25 into the top k episodes

Two things in that picture are worth spelling out, because both were wrong until recently and neither is visible from the outside.

The filters live inside the scan. agent_id is a vec0 partition key and the timestamp is a metadata column, so "this agent's episodes" and "as of March" are conditions the index applies while it searches. They used to be applied afterwards, in a join, where a filter can only cut into a top-k that has already been chosen: in a shared store where one agent held most of the episodes, the other agent's recall(k=5) returned nothing at all rather than its own five nearest. It also means scoped recall no longer grows with the store. An agent holding five episodes pays for five, whether the shared file holds a thousand or a hundred thousand: 0.05 ms at a thousand episodes and 0.09 ms at a hundred thousand (scoped column of the scale table in the API reference).

The keyword side ORs its terms. FTS5 reads a space between words as an implicit AND, so joining a question's tokens with spaces demands that every one of them appear in a single episode. For "what was the name of the restaurant I mentioned when we talked about my anniversary dinner?" that is sixteen words; it matched nothing, and the blend quietly reduced to plain cosine. Hybrid mode was cosine under another name for any query longer than a few words. What exposed it was a benchmark run scoring both modes to three identical decimal places.

Where a memory came from

Added in 3.0.0. Version 2.4.1 does not have it.

Every observation records a source: user (typed by the person), tool (returned by a tool), or external (anything else, such as a web page or another agent's output). A write that names no source is external. Through the library, engram stores the value the writer declares and does not verify it. Rows written before this field existed read as unknown, never as user.

Through engram-mcp the caller does not get to say. The server is started as one agent and serves only that agent's memory, refusing a call that names another. It records the source itself (external unless its operator configures tool or user), and a caller may only lower it. Once a session has read untrusted content (a recalled memory that is not the user's own, a tool result it labels as such, or anything it says it read with read_untrusted=true), every later write is stored quarantined, and recall and why return the mark with the content. A fact is private to its writer unless shared at write time, and only its writer can delete it. See MCP Server.

mem.observe("Ivan moved from Acme to Globex", provenance="user")
for r in mem.recall("where does Ivan work"):
    print(r.episode.provenance, r.episode.content)

recall(), why(), the engram-mcp tools and the LangChain and LlamaIndex adapters all return the source and the quarantine mark with each result. A fact has no source of its own: why() reports the least trusted source among the episodes it was extracted from, and unknown wh

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#agents · #memory · #sqlite