Blog·Engineering

We dug into Claude Code's memory. Here's exactly how it works

By Muskan Jain·9 min read

A glowing folder of notes with one note lifted out, linked by golden threads to three floating notes, on a grainy blue background beside the headline How Claude Code's memory works.

Last month, our founder Dhravya Shah broke down how Instinct's memory works. We wanted to do the same for Claude, since that's where we spend most of our day.

X content is paused until you allow embedded content.

Open on X ↗

We figured all of this out by asking Claude Code a lot of questions, reading the memory files it wrote on our machines, and going through Anthropic's docs, then double-checking whatever we could. Most of it should be right, but we haven't seen Claude Code's source, so some things might be off. If you spot one, please tell us!

TL;DR

  • Claude's memory has come a long way this year. It now lives in four main places, each scoped to where you work.
  • In Claude Code, you write CLAUDE.md and Claude writes auto memory, a folder of plain Markdown notes on your machine. Claude loads a short index at the start of every session and opens a note when it decides it needs one.
  • Every memory system has to get three things right: what to write down, how to store it, and how to bring it back. Here's how Claude Code handles each, and where Supermemory adds to it.

Memory in the Claude app

If you use the Claude app, its memory is really good. It has been available on every plan since March, including Free. In July, Anthropic moved it from a single daily summary to separate topics that Claude saves as you chat. And since August 25, Chat and Cowork share one memory (when Cowork runs in the cloud):

X content is paused until you allow embedded content.

Open on X ↗

Most of our work happens in Claude Code, though, so that's where we dug in.

Claude has four main kinds of memory

Going by the docs for the Claude app and Claude Code, we count four main memories Claude keeps for you, each scoped to a different place you work:

Hand-drawn diagram: Claude has 4 kinds of memory. In the Claude app: your account (Chat and Cowork share it) and each project (its own memory, plus your account's). In Claude Code: each cloud project (its own MEMORY.md) and your machine (a folder per repo that stays on that machine). Ours: 300+ notes in 6 folders.

In the app, projects also draw on your account memory. Claude Code keeps its own, on your machine and in cloud projects.

Inside Claude Code's memory

Claude Code got auto memory in February (Thariq's launch post). Type /memory and you'll see this:

Screenshot of Claude Code 2.1.306 with the /memory panel open: auto-memory true, user instructions saved in ~/.claude/CLAUDE.md, project instructions checked in at ./CLAUDE.md, and Open auto-memory folder.

The two "instructions" entries are your CLAUDE.md files, which you write yourself. The project one lives in the repo, so if you commit it, it travels with the code. "Open auto-memory folder" takes you to the notes Claude writes: a flat folder of Markdown files, plus an index file, MEMORY.md, with one line per note. On one of our machines, that folder holds over 140 notes (names blurred):

Screenshot of the Finder window for Claude Code's auto-memory folder: a flat list of Markdown documents with dates and sizes. File names are pixelated for privacy.

Each note is a short Markdown file with a header that says what it's about. Here's the one Claude reads in the next screenshot:

Screenshot of one memory note in a terminal: a header with name forgetting-film, a description of the film notes and metadata type project, followed by the first line of the note in Markdown.

What Claude Code's memory does really well is transparency. It's all plain Markdown you can read and edit, and when you ask Claude to check its memory, it does:

Screenshot of Claude Code with the Supermemory plugin off: asked to check its memory for the first note on the forgetting film, Claude reads 1 file and answers with the note and the file it's in, forgetting-film.md.

By default, Claude opens a note only when it decides it needs one. Each session loads the MEMORY.md index (up to 200 lines or 25KB), and the notes stay out of context until Claude reads them "on demand". That keeps sessions light. Two things we saw:

  • The index had the answer: Claude named the film version we'd picked without opening a note.
  • The index didn't: on a repo Dhravya has worked on for over three years, Claude checked the Git history for our old embedding model, a fair guess, but not the note that had it.

So a note helps only when Claude thinks to look.

Notes are plain files, so they behave like files:

  • Latest version only: a note keeps its current text, not how it got there.
  • Nothing expires: notes "stay until you or Claude edits or deletes them," so "I have exams this weekend" outlives the weekend.
  • Tied to a path: the folder is named after the project's path, so a rename starts an empty one. After we renamed a workspace on October 14 and copied 84 notes over, more than a third of the copies drifted apart. You can pin the folder with autoMemoryDirectory in that project's settings.
  • One machine: "Auto memory is machine-local."

Our Claude Code plugin keys memory to the repo's Git remote instead, so it survives a rename and follows every clone with the plugin on the same account, on any machine. (A repo without a remote falls back to its path.)

Hand-drawn diagram: same repo, same memory. Your laptop, a work machine and a fresh clone all point to one memory, tied to the repo's Git remote. Any clone, any machine, same Supermemory account.

The three hard parts of any memory system

The deeper we went, the more it came down to three things every memory system has to get right, ours included:

  1. Writing: what gets learned, and what that costs
  2. Representation: how it's stored
  3. The harness: how memory gets back to the model

1. Writing

Someone has to decide what's worth remembering. In any conversation there are endless things you could remember, but someone paying attention knows which two or three actually matter, and that takes taste. In Claude Code, Claude makes that call itself. The docs put it this way: "It decides what's worth remembering based on whether the information would be useful in a future conversation."

Supermemory gives this job to a dedicated learning model, which decides "what and how to learn, what is important, when to forget."

Then there's cost. To write a note well, you first check what's already there, or you end up with duplicates and contradictions. An index like MEMORY.md helps, but the more you store, the more there is to check.

Supermemory checks new information against what it already knows too, but on its own servers, so none of that reading lands in Claude's context. Dhravya describes it as a model trained to learn from incoming context, "along with a sampler that's also specialized for ensuring there's no redundancy."

Hand-drawn diagram: to remember one new thing. Markdown files: a grid of notes all feeding into the new fact; to do it right, it reads all of it, and that grows over time. Supermemory: a sampler built to avoid redundancy picks the related notes and reads only those.

2. Representation

You want two things from memory: what happened over time, and anything loosely related. We made a short video on exactly this a couple of weeks ago:

X content is paused until you allow embedded content.

Open on X ↗

Our Claude Code notes link to each other, which covers some of the second. For the first, a note shows its latest state rather than how it got there. The memory folder isn't under Git by default, and even when it is, Git tracks whole files, so tracing one fact means digging through diffs. And "what points to this?" means searching every note, because nothing indexes the links.

Hand-drawn diagram: two questions memory has to answer. What's the history of this one fact: Markdown files read the whole file; Supermemory follows the fact, new one on top, old one kept as history. What points to this: Markdown files search every note; Supermemory is one hop, through updates, extends and derives.

Supermemory stores memory as "a living knowledge graph of facts on top of other facts". When a fact changes, you get what's true now, with the old one kept as history. Facts update, extend, or derive from each other, and something like "exam tomorrow" stops counting once it has passed.

Here's what that looks like on one of our own memory graphs:

X content is paused until you allow embedded content.

Open on X ↗

3. The harness

The harness is how memory gets back to the model. It needs three things:

  • A profile: what the model should always know about you
  • Hooks: a few related memories on every prompt
  • Tools: so the model can look things up mid-task

Claude Code already has a version of the first and the last: CLAUDE.md and the MEMORY.md index load when a session starts, and Claude can open any note mid-task with its file tools. The plugin adds the most in the middle one.

A profile. Supermemory keeps one for each user or project, with long-term facts and recent context (static and dynamic), and keeps it up to date on its own. The plugin loads it when a session starts. Here's a test user's profile in our console: two messages went in, "I'm a morning person. I run at 6 a.m." and later "I'm not a morning person anymore. I run at 9 p.m. now.", and the profile kept the newer facts on its own:

Screenshot of the Supermemory console for a test user, user_rio: two documents, I'm a morning person. I run at 6 a.m. and I'm not a morning person anymore. I run at 9 p.m., and a profile whose dynamic facts now say the user runs at 9 p.m.

Fun fact: In Claude Code, Claude tidies its own index. When MEMORY.md gets near its limit, the docs say Claude Code "reminds Claude to shorten it: keep one line per entry, move detail into topic files, and merge or drop stale entries." Supermemory's profiles are "automatically maintained", so when "I run at 6 a.m." becomes "I run at 9 p.m.", nobody has to tidy anything.

Hooks. These are scripts Claude Code lets plugins run at moments like a new prompt. If memory is a notebook, each note is a whole page, but in the moment you want a line or two from every page that relates to what's being said. So on every real prompt, the plugin:

  • searches memory
  • adds the most relevant short memories (up to 15, 300 characters each) before Claude reads the prompt

Here's one of our sessions:

  • the profile loads when the session starts: 7 memories
  • 5 more are recalled for the question: about 297 tokens
  • the answer is marked ◪ because it came from Supermemory

Just enough to point Claude in the right direction:

Bar chart, what reaches Claude's context and when: the MEMORY.md index at every session start, about 4,600 tokens; one note when Claude opens it, about 660; recalled memories on each real prompt with a close match, 297 (Supermemory plugin).

Tools. Halfway through a long task, agents often need something they didn't know they'd need. Every set of recalled memories ends with a pointer to Supermemory's search tool, so Claude can look things up on its own, the same way it would search a folder.

Keeping the raw text too

Even the best learning can't predict today what will matter later, and we've said so ourselves: "it's impossible to be able to accurately predict everything important for learning." So it still indexes everything raw, and on the API, search is hybrid by default: memories and the original chunks come back together, and the model decides what to use. (The Claude Code plugin's recall searches memories only.) Here's the full post:

X content is paused until you allow embedded content.

Open on X ↗

Our vibe test of Claude Code's auto memory

Here's how we'd score it (✅ works well, ☑️ partly, ❌ not built in), going by the docs and our own setups today:

  • Setup: ✅ none, it's on by default
  • Reading and editing it yourself: ✅ excellent
  • Recalling a fact when you ask it to check: ✅ good
  • Recalling a fact without being asked: ☑️ depends on whether Claude thinks to look
  • Pulling several notes together: ☑️ works once Claude opens them
  • Version history: ❌ not built in
  • Updates and contradictions: ☑️ up to Claude to notice and fix
  • Forgetting stale facts: ☑️ no expiry, so you or Claude delete them
  • Staying on your machine: ✅ great for privacy, though it won't follow you to another one

Overall, it's a thoughtful, transparent foundation: a notebook Claude keeps for you that you can always open and edit. Supermemory is built to sit alongside it, and in our sessions both run at once. It adds memory that connects facts, keeps track of how they change, and follows you from machine to machine. The trade-off is that with the plugin, that memory lives in your Supermemory account rather than in files on your disk.

Try it

Claude Code's plugin system makes it two commands:

/plugin marketplace add supermemoryai/claude-supermemory
/plugin install supermemory

Or set up all your coding agents at once: npx supermemory plugin finds Claude Code, Cursor, Codex and OpenCode on your machine and installs the plugin in the ones you pick. The plugins are available on every plan, and usage comes out of your plan's credits ($5 a month on Free).

Curious how many places Claude Code remembers you? Run ls ~/.claude/projects/*/memory/MEMORY.md. One of our machines has 6.

Oh, and something big is launching soon.

  1. How AI memory actually works. A beginner's guideHow AI apps remember things between chats, why a bigger context window doesn't solve it, and the parts every memory system shares.
  2. We're open sourcing the company brain. Here's how we designed the multiplayer harnessCompany Brain is now open source. A walkthrough of the multiplayer harness behind its Slack experience, from proactivity and memory boundaries to approvals and recovery.
  3. Jev changes a lot in memory & context engineering. Here's exactly how.We tested Jev across reranking, chunking, observation, and harness decisions. Here is where fast decision models help memory systems, where they cost more, and where they still fall short.
  4. I reverse-engineered Instinct's memory. Here's exactly how it worksInstinct keeps its memory as git-tracked markdown files, found with grep rather than vectors. Here is the whole system as far as black-box probing can reconstruct it, and how to rebuild it on supermemory in about 60 lines.
  5. An update to supermemoryWe've discontinued the supermemory company brain and Nova. Everyone who was charged has been refunded, our MCP and plugins continue to run, and we're going all in on the memory engine.
  6. Scaling Conversations: How Adapta Grew Usage Without Losing ContextAdapta added Supermemory as a persistent memory layer so every conversation keeps its context — letting the team scale usage without losing the thread.
  7. How Chatarmin Ditched RAG and Went Memory-Only with SupermemoryChatarmin replaced a heavy RAG pipeline with Supermemory's memory layer — cutting average AI response time from 40s to 12s and token usage by 40–50%.
  8. SMFS: making agentic retrieval 55% cheaper AND more accurateWe launched SMFS.ai (Supermemory Filesystem) a few weeks ago, with a simple bet: We can redesign the filesystem specifically for agents, with special files, structures, and commands that it can use for it's tasks. Today, SMFS is used by hundreds of companies to power their agents.
  9. Introducing Dynamic Dreaming: supermemory now connects the dots, for you.Dreaming is magical. TLDR: We're launching Dynamic Dreaming in supermemory today, which automatically works if you're using supermemory in any way - API, OpenClaw, Hermes agent, etc.
  10. Dear reader, we just made supermemory insanely cheap... the Context CloudWhen I first started building supermemory, I had one goal: To build the best memory system for AI. I would talk to customers, and find out that memory was not the only thing they needed - They were all setting up 7-8 different vendors at the same time.
  11. Introducing @supermemory/tools v2.0.0Today we're releasing v2.0.0. This release unifies the API across all agents sdk integrations from AI SDK to Mastra, makes conversation identity a first-class concept, and ships with memory saving on by default.
  12. Solving the Precision-Recall Tradeoff: Search Result AggregationWhen you're building memory for AI, search is your foundational layer. The way search generally works is straightforward: the user defines a query, and then sets a limit (top-K) on how many search results they want returned. Usually, this is set to 10 or 20.
  13. OpenClaw Memory Problems: Why It Forgets and How to Fix It (2026)OpenClaw remembers by writing Markdown files in its workspace, so it forgets anything the agent didn't save. Why that breaks down, how the supermemory plugin recalls and saves on every turn instead, and how to install it, free on every plan.
  14. Stateful Coding Agents with Memory: Build Long-Running Agents (2026)We built a plugin for Claude Code and OpenCode that gives your coding agent persistent memory. It remembers your preferences, learns your codebase, and never loses context mid-conversation. The result is an agent you can run for months without starting over.
  15. Clawd / Molt bot's memory SUCKS. We gave it supermemory.I'm the founder of supermemory. Clawd/Molt bot is blowing up right now, with many, many use cases. I set it up, too, and have been using it through telegram. TLDR: just go to https://supermemory.ai/docs/integrations/clawdbot to set up supermemory for your clawd bot.
  16. Catch up with our UNFORGETTABLE Launch WeekOver the last year, one belief has guided almost everything we’ve built at Supermemory AI becomes meaningfully useful only when it remembers. Memory shouldn’t be something developers rebuild from scratch. It shouldn’t be fragile, expensive, or trapped inside a single tool.
  17. Empowering the Next Generation of Founders: Supermemory Startup ProgramIf there’s one thing we’ve learned while building Supermemory, it’s that most startups don’t fail because they didn't build features; they fail when infrastructure slows them down, or they built too slow.
  18. Building code-chunk: AST Aware Code ChunkingAt Supermemory, we're building context engineering infrastructure for AI. A huge part of that is dealing with code: ingesting repos, understanding structure, and making it searchable. The problem is that most code chunking solutions are terrible. We built code-chunk to fix this.
  19. Supermemory raises $3 million with the best memory engine for LLMsToday, I am excited to announce our first funding round to accelerate our mission of building an interoperable, scalable and reliable memory for LLMs and agents. Memory is one of the hardest challenges in AI right now.
  20. Mem0 vs Supermemory: Why Scira SwitchedScira AI moved its production memory layer from Mem0 to Supermemory. This is what failed, what improved, and how the team evaluated the two systems.
  21. Never Record Again: How Montra Uses Supermemory to Rethink Video CreationCampbell Baron, the founder of Montra, has been making videos since he was twelve. By thirteen, he was already doing brand work. Today, he’s betting on a very different future for creators: a world where recording is the exception, and most videos are generated from scratch.
  22. Unified Memory That Works Where You Work: Your Second Brain With SupermemoryHi everyone, I’m Dhravya, the founder of Supermemory. I want to start with a little story behind why this product means so much to me. You can also skip straight to what it is and how it works below.
  23. Supermemory just got faster on PlanetScaleWhat is Supermemory? Supermemory completes the missing part of the LLM puzzle: memory. Just as memory is crucial for human intelligence, it's essential for truly intelligent AI systems.
  24. Faster, smarter, reliable infinite chat: Supermemory IS context engineering.People are obsessed with prompts and prompt engineering. Sure, what you say is important, but what the model knows when you say it is the difference between a stateless text generator and an intelligent AI system. In short, context is the most crucial component.
  25. We solved AI API interoperabilityOne API to rule them all, One spec to find them, One library to bring them all and in the TypeScript, bind them. When we were building the Infinite Chat API, initially, we only supported the OpenAI format. This was fine, until a lot of our customers started asking for more.
  26. The Wow Factor of Memory - How Flow Used Supermemory To Build Smarter, Stickier ProductsOverview: Flow is a note-taking app built around a bold vision: to create a more personal, context-aware writing experience powered by AI. At the heart of this mission is memory.
  27. The UX and technicalities of awesome MCPsLast month, we launched the Supermemory MCP, mostly to test our own infrastructure and get some initial traction. It blew up. To my absolute surprise, the initial launch itself got half a million impressions (!!!). Then, we launched and got #2 on ProductHunt too.
  28. Architecting a memory engine inspired by the human brainLanguage is at the heart of intelligence, but what truly powers meaningful interaction is memory — the ability to accumulate, recall, and contextualize information over time. Large Language Models (LLMs) have mastered language, but memory remains their Achilles’ heel.
YOUR PRIVACY

Change or withdraw any time via Cookie settings in the footer. Read our cookie notice.