MEMORY_SYSTEMS
ADVANCEDGo beyond simple chat history. Implement long-term persistence, vector retrieval, and episodic memory.
MEMORY_TYPES#
SHORT_TERM
The immediate context window. Stores recent messages. Cleared when session ends.
LONG_TERM
Semantic search over documents. "Read-only" knowledge base for the agent.
EPISODIC
Remembering past interactions with this specific user. "You mentioned you like Python last week."
IMPLEMENTING_PERSISTENT_MEMORY#
By default, InMemoryStore forgets everything on restart. To build a real app, use a database adapter (e.g., Redis, Postgres).
redis-memory.ts
EPISODIC_MEMORY_PROFILE_PATTERN#
To make agents feel personal, they need to update a "User Profile" based on conversations. This is often done with a background "Summarizer" agent.
ARCHITECTURE_PATTERN
Don't stuff every past conversation into the context window. Instead, have a background job summarize key facts into a `user_profile` table, and inject that profile into the System Prompt.
profile-injection.ts