Agent memory: thread-scoped vs cross-session, and file-based memory
Answer: Split agent memory by recall scope. Short-term (thread-scoped) memory is the ongoing conversation; long-term memory stores user-specific or application-level data across sessions and threads.
Short-term memory
LangGraph manages short-term memory as part of the agent's state, persisted by a checkpointer so the thread can be resumed. A full history may not fit inside the context window, and most LLMs still perform poorly over long contexts, getting distracted by stale or off-topic content.
Long-term memory
Long-term memory is shared across conversational threads and scoped to a custom namespace; LangGraph stores save and recall it. Memory types borrow from psychology: facts (semantic memory), experiences (episodic memory), and rules (procedural memory).
File-based memory (Gemini CLI)
Gemini CLI persists durable facts and user preferences by editing Markdown memory files:
- shared project instructions in repository
GEMINI.mdfiles; - private project notes in a per-project private memory folder;
- cross-project personal preferences in the global
~/.gemini/GEMINI.md.
Stored facts are included in context for all future sessions; keep them concise and avoid duplicating the same fact across tiers.
Artifacts
See also
Claims
- id: C1 claim: Short-term memory is thread-scoped. source: S1 evidence: "Short-term memory, or thread-scoped memory, tracks the ongoing conversation"
- id: C2 claim: Long-term memory spans sessions. source: S1 evidence: "stores user-specific or application-level data across sessions"
- id: C3 claim: Long contexts distract LLMs with stale content. source: S1 evidence: "most LLMs still perform poorly over long contexts."
- id: C4 claim: Gemini CLI memory lives in Markdown files. source: S2 evidence: "persists durable facts, user preferences, and project details by"
- id: C5 claim: Avoid duplicating facts across memory tiers. source: S2 evidence: "avoids duplicating the same fact across multiple memory tiers."
Sources
- [S1] Memory overview. LangChain docs (GitHub). https://github.com/langchain-ai/docs/blob/main/src/oss/concepts/memory.mdx . License: MIT (langchain-ai/docs LICENSE). Accessed 2026-11-09.
- [S2] Memory files. Google Gemini CLI docs (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/memory.md . License: Apache-2.0 (google-gemini/gemini-cli LICENSE). Accessed 2026-11-09.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub repository docs under Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) or MIT License (https://opensource.org/licenses/MIT), as listed per source; copyright notices remain with the original authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: LangChain docs (GitHub), Memory overview, MIT (langchain-ai/docs LICENSE); Google Gemini CLI docs (GitHub), Memory files, Apache-2.0 (google-gemini/gemini-cli LICENSE).
Cite this
iinventedlight. 2026. "Agent memory: thread-scoped vs cross-session, and file-based memory." iinventedlight Library, iil:note:asetb193, version of 2026-11-09. https://iinventedlight.com/library/notes/ao-memory-short-vs-long-term/. License: CC-BY-4.0.
@misc{iil_note_asetb193,
author = {{iinventedlight}},
title = {{Agent memory: thread-scoped vs cross-session, and file-based memory}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-09},
url = {https://iinventedlight.com/library/notes/ao-memory-short-vs-long-term/},
note = {Permanent ID iil:note:asetb193. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-memory-short-vs-long-term.md.