SkillByAIOpen interactive version →

Lesson 18 / 25

Memory and Context Length

How much history the model sees.

Window, summary, cost

LLM nodes in chatflows can include recent conversation history as memory, usually with a window size (last N messages). More history helps continuity but costs tokens and can distract the model with stale details. Use a modest window, keep durable facts in conversation variables, and for long conversations summarise older turns. Watch for history carrying sensitive data into every later prompt. Dify's node names, menus and options change between versions; check the current Dify documentation.

A meeting with minutes

Instead of replaying an entire two-hour recording before each decision, a team reads the minutes and the last few comments.

Tune the window by testing

Try a few window sizes on real conversations and compare quality and token use.

Quick check: What is a cost of a very large memory window?

  • More tokens per call and more chance of distraction by stale details
  • The model forgets everything
  • It disables retrieval
  • It removes the end node
Answer

More tokens per call and more chance of distraction by stale details — More context is not always better.