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.

Meeting

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.

Layer What it stores Risk if mixed
Working memory What is needed for the current task Saturate the window with noise
Episodic memory What happened, when, and with what outcome Repeat errors as if they were learning
Semantic memory Facts, entities, relationships and stable state Turn rumors or outputs into truth
Procedural memory How to do a task, workflow or skill Execute outdated procedures
Hierarchical memory What is hot, warm, cold or archived Retrieve too much or too little
Prospective memory What must be remembered or executed later Forget follow‑ups, deadlines and commitments
Shared memory What several agents must share Create 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.

Decision Question Healthy signal
Store This should survive the current run Memory with source and owner
Consolidate This changes a rule or procedure Human review or traceable automatic criterion
Retrieve This helps the current decision Ranking by utility, validity and permission
Expire This should no longer influence TTL, versioning or archiving
Share Other agents should use it Common 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