Skip to content
Context engineering

05.03 · Concept

Memory that is not a vector database

Choose between a scratchpad, a file, a database and embeddings for agent memory.

Agent memory should be chosen by the later access pattern: scratchpad for temporary reasoning state, files for durable artefacts, databases for structured source-of-truth records, and embeddings for fuzzy recall over unstructured text. A vector database is useful only when semantic similarity is the operation you actually need.

What this lesson answers

  • when should agent memory use a database
  • agent scratchpad versus vector database memory
  • how to choose storage for agent memory

Notes

Agent memory is any state an agent can use across steps or across runs. A vector database is only one kind of memory: it helps find text that is semantically similar to a query. Many agent memory problems are not similarity search problems. If the agent needs to remember the current plan, use a scratchpad. If it needs to persist an artifact, use a file. If it needs reliable structured facts, use a database. If it needs fuzzy recall over unstructured text, use embeddings and retrieval.

A useful mental model is to ask what operation the agent must perform later.

Common questions

Is a vector database the default choice for agent memory?
No. A vector database is appropriate when the agent needs to retrieve semantically related text without exact keys or a clean schema. It is a poor substitute for state that needs identity, ordering, permissions, freshness, constraints or reliable updates. Many memory needs are better handled by simpler stores.
When should an agent use a scratchpad?
Use a scratchpad for temporary working state during a task: current plan, partial findings, tool outputs, assumptions, hypotheses and next actions. It is for helping the agent continue its reasoning, not for long-term records or authoritative facts that must survive as system state.
What belongs in a database rather than embeddings?
Put structured facts in a database when they have identity, constraints, permissions or updates: users, orders, tickets, preferences, audit events and similar records. If the agent must answer from the current authorised value, exact lookup and transactional semantics matter more than semantic similarity.