Back to writing
·4 min read

How I Gave My AI a Memory

Every AI session starts from scratch. I built a system that fixes that: a vector database, multi-machine sync, and a core memory injected before the session even starts.

Every AI conversation starts from scratch. You explain your context. You correct the same mistakes you corrected last week. Then you close the tab and it all vanishes.

I lived with this for months. The AI I work with is capable. It writes good code, catches mistakes, proposes architecture. But every session, it wakes up with amnesia.

Then I read an article by Zak El Fassi titled "How Do You Want to Remember?" He showed that structuring how an AI's knowledge is organized boosted recall from 60% to 93%. No model upgrade. Just better architecture.

So I audited my own setup, using a structured process I keep for bigger questions. The results were brutal.

The audit

Nine of ten explorations had no persistent knowledge files. The session log was 6,800 lines and nobody read it. I had 22 files documenting corrections I'd given the AI. Eleven had never been loaded into a session.

The worst finding. When we made a decision, the reasoning behind it survived only 40% of the time. We'd know "we chose two-stage retrieval" but not why we rejected pure vector search. Losing the why means losing the ability to learn from your own decisions.

Asking the patient

I asked the AI something I'd never asked before: "What would you change about how you remember our conversations if you could?"

The answer was specific. Decisions linked to evidence, with sources. Memory compressed by topic rather than by date. Confidence scores, so it knows what it doesn't know. My 22 corrections loaded before anything else. A synthesized briefing at session start instead of a raw log. And a mistakes index, because errors are the fastest path to improvement.

That last one mattered most to me. I needed AI that was terrified of being wrong.

I decided to take the answer seriously and build all six.

The architecture

I named the project Anamnesis. Greek for "recollection." The knowledge already existed across hundreds of documents. The problem was retrieval.

The search layer. SQLite with full-text search. Every document gets chunked and indexed. "Why did we choose this database?" returns relevant chunks in under 100 milliseconds.

The embedding layer. Full-text search finds exact words. But "deployment configuration" and "server setup" mean similar things without sharing any. So each chunk also becomes a vector, and the search runs in two stages: exact match first, semantic re-ranking second.

The indexer. A Python script walks every markdown file, decision log, and feedback file. First build: 639 sources, 14,613 chunks. Rebuilds in about 90 seconds.

The core memory injection. This is the piece that changed daily life. At session start, before I say anything, a hook injects the AI's identity, active explorations, recent decisions, a failure atlas, and every correction I've given. Passive memory can search if it knows to look. Active memory already knows what matters before the conversation begins.

The database syncs across the three machines I work on every 15 minutes, with a failover chain if the primary goes quiet. A secured server tunnel makes the same memory reachable from cloud sessions. It travels with me.

The result

Before, every session started with 5 to 10 minutes of context rebuilding. Now the AI arrives already knowing what we did last weekend, and the corrections load before anything else. The decision reasoning that used to survive about 40% of the time now persists by default. And it's fast: a typical query comes back in well under 100 milliseconds, so the memory is there before I notice I need it.

Zak's insight held. The biggest improvement came from structuring knowledge, not from upgrading models. The models keep getting better anyway. The architecture around them matters just as much.

If you re-explain context to an AI every session, the problem probably isn't the model. The knowledge exists. Retrieval is the missing piece.


Anamnesis isn't perfect. But arriving with context beats waking up with amnesia, every single time. And the compound effect means it gets better every week.