Learn AI compute, then follow the market
← Back to Compute College

Compute College

Conversation history, state, and memory

Separate recent messages, durable facts, task state, and retrieved knowledge in a long-running AI workflow.

Plain-English definition

Conversation history is the sequence of recent messages. Task state records what a workflow has completed, what remains, and which decisions or tools are active. Durable memory stores facts or preferences that should survive a session. Retrieved knowledge comes from an external source for the current decision. Keeping these categories separate helps the application decide what to include, summarize, expire, or verify.

Memory trick: History is what was said. State is what is happening. Memory is what should persist. Retrieval is what is true enough for this decision.

Why it matters

Appending every message forever increases token cost and can preserve outdated or contradictory information. A memory system can also create privacy, access, and deletion obligations. Good state management makes a workflow shorter and more reliable by carrying forward the decisions that matter rather than the entire transcript.

  • Recent history preserves conversational references but becomes stale and expensive as it grows.
  • Task state supports resumption without requiring the model to reread completed work.
  • Durable memory needs source, scope, update, and deletion rules so it does not become untrusted context.

Simple example

A support assistant stores the current ticket ID and unresolved action as task state, keeps the last few user messages for conversational reference, retrieves the current account policy for each decision, and stores a user preference only after the product explicitly allows it. It does not copy every tool response into permanent memory.

  • Use task state for workflow facts and retrieval for authoritative changing facts.
  • Summarize history with decisions, sources, and unresolved questions—not just a shorter transcript.
  • Attach access scope and timestamps to durable memory.

Example figures are illustrative calculations, not current quoted market prices.

Current example

Agent context reference

Anthropic’s context-engineering guidance describes message history, tools, external data, and agent state as parts of the information environment. This lesson applies that distinction to memory design and the cost of carrying state across requests.

Anthropic: Effective context engineering for AI agents

Primary guidance on history, state, tools, external data, and maintaining useful context over time.

Source discipline: the reference explains the concept or method; it is not a substitute for measuring a production workload under its actual provider, model, and data conditions.

Common mistake

An append-only transcript is not reliable memory. It is not a verified database, and old user statements may no longer be true or authorized to reuse.

Practical takeaway

What you can do with this

For one workflow, draw four stores: recent history, task state, durable memory, and retrieved knowledge. Define who can write each store, how entries expire, how they are verified, and what enters the model context for each step.

  • Builders: keep workflow state structured and inspectable.
  • Product teams: give users visibility and control over durable memory.
  • Operators: monitor context growth, repeated work, stale memory, and deletion failures.

Decision check: can the system resume the task with the necessary state without replaying every prior message or trusting an unverified old fact?

Compute College track

Prompt & Context Engineering

Step 16 of 18: Conversation history state and memory