Skip to content
Back to Magazine
automation-aiops 6 min read

AI Agent Memory Stack: why agents degrade when mixing memory and context

Does this apply to your company?

Free 30-min AI diagnostic →

Key Takeaways

  • - Cost: retrieving irrelevant memory increases tokens, latency and rework.
  • - Risk: memory without permissions can leak data or reactivate untrusted instructions.
  • - Quality: memory without expiration turns old decisions into current criteria.
  • - similarity does not mean relevance

Decision

Separate reliable automation from fragile demo before granting it autonomy.

Room

Operations review, architecture, security or platform.

Risk

Adding speed with no observability, rollback, ownership or stop criterion.

Agent prompt: identify guardrails, control points, likely failures and autonomy criteria

Problem

Many agents don’t fail because the model is bad. They fail because they remember poorly.

They mix chat history, preferences, business data, instructions, old errors, partial results and approved decisions within the same context. At first it seems to work. Then drift appears: the agent starts retrieving irrelevant things, repeats expired criteria, confuses preferences with policies and treats a past failure as if it were a rule.

That is not memory. It’s accumulation.

An enterprise agent needs to distinguish what it is thinking now, what happened before, what it knows is true, how it should perform a task, what is pending, what it shares with other agents and what it must forget.

Thesis

Agent memory is not a feature. It is a state system.

The correct stack does not try to make the agent “remember more”. It tries to make it remember with semantics: each type of memory has its own source, expiration, permissions, retrieval method and update criteria.

When everything lives in a single context bag, the agent degrades. When each memory lives in its own layer, the system can audit, correct and scale.

Framework

An enterprise memory stack has seven layers.

LayerWhat it storesRisk if mixed
Working memoryWhat is needed for the current taskSaturate the window with noise
Episodic memoryWhat happened, when, and with what outcomeRepeat errors as if they were learning
Semantic memoryFacts, entities, relationships and stable stateTurn rumors or outputs into truth
Procedural memoryHow to do a task, workflow or skillExecute outdated procedures
Hierarchical memoryWhat is hot, warm, cold or archivedRetrieve too much or too little
Prospective memoryWhat must be remembered or executed laterForget follow‑ups, deadlines and commitments
Shared memoryWhat several agents must shareCreate incompatible versions of reality

The key difference is not technical. It is operational.

A CRM data point should not enter through the same door as a tone preference. A lesson learned from a failure should not have the same weight as an approved policy. A procedure used by sales should not be automatically updated because an agent improvised it once.

Good memory is not longer. It is more governable.

Why it matters now

Frameworks are already separating these layers. LangGraph distinguishes short‑term memory tied to the thread and long‑term memory via stores. OpenAI Agents SDK documents sessions to maintain history across runs and allows custom sessions with retention policies, encryption or metadata. Letta treats memory as an explicit part of the agent architecture, with editable memory and layers inspired by MemGPT.

Research is heading the same direction. MemGPT proposed an operating‑system‑inspired architecture to manage different memory levels beyond the context window. CoALA described agents with modular memory components, action space and decision processes.

Practical translation: memory is no longer “add a vector database”. It is a runtime piece, governance, security and operational design.

For the enterprise, this changes three things:

  • Cost: retrieving irrelevant memory increases tokens, latency and rework.
  • Risk: memory without permissions can leak data or reactivate untrusted instructions.
  • Quality: memory without expiration turns old decisions into current criteria.

Anti‑example

The typical anti‑example is building “memory” with an embeddings table over the entire history.

Each conversation, ticket, document, decision, error and preference is chunked, vectorized and retrieved by similarity. It looks sophisticated. In production it generates very concrete problems:

  • similarity does not mean relevance
  • recall does not mean authority
  • history does not mean truth
  • experience does not mean procedure
  • old data does not mean valid data

The agent does not need to retrieve the similar. It needs to retrieve what it has permission, validity, source and utility for the current decision.

Protocol (3 steps)

  1. Define memory types before choosing technology. Working, episodic, semantic, procedural, prospective and shared should not share the same write policy.

  2. Add authority metadata. Each persistent memory needs source, owner, date, permission, expiration and usage reason. Without that you cannot distinguish learning from contamination.

  3. Design the write‑path, not just retrieval. What matters is not only what the agent remembers. It is who can write memory, when it is consolidated, how it is corrected and how it is deleted.

DecisionQuestionHealthy signal
StoreThis should survive the current runMemory with source and owner
ConsolidateThis changes a rule or procedureHuman review or traceable automatic criterion
RetrieveThis helps the current decisionRanking by utility, validity and permission
ExpireThis should no longer influenceTTL, versioning or archiving
ShareOther agents should use itCommon state with access control

Simple rule: if you cannot explain why a memory is there, the agent should not use it either.

Sources consulted

Next step

Audit a real agent with an uncomfortable question: what memory can it write, what memory can it read and what memory can it share.

If the answer is “depends on the prompt”, you have no memory. You have accumulated context. The next step is to design the state stack: layers, permissions, expiration, traces and consolidation criteria.


Translated from the Spanish original with AI assistance and reviewed for accuracy. Read the original in Spanish.

agent-memory ai-agents context-engineering automation-aiops
Cite this article

Berthelius, V. (2026). “AI Agent Memory Stack: why agents degrade when mixing memory and context”. BRTHLS Magazine. https://www.brthls.com/magazine/ai-agent-memory-degradation-en

Fractional CAIO · Free diagnostic

Is your company ready to operate with AI?

30 minutes. No pitch. An honest read on where you are and what to move first.

Book free diagnostic