What problem does it solve?
LLM chat applications forget everything between sessions, forcing users to repeat context. This Skill wires persistent, per-user or per-thread memory into a TanStack AI chat() call so the model recalls prior context across turns and sessions.
Core Features & Use Cases
- Recall/Save Middleware:
memoryMiddleware injects recalled memory into the system prompt before the model runs and defers saving the turn after it finishes, with non-fatal failure handling.
- Pluggable Adapters: Choose from
inMemory, redis, hindsight, mem0, or honcho, or implement the two-verb MemoryAdapter contract (recall/save) yourself.
- Secure Scoping: Derive
MemoryScope (threadId, userId, tenantId, namespace) server-side from session state to enforce isolation boundaries.
- Use Case: A support chatbot needs to remember a user's preferences from last week. Attach
memoryMiddleware with a Redis adapter and a session-derived scope so each conversation recalls prior facts automatically.
Quick Start
Add memoryMiddleware from @tanstack/ai-memory to my chat() call with a Redis adapter and a scope derived from my server-side session.