ai newsMo., 2. Nov.
EilmeldungOpenAI’s Lehane likens backing a data centre ban to the 2002 Iraq vote

Your AI Has Amnesia - And It's Not an Accident

You told it your name. You explained your project. You even said "don't use bullet points." And then you closed the tab. Next day - blank slate. Total stranger. Sound familiar? The Goldfish Problem Every AI assistant you've ever used has the memory of a goldfish - and not even a real goldfish, beca

dev.toMontag 12:29 · 02.11.6 Min. Lesezeit
Bild: dev.to

You told it your name. You explained your project. You even said "don't use bullet points." And then you closed the tab.

Every AI assistant you've ever used has the memory of a goldfish - and not even a real goldfish, because those actually remember things for months. Every new conversation starts from absolute zero. No context, no history, no "hey, good to see you again."

This isn't a bug. It's how these systems were built.

Large Language Models - the engines behind ChatGPT, Claude, Gemini - are stateless by design. They process what's in front of them and produce a response. When the conversation ends, nothing is stored. It's like talking to someone who gets a memory wipe the moment you hang up the phone.

The current workaround? Just shove everything into the conversation.

Paste in your previous chat. Re-explain your project. Add a giant system prompt that says "Here's everything you need to know about me..." before every session.

So the band-aid has limits. And as AI gets used for more serious, long-running tasks - managing your work, running automated agents, acting as a personal assistant - those limits start to really hurt.

Here's where it gets interesting - and where the engineering gets hard.

Real memory for AI isn't just "save the chat log and reload it next time." That's like solving a cluttered desk by buying a bigger desk. What you actually need is a dedicated memory service - a persistent layer that sits alongside your AI agent and handles the messy work of remembering things correctly.

And "correctly" turns out to be the hard part.

When an agent processes a batch of messages, the order they arrive in is the order the conversation makes sense. Mix that up and the agent reconstructs a completely different history.

Here's a concrete example. Say an agent is helping a developer debug a production issue. The conversation goes:

If the memory service returns those entries out of order - say, 3 before 2 - the agent now thinks the errors stopped before the rollback. It will draw the wrong conclusion. The model didn't hallucinate. The infrastructure fed it the wrong sequence.

This means the write path, the storage layer, and the retrieval API all need to agree on order - and preserve it through retries, reconnects, and concurrent writes. It's one of those problems that seems obvious until you're debugging it at midnight.

Here's a scenario: your app sends a message to the memory service. The network hiccups. Did the write go through or not? You retry - and now you might have two copies of the same message.

This is the idempotency problem, and it's one of the classic headaches of distributed systems.

A well-designed memory service needs to recognise "I've seen this exact request before" and return the original result instead of creating a duplicate. The client sends a stable identifier with each write - a key that uniquely represents that logical operation. If the server has already processed it, it returns the existing result. No duplicate. Safe to retry as many times as needed.

The tricky part? Every database handles this differently:

Same API contract on the outside. Three completely different implementations underneath. And you have to test all three to be sure they behave identically from the caller's perspective.

Imagine searching your conversation history and getting results back page by page. Page 1 looks right. But follow all the pages to the end and you've either missed some records or seen some twice.

Pagination bugs are sneaky. They look fine in isolation. The first page passes every test. But a client that walks through pages 1, 2, 3... to the end - like an agent replaying its full history - can silently skip messages or see duplicates.

The fix is cursor-based pagination - instead of "give me page 3", you say "give me everything after this specific record". The cursor encodes a stable position in the result set, so even if new records are added mid-traversal, you don't lose your place.

This matters even more for forked conversations and filtered queries, where the visible result set is a subset of the underlying stored entries. A correct first page does not prove correct pagination. You have to walk the whole thing.

Here's one of the genuinely interesting ideas in this space.

Right now, a conversation is a straight line - message, response, message, response. If you want to try a different approach mid-conversation, you start over from scratch.

But what if you could fork a conversation, like branching a git repository?

Imagine using an AI agent to draft a technical design. Halfway through, you think "what if we approached this completely differently?" Instead of starting over, you fork the conversation at that exact point - keep the original on one branch, explore the new direction on another, and compare outcomes side by side.

This is real, and building it correctly is non-trivial. A flat list of messages doesn't cut it anymore - you need to store conversations as a tree, where every entry knows its parent and its branch. Retrieval has to be branch-aware. Replay has to reconstruct the right lineage. And pagination has to work correctly within a branch, not just across the whole flat history.

It's a small API feature with a surprising amount of infrastructure behind it.

One more underappreciated problem: AI responses take time. Sometimes a lot of time.

If your connection drops halfway through a long agent response, what happens? In most systems today - you lose it. Start again.

A proper memory service keeps the stream alive on the server side. As the response arrives, it gets checkpointed - written to durable storage in chunks. When the client reconnects, it sends the ID of the last chunk it received, and the server picks up from there. The response continues from where it left off, not from the beginning.

For short chat responses this feels like a nice-to-have. For long-running agent tasks - a multi-step code review, a research synthesis, an automated deployment plan - it's the difference between a reliable system and one that randomly loses work.

Pull back from the individual problems and a pattern emerges. All of these - ordering, idempotency, pagination, forking, resumable streams - are classic distributed systems problems. They're not new. Engineers have been solving them in databases, message queues, and storage systems for decades.

What's new is that they now apply to AI agent memory, where the stakes are different. A missed message isn't just a missing row - it's a broken chain of reasoning. A duplicate entry isn't just extra data - it's a false memory. A dropped stream isn't just an inconvenience - it's a lost work session.

A few principles that hold across all of these:

We're at an interesting moment where the model capabilities have raced ahead, but the infrastructure to make those models reliable in real-world, long-running, multi-session applications is still being built out.

The shift to persistent, intelligent memory is what takes AI from "impressive demo" to "genuinely useful in real work." It's the difference between an AI that answers questions and one that actually knows you - your context, your preferences, your history - and builds on it over time.

We're not fully there yet. But the engineering is happening right now, and it's more interesting than most people realise.

Next time you find yourself re-typing "as I mentioned before..." to your AI - you'll know exactly what's missing, and why building it properly is harder than it looks.

Quelle: dev.to (dev.to). Original öffnen