Chapter C · 3 of 4~8 min

Memory & conversation state

Chatbots don't magically remember forever — you manage **history, summaries, and context limits**.

Paths & resources for this lesson

1Try it yourself

Playground

Conversation memory vs context window

Chat history eats tokens. Summarize or trim old turns to stay in budget.

Context used: 3 / 5 slots

User: What's our refund policy?
Bot: Annual plans may qualify within 14 days…
User: What about monthly?

2Read & reflect

Recap

#What you just did

You filled the context suitcase and summarized older turns to make room.

Teach

#How it works

Options in production:

  1. Sliding window — keep last N messages
  2. Summary memory — compress old turns into a paragraph
  3. External memoryvector DB or database of user facts (with consent)

None of this is unlimited — it's engineering on top of token limits.

Use it

#When you'd use this

  • Multi-turn support bots
  • Personal assistants that should "remember" preferences
  • Debugging why the model "forgot" earlier instructions

Watch out

#Watch out

Summaries can drop nuance. Sensitive history needs retention policies and delete buttons.

3Spark check

Continue learning · glossary & guides
  1. Summarizing old turns… frees context space / increases token limit forever
  2. "Perfect memory" in chat usually means… engineered storage / magic brain