GuideClaude CodeIntermediate25 min to do

I told Claude Code five facts, then started a brand-new session. It remembered all five only when I asked it to.

A new Claude Code session starts blank, so what does it actually carry over? I tested five ways of keeping five project facts, including a correction and a later update, and found that Claude Code's built-in memory is quieter and less predictable than I expected.

15 of 15 facts kept when asked to remember, 10 of 15 when not
CC
Claude Code Lab
·November 26, 2026·6 min read
I told Claude Code five facts, then started a brand-new session. It remembered all five only when I asked it to.

Level: Intermediate. About 25 minutes. Needs a Claude Code login and a terminal.

Every Claude Code session starts blank. You told it yesterday that staging runs on port 5433 and the team deploys on Tuesdays and Thursdays. Today it knows none of that, unless something carried it over.

Something can. Claude Code can keep notes between sessions, you can keep your own notes file, or you can continue an old conversation. I wanted to know which of these actually works, so I tested them with five invented project facts and a brand-new session each time.

Anthropic published a research post this month on how agent memory works. Two of its warnings are the ones I wanted to test: notes you write can be wrong and still get trusted later, and a long instructions file is less reliably followed than a short one.

The test

In session 1 I told Claude Code five facts, one of them with a correction in the middle. In session 2, a fresh one, I asked for the facts back as JSON and said to use null for anything it didn't know and not to guess.

The two prompts

The correction matters: I said "npm test... sorry, correction: it is npm run check." A memory that kept the wrong version would be worse than no memory at all.

Then, in later sessions, I changed two facts: the on-call engineer, and I added Friday to the deploy days. I asked the same questions again to see whether old notes got replaced or just piled up.

I ran each setup three times, 15 facts per setup. One more thing: Claude Code has a built-in memory feature that is on by default, so for the setups that test other methods I switched it off with the environment variable CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. I found out the hard way why that matters, and I'll get to it.

The results

Five ways of keeping five facts

With nothing saved, it got zero of fifteen. Every answer was null. That's the behaviour I wanted: it said "I don't know" instead of making something up.

Continuing the same conversation (--continue) got fifteen of fifteen. That's not really memory. It replays the old conversation, so it only works for the most recent one. It was also cheaper in these runs, about 1 to 2 cents against 7 to 12 cents, probably because the earlier conversation was already cached. I didn't dig into why.

Telling Claude Code "please remember all of this for future sessions" got fifteen of fifteen, and kept getting it right after I changed two facts. It wrote its own notes, updated them rather than adding contradictions, and the correction survived: all three runs gave npm run check, never npm test.

Saying nothing got ten of fifteen. This is the surprise.

It saved notes without being asked

In my first round I hadn't switched the built-in memory off. The "say nothing" setup was supposed to be my empty baseline. In two of three runs it answered perfectly anyway. Nobody had asked Claude Code to save anything, but it had.

Here is what it wrote in one of the "please remember" runs, in a folder I never created:

Notes Claude Code wrote by itself

There's an index file, and a notes file with a short "why" and "how to apply" for each fact. The on-call entry was marked as time-bound: "verify freshness." In the third "say nothing" run it wrote nothing, and every answer was null.

So by default, whether Claude Code remembers something you merely mentioned is a coin flip. If a fact matters, say so: "please remember this" worked three times out of three. That's all I tested.

My own notes file did worse

I also tried the do-it-yourself version. I put a rule in CLAUDE.md: at the end of a session, save the still-true facts to MEMORY.md; at the start, read it. With Claude Code's built-in memory switched off, this got ten of fifteen.

The failed run is a good warning about wrong notes:

When the notes are missing or wrong

In that run, Claude Code read my rule and said "Got it," but it never wrote the file. The next session found no notes and answered null to everything, which is fine. But then I told it the on-call had changed. It created MEMORY.md containing only the two updates, with the old facts gone. Its own note about Fridays was worded loosely ("not restricted to weekdays excluding Friday"), and in the next session it read that as Monday through Friday, which nobody ever said.

That's exactly the failure Anthropic's post warns about: a wrong note gets trusted.

What I'd do with this

  1. Say "please remember" when it matters. It's the most reliable thing I tested.
  2. Look in the memory folder. Claude Code keeps its notes in a memory folder inside its project folder under ~/.claude/projects/, with an index file. Open it now and then and delete what's wrong.
  3. Don't rely on a rule in CLAUDE.md to write notes. It ignored mine once in three. A rule that depends on Claude remembering to follow it is a request, not a guarantee.
  4. Use --continue for "the thing we were just doing". It's exact, but only for the last conversation.
  5. Keep notes short and specific. The run that went wrong had one vague line, and the model filled the gap.
  6. Make "I don't know" an acceptable answer. My "do not guess" instruction is the only reason the empty runs were harmless.

What I didn't test

  • Five invented facts, three runs per setup, one model (Sonnet 5, the default) on one day. A real project has hundreds of facts and a messy history.
  • I tested simple facts. Memory for things like coding style or past mistakes is harder to score, and I didn't try it.
  • I tested the headless mode (claude -p). The interactive app might behave differently.
  • I didn't test how the notes hold up after weeks, or whether old notes get cleaned up on their own.
  • Costs: Claude Code reported 1 to 13 cents per run. I'm on a Pro plan, so I wasn't billed per run.

Sources

  • https://www.anthropic.com/research/components-of-agent-memory
  • https://code.claude.com/docs/en/headless

Editorial note: We ran the steps in this guide ourselves and the screenshots come from those runs. Your results may differ with your plan, model or settings, so check anything important. Cover illustrations are AI-generated. Discovia is independent and not affiliated with Anthropic.

Share this guide X LinkedIn

New guides and tools

Hands-on Claude guides, straight to your inbox

Step-by-step walkthroughs of what's new in Claude and Anthropic's tools, with real screenshots and honest results, including what didn't work. No hype, no jargon, no noise.

By subscribing, you agree to receive newsletter and marketing emails, and accept our Terms of Use and Privacy Policy. You can unsubscribe anytime.

Claude Code Lab

Tests of Claude Code features: hooks, skills, rules files and workflows, with the numbers.

More Claude Code guides →

More from this author

Claude Code

I asked Claude to review a pull request with six planted bugs. Without the spec it found three. With it, all six.

Nine reviews, six planted bugs, three setups. Claude never invented a problem, but it could only catch what the code itself shows. The thing that moved the score from three to six was one short file saying what the change was meant to do.

C
Claude Code Lab
5 min read
Read next

Comments

Related Guides