AI implementation
AI Agent Memory: What to Store, What to Forget, and What Can Go Wrong
Separate agent conversation history, durable task state, and reusable memory, with practical rules for provenance, expiration, access, and correction.
AI agent memory is information retained for use beyond the immediate model call. It can help a system continue a task or remember a confirmed preference, but it can also preserve mistakes and expose information to the wrong user.
Start by deciding which information needs to persist, who owns it, and when it stops being valid. Storing every conversation is not a complete memory design.
Separate three kinds of state
| Kind | Example | Appropriate source of truth |
|---|---|---|
| Working context | Evidence needed for the next decision | Current task context, with references |
| Durable execution state | An update was submitted but its outcome is unknown | Application or workflow storage |
| Reusable memory | A user confirmed a preferred report format | Scoped record with provenance and revision controls |
A conversation summary can help the model resume its reasoning. It should not be the sole record of whether a payment, shipment, or account update occurred. Verify consequential state against the application that owns the action.
The failure: a temporary exception becomes a permanent rule
Suppose a manager authorizes a one-time replacement outside the normal policy. An agent summarizes the conversation as “this customer qualifies for replacements after 30 days” and saves it for future use.
The next request retrieves that summary and treats it as policy. The memory has lost the exception's scope, source, and expiration.
Store the confirmed fact precisely: which request was approved, by whom, for what action, and under which conditions. Do not generalize an exception into a rule. Policy should come from the maintained policy source, not an inferred memory of a past conversation.
Define a memory record
For information worth retaining, record the subject, scope, source reference, creation time, verification status, and expiration or review condition. A preference such as “send reports in Portuguese” should be distinguishable from a model inference that the user might prefer Portuguese.
Store only information that has a clear purpose. Credentials and unrelated sensitive details should not become general-purpose agent memory. Enforce access during retrieval, including tenant and user boundaries where relevant.
Provide a way to correct or delete a memory. If the original information changes, derived summaries and search indexes may need invalidation too. Otherwise, a deleted source can continue influencing answers through a retained embedding or cached summary.
Retrieve by relevance and authority
A memory that is textually similar to the current question may be outdated or belong to another account. Retrieval should consider authorized scope, applicability, freshness, and whether the information was verified.
When a remembered fact conflicts with the current system of record, define which source wins and how the conflict is reported. For account status or transaction state, retrieve the current authorized record rather than trusting an old conversation.
Memory is one part of context engineering. It should supply useful evidence for the next step without silently turning historical text into new instructions.
Test forgetting as well as remembering
Create cases for a changed preference, an expired exception, a deleted record, two users with similar names, and a task resumed after interruption. Check whether corrections reach every retrieval path.
Also test summaries that must preserve uncertainty. “The CRM update timed out” must not become “the CRM was updated.” Verify durable task status before an agent retries or claims completion.
Measure whether memory improves accepted outcomes on the intended tasks. If the benefit is small and the information changes frequently, querying the source system may be simpler and safer to maintain.
Use agent evaluation for these cases and recovery patterns for action state. Discuss your agent architecture with Dream Hatch Labs before adding a memory store simply because a framework offers one.