Brain labTry it → read → next · ~8 min

Tutorials · Chapter C (3/4) · ~8 min

Memory & conversation state

Try it → see it → read → next

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

On paths: Student

Optional on: Everyday learner

Try 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?

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.