← All notes

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:

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

Sources

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

Permanent ID: iil:note:asetb193

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.},
}

Markdown

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.