# Long-term memory
## The split
- Short-term memory: checkpoints, per thread_id. The conversation.
- Long-term memory: stores, across threads. Facts about the user, preferences, learned state.
## The interface
LangGraph's store is a namespaced key-value API (`BaseStore`; `InMemoryStore` for dev). Tools access it through the ToolRuntime (`runtime.store`), and middleware can load it before the model call.
## Rules
- Namespace deliberately: `(user_id, "preferences")` style namespaces keep users' memories separate. A flat namespace leaks one user's facts into another's.
- Write memories from tools (after a successful lookup or when the user states a preference), read them in before_model middleware or in the tool itself. Do not dump the whole store into every prompt; retrieve the relevant slice.
- Decide what is worth remembering. Long-term memory without a write policy becomes a junk drawer that poisons prompts. The docs' long-term memory guide covers the patterns; start with explicit user facts and preferences.
- Stores are separate from checkpointers. Back them up and secure them independently; they hold user data across sessions.