Back to Blog

AI Agent Memory Systems: How Claude, GPT, and Gemini Remember Context Across Sessions

AI Transformation Lead
  • AI
  • Agents
  • Memory
  • Claude
  • GPT
  • Gemini
  • LLM
  • Context
  • mem0
  • Letta
  • MemGPT
  • Zep
  • Graphiti
  • cognee
  • Open Source
Abstract visualization of AI memory systems with interconnected neural pathways and persistent storage nodes

Building AI agents that remember across sessions requires understanding each platform's memory architecture. Claude Projects, GPT memory, and Gemini context windows solve different problems.

Memory Architecture Comparison

FeatureClaude ProjectsGPT MemoryGemini Context
Max Context500K tokens128K + memory1M tokens
PersistenceProject-levelFact storageSession-only
Document UploadYes (unlimited)NoYes (per session)
Cross-SessionYesPartialNo (requires Vertex AI)
RetrievalFull projectSemantic searchFull context

Claude Projects Memory

Claude Projects maintains persistent context across all conversations within a project. Upload documents, code, or reference materials once, and Claude remembers them in every subsequent chat.

Best for:

  • Ongoing codebase work
  • Long-form writing projects
  • Research with reference documents
  • Multi-step workflows

Limitations:

  • Project-scoped only (no cross-project memory)
  • Requires manual project creation
  • Token limit applies to active context

GPT Memory

GPT memory stores specific facts you explicitly ask it to remember. It retrieves these facts when semantically relevant to your query.

Best for:

  • Personal preferences
  • Recurring task templates
  • User-specific context
  • Cross-conversation facts

Limitations:

  • Cannot store documents
  • Retrieval is approximate
  • Limited storage capacity
  • No project-level organization

Gemini Context Window

Gemini 2.5 Pro offers the largest context window at 1M tokens. However, context resets between sessions unless you use Vertex AI Agent Engine.

Best for:

  • Analyzing entire codebases
  • Processing long documents
  • Multi-document reasoning
  • One-shot analysis tasks

Limitations:

  • No built-in persistence
  • Requires Vertex AI for agent memory
  • Higher latency with full context
Loading memory data…

The dedicated memory layer

Three vendor platforms is not the whole market. A separate category of open-source projects treats memory as the product rather than a feature attached to a chat interface, and any agent that has to outlive one vendor's session model ends up looking at them.

Letta grew out of the MemGPT research, which framed the problem as an operating system question rather than a prompting one. The MemGPT paper proposed paging information between a limited context window and external storage the way an OS pages memory, and Letta turned that into a platform for stateful agents. When people describe an agent that edits its own memory, this is the lineage they are drawing on.

mem0 takes the opposite posture. It sits as a thin universal layer between your application and whichever model you call, extracting durable facts from conversations and replaying only the relevant ones on the next turn. The appeal is portability. Your memory survives a swap from GPT to Claude, which none of the three vendor systems above can offer.

Zep and its Graphiti engine argue that flat fact storage discards the thing that matters most, which is when something became true. Graphiti builds a temporal knowledge graph, so every fact carries a validity window and a later contradiction supersedes the earlier claim instead of sitting beside it. For anything whose state changes over time, a customer's plan or a project's status, that distinction is what stops an agent confidently reporting last quarter's answer.

cognee sits closest to the custom pattern below, combining graph and vector storage behind a single interface so retrieval can walk relationships rather than only matching embeddings.

All four ship under Apache-2.0. That matters more than it sounds when the memory store holds regulated data and cannot phone home, which is the usual reason a team reaches past the vendor platforms in the first place.

Implementation Patterns

Pattern 1: Claude Projects for Codebase Work

Project: my-saas-app
├── uploaded: src/ (entire codebase)
├── uploaded: docs/api-spec.md
├── chat 1: "Review auth flow"
├── chat 2: "Add rate limiting"
└── chat 3: "Write tests"

Each chat has full context of previous work.

Pattern 2: GPT Memory for User Preferences

User: "Remember I prefer TypeScript over JavaScript"
GPT: [stores preference]

User (later session): "Write a script to parse CSV"
GPT: [generates TypeScript] "Here's a TypeScript script..."

Pattern 3: Custom Memory with Vector DB

For production agents requiring persistent memory across platforms:

typescript
// Memory layer using Pinecone const memory = await pinecone.query({ vector: embed(userQuery), filter: { userId, projectId } }); // Inject retrieved context into prompt const context = memory.matches.map(m => m.text).join('\n'); const response = await claude.messages.create({ system: `Previous context:\n${context}`, messages: [{ role: 'user', content: userQuery }] });
Loading implementation costs…

Token Economics

Memory has costs. Each platform charges for tokens processed:

PlatformInput CostMemory Cost
Claude Opus$15/1M tokensProject storage free
GPT-5$10/1M tokensMemory storage free
Gemini Pro$3.5/1M tokensVertex AI extra

Pooya Golchian calculates that Claude Projects offers the best value for iterative work: you pay for tokens once per session, but the uploaded documents persist without re-processing.

When to Use Each

Claude Projects:

  • You work on the same codebase repeatedly
  • You need document reference across sessions
  • You want zero-setup persistence

GPT Memory:

  • You want personalization across all chats
  • You have recurring task templates
  • You need cross-platform memory (web + mobile)

Gemini Context:

  • You analyze massive documents (100K+ tokens)
  • You need one-shot reasoning over entire codebase
  • You use Vertex AI for production agents

Custom Memory:

  • You need platform-agnostic persistence
  • You require fine-grained retrieval control
  • You're building multi-tenant agent systems

Dedicated Memory Layer (mem0, Letta, Zep, cognee):

  • You need memory that survives a model or vendor swap
  • You need facts to carry validity over time, not just similarity
  • You are self-hosting because the data cannot leave your infrastructure

Future: Unified Agent Memory

The industry is converging on persistent, cross-platform agent memory. Anthropic's Model Context Protocol (MCP) standardizes how agents access external memory. OpenAI's GPT memory will likely expand to document storage. Google's Vertex AI Agent Engine provides production-grade persistence.

Pooya Golchian predicts that by 2027, all major AI platforms will offer project-level memory with document persistence as a baseline feature. The differentiation will shift to retrieval quality, multi-modal memory, and collaboration features.

Loading trends…
X / Twitter
LinkedIn
Facebook
WhatsApp
Telegram
AI Engineering for B2B

Stuck between an AI pilot and a system your team can run?

I join your engineering team and build the agent layer alongside you, covering architecture, MCP integration, evals, and production deployment. When the engagement ends, your team owns the system and keeps shipping.

12+ years shipping production systems

Senior engineer turned AI specialist. React, Next.js, AWS, agent orchestration.

Dubai-based, working with B2B teams worldwide

Direct collaboration across UAE, Europe, and US time zones.

AI agent teams that ship, not demos that stall

Discovery, role design, MCP integration, evals, and production deployment.

Questions about this piece

Follow-ups readers ask most often about the argument above.

  • Claude Projects maintains persistent context across all conversations within a project workspace. GPT memory stores specific facts you ask it to remember and retrieves them when relevant. Claude Projects can hold up to 500K tokens of context including uploaded documents, while GPT memory is limited to stored facts and recent conversation history. Pooya Golchian notes that Claude Projects works better for ongoing work like codebases, while GPT memory suits personal preferences and recurring tasks.

  • Claude 4 Opus supports 200K tokens input, Claude Sonnet 4.6 supports 200K tokens. GPT-5 supports 128K tokens with memory compression for longer sessions. Gemini 2.5 Pro supports 1M tokens input, the largest context window available. Pooya Golchian observes that Gemini's massive context window makes it ideal for analyzing entire codebases or long documents, but Claude's project-level persistence often proves more practical for iterative work.

  • Four projects treat agent memory as the product rather than a platform feature, all under Apache-2.0. Letta is the productised form of the MemGPT research and gives agents that edit their own memory. mem0 is a universal layer that keeps memory portable when you swap the underlying model. Zep and its Graphiti engine build a temporal knowledge graph, so facts carry a validity window and a later contradiction supersedes an earlier claim rather than sitting next to it. cognee combines graph and vector storage behind one interface. Pooya Golchian points to the vendor-swap case as the usual reason teams reach past Claude Projects or GPT memory, along with self-hosting when the data cannot leave their own infrastructure.

  • Yes, but implementation varies. Claude Projects stores all project files and conversation history persistently. GPT memory stores explicit facts you ask it to remember. Gemini's context resets between sessions unless you use Vertex AI Agent Engine for persistence. Custom agent frameworks like LangChain and AutoGen implement their own memory layers using vector databases. Pooya Golchian recommends Claude Projects for most use cases due to its seamless integration without additional infrastructure.

Get practical AI and engineering playbooks

Weekly field notes on agentic AI, automation, and high-performance Next.js builds. Each edition is concise, implementation-ready, and tested in production work.

Open full subscription page

Get the latest insights on AI and full-stack development.