Short-Term Working Memory
Hold the current task's context — the active turn, recent observations, scratch reasoning — in a bounded window that is cheap to read and replace.
This page is the complete instruction page for one pattern called "Short-Term Working Memory." It explains the problem this pattern solves, the idea behind the solution, when you should (and should not) use it, and what happens afterward — both the good effects and the costs.
This matters because building AI agents is not just about making them clever. It is also about making them safe and predictable. Following a well-tested pattern like this one helps avoid common mistakes, and shows you exactly which safety rules and regulations it connects to, listed under "Standards Mesh" on this page.
Context
Everything an agent does within a single task benefits from shared scratch space. The model's context window is one implementation; an explicit working-memory abstraction is cleaner and easier to govern.
Problem
Stuffing everything into the model context conflates ephemeral scratch with durable knowledge, and inflates every call.
Forces
- Context window cost vs information availability
- Ephemerality vs reconstructability
Solution
Maintain a typed working-memory store scoped to the current task. Populate with the immediate goal, recent turns, and active plan. Summarise or evict on overflow. Do not persist beyond task boundary.
Applicability
- All multi-turn agents
- Any agent with more than a single tool call per task
Anti-Patterns
- Working memory spilled to long-term store by default
- Unbounded context accretion
Consequences
- +Predictable per-call cost
- +Clear lifecycle boundary
- −Requires summarisation strategy on overflow