compare

CrewAI memory, explained, and a simpler layer beside it

CrewAI gives crews built-in short-term, long-term, and entity memory. This page explains how each type works, where the design is strong, and where a plain-file state layer fills the gaps.

How CrewAI handles memory

Set memory=True on a Crew and CrewAI activates three memory stores with sensible defaults. Short-term memory uses ChromaDB to embed text and retrieves relevant chunks through RAG. It resets when the run ends.

Long-term memory persists across runs. It uses SQLite to store task results and learned insights. On the next run, the crew recalls what worked and what did not. Entity memory tracks people, companies, and concepts using the same RAG pipeline as short-term memory.

Contextual memory is not a separate store. It combines short-term, long-term, and entity memory into a single retrieval step and injects the most relevant information into the prompt.

What this design does well

  • Zero-config activation. One flag turns on all memory types.
  • Built-in entity tracking. Structured recall about named entities without custom tooling.
  • Cross-run persistence. The crew gets better over repeated runs.
  • Pluggable providers. Swap the default storage with external providers like Mem0.

For many single-crew use cases, the default memory system works well out of the box.

The gap

Storage locations are opaque. Short-term and entity memory write to ChromaDB in a platform-specific directory. Long-term memory defaults to .crewai/ in your project. Finding these files means knowing the internal layout.

Debugging retrieval is difficult. When an agent produces a bad answer, you cannot easily see what memory contributed to the prompt. Memory is locked inside the crew. Another framework or a second crew cannot read what the first crew learned.

Resets between projects require finding and deleting hidden files. There is no single command to clear all memory for a crew.

Plain-file state beside a crew

The alternative: give the crew a shared folder of plain text files. Agents read and write files in that folder through a custom CrewAI tool. You can open any file and see exactly what the crew knows.

The folder is portable. Copy it to another machine, point a different framework at it, or check it into version control. The knowledge moves with the folder, not with a specific framework.

Comparison

CrewAI short-termCrewAI long-termgcontext files
ScopeSingle runCross-run (same crew)Cross-tool (any MCP client)
StorageChromaDB (in-memory + SQLite)SQLitePlain files on disk
InspectionRequires code to queryQuery SQLite directlyOpen in any editor
Cross-frameworkNoNoYes, any MCP client
CorrectionNot possible (resets each run)Not straightforwardEdit the file
Best forTask context within a runCrew-scoped recall across runsShared, inspectable knowledge

Using them together

CrewAI and file-based state are not mutually exclusive. Keep CrewAI memory for in-run context and cross-run learning. Add a file layer for knowledge that needs to be visible, editable, or shared with tools outside the crew.

Create a custom CrewAI tool that reads and writes files in a gcontext state folder. The crew uses the tool like any other. The state folder is also served over MCP, so your coding assistant or a second crew can access the same files.

conceptual
from crewai.tools import BaseTool
class ReadLearnings(BaseTool):
name = "read_learnings"
description = "Read the learnings file"
def _run(self) -> str:
path = "state/modules/project/learnings.md"
with open(path) as f:
return f.read()
# Use in an agent
researcher = Agent(
role="Researcher",
tools=[ReadLearnings()],
)

Questions

Where does CrewAI store memory?

Long-term memory uses a SQLite database in your project directory (default: .crewai/). Short-term and entity memory use ChromaDB, which also writes to a local SQLite file. The exact paths depend on your OS and the appdirs package. You can override the long-term path with the db_path parameter on LTMSQLiteStorage.

How do I share memory between crews?

CrewAI memory is scoped to a single crew instance. There is no built-in mechanism to share memory across crews. To share knowledge, store it in external files that both crews can access through a custom tool.

Can I inspect CrewAI memory?

Long-term memory is in a SQLite database and can be queried with standard tools. Short-term and entity memory use ChromaDB embeddings, which require code to search. There is no built-in viewer. File-based state is readable in any text editor.

Related

LangGraph memory
Checkpointers, Store, and the file layer
AI agent memory
Four approaches compared
What is agent state?
Definition and management patterns
Add a readable memory layer

Keep CrewAI for orchestration. Add gcontext for memory you can read, edit, and share.

View on GitHub