Short-Term Thread Memory
Carry the relevant slice of conversation context across turns within a session.
Problem
Replaying the entire conversation history on every turn becomes expensive quickly and pollutes the context with stale facts that no longer matter. On the other hand, throwing away history between turns breaks continuity: the agent forgets what it was just doing, the user has to re-state their goal, and tool results disappear before the agent has a chance to use them. The team needs a bounded, recent slice of state that survives turn-to-turn within a session and is bounded by something other than 'everything that has ever been said'.
Solution
Define a typed state object per thread (messages, current screen, active plan, agent step). Persist with a TTL (commonly 24h). Reload on the next turn; expire and reset on TTL.
When to use
- Multi-turn agent needs continuity across turns within a session.
- Replaying full conversation each turn is expensive or pollutes context.
- A typed state object with TTL can capture the relevant slice.
Open the full interactive page →
Diagram, neighbourhood map, code examples, related patterns and full provenance.