Agent memory architecture

From akillness/jeo-skills · View interactive version

Agent memory architecture is an AI agent skill from the GitHub repository akillness/jeo-skills. 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.

How to use this skill

Skill file

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

Backend selection

| Backend | Strength | Pick when |

|---------|----------|-----------|

| mem0 | Self-improving, fact extraction, OSS | Personalization, conversational memory |

| Letta (MemGPT) | OS-style tiered memory, persistence | Agent-as-process, long-lived agents |

| Zep / Graphiti | Temporal knowledge graph, bi-temporal | Facts change over time, need history |

| LangMem | LangGraph-native, simple | Already on LangGraph, no extra service |

| Postgres + pgvector | Roll your own, full control | Compliance / 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

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

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.