Reference · How-to · ~6 min

How to manage chat memory

Last updated

Keep long chats useful without blowing the context window — in about 6 minutes.

Keep long chats useful without blowing the context window — in about 6 minutes.

Steps

1. **Track usage** — Estimate tokens for system prompt + history + new user message.

2. **Trim oldest turns** — Drop early chit-chat before dropping recent facts.

3. **Summarize mid-chat** — Replace turns 1–N with a short bullet summary.

4. **Store facts externally** — User prefs in a DB; inject only what matters this session.

5. **Re-test** — Ask a question that depends on an old turn; confirm the bot still knows.

Copy-paste prompt

Summarize our conversation so far in ≤8 bullets.
Keep: names, decisions, open questions, policy facts.
Drop: greetings and repeated text.
Then continue answering my next message using that summary as memory.

Watch out

Summaries can **drop nuance**. Re-confirm numbers, dates, and names before irreversible actions.

**Try the lesson:** `conversation-memory` in Lane C