DEV Community

Swagger
Swagger

Posted on • Edited on

I built AI memory that forgets intelligently-here's what I learned

AI memory should forget. Here's how I built intelligent decay.

I've been frustrated with AI memory for a while.

Every conversation with Claude or ChatGPT starts completely blank.
You explain yourself again and again. Your name, your project, your
preferences — gone after every session.

When memory does exist, it's a flat list. No scoring. No decay.
No understanding of what matters more. Everything weighted equally. Forever.

So I asked Claude directly about its own memory limitations. It said:

"I don't have a scoring system for memories. I don't have a graph
or network of linked memories. The information exists as flat text
snippets, not a connected knowledge structure. I don't forget on
a schedule."

That answer became the spec for Engram.


The insight that changed everything

Human memory isn't a database. It's a narrative.

We remember things because they matter. We forget things because they don't.

Two dimensions that no shipped memory system uses today:

Irreplaceability

Can this memory be Googled? A definition of Python exists everywhere—low value, forget it fast. But "I'm building an AI memory system because I was frustrated with AI amnesia" exists nowhere else. Never forget it.

Connectivity

What breaks if we delete this memory? A memory that five other memories depend on is more dangerous to delete than an isolated one. This pushed the architecture toward a knowledge graph.

Combined, these create intelligent forgetting. Not random deletion. Not storing everything forever. Keeping what actually matters.


The scoring formula

score = 0.40 × irreplaceability

  • 0.30 × connectivity
  • 0.20 × recency
  • 0.10 × frequency

Memories below 0.20 get pruned. Archived memories never get pruned regardless of score.


Causal chains

Current AI memory stores what happened. I wanted to understand why.

"I was frustrated because AI kept forgetting everything, so I decided to build Engram" contains a causal chain:

"AI kept forgetting" → caused → "frustration" → caused → "decided to build Engram"

Two detection methods — explicit linguistic patterns and semantic flow detection. No labels. No annotation. Pure inference.

This is the closest current AI gets to narrative memory.


The benchmark results — updated

I built a personalization benchmark that tests what Engram is
actually designed for.

After adding memory consolidation—merging redundant memories
into stronger unified knowledge—the results changed significantly:

metric no memory flat memory engram

overall accuracy 0.40 1.00 1.00
personalization 0.29 1.00 1.00
causal understanding 0.50 1.00 1.00
noise rejection 1.00 1.00 1.00
memory retained 100% 100% 28%

Engram matches flat memory on every accuracy dimension
while retaining only 28% of memories.

Same intelligence. 72% less storage. 72% faster retrieval.

The intelligent forgetting is working exactly as designed.
Consolidation merges redundant memories into stronger unified
knowledge — so the system gets cleaner over time, not noisier.

I also ran against LoCoMo—the industry standard benchmark:

no memory baseline : 0.006
flat memory : 0.209
engram : 0.211 (+0.9%)

Forgetting quality on internal benchmarks: 0.94 out of 1.00.


Live dashboard: https://web-production-07b0a4.up.railway.app
Try the API directly from the browser — no curl needed.
Email cdeekshith1@gmail.com with subject "Engram Access"
I'll respond within 24 hours with your personal API key

The live API

Engram is live. Three endpoints—ingest, query, and decay. Any AI app gets persistent intelligent memory with three API calls.

curl -X POST https://web-production-07b0a4.up.railway.app/v1/ingest \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-key" \
  -d '{"user_id": "alice", "content": "I prefer Python and hate verbose code"}'
Enter fullscreen mode Exit fullscreen mode

Email cdeekshith1@gmail.com for API access.


What's next

Memory consolidation — merging related memories into stronger unified knowledge. Significance scoring — detecting moments of decision and emotion. Reconstructive retrieval — following causal chains to rebuild full context.

The foundation is solid. Now I need real users breaking it in ways I haven't thought of.

If you're building AI apps and want memory that actually forgets intelligently—try it. Break it. Tell me what's wrong.

GitHub: https://github.com/deekshith080/engram-public

Built this solo. Feedback welcome.

Top comments (0)