Three-tier memory system for AI agents: short-term, long-term, and episodic.
from memory_layer import AgentMemory
mem = AgentMemory(agent_id="my-agent")
mem.short_term.add("User prefers dark mode", priority=0.8)
mem.long_term.store("Project uses React + TypeScript", tags=["tech", "project"])
mem.episodic.record("Debugged auth bug", outcome="success", duration_min=15)
# Recall
context = mem.short_term.recall(limit=10)
relevant = mem.long_term.search("frontend framework")
similar = mem.episodic.find_similar("debugging session")
┌─────────────────────────────────────────┐
│ Agent Memory │
├───────────┬───────────┬─────────────────┤
│ Short-Term│ Long-Term │ Episodic │
│ (Redis) │ (Vectors) │ (Timeline) │
│ TTL: 1hr │ Permanent │ Decay: 30d │
│ Hot cache │ Semantic │ Consolidated │
└───────────┴───────────┴─────────────────┘
references/short-term.mdreferences/long-term.mdreferences/episodic.mdEpisodic memories that recur are automatically promoted to long-term:
scripts/consolidate.py共 1 个版本