# What is agent memory, and how is it different from context?


URL: https://getunblocked.com/answers/agent-memory-vs-context/
Published: 2026-11-06T17:00:00Z
Updated: 2026-11-01T13:41:42Z
Author: Brandon Waselnuk
Categories: Context Engine, Engineering Insights

**Short answer:** Context is everything the model can see on this turn: the prompt, files, tool results and history in its context window. Agent memory is what survives after that window is gone: notes and facts stored outside the model that a later session can read back. Memory only helps when it is loaded into context, so memory is one source of context, not a replacement for it.

---
Context is what the model can see right now. Agent memory is what the agent can still get back after that view is wiped. **Context** is the text in the model's context window for one request: the system prompt, your message, open files, tool results and the conversation so far. **Agent memory** is information an agent stores outside the model, in files or a database, so a later session can read it again. The two meet at one point. Memory does nothing until something loads it into context, so memory is one of the sources that feed context, not a second kind of context.

## Context: what the model sees on this turn

Anthropic's docs describe the context window as "all the text a language model can reference when generating a response, including the response itself". They also call it "a 'working memory' for the model" ([Anthropic context window docs](https://platform.claude.com/docs/en/build-with-claude/context-windows)). Everything in the request counts: the system prompt, every message, tool results, and the tool definitions themselves.

Two facts about context matter for engineering teams. First, it is temporary. Claude Code's docs put it plainly: "Each Claude Code session begins with a fresh context window" ([Claude Code memory docs](https://code.claude.com/docs/en/memory)). Close the session and the agent forgets the bug you explained an hour ago. Second, bigger is not better. The same Anthropic page warns that "more context isn't automatically better". **Context rot** is Anthropic's name for the drop in accuracy and recall as the token count grows. So the job is choosing what goes in. Our [Claude Code context window guide](https://getunblocked.com/blog/claude-code-context-window/) shows how to check what is using it, and the [context engineering guide](https://getunblocked.com/blog/context-engineering-guide/) covers how teams decide what goes in.

## Agent memory: what survives the session

Memory exists because context does not last. Anthropic's memory tool "lets Claude store and retrieve information across conversations in a directory of memory files", which "persist between sessions" ([Anthropic memory tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool)). The agent writes what it learned and reads it back next time, "without keeping everything in the context window".

LangChain's docs split memory two ways ([LangChain memory concepts](https://docs.langchain.com/oss/python/concepts/memory)). By lifetime, short-term memory "tracks the ongoing conversation by maintaining message history within a session". Long-term memory "stores user-specific or application-level data across sessions". By content, they borrow three human categories:

- Semantic memory is "the retention of specific facts and concepts", such as "this repo uses pnpm".
- Episodic memory is "recalling past events or actions", such as "last time, the migration failed on the staging database".
- Procedural memory is "remembering the rules used to perform tasks", such as "always run the linter before committing".

Short-term memory is really just context that has not been cleared yet. When people say "agent memory", they almost always mean the long-term kind.

## Where the two meet: memory only counts once it is loaded

A memory store is like a notebook in a drawer. It helps only when someone opens it. Claude Code shows the mechanics. It keeps two memory systems: CLAUDE.md files that you write and auto memory notes that Claude writes. The docs say "both are loaded at the start of every conversation". For auto memory, only "the first 200 lines of MEMORY.md, or the first 25KB, whichever comes first" are loaded. The docs add that "content beyond that threshold is not loaded at session start" (Claude Code memory docs, linked above). The docs also say Claude treats memory "as context, not enforced configuration".

Anthropic's memory tool works the other way round. Instead of loading memory up front, "an agent records what it learns in memory files and reads them back on demand". Either way the rule is the same: a memory turns into context when it is read into the window, and it competes for space there with everything else. A memory system that loads the wrong notes adds to context rot instead of curing it. If your agent keeps ignoring what you wrote down, see [why agents ignore CLAUDE.md rules](https://getunblocked.com/answers/agents-ignore-claude-md-rules-how-to-make-context-stick/).

## What agent memory does not cover

Memory holds what one agent saw or one person told it. That leaves teams two gaps.

The first is scope. Claude Code's auto memory "is machine-local", and its files "are not shared across machines or cloud environments" (Claude Code memory docs). Your agent's notes never reach a teammate's agent or a CI agent.

The second is source. Memory is built from past sessions, so it cannot hold a decision the agent never saw: the Slack thread where the team dropped an approach, the PR review that changed an API, the incident that explains a retry limit. Early recall evidence is weak too. VibeMemBench, a September 2026 benchmark, paired four memory systems with coding agents on real repository tasks and found that "eleven of twelve solver and system pairings fail to exceed the matched memory-off baseline" ([arXiv 2609.23570](https://arxiv.org/abs/2609.23570), 2026). The test setup used 111 coding targets from 90 repositories, scored by executable tests. Injecting verified past experience directly did help, by 1.1 to 4.5 percentage points on four of five held-out agents, which the authors call a gap between the experience the history holds and what memory systems deliver. Our [comparison of memory tools for coding agents](https://getunblocked.com/blog/memory-mcp-servers-compared/) covers what each one stores.

That team knowledge is a context problem, not an agent memory problem. It is the team's institutional memory, and no agent's notes contain it. "Unblocked is the institutional memory you were never given access to," says Chris Hovanessian, Group Product Manager at Cloudbeds ([Cloudbeds customer story](https://getunblocked.com/customers/cloudbeds/)). Unblocked is a [context engine](https://getunblocked.com/blog/inside-the-unblocked-context-engine/) for this case. It reasons across code, PRs, issues, docs, Slack or Teams threads and incident channels, and returns a synthesized answer with citations to Claude Code, Cursor, Codex, VS Code and other MCP clients, enforcing each user's source-system permissions at query time.

## A quick test for telling them apart

Ask where the information came from and who can read it.

- If it was written by the agent or one user during past sessions, it is memory. Example: "Dana prefers small PRs".
- If it is in the request the model is answering right now, it is context. Example: the diff you just pasted.
- If it lives in your team's systems and the agent never saw it, it is neither yet. It becomes context only when something retrieves it for this request. Example: the design doc that explains why the cache expires after 30 minutes.

Most confusion between the two terms comes from that third case. Teams add a memory tool expecting it to know the codebase's history, then find it only remembers its own past chats.

## Read more

- [Memory for Coding Agents Compared: Mem0, Letta, Zep, Cognee, Context7, and Unblocked (2026)](https://getunblocked.com/blog/memory-mcp-servers-compared/)
- [Team Memory Hubs for AI Agents: What TencentDB-Agent-Memory Solves — and What It Misses](https://getunblocked.com/blog/team-memory-hubs-ai-agents/)

## Related answers

- [Is an LLM-maintained wiki in git a better fix than a context tool for engineering knowledge?](https://getunblocked.com/answers/llm-maintained-wiki-vs-context-tool/)
- [How do we drive adoption of an AI coding tool from a third of engineering to everyone?](https://getunblocked.com/answers/drive-ai-coding-tool-adoption-across-engineering/)
- [How do I make sure Claude actually calls the context MCP without every engineer editing their CLAUDE.md?](https://getunblocked.com/answers/make-claude-call-context-mcp-without-editing-claude-md/)
- [Atlassian Rovo MCP versus a dedicated context tool for Confluence, Jira and code?](https://getunblocked.com/answers/atlassian-rovo-mcp-vs-context-tool/)
