
People massively overcomplicate agent memory. The reality is that most agents don’t need complex memory at all, and the ones that do usually only need one of two simple forms.
Two Types of Memory
1. Short-Term Memory (Conversation)
What has been said so far in the current session. This is the message history — the running log of user inputs and agent responses that the LLM reasons over.
You already get this by default. Most SDKs handle it automatically. Just don’t reset the messages between turns.
2. Long-Term Memory (External Knowledge)
Information the agent can look up — your notes, PDFs, documents, databases, prior session records. This is what people usually mean when they say “RAG” (Retrieval-Augmented Generation).
You have to build this. It requires either file search tools or a vector database.
Do You Actually Need Memory?
Ask these questions before adding any memory:
| Question | If yes → |
|---|---|
| Does the agent need to remember things across messages in the same session? | Short-term (already built in) |
| Does it need to use external documents or knowledge? | Long-term (file search or RAG) |
| Neither? | You probably don’t need memory |
The Three Options
Option A: No memory (start here)
Works for 70%+ of use cases. The agent reasons over the current conversation only. Simple, cheap, reliable.
Option B: Conversation memory
Already handled in most SDKs — just don’t reset messages. The full conversation history becomes the agent’s working memory.
Option C: File-based memory (easy RAG)
Upload documents. Attach a file search tool. The agent retrieves relevant chunks when needed. This is the right starting point for long-term memory — not vector databases.
Structured Note-Taking (Agentic Memory)
A third pattern, surfaced by Anthropic’s context-engineering guide and visible in production agents like Pi (Coding Agent) and Claude Code: the agent writes its own notes to disk during work and reads them back across context resets.
This is not RAG. It’s not a vector database. It’s the agent maintaining a NOTES.md, TODO.md, or PLAN.md as it works, with full read/write access. Two properties make it powerful:
- Persistence is free — files survive context resets, sessions, even agent restarts
- State is observable — the user can read the file, edit it, version it (see Context Engineering on file-as-state)
The canonical illustration is Claude playing Pokémon: without any prompted memory schema, the agent develops maps of explored regions, level-up tallies (“for the last 1,234 steps I’ve been training Pikachu…”), and combat strategy notes. After context resets, it reads its own notes and resumes multi-hour training sequences. Long-horizon coherence becomes possible.
When to add it:
- Multi-hour or multi-session work where context will reset
- Iterative tasks with milestones (codebase migrations, research projects, game playthroughs)
- Anywhere you’d otherwise feel the need for compaction (see Context Window Management Strategies)
When not to add it: short single-session tasks. The cost of teaching the agent to maintain notes isn’t worth it for one-shot work.
Structured note-taking is the most underrated form of memory
It sits between conversation memory (free, ephemeral) and long-term retrieval (expensive, infrastructure-heavy). For long-horizon work, it’s often the right answer.
The canonical worked example is Long-Running Agents - Initializer + Coding Pattern: an initializer agent writes a claude-progress.txt, a JSON feature rubric, and a runnable init.sh; every subsequent coding-agent session reads them as the first acts of the new shift. The pattern is structured note-taking promoted from a habit to a harness contract.
What Not to Do (Until You Need It)
Don’t start with:
- Vector databases
- Embeddings pipelines
- Complex retrieval architectures
These are powerful but add significant complexity. The rule: if your agent works without them, don’t add them.
Only graduate to vector search when:
- Your document corpus is too large for simple file search
- You need semantic similarity (not just keyword matching)
- Retrieval quality is measurably impacting performance
See Also
- AI Agents - How They Work
- Building Your First AI Agent
- Making Your Agent Reliable
- Context Engineering — the broader discipline; structured note-taking as one of the three long-horizon techniques
- Context Window Management Strategies — file-as-state as a lossless alternative to compaction
- Personal Agent Operating Rules — a worked flat-markdown design: domain-split files plus an index, hot context with a 72-hour TTL, hypotheses that age out,
last_sync:headers on caches - Context Systems and Agent Factories — shared team memory: one governed store every agent reads and writes, with structure and permissions
- Knowledge Factory — maintaining shared procedural and domain memory with a background curator; context versus knowledge