# Layered Agent Memory with a Salience Gate
<!--
ref: @knowledge/frameworks/layered-agent-memory
type: framework
tags: [memory management, multi-agent systems, AI retention, salience gate]
triggers: [agent forgets previous interactions, need to store long-term knowledge, information retrieval issues, overwriting of corrected data]
trigger_prompt: When an agent needs to remember details about users or contexts over multiple sessions without losing important information.
version: 2
updated_at: 2026-07-18T22:55:19.585Z
-->
Durable agent memory is engineered as distinct layers with an admission gate and a corrections-win conflict rule - not left to a model's short context window.
*Synthesized from Rushabh Doshi, The Factory That Dreams (AI Engineer World's Fair 2026).*
A raw language model is "a goldfish" - coherent for a short window, then it forgets. To give a multi-agent system durable memory, model it as explicit layers, each with a different retention horizon and purpose:
- **Working memory** - the last few minutes of interaction.
- **Pinned facts** - stable identity facts about an entity (who someone is).
- **Episodes** - whole conversations stored as discrete narratives ("little stories").
- **Relationships** - edges carrying a "warmth" score that grows as a contact moves stranger -> trusted.
Two control mechanisms make it work in production:
1. **Salience gate** - a "bouncer at the door" that decides whether a new item is even worth remembering, so the store does not fill with junk.
2. **Corrections-win conflict rule** - when two facts disagree, the human/verified correction always overrides. A dedicated function guards corrections so that the moment a human fixes something, it stays fixed. This yields continuity without the system making things up.
Underneath, meaning is stored as vectors and relationships as a graph; no model training or fine-tuning is required - the leverage is in organizing the memory, not in a smarter model.
**When to apply.** Any long-lived agent that must accumulate knowledge about people, accounts, or a domain across many sessions. The layer split lets you tune retention independently and keeps hot context small.
**Gotcha.** Without the salience gate the store bloats and retrieval degrades; without an explicit corrections-win rule, re-ingested stale data silently overwrites human fixes.
---
*Related: `@content/youtube/cole-medin/your-ai-second-brain-is-slowly-rotting-here-s-how-to-fix-it` · `@content/youtube/a16z/recursive-self-improvement-and-the-future-of-ai` · `@content/youtube/no-priors/really-big-test-time-compute-in-ai-changes-benchmarks-safety-and-research` · `@content/youtube/langchain/how-bridgewater-built-an-ai-analyst-that-does-hours-of-expert-research-in-minutes` · `@content/youtube/aie/the-factory-that-dreams-39-ai-agents-no-framework-rushabh-doshi-machinecraft`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*