# Long-Term Memory With a Store — LangGraph Agents & Multi-Agent Systems

Source: https://www.geekswithgeeks.com/en/langgraph-agents/m-longterm

> Keep facts across threads, such as user preferences.

## Beyond one conversation

Thread state is **short-term** memory scoped to one conversation. For facts that should persist across conversations (a user's name, language, preferences, past decisions), LangGraph offers a **store**: a key-value-like memory organised by **namespaces** (for example `("users", user_id)`), usable from nodes and optionally searchable semantically. Decide what to remember (explicit user statements, confirmed facts), write it deliberately, let users **view, correct and delete** it, and keep sensitive data out unless you have a clear purpose and consent. Retrieve only the few memories relevant to the current task instead of dumping everything into the prompt.

## Short-term versus long-term memory

A comparison to guide design decisions.

```text
Short-term (thread state)                Long-term (store)
scope: one conversation (thread_id)      scope: across conversations (namespace, e.g. ("users", id))
content: messages, intermediate values   content: preferences, facts, summaries
saved by: checkpointer after each step   saved by: your nodes, on purpose
lifetime: as long as the thread is kept  lifetime: until deleted; user can view/edit/delete
risk: long threads inflate cost          risk: remembering wrong or sensitive things
```

**Quiz:** Which belongs in long-term memory?

- [ ] A node's local variable
- [ ] The intermediate tool result of one step
- [x] A user's preferred language across conversations
- [ ] The recursion counter

*Answer:* A user's preferred language across conversations. Cross-conversation facts live in the store; per-run details live in thread state.
