Why Your Chatbot Forgets, and the Three Layers That Fix It

Leader 1 4 33
calendar_today agoschedule2 min read

Most agent posts here focus on tools and prompts, so this one takes the layer underneath: what actually happens to conversation state between turns. It is the part that decides whether your bot feels like a colleague or a stranger every Monday morning.

The Stateless Default

Every mainstream LLM API is stateless. You send the full conversation, the model answers, and then it forgets. So "memory" in most chatbots is just an ever growing message list resent on every request, and that breaks in three predictable ways.

Context windows overflow. Fifty turns can pass 30,000 tokens before you count the system prompt, tool definitions and retrieved documents. Once you exceed the limit something gets truncated, usually the oldest messages, which is exactly where the user explained their problem.

Cost scales badly, because turn N pays to reprocess turns 1 through N-1 all over again.

And nothing survives the session. Close the tab, come back tomorrow, start from zero.

Three Layers, Not One Store

Working context is the current task: the last few turns verbatim plus whatever the model needs right now. Short lived, high fidelity.

Episodic memory is what happened: summaries of past sessions with timestamps. Compressed, retrieved by relevance.

Semantic memory is what is true about the user: preferences, entities, account facts. Small, structured, updated in place rather than appended.

Most implementations collapse all three into one vector store, then wonder why retrieval returns a two month old aside instead of the preference the user stated last week.

Retention Is A Policy Decision

The write path is the easy half. The hard calls are what gets summarized versus kept verbatim, what expires and when, and what happens when a new fact contradicts an old one. Write those rules down before you pick a database, because they shape the schema more than the database does.

A practical default: summarize any session older than the current one, keep entities and preferences as structured rows you update in place, and give every stored fact a source and a timestamp so you can expire it later without guessing.

The longer version of this, including dialogue management patterns, summarization strategies and the framework landscape, is in our guide to conversational AI and chatbot memory.

What does your retention policy look like, or is it all still one big embeddings table?

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Your AI Doesn't Just Write Tests. It Runs Them Too.

Kevin Martinez - May 12

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

Beyond the Crisis: Why Engineering Your Personal Health Baseline Matters

Huifer - Jan 24

MCP Is the USB-C of AI. So Why Are You Plugging Everything In?

Ken W. Algerverified - Jun 10
chevron_left
2k Points38 Badges
United Statest.co/5LlztlB5C5
31Posts
10Comments
14Connections
Our AI Apps are a self expanding AI SaaS ecosystem used to create the custom web application of your... Show more

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!