Memory & Context Architecture

Build Claude Workflows That Remember Between Sessions

Your first project. 20 minutes.

Claude does not have persistent memory by default — every new conversation starts blank. But there are five distinct mechanisms for giving Claude the memory it needs. Understanding which to use transforms good AI interactions into reliable AI workflows.

Six Memory Mechanisms

The complete Claude memory architecture

In-Context Memory
Everything in the active conversation window. Claude reads every prior message on each turn. The limit is the context window — currently up to 200K tokens.
CLAUDE.md Files
Markdown files that Claude Code reads automatically at session start. Acts as persistent, project-scoped memory for development workflows.
Projects Knowledge Base
Uploaded files inside a Claude Project persist across all conversations. The closest thing Claude has to long-term memory for individual users.
System Prompts
Instructions injected before the conversation begins. Used in API integrations and Claude Projects custom instructions to set permanent behavioral rules.
External Memory Tools
When building with the Claude API, you can retrieve facts from a vector database and inject them into each prompt — giving Claude access to arbitrarily large memories.
Agent Memory Patterns
Multi-agent architectures can pass state between agents using structured files, databases, or message queues — enabling memory that survives across agent sessions.

CLAUDE.md: The Developer Memory System

CLAUDE.md is a Markdown file you place at the root of your project. When Claude Code starts a session, it reads this file before anything else — making it the primary memory mechanism for developer workflows.

CLAUDE.md
# Project Memory

## Commands
- Build: `npm run build`
- Test: `npm test`
- Deploy: `vercel --prod --no-wait`

## Code Style
- TypeScript strict mode enabled
- Prefer named exports over default
- No `any` types — use `unknown` + narrowing

## Architecture Decisions
- Auth: Supabase with RLS on every table
- Database: explicit column selects, no select("*")
- API routes: per-IP rate limiting on all mutations

## Context
Reid is the solo developer. Prioritize shipping
speed over perfect abstractions. Note open TODOs
with `// TODO(reid):` comments.

What makes CLAUDE.md powerful is specificity. Vague instructions like "write clean code" are useless. Specific instructions like "no select('*') in Supabase queries" or "per-IP rate limiting on all POST routes" become automatic constraints Claude enforces every session.

Which Memory Mechanism Should You Use?

You need Claude to remember project facts across CLI sessions
CLAUDE.md — add it to your repo root.
You want Claude.ai to remember files between conversations
Claude Projects — upload files to the Project knowledge base.
You want consistent behavior for a team
Claude Projects with custom instructions — share the Project with teammates.
You're building an API-powered app and need long-term user memory
External vector database — retrieve relevant facts and inject into each prompt.
You need memory that survives across multiple AI agents
Structured files or database — write state to disk, pass between agents explicitly.

Build AI workflows that actually remember

Learn memory architecture hands-on in Learn to GPT's free tracks.