agent-memory-architecture

v2026.09.24

Design tiered agent memory — core / recall / archival — with backend selection (mem0, Letta, Zep/Graphiti, LangMem) and temporal vs snapshot tradeoffs. Use when an agent needs persistent context across sessions, personalization, or temporal knowledge graphs.

GitHub
Install command
npx skhub add akillness/agent-memory-architecture
Markdown
SKILL.md

Agent Memory Architecture

Overview

Conversation history ≠ memory. Production agents need tiered stores: hot in-context, warm vector recall, cold archival, plus temporal knowledge graphs for facts that change over time. This skill picks the backend and tier layout.

When to use

  • Agent needs to remember user preferences across sessions
  • Multi-session task continuity (Ralph, long-running research)
  • Personalization that survives restarts
  • Multi-tenant agents with strict isolation
  • Facts change over time (price, status, relationships) → temporal KG needed

Backend selection

BackendStrengthPick when
mem0Self-improving, fact extraction, OSSPersonalization, conversational memory
Letta (MemGPT)OS-style tiered memory, persistenceAgent-as-process, long-lived agents
Zep / GraphitiTemporal knowledge graph, bi-temporalFacts change over time, need history
LangMemLangGraph-native, simpleAlready on LangGraph, no extra service
Postgres + pgvectorRoll your own, full controlCompliance / on-prem requirements

Tier design

┌─────────────────────────────────────────────┐
│  Core (in context)      — identity, rules   │  <2k tokens
├─────────────────────────────────────────────┤
│  Recall (vector search) — last N sessions   │  100k+ items
├─────────────────────────────────────────────┤
│  Archival (cold store)  — full history      │  unbounded
└─────────────────────────────────────────────┘

Promotion rule: archival → recall on retrieval; recall → core on repeated use. Eviction rule: core → recall on token pressure; recall → archival on staleness.

Temporal vs snapshot

  • Snapshot: latest value wins (mem0 default). Simple, loses history.
  • Temporal (bi-temporal): every fact has valid_from, valid_to, recorded_at. Required when "what did the agent believe yesterday?" matters.

Graphiti / Zep give you bi-temporal out of the box. Hand-rolled needs (entity, relation, value, t_valid_start, t_valid_end, t_recorded) tuples.

Privacy patterns

  • Per-tenant memory namespace, never share embeddings across users
  • PII detection (Presidio) before embedding
  • TTL on recall tier (e.g. 90 days), explicit retention for archival
  • User-initiated forget: hard-delete from all tiers + reindex

Quick start — mem0

from mem0 import Memory
m = Memory()
m.add("User prefers concise answers in Korean.", user_id="jeo")
results = m.search("language preference", user_id="jeo")

Quick start — Graphiti (temporal)

from graphiti_core import Graphiti
g = Graphiti(neo4j_uri, neo4j_user, neo4j_pwd)
await g.add_episode(name="session_1", episode_body="User joined Acme Corp 2026-03-01", reference_time=datetime.now())
nodes = await g.search("where does the user work?")

Further reading

  • mem0 — fact extraction, semantic search
  • Letta (MemGPT) — OS-style memory blocks
  • Graphiti / Zep — bi-temporal knowledge graph
  • LangMem — LangGraph-native memory primitives
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

Not specified

Source path

.agent-skills/agent-memory-architecture

Default branch

main

Latest commit

f579bfe

Tree SHA

34a09b3