DEV Community

Cover image for I Built an AI That Forgets on Purpose — and It Made It Smarter
Vinayak Sonthalia
Vinayak Sonthalia

Posted on • Originally published at vinayaksonthalia.Medium

I Built an AI That Forgets on Purpose — and It Made It Smarter

It's 3am, your site is down, and your AI confidently tells you to fix a server that was deleted a month ago. Here's why I spent a week building the delete key.

The AI That Forgets on Purpose

The night my own assistant lied to me

I was building an incident-triage assistant — the kind of thing an on-call engineer asks for help at 3am when the site is down. Feed it your team's runbooks, ask it what to check, get a calm answer back. It worked. I was pretty happy with it.

Then one evening, while testing, it told me to go fix a server we'd switched off a month earlier.

3am panic

Me: auth-service is slow, what do I check?
Assistant: Check the legacy-cache — flush and resize the cluster!

Confident. Detailed. Completely wrong. The legacy-cache didn't exist anymore. And here's the thing that stuck with me: the assistant hadn't malfunctioned. It did exactly what I built it to do — remember. It just remembered something it should have forgotten.

The bug wasn't a bug. It was the whole design.

Look at how everyone builds "AI memory" right now — they're all racing in one direction: remember more. More documents, longer history, bigger context.

It's genuinely useful — until you notice the quiet assumption holding it all together: every fact we remember stays true forever.

Facts do not do that.

The hoarder problem

Servers get retired. People change teams. Last year's clever fix becomes this year's outage. A bigger memory just hands you more stale facts, with no way to tell "still true" from "used to be true."

Think of your phone's contacts: if you only ever add numbers, eventually you call an old friend and a stranger picks up. The bug was never a number you forgot — it was a number you kept when you shouldn't have.

So I stopped asking "how much can it remember?" and started asking:

Can it stop remembering the things that have stopped being true?

I named the project Lethe, after the river of forgetting. (I'm not subtle.)

Watch it forget, live

I retire the legacy-cache — decommission it, gone — and ask the exact same question as before, word for word:

The hero flip — same question, one delete, different answer

Before: "Check the legacy-cache, flush and resize the cluster." (go fight the ghost)

After the delete, same question: "Check the session-store connection pool and its hit rate…"

The answer flips. And when I pushed it — "okay, then what IS the legacy-cache?" — it said:

"The legacy-cache is not documented in the runbooks."

Not "I remember more." Instead: "I stopped remembering the wrong thing" — and it admits it doesn't know rather than confidently inventing something. Which, for an AI, is basically emotional maturity.

How it works (the two-minute version)

Lethe is built on Cognee, an open-source memory engine. You feed it runbooks as plain English — no tags, no schema — and one cognify() call builds two stores at once: a knowledge graph (Kùzu) and a vector index (LanceDB).

The live knowledge graph

Ask a question → vector search finds what's relevant, the graph adds what's connected, and the model writes one runbook-style answer — every claim cited to its source.

And when a system dies? forget() — a real hard delete: raw files, graph nodes, edges, embeddings. Gone. With a printed receipt and a live re-query proving it.

There's a gentler layer too: a curation loop that scores memory health, reversibly down-weights aging runbooks, and queues true deletions for a human to approve. Nothing gets hard-deleted without a person saying yes.

The curation loop

Then I tried, on purpose, to prove myself wrong

Cognee advertises several superpowers beyond forgetting. Instead of listing them all as my features, I raced them against plain, boring RAG — same docs, same model, temperature zero:

The honest bake-off

Multi-hop? Tied at this scale. Learning from feedback? No clean win. Blast-radius? Tied. Only forget produced something RAG-with-the-same-stack fundamentally cannot do. So I cut the three ties as headline claims and built the whole product around the one provable win.

Then I measured forgetting itself — twice, with a blind judge from a different model family scoring every answer:

Forgetting, measured

(Fun confession: my first benchmark got thrown out — it graded whether the forgotten word was absent, which is circular. The blind-judge version grades correctness.)

The bug that almost killed the demo

For a while, the demo was haunted: the same question usually returned a full sentence — but sometimes it fired back a single word: "legacy-cache." Just the word.

The case of the one-word answer

I cleared the suspects one by one — the build (glitch happened on the same saved graph), my phrasing, retrieval (the assembled context was rich and correct every time). The culprit? A line buried in the tool's default prompt: "answer as briefly as possible." On a vague question, that collapses to the single most relevant word. The model wasn't broken — it was obeying its instructions a little too well.

One custom prompt later, three separate bugs disappeared at once. When an LLM writes your final answer, the instruction you hand it is the most powerful lever you have.

Go poke it yourself

Everyone's building memory that only grows. Lethe is the other half — memory that knows when to let go.

Thanks for reading. Now go delete something. 🌊


Built solo in one week by Vinayak Sonthalia (final-year B.Tech) for the WeMakeDevs × Cognee hackathon.

Top comments (0)