4 The Guide 5 Almost Architect ~9 min

AI Agent Memory: How Claude Remembers You Between Sessions

One minute it already knows your habits, the next it asks the same thing over and over - let's figure out why

How AI agent memory works: what instincts, confidence, and memory scope are, why an agent's long-term memory lives in files rather than the model, and how to set it up.

ECC skills in this lesson: continuous-learning-v2

Agent memory in plain English

Picture a new barista at your favorite coffee shop. Day one, you tell them: oat milk cappuccino, no sugar. They nod, make it, perfect. The next day you walk in and it’s right back to “How do you take it?” And the day after. And a week later. Every. Single. Time. From scratch.

Annoying, right? That’s exactly how a bare model behaves. Within a single conversation it’s brilliant - it remembers every little detail. But close the chat and you’re a stranger to it all over again. Not because it’s dumb. It literally has nowhere to keep notes on you between visits.

Now picture that barista keeping a little notebook: regular, cappuccino, oat milk, no sugar. They open it in the morning, read it, and greet you like an old friend. That notebook is the agent’s memory. And the whole trick is in what you write there and how.

A barista robot with a notebook listing a regular customer's preferences
The model doesn't remember you. The notebook does. An agent's memory is its notebook.

Why a vibecoder should understand AI memory

You’re a vibecoder. You run an agent through your project day in, day out. Once you get how it remembers, a few things click into place at once:

  • you stop explaining the same thing for the tenth time - the agent picks up your habits on its own;
  • you know where to put an important rule so it survives a restart;
  • you stop getting blindsided by the classic “new chat - forgot everything - did its own thing”;
  • you understand why the agent sometimes confidently does it the way you like and sometimes plays it safe.

The whole difference between “starting from zero every time” and “the agent already knows my project” comes down to three things: where the memory lives, what form it takes, and how much the agent trusts it. Let’s break it down.

How Claude’s memory is built: instincts, confidence, and scope

In smart memory systems (like the continuous-learning skill), the agent doesn’t dump everything into the notebook. It writes neat little chunks. The whole thing rests on three pillars.

An instinct is a single habit, not a wall of text

Memory isn’t written in paragraphs like “here’s what happened yesterday.” It’s written as instincts . An instinct is an atomic building block: one trigger, one action. That’s it.

For example: when I write a new function, do it in a functional style. Or: when I save a file, read it first. Small, specific, no fluff. Blocks like these are easy to add, easy to verify, and no big deal to toss out once they’re outdated.

Confidence is how much the agent trusts a habit

Every instinct has a number attached - a confidence from 0.3 to 0.9. That’s the difference between “no sugar, right?” and “oat milk cappuccino, the usual - pouring it now.”

ConfidenceWhat it meansHow the agent behaves
0.3A timid guessOnly suggests, won’t push it
0.5Middle of the roadApplies it if it fits
0.7StrongDoes it itself, no asking
0.9Nearly rock-solidDefault behavior, taken for granted

Confidence rises when a habit repeats and you don’t correct it. And it falls when you say “no, not like that” or the pattern hasn’t come up in a while. So memory isn’t set in stone - it lives and adapts to you.

A confidence scale from a timid guess to an iron-clad rule
The longer you go without correcting it, the bolder the agent gets about doing things the way you like.

Memory scope: a rule for one project or for everything

Here’s the part beginners trip over. Memory lives in two scopes:

  • Per project - it only applies inside that one project. This is where language and framework conventions go: use React hooks, put tests in the tests folder, the style here is such-and-such.
  • Global - it applies everywhere. This is where universal truths go: always validate user input, write tests, read the file first, then change it.

Good memory vs. bad memory: the pros and cons

Memory working for you
  • Important rules live in files, not in a single chat message that vanishes.
  • Memory is atomic: one note, one fact, no walls of text.
  • Facts have a confidence - weak ones get suggested, strong ones apply on their own.
  • Memory gets cleaned up: stale stuff is deleted, not hoarded for years.
  • Local rules live per project, universal ones live in the global scope.
Memory working against you
  • Memory has turned into a junk pile - the agent burns context reading garbage.
  • Notes contradict each other: one says “do it this way,” another says “never do this.”
  • Secrets (passwords, keys) ended up in memory - and then the file leaked.
  • Habits from another project creep in where they don't belong and break the logic.
  • The agent trusts an old note even though the project changed long ago.

Agent memory in practice: a real example

You spend a week building a site. And every single time you dictate to the agent from scratch: 8-pixel spacing, rounded buttons, text in Russian. By day five it’s a real headache, and you genuinely don’t get why it just won’t remember.

Of course it doesn’t - you never gave it a notebook. A vibecoder who gets it does it differently: you ask the agent once to set up a memory file and stash habits in it. From then on, the notebook keeps itself.

Prompt - copy it and try it

Set up a MEMORY file in this project with my habits and maintain it yourself.

Rules for keeping it:

  1. Write short bullet points in the style of “when I do X, do Y.” One bullet, one fact.
  2. What we already know: 8-pixel spacing, rounded buttons, all text in Russian.
  3. If I correct you, update the relevant bullet - don’t spawn duplicates.
  4. If a fact is outdated or conflicts with a new one, delete the old one - don’t keep both.
  5. No passwords, keys, or secrets in this file.
  6. At the start of every new session, read this file first, then start the task.
Meme: in a new session the agent happily does everything its own way, because the rules only lived in the chat
A classic of the genre: “but it remembered this yesterday!” It didn't. That only lived in the chat.

Why the agent forgot your habits: a diagnostic checklist

Agent forgot your habits? Run through the checklist before you lose it:

  1. Is the rule actually in a file? Said it once in the chat? After a restart it’s gone. Move it into memory.
  2. Any duplicates or contradictions? If memory holds both do A and never A, the agent will flip-flop. Clean it up.
  3. Is it a junk pile? The memory file has ballooned into a wall of text - break it into short, atomic bullets.
  4. Is the rule from another project? A local habit may have wandered to the wrong place. Check where it lives.
  5. Has the fact gone stale? The agent genuinely trusts an old note. If everything in the project changed, update the entry.

Common beginner mistakes with memory

  • Believing the AI will remember on its own. Without a memory file, it starts every session with a blank slate.
  • Keeping rules only in the chat thread. Close the chat and the rules are gone. Move them into a file.
  • Writing memory as walls of text. The agent will drown in it. Chop it into short “when X, do Y” bullets.
  • Hoarding and never cleaning up. Old, contradictory notes confuse the agent worse than an empty file.
  • Stashing secrets in memory. A file will leak one day. Passwords and keys - never in memory.
  • Being surprised a habit didn’t fire in another project. Per-project memory is locked to its own project - that’s a feature, not a bug.

TL;DR - если коротко

  • The model itself remembers nothing between sessions. An agent's memory is files on disk, and it re-reads them from scratch on every launch.
  • Good memory doesn't store walls of text - it stores instincts, tiny rules of the form “when X, do Y.”
  • Every instinct has a confidence from 0.3 to 0.9: weak ones are merely suggested, strong ones fire on their own.
  • Memory splits into project and global: React rules stay in the React project, while “always validate input” works everywhere.
  • Good memory is atomic and gets cleaned up: one note, one fact; stale stuff gets deleted, not hoarded.
  • Secrets have no place in memory. Passwords and keys stay out: a file leaks sooner or later.

Search Wiki

Press Esc to close

Enter a search term to query all course pages and lessons.