Short-Term Thread Memory
Persist a typed state object per session thread — current screen, active plan, recent tool calls — with a TTL so it survives across turns but expires when the session is done.
Intent & Description
🎯 Intent
Carry the relevant slice of conversation context across turns within a session.
📋 Context
A multi-turn agent needs continuity across recent turns — what screen the user is on, what the active plan looks like, what tools have been called and what they returned. But it doesn’t need this information forever; the current session uses it, the next conversation almost certainly won’t.
💡 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.
Real-world Use Case
- A multi-turn agent needs continuity across turns within a session.
- Replaying the full conversation history each turn is expensive or pollutes context.
- A typed state object with TTL can capture the relevant slice.
Source
📌 TL;DR
Persist a typed state object per thread with a TTL — session continuity across turns without full-history replay, and automatic cleanup when the session ends.
Advantages
- Session continuity without the cost of full-history replay.
- Bounded memory footprint per active user — the TTL cleans up automatically.
Disadvantages
- TTL boundaries surprise users when state vanishes mid-task — communicate TTL behavior clearly.
- Schema migrations are painful for live state — in-flight sessions may hold old schema versions.