Memory Types

Agents without memory reset to zero every session. Four memory types — context, long-term, episodic/semantic, scratchpads — and the discipline of what NOT to remember.

▶ Watch this reel

What you'll learn

  1. Short-term: the context window
  2. Long-term memory
  3. Episodic vs semantic
  4. Scratchpads & working files

Remember this

Short-term = context window

Long-term memory

Episodic vs semantic

Scratchpads

Code: Write gates: what enters memory, when

# Gate 1 · REFLECTION POINT (end of meaningful work)
→ extract semantic facts only: preferences, project truths, decisions
→ skip: time-sensitive details, one-off context, anything PII-tagged

# Gate 2 · TASK END
→ summarize episode: goal → approach → outcome → one lesson
→ tag: task_type, date, outcome (success/failure/abandoned)

# Gate 3 · NEVER (memory safety, AG-13)
→ raw secrets, API keys, credentials
→ PII about people without consent basis
→ unverified claims marked as facts (store as 'unverified' or drop)

# Gate 4 · EVICTION (scheduled)
→ semantic: superseded facts replaced (keep old version 30d)
→ episodic: raw → summary after 30d; lessons survive