Corpus Agentis
The field book to agent ecosystems
The field book to agent ecosystems
Memory · Types

The cognitive layers

A model is stateless: it remembers nothing between calls. Memory is the layer that gives an agent continuity, holding what it has done, learned and been told across runs. It assembles from four cognitive layers, working, episodic, semantic and procedural, each with its own scope and its own storage mechanism.

Short-Term / Working·Episodic·Semantic·Procedural
Thread-scoped (one session)

Tracks the immediate sequence of thoughts, actions and observations within a single run.

Mechanism
Context window holds the raw trace; a working-memory scratchpad writes compressed progress summaries ("Papers reviewed: 12. Gaps: […]") to a structured buffer, often Redis, to stop context overflow.
Watch-out
Long histories slow responses, raise cost, and distract the model with stale content.
e.g. LLM context window · Redis scratchpad
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Cross-session (experiences)

Stores past experiences, historical actions and conversation logs: remembers HOW a task was accomplished.

Mechanism
Few-shot example prompting: retrieve records of past successful execution sequences and inject them so the agent replicates the correct tool-calling behaviour.
Watch-out
Needs relevance retrieval, replaying the wrong episode misleads the agent.
e.g. Few-shot trajectory stores
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Cross-session (facts)

Long-term retention of facts, concepts and user preferences for personalization and RAG.

Mechanism
Two patterns, Profiles: a continuously patched JSON document per user/entity (error-prone as it grows). Collections: an append-only list of facts (easy to add, but the agent must delete/update contradictions to avoid pollution).
Watch-out
Profiles bloat; collections pollute, both need active conflict resolution.
e.g. Vector stores · JSON profiles
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Persistent (rules / skills)

The agent's rules of operation, instincts and "motor skills": model weights, code, and system prompt.

Mechanism
Reflection / meta-prompting: the agent evaluates its instructions against recent logs + user feedback and rewrites its own system prompt to improve future performance: an autonomous self-improvement loop.
Watch-out
Agents rarely touch weights/code; self-rewriting prompts can drift without guardrails.
e.g. System prompts · skills · reflection
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Specialised architectures · 3: when vector recall isn't enough
Long-term semantic

Stores structured facts instead of raw logs; prevents memory pollution when users change their mind.

Mechanism
Single-pass extraction pulls atomic facts; operates with ADD / UPDATE / DELETE so a stale fact is explicitly overwritten.
Watch-out
Extraction quality bounds everything downstream.
e.g. Mem0
mem0.ai · verified 2026-06-19
Time-aware semantic

Treats time as a first-class structural dimension: knows a preference or job was superseded.

Mechanism
Facts are nodes; relationships are edges carrying valid_from / invalid_at metadata.
Watch-out
Graph maintenance cost grows with entity count.
e.g. Zep / Graphiti
getzep.com · verified 2026-06-19
Belief vs evidence

Decouples raw evidence from belief by isolating four memory networks.

Mechanism
World (external facts) · Experience (historical actions) · Opinion (subjective beliefs + confidence scores) · Profile (synthesized user data).
Watch-out
More moving parts; reconciliation across networks is non-trivial.
e.g. Hindsight
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Managed implementations & governance
Enterprise orchestration

Organizes memory into three tiers for multi-agent continuity.

Mechanism
Session Attributes (persist across a session) · Prompt Session Attributes (single invocation) · Conversation History Sharing (supervisor ↔ sub-agents share context).
Watch-out
Vendor-specific; portability across clouds is limited.
e.g. AWS Bedrock AgentCore
docs.aws.amazon.com · verified 2026-06-19
Write-time governance

Stops memory growing out of control by validating before commit.

Mechanism
Before committing to long-term semantic/episodic storage, run a check: is it durable, reusable, and stripped of temporary session noise and sensitive PII?
Watch-out
A weak gate is how PII and noise leak into permanent memory.
e.g. Production write-gates
Internal research (Scalarity), Architectural Frameworks for AI Agent Memory Systems · verified 2026-06-19
Field notes

Working, episodic, semantic, procedural: how agents actually remember

Memory is one of the harder parts of an agent to get right. Past simple retrieval, the difficulty is in the detail: how long a lookup takes, what schema the memories were harvested into, and whether what comes back is structured well enough to act on. The sophistication sits in retrieval and structure, not in the storing.

Show more

The types above are the well-cited core of agent memory: working memory for the run in progress, episodic for what happened before, semantic for facts and preferences, procedural for rules and skills. Using them together is the hard part, and that difficulty is why a supplier layer has grown around specific kinds of memory, from atomic facts to ephemeral session state.

From the corpus, curated by Brandon Chaplin
Common questions
What is agent memory?

Whatever an agent keeps between calls. The model itself is stateless and forgets everything the moment it replies, so memory is a separate store the agent writes to and reads back. It is what lets an agent still know who you are tomorrow.

What are the four types of agent memory?

Working memory is the conversation you are in. Episodic memory is what happened in past runs. Semantic memory is facts and preferences. Procedural memory is rules and skills. The split borrows from human memory research, and most stacks implement two or three of the four rather than all of them.

What is semantic memory in an AI agent?

The facts the agent stores about you and your world: your name, your stack, what you prefer. Two patterns dominate. One profile document per user that keeps getting patched, or a growing list of separate facts. Profiles read cleanly and get harder to edit as they grow; lists are easy to add to and need conflict resolution.

What is episodic memory in an AI agent?

A record of past runs: what the agent tried, what happened, and whether it worked. It is normally fed back in as examples so the agent repeats an approach that succeeded before. The main failure is pulling up the wrong past episode and confidently repeating the wrong approach.

What is procedural memory in an AI agent?

The rules and skills that shape how an agent behaves: its system prompt, its code, its model weights. Updating it means rewriting instructions rather than storing a fact. Agents that edit their own instructions improve quickly and can drift, so most teams keep a person in that loop.

Do I need a vector database or a memory service?

A vector database does similarity search: embed the query, return the nearest chunks, done. A memory service adds what an agent actually needs on top, pulling out facts, spotting duplicates, and knowing which version of a fact is current. Use a vector DB for document search and a memory service for remembering a user.

When is plain vector search not enough?

When the answer depends on time or on relationships. Similarity search has no idea which of two contradictory facts is newer, and it cannot follow a link from one entity to another. That is the point where teams add timestamps on every fact, a knowledge graph, or both.

Next in the learning path