TL;DR
- Agentic memory is a notebook your coding agent keeps for itself: it writes down what it learns while working and reads it back in the next session.
- The early numbers look promising. In Anthropic's benchmark, a memory folder roughly doubled the score of some models, but an older model barely improved. In GitHub's A/B tests, Copilot Memory raised the share of merged coding agent pull requests from 83% to 90%.
- You don't have to build it: Squad, Copilot Memory and Copilot Dreaming already do this. But a small notebook of your own is a good way to learn what works.
- My rules for starting small: one folder of Markdown, explain why instead of how, only save what the agent can't look up, make every note checkable, and let an agent tidy it up every week.
- I tried it on a small webshop. The agent read only the notes it needed, saved a decision the code couldn't explain, and the weekly clean-up caught 6 of 7 problems I planted.
I've been demoing Squad, a framework for AI agent teams, quite a lot lately. One part kept catching my attention: the memory. Every agent keeps its own history file, and there's a shared decisions.md that the whole team reads before starting. Close the chat, open a new one, and the team picks up roughly where it left off.
That made me look at how I usually work with coding agents. A new chat often means starting from zero. The agent might walk into the same trap as yesterday, or ask about a decision you already explained. Instruction files help, but they don't capture what the agent learns along the way.
So I wanted to understand agentic memory a bit better: what it is, what the evidence says so far, and how you could try it without building a big system. To be clear, this is about memory for the agents that help you build software: in your editor, your pull requests and your CI. Not about adding memory to the AI features in your own product. That's a different topic.
Chapters
- So what is it?
- Does it actually help?
- You don't have to build it yourself
- How I'd start: small
- So I tried it
- What I like about this
- What's not there yet
- Want to try it?
- References
So what is it?
The idea is pretty simple: give your coding agent a notebook. While it works, it writes down stuff that's worth keeping, like facts, rules or mistakes to avoid. Next time it starts, it reads the notebook first (ideally only the bits that matter) instead of starting from zero.
GitHub puts it like this in their post on Copilot's memory: "Cross-agent memory allows agents to remember and learn from experiences across your development workflow, without relying on explicit user instructions." So it's really about agents that work on their own. They should be able to self-instruct. Not self-destruct.
I like to think of every note as a little bet. A rule says "I think this will come up again." A checked fact says "trust me, you don't need to check this again." And from what I've read so far, newer models seem to be getting better at making those bets.
Does it actually help?
I wanted numbers, not vibes. Two places had them.
Anthropic: memory only helps if the model knows how to use it
Anthropic wrote about this in The components of agent memory, using a benchmark called CL-Bench (Continual Learning Bench). The setup is neat. It's not a coding task, but it tests the same skill a coding agent needs: learning from one session and using it in the next. The agent gets thirty questions, and for each one it has to look things up in a database to find the answer. Afterwards it's told the right answer and can leave itself a note in a memory folder.
The catch: every question starts in a brand new session. The agent forgets everything except that folder. So the only way to do better next time is to write down what it learned. Same model, same questions, with or without the folder.
Scores run from 0 to 1:
- Sonnet 5 doubles, from 0.31 to 0.61.
- Opus 4.7 goes from 0.38 to 0.70, and Opus 5 from 0.56 to 0.83.
- Opus 5.5 and Sonnet 5.5 go from about 0.65 to about 0.84.
- Sonnet 4.6, with the exact same setup, barely moves: 0.33 to 0.36.

So just having memory isn't enough. Sonnet 4.6 mostly wrote down guesses it never tested, and often didn't even read its own notes. Once it was told to read its memory first and test its ideas, its score nearly doubled. Sonnet 5 just does that by itself: it reads its memory nine out of ten times, where the older model did it less than half the time.
My favourite bit: rules can backfire. When Anthropic told Opus 5 and Opus 4.7 to "record only failures", they lost a big part of what memory had given them. So with good models, you explain what the memory is for and let them figure out what's worth saving.
GitHub: notes that point to the code
GitHub's take is very practical. Every memory comes with citations, links to the exact lines of code that back it up. Before the agent uses a memory, it's prompted to check those lines. If the code disagrees, it's encouraged to write a corrected version.
In their A/B tests, pull requests from the Copilot coding agent got merged 90% of the time with memory, against 83% without. Code review comments got positive feedback 77% of the time instead of 75%. Not huge jumps, but real ones, and GitHub says both are highly statistically significant.

You don't have to build it yourself
Lots of agent frameworks already have memory built in. Squad is the one I started with (here's how its memory works): decisions and history live as files in your repo, so a new chat picks up where the last one stopped.
GitHub now also gives you two things out of the box.
Copilot Memory is the feature from that GitHub article. While Copilot works, it saves two kinds of things:
- Facts about a repo, about how a codebase works. These only apply in that repo and are shared with your collaborators there. Each fact cites the code that backs it up.
- Your own preferences, like how you want answers presented or which actions need your approval. These follow you from repo to repo.
What I like is that it works across the board: the CLI, the cloud agent, code review and more. So something the cloud agent learns while fixing a bug can help code review on the next pull request, and the other way around. It's available on all paid plans, and it's off by default, so you choose where to turn it on. You can also add memories yourself: just ask Copilot to remember something, in the CLI, the cloud agent, the Copilot app or VS Code, or even in a pull request comment. You can also bulk-import prepared memories with the CLI (here's how). It's not a guarantee though: the model still decides whether to store it. And you can't type or edit a memory directly in the settings on GitHub.com.

In the repo settings you can see what it has stored and delete what you don't want. Memories also expire after a while (90 days by default) unless Copilot confirms they're still valid, so old stuff doesn't stick around forever. One nuance from the docs I think is important: checking a memory against the code is a judgment call by the model, not a guarantee. So rules that must always apply still belong in your instruction files.
About GitHub Copilot Dreaming is new and in public preview. It runs in the background, looks back at your Copilot sessions and pull request reviews, adds useful stuff, fixes outdated guidance and removes duplicates. It updates memories by itself, but changes to your instruction files and skills come in as a pull request, so you stay in charge. The preview needs access to GPT-6.1 Sol and isn't available on Copilot Pro.
How I'd start: small
Before you switch everything on, I'd build a tiny memory system yourself and see if it actually helps in your repo. Here's what I'd keep in mind.
- Start with a notebook. One folder, a few Markdown files. No database, no extra tooling. You can always grow it later if it turns out to be worth it.
- Tell it why, not how. Explain what the memory is for and let the model decide what to save. One exception: with an older model, do tell it to read its notes first.
- Only write down what it can't look up. This goes for all your instructions, not just memory. Researchers at ETH Zurich tested AGENTS.md files: they made agents over 20% more expensive on average, without clearly solving more tasks. Files the agents wrote themselves did slightly worse and human-written ones slightly better, but neither difference was statistically significant. Your agent can already read your code. Copying it into notes just eats context and goes stale. Write down the why instead: decisions, unwritten rules, known traps, stuff that didn't work. My quick test: "Could the agent find this in the repo?" If yes, skip it.
- Make every note checkable. Say where it came from (a file and line, a link, a test) and whether it's confirmed or still a guess. Code changes. And sometimes a note is just wrong from day one.
- Let an agent clean up every week. Basically your own mini Dreaming. With GitHub Agentic Workflows you write the workflow in plain Markdown and it runs as a GitHub Action. Something like: "Check every memory against the code. Fix or remove what's wrong, merge duplicates, and open a pull request."
So I tried it
I built exactly that into Planet Pizza, a small alien-themed webshop I use for demos. Pizzas, some merch, a lot of UFO jokes. It has a React frontend and an Express backend with SQLite, so it's small but realistic enough to have a few traps.
What the notebook looks like
The whole memory system is a handful of files:
.github/
copilot-instructions.md ← one short section: "read memory/README.md first"
workflows/
memory-check.yml ← runs the checker on every pull request
memory-tidy.md ← the weekly clean-up, as an agentic workflow
memory/
README.md ← what the notebook is for, and how to read and write notes
decisions.md ← choices that were made, and why
conventions.md ← unwritten rules for how things are done here
traps.md ← things that look fine but break
attempts.md ← things that were tried and didn't work
scripts/
check-memory.mjs ← checks that every cited file and line still exists
The instructions file only points the agent to the notebook:
Read
memory/README.mdand the notes relevant to your task before you start. Treat a note as a lead, not a fact: check its evidence against the current code before you rely on it, and fix or remove it if the code disagrees.
All the real behaviour lives in memory/README.md. It's about a page long, written for the agent rather than for humans, and it's the heart of the whole thing. Here it is in full:

That's it. No code, no framework. If I want the agent to behave differently, I edit a sentence in this file.
Every note follows the same format. Here's one of the traps:
## Product queries must filter out `category = 'option'`
- **Status:** confirmed
- **Evidence:** `backend/src/routes/products.ts:19` → `WHERE category IN ('pizza', 'merch')`
- **Evidence:** `backend/src/routes/orders.ts:77` → `AND category IN ('pizza', 'merch')`
- **Checked:** 2026-11-11, read both routes
- **Why it matters:** The products table also holds 20+ custom-pizza options (see
`decisions.md`). Any new query on `products` without this filter puts "Mozzarella"
and "Small" on the catalog page and lets them be ordered as menu items.
The heading is the claim. The status says whether it's confirmed or still a guess. The evidence points to an exact file and line, plus the text that should be on that line, so the checker can tell when the code has moved or changed. And "why it matters" is the part you can't get from the code. Same idea as GitHub's citations, just in plain Markdown.
To give it something to work with, I seeded the notebook with 14 notes. Eight were good. Six were wrong or stale on purpose, so I could test the clean-up later.
Test 1: does the agent use the notebook?
I asked for a "Today's Specials" section on the home page with three random products from a new endpoint. That's exactly where the trap above bites: a lazy SELECT * FROM products would put Mozzarella on the specials list.
The first time, the agent got the filter right but its final answer didn't mention the notebook at all. And the same filter was already a few lines up in the same file. So did it learn from its notebook, or just copy its neighbour? From the chat alone, I couldn't tell. So I added this to the README:
In your final reply, name every note you relied on (by its heading) and say how it changed what you did. If no note applied, say so. This shows whether the notebook is actually being used.
Then I ran the same task again. The session log shows how it went about it:

It read the README, scanned all the headings, and then opened just three notes out of fourteen. Right after reading them it said: "The products table also contains pizza-building options, so I'll exclude those." And this time the final answer named the notes it used:

And the code keeps the cheese off the menu:
+productsRouter.get('/specials', (_req, res) => {
+ const rows = db
+ .prepare("SELECT * FROM products WHERE category IN ('pizza', 'merch') ORDER BY RANDOM() LIMIT 3")
+ .all();
+ res.json(rows);
+});
Funny detail: when I went back to the log of the first run, it had opened the exact same three notes. It just didn't tell me. So the notebook was being used both times; the README line only made it visible. To be fair, it also read products.ts, where the filter already existed, so the note and the code pointed the same way. That's how it should be, really. The note is there for the day the code doesn't make it obvious.
Test 2: does it write good notes?
Next I asked: "Raise the free-delivery threshold to $40. Marketing picked $40 because our average order is about $32 and they want to nudge earthlings into adding one more item. Don't change it again without checking with them."
That reason only lived in my head and in my prompt. It's nowhere in the code. That's exactly the kind of thing that gets lost.

The code change itself is small. The threshold sits in the cart and the checkout, and the banner text is in the layout:
// frontend/src/pages/CartPage.tsx (CheckoutPage.tsx has the same change)
-const FREE_SHIPPING_THRESHOLD = 3500;
+const FREE_SHIPPING_THRESHOLD = 4000;
// frontend/src/components/Layout.tsx
-🛸 Free unmarked-craft delivery on transmissions over $35
+🛸 Free unmarked-craft delivery on transmissions of $40 or more
And in the same change, it added this note to memory/decisions.md:
## Free delivery is a Marketing-owned incentive to add one more item
- **Status:** confirmed
- **Evidence:** `frontend/src/pages/CartPage.tsx:6` → `const FREE_SHIPPING_THRESHOLD = 4000;`
- **Evidence:** `frontend/src/pages/CheckoutPage.tsx:7` → `const FREE_SHIPPING_THRESHOLD = 4000;`
- **Checked:** 2026-11-12, user explicitly selected $40 and required checking with Marketing before future changes
- **Why it matters:** Marketing chose $40 because the average order is about $32
and the gap should nudge earthlings into adding one more item. Check with
Marketing before changing this threshold again; do not tune it independently.
That's a good note. It doesn't repeat the number for the sake of it; it saves the reason and the rule ("check with Marketing first"), and points to where the number lives. It also ran the checker before finishing: no errors, just a few warnings about older notes that weren't part of this task.
Then I asked a follow-up: "Is there anything from this change a future agent would trip over?" It named two gotchas: the threshold is copied in two files, and exactly $40 already counts. But it chose not to write those down. That's the README doing its job:
Quick test before you write: "Could the next agent find this in the repo in under a minute?" If yes, skip it.
A quick search finds both files, so no note. That's a choice, not a law of nature. If your team does want traps like that saved, you change that one line, and the next session behaves differently.
Test 3: does the clean-up work?
Notes go wrong over time, so a weekly agentic workflow goes through the notebook. Here's the core of it:
---
on:
schedule: weekly on monday
workflow_dispatch:
engine: copilot
safe-outputs:
create-pull-request:
title-prefix: "[memory] "
---
# Tidy the memory notebook
1. Run `node scripts/check-memory.mjs`. Then run it with `--fix` to update
line numbers that only moved.
2. For every note, read the cited code and decide whether the claim is still true.
Don't stop at the checker: the anchor can still be there while the claim
around it has changed.
3. Merge notes that say the same thing. Delete notes that only repeat what the
code, `README.md` or `.github/copilot-instructions.md` already make obvious.
...
The workflow only gets read access to the repo. Any change comes out as a pull request for a human to review. I kicked off the first run by hand. GitHub Actions wasn't allowed to create pull requests in that repo yet, so it pushed a branch and I opened the pull request myself:

My favourite catch is this one. The note looks perfectly valid: the cited line still exists. But the line says the opposite of the claim:
-## Orders start as `pending` and move to `paid` after payment
-
-- **Status:** confirmed
-- **Evidence:** `backend/src/db/index.ts:35` → `status TEXT NOT NULL DEFAULT 'paid'`
-- **Checked:** 2026-08-14, read the orders schema
-- **Why it matters:** Order history and the confirmation page should show a "pending"
- badge until payment is confirmed. Never insert an order as `paid` directly; let the
- payment step flip the status.
A script would have said "line still there, all good". The agent actually read it.
It also fixed my main instructions file, which still said pizzas couldn't be customized while the shop already had a build-your-own flow:
-- **Pizzas are fixed menu items.** No size/topping customization.
+- **Pizzas are fixed menu items**, plus a Build-Your-Own flow (size, crust, sauce,
+ toppings) backed by `category = 'option'` rows in `products`. Beyond that, no
+ further customization.
Because that file steers every agent in the repo, the pull request flags it as a protected file that needs a careful human look before merging.
So how did it do against the problems I'd planted?
Caught:
- a note whose line number had moved (fixed)
- the false "orders start as
pending" note (removed) - a note about an endpoint that only existed on an old branch (removed)
- a guess that toppings could be charged twice (disproved: the code removes duplicates)
- two notes that said the same thing (merged)
- the outdated line in the instructions and README (fixed)
Missed:
- a note that just repeated advice from the instructions file. The workflow says to delete those, but it kept it.
Six out of seven. And as a bonus it confirmed one guess I hadn't planted: that stock for build-your-own options is checked per line, not per order. That run cost about 35 AI credits.
What I like about this
It's all just text in your repo. Notes are reviewed in pull requests, versioned with the code, and you can see who changed what and why. If a note is wrong, you revert it like any other change. Nothing lives outside your repo.
You control the behaviour with plain words. Want the agent to cite its notes? One line. Want it to save gotchas too? Change one line. No config, no code. I changed the agent's behaviour twice in this experiment, and both times it was a sentence in a README.
It stays small. Because the agent scans headings first and only opens what's relevant, it read three notes out of fourteen. And the "could you look it up?" rule keeps the notebook from turning into a copy of the code.
Notes are checkable, so they don't silently rot. The checker runs on every push and pull request, and the weekly clean-up actually reads the code behind each claim. A wrong note is worse than no note, because the next agent trusts it.
It captures the why. The free-delivery decision is the best example. The code says 4000. Only the note says why, and who to ask before changing it.
It's not tied to one tool. It's just Markdown, so any agent that can read files can use it. And it doesn't compete with Copilot Memory: Copilot Memory learns automatically across all Copilot surfaces, while a notebook like this is explicit and reviewed by your team. You can use both.
What's not there yet
It's not all solved, though.
I'm partly taking the agent's word for it. The session log shows which notes it opened, and the final answer says which ones it used. But in my test, the code pointed the same way as the note, so I can't prove the note changed the outcome.
This is a tiny experiment. Two tasks, one small repo, and notes I planted myself. That's a long way from the benchmarks and A/B tests earlier in this post. It shows the mechanics work, not that it pays off on a big codebase over months.
The clean-up isn't perfect. It missed one of seven problems. That's why it opens a pull request instead of changing things directly, and why someone still has to read that pull request.
It costs something. Every clean-up run uses AI credits, and every session spends a bit of context reading the notebook. Worth it if the notes save the agent from a trap, wasted if they don't.
And someone has to care. Just like instruction files, a notebook works best when the team agrees on what goes in it. The README helps, but it's still a habit you have to build.
Want to try it?
I pulled the memory part out into its own repo: agent-notebook. Run npx github:mvanderbend-msoft/agent-notebook in your repo and you get the notebook, the checker and the weekly clean-up in one go. Then give your agent one real task and see if it read the notebook, wrote something worth keeping, and skipped what it could look up.
If you try it, or memory made things worse for you, I'd really like to hear about it. 🛸
References
- Squad: GitHub repository and Memory and Knowledge
- Anthropic: The components of agent memory
- Asawa, Glaze et al.: Continual Learning Bench: Evaluating Frontier AI Systems in Real-World Stateful Environments
- GitHub Blog: Building an agentic memory system for GitHub Copilot
- GitHub Docs: About GitHub Copilot Memory
- GitHub Docs: Manually creating memories for GitHub Copilot
- GitHub Docs: About GitHub Copilot Dreaming
- Gloaguen, Mündler-Sasahara et al.: Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents?
- GitHub Docs: GitHub Agentic Workflows
- My memory kit: agent-notebook