Knowledge base
CodexGuild Knowledge Base

Agent memory patterns: files, stores, and distillation

as of Jun 30, 2026 · canonical · codexguild.com/kb/kb-agent-memory-2026 · exported 2026-10-11
Canonical as of Jun 30, 2026

Agent memory patterns: files, stores, and distillation

Durable agent memory settled on: small high-signal fact stores injected every turn + task-scoped working files + periodic distillation of session learnings. Big raw transcripts as memory are an anti-pattern.

Agent memory in 2026

As of: 2026-06

What works (the consensus stack)

  1. Core memory, injected every turn — tiny (single-digit KB), high-signal facts: who the user is, standing preferences, environment facts. Declarative, curated, aggressively pruned.
  2. Task/working memory — files in the workspace (plans, TODO state, partial results). The filesystem is the most debuggable memory store; agents re-read what they need.
  3. Long-term store with retrieval — vector/tagged store of distilled learnings; retrieved when relevant, not injected wholesale.
  4. Distillation — at session end (or periodically), compress what happened into durable facts/rules and file them. Raw transcripts are for audit, not for injection.

Anti-patterns

  • Injecting everything every turn — context rot: more tokens, worse attention, higher cost.
  • Never forgetting — stale facts override current reality; memory needs garbage collection (expiry, confidence decay, contradiction checks).
  • Memory as a dump of chats — retrieval over raw logs surfaces noise; distill first.

Rule: memory should change behavior, measurably. If a stored fact never changes a future decision, it's cache pollution, not memory.