Everyone talks about context engineering

Published on November 3, 2026

Everyone talks about context engineering. No one shows you the memory stack underneath it. Here are the 5 layers of agent memory.

  • Working Memory
  • In-context state for this turn. Conversation buffer, tool calls, intermediate reasoning
  • Bounded by the context window.
  • Compaction strategies (truncation, summarisation, hierarchical pruning) each lose different things
  • No compaction policy means you drop critical state or blow the budget.
  • Resets at session end.
  • Episodic Memory
  • Cross-session record of what happened: tool calls, results, errors, user state, time-indexed
  • Stored as append-only traces. Retrieved by semantic search, time window, or user scope
  • Many teams log traces for debugging but never query them at planning time
  • Without retrieval at planning time, the agent treats every session as its first
  • Semantic Memory
  • An entity store. Users, accounts, documents and their typed attributes
  • Queried at planning time. By entity ID or similarity search
  • Extraction jobs read episodes. They write structured facts to entity records
  • Many teams keep appending facts, with no deduplication, entity resolution or contradiction handling
  • Without those ops, retrievals serve contradictions.
  • Procedural Memory
  • A skill registry. Versioned procedures for recurring task patterns
  • Queried at planning time. Indexed by task type or input pattern
  • Many teams hard-code prompts and never update them from what failed
  • No reflection loop, no procedure store, no versioning
  • Without those ops, same mistakes repeat session after session
  • Meta-Memory
  • A control plane over the other four layers.
  • Policies for retention, decay, compression, and forgetting
  • Runs offline. Scheduled or triggered by memory thresholds
  • Reviews all four layers. Archives stale entries, dedupes duplicates, deprecates unused procedures
  • Without it, the stack rots. Storage grows forever, retrieval slows, stale wins

Context engineering decides what the model sees in this turn.

Memory decides whether your agent compounds or rots.
Working, episodic, semantic, procedural, meta.

Episodes become facts and procedures.
Meta-memory keeps all of them clean.

An agent that gets better over time owes it to the system around the model, not the model alone.

🔖 Save this for your next agent architecture review.

LinkedIn Post