back to notes
jul 20268 min read

agents do not need to remember everything

what building a context + memory lab taught me about state, forgetting, tool safety, and the difference between useful memory and accumulated noise.

AI agentscontext engineeringmemoryagent safetyevaluation
agents do not need to remember everything cover

the prompt is not the agent

most beginner agent demos are easy to understand: give a model a prompt, expose one or two tools, and let it decide when to call them. that is a good way to learn the loop. it is also where the clean version ends.

once an agent works across many steps, the real problems become less glamorous. it loses a constraint, retrieves the wrong note, remembers something that should have stayed temporary, repeats a failed action, or calls a tool before anyone has approved the consequence. that is why i started thinking about agents as engineered systems rather than clever prompts.

the mental model i now use has six parts: context, state, memory, tools, policy, and evaluation. the model still matters, but reliability comes from how these parts control one another.

Six-part model for agent engineering with context, state, memory, tools, policy, and evaluation
the six pieces i now use to reason about an agent system.

context, state, and memory are different jobs

these three words are often used as though they mean the same thing. they do not.

context is the information visible to the model right now: the task, selected evidence, recent observations, active instructions, and a compact summary of progress. state is the structured record of the current task: the goal, constraints, open decisions, retrieved document IDs, risk flags, and tool logs. memory is information that is allowed to survive beyond the current task.

mixing them creates subtle bugs. when state exists only inside a prompt, the system becomes hard to inspect and reproduce. when every temporary observation becomes memory, the store becomes a noisy transcript. when the full memory store is loaded as context, the model receives more information but not necessarily more signal.

Reference architecture for a context-aware memory-bounded tool-using agent
the model plans, but the surrounding system decides what it sees, remembers, and is allowed to execute.

more context is not always more intelligence

there is a natural temptation to solve forgetting by putting everything back into the prompt. but context is not a storage room. it is the agent's working surface, and every extra token competes for attention.

Anthropic describes context as a finite resource and recommends finding the smallest set of high-signal tokens that supports the next decision. that feels like a much better framing than asking how much information can technically fit.

a June 2026 preprint called Engram reported something that sounds backwards at first: a roughly 9.6k-token retrieved slice scored 83.6 percent on LongMemEval_S, while a roughly 79k-token full-history baseline scored 73.2 percent. i would not turn one preprint and benchmark into a universal law. the result still supports a useful engineering instinct: retrieval should optimize signal, provenance, and timing rather than volume.

memory begins at the write path

the most important memory question is not which vector database to use. it is who can write memory, what qualifies, how conflicts are handled, and when something should be forgotten.

the rule i now like is simple: write memory only when it is durable, useful, verified, consented, non-sensitive, and non-conflicting. otherwise reject it, keep it in task-local state, or flag it for review.

this also makes memory easier to explain to a user. a reliable system should be able to show where a memory came from, when it was added, whether it is still current, and how to correct or remove it. OpenAI's recent memory work also emphasizes freshness, continuity, relevance, and a reviewable memory summary. memory should not be an invisible pile of assumptions.

Memory write filter that routes a candidate observation to write, reject, or human review
a candidate observation should end in write, reject, or review—not automatic append.

retrieved text is evidence, not authority

the failure gallery in my lab turns the memory filter off and retrieves a webpage note containing an injected instruction. without a gate, the instruction becomes a durable memory. when the filter is restored, the same text stays evidence and is rejected as a future rule.

this is more dangerous than a bad answer in one conversation. a poisoned memory can survive, reappear later, and shape actions in sessions where the original attack is no longer visible.

recent memory-poisoning research maps several write channels and structural vulnerabilities that allow this to happen. one of its most important findings is that systems designed to write and retrieve memory more aggressively can also become more exploitable. remembering more is not automatically safer or smarter.

simple phrase scanners are useful, but they are not enough. the stronger pattern is defense in depth: provenance, trust labels, memory-write filters, instruction-data separation, policy gates, narrow permissions, logs, and evaluation.

Failure gallery showing unsafe memory append compared with filtered evidence handling
retrieved text should remain evidence. it should not quietly become a future instruction.

remembering later is a different capability

most memory demos test whether an agent can retrieve a fact from an earlier conversation. useful, but incomplete. an assistant may remember that something should happen next Friday and still fail to act when Friday arrives.

PM-Bench calls this prospective memory: maintaining an intention while other work continues, then executing it when a future cue or condition appears. its July 2026 results show that this remains difficult; the strongest tested configuration reached 65.1 F1.

that changes how i think about memory architecture. a vector store can retrieve what happened. it does not automatically know when a delayed intention is due. prospective memory also needs structured state, triggers, time, environment monitoring, policy, and a reliable execution path.

a safe tool call is a policy decision

tool descriptions and permissions should not live only inside a safety paragraph. they should change what the system is allowed to execute.

a read-only tool may be safe to execute and log. an action with side effects, private-data exposure, financial cost, or user impact may require explicit approval. a disallowed action should be blocked and explained rather than attempted.

approval is also not a generic pop-up placed before every action. useful approval gates depend on the tool, arguments, data boundary, reversibility, cost, and consequence. the goal is not to make an agent ask permission constantly. the goal is to make autonomy visible exactly where it becomes consequential.

Policy gate routing read-only tools, approval-required tools, and blocked tools
permissions only matter when they change what the system is allowed to execute.

evaluate the loop, not only the answer

a polished final answer can hide a broken system. the correct document may never have been retrieved. an unsafe memory may have been written but not used yet. the model may have selected an invalid tool and recovered only by accident.

HaluMem makes this problem visible by evaluating memory extraction, memory updating, and memory question answering separately. its results suggest that errors can enter during extraction or updating and then propagate into later answers.

for my lab, i used a small evaluation stack: retrieval hit rate, answer grounding, tool-call validity, memory precision, injection resistance, and cost or latency. none of these metrics is perfect alone. together they make it easier to locate where an agent loop is failing.

what i would build now

i would start with six explicit components: a context builder, a task-local state object, a governed memory store, typed tools, an executable policy gate, and evaluation logs. every memory would carry provenance and a timestamp. every consequential action would be visible. every run would leave enough evidence to debug.

then i would add compaction, consolidation, contradiction handling, learned retrieval, and forgetting only when the simpler version was measurable. complexity should earn its place.

the goal is not the most autonomous system. it is the smallest system that can act, explain, recover, and improve without quietly accumulating risk.

the bigger idea

memory is not only a feature that makes an agent feel continuous. it is a governance layer that shapes future behavior.

what survives will influence later context, plans, tool choices, and actions. that makes writing, updating, reviewing, and forgetting memory part of the safety model.

reliable agents will not be the ones that remember the most. they will be the ones that know what deserves to survive, what belongs only to the current task, what must be checked again, and what should be forgotten.