[{"data":1,"prerenderedAt":60},["ShallowReactive",2],{"blog-ai-agent-memory":3,"blog-related-ai-agent-memory":42},{"slug":4,"title":5,"description":6,"category":7,"categoryId":8,"keyword":9,"date":10,"minutes":11,"body":12,"html":13,"headings":14},"ai-agent-memory","AI agent memory: what to keep, where, and how much","How to give an AI agent a memory that works. The kinds of memory an agent needs, why plain files beat a vector database for most of it, what deserves a line, why a cap helps, and how it remembers further back.","Agents & automation","agents-automation","ai agent memory","2026-11-25",6,"There are two ways an agent's memory fails. The first is no memory at all: every session starts blank, and on Tuesday it asks again what you told it on Monday. You stop correcting it, because the correction won't last.\n\nThe second is too much memory. Every conversation is kept and fed back, the agent reads a thousand lines before each answer, half of them out of date, and it confidently follows a rule you dropped three weeks ago.\n\nGood agent memory sits between the two, and it's mostly a writing problem, not a database problem: deciding what deserves a line, keeping it short, and keeping it true.\n\n## What kinds of memory does an agent need?\n\n\"Memory\" covers several things that behave differently:\n\n| Kind | Holds | Who writes it | When it's read |\n| --- | --- | --- | --- |\n| Instructions | Its job, its rules, its tone | You | Every run |\n| Long-term memory | Preferences, corrections, decisions, facts it'll need again | The agent, as it learns | Every run |\n| About you | Who you are, how you work, rules for every agent | You and the agents | Every run, by every agent |\n| Work log | What it did, day by day, what's next | The agent, after each run | The last few days every run, the rest when needed |\n| Conversations | Everything said | Nobody, it's a transcript | Only when searched |\n| Knowledge | Docs, code, files, skills | You and the agents | When a task needs it |\n\nThe first four are small and always loaded. The last two are large and only searched. Mixing them up is where most designs go wrong.\n\n## Why not just keep every conversation?\n\nBecause whatever is loaded is paid for, on every run, and competes for the model's attention:\n\n- **Cost.** A memory read at the start of each run is billed each time. Ten thousand tokens of history on a routine that runs every hour adds up fast.\n- **Staleness.** Conversations record what was true then. \"Use the staging database\" from a month ago is still in there after you moved to the new one.\n- **Contradictions.** The longer the history, the more it disagrees with itself, and the model has to guess which version wins.\n- **Dilution.** One important rule in a thousand lines of chat gets less attention than the same rule in a list of twenty.\n\nKeep conversations, by all means, but as an archive the agent can search when it needs to, not as something it rereads every time.\n\n## Plain files or a vector database?\n\nFor what an agent reads every run, plain files. A short Markdown file of bullet points is:\n\n- **Readable.** You can open it and see exactly what the agent believes.\n- **Editable.** A wrong line is fixed in two seconds. Try that with an embedding.\n- **Searchable.** The agent can grep its own work log like any other folder.\n- **Portable.** It goes into git, a backup, or a teammate's copy of the agent, as is.\n\nVector search earns its place for the archive: finding a decision from five months ago in a thousand pages of notes, by meaning rather than by exact words. Even there, it's the search that changes, not the storage. The notes stay text.\n\n## What deserves a line in an agent's memory?\n\nSave at the moment you learn it, one short line each, in plain words:\n\n- **A correction.** \"Don't open a pull request for typo fixes, commit them on main.\"\n- **A preference.** \"Weekly report as a table, revenue first.\"\n- **A decision, with its why.** \"Refunds only within 30 days: the payment provider charges a fee after that.\"\n- **A fact it will need again.** \"The staging site deploys from the `next` branch.\"\n\nAnd leave out:\n\n- **Progress on the task at hand.** That belongs in the work log, not in memory.\n- **One-off details.** The order number of yesterday's ticket won't matter next week.\n- **What the instructions already say.** Two copies of a rule drift apart.\n- **Secrets.** A key in a memory file is a key in every prompt, every backup and every copy of that file.\n\nWhen something stops being true, delete the line. A memory with a wrong line is worse than a memory without that line.\n\n## Why cap the memory?\n\nA cap is what keeps memory useful. Without one, an agent adds a line for everything and never removes any, and in two months it's back to the \"too much\" failure.\n\nWith a cap, say 2,000 characters (around 500 tokens, a few dozen short lines), a full memory forces a choice: merge two lines, drop one that matters less, rewrite the whole thing shorter. That's exactly the work that keeps a memory true. And at that size it costs almost nothing to load on every run.\n\nDo the same for what the agent knows about you, kept apart and shared by every agent, so you don't teach each one your time zone and your dislike of emoji.\n\n## How does an agent remember further back?\n\nWith a log and a search, in that order:\n\n1. **A work log by day.** After each run, one to three lines: what it did, what's next. Each day is a file. The end of the last day or two goes into the next run, so it picks up where it left off.\n2. **Search the log.** \"Do you remember when we changed the pricing?\" is a grep through the daily files. Every past day is still there, it just isn't loaded unless asked.\n3. **Search the conversations.** If the log doesn't have it, the transcripts might. Only then should the agent say it doesn't know.\n\nThis is how people work, too. You remember the rules, you keep a diary, and you look things up in old mail when you have to.\n\n## Who should see and edit an agent's memory?\n\nYou should, always. An agent whose memory you can't read is an agent you can't correct: it keeps acting on a misunderstanding and you never find out why. Its memory, what it believes about you and its work log should be a click away, editable, with a way to tell it \"forget that\".\n\nOn a team, decide what travels. If teammates each run a copy of the same agent, its memory and its work log should sync, so a correction made on one machine reaches every copy. What it knows about *you* shouldn't: that's yours. See [how to share AI agents with your team](\u002Fblog\u002Fshare-ai-agents-with-your-team).\n\n## How does Claude Code handle memory?\n\nClaude Code starts each session with a fresh context and two ways for knowledge to survive: `CLAUDE.md` files you write for the project and for yourself, and auto memory, notes Claude keeps about your corrections in a `MEMORY.md`. `\u002Fmemory` opens them. It's the same split as above: rules you write, notes the agent writes, both plain files you can read. The [CLAUDE.md guide](\u002Fblog\u002Fclaude-md-guide) covers what to put where.\n\n## In Relais\n\nEach Relais agent has three plain files. `MEMORY.md` in its folder holds what it should always remember, 2,000 characters at most; `USER.md` holds who you are and your rules, the same size, and every agent reads it. Its work log keeps one file per day, a few lines after each run, and the end of its last two days starts each new session. Agents save with `remember` the moment they learn something, drop lines with `forget`, and log with `log_work`; when a memory is full, the save is refused until the agent rewrites it shorter. To remember further back, an agent searches its whole log first, then its past conversations, before saying it doesn't know. You read and edit all three in the agent's details: Memory, About you, and the last seven days of its Work log. When an agent is shared with your team, its memory, work log and skills sync to every teammate's copy; `USER.md`, your keys and your conversations never do. More on [shared agents](\u002Ffeatures\u002Fshared-agents) and [the agents page](\u002Fagents).","\u003Cp>There are two ways an agent&#39;s memory fails. The first is no memory at all: every session starts blank, and on Tuesday it asks again what you told it on Monday. You stop correcting it, because the correction won&#39;t last.\u003C\u002Fp>\n\u003Cp>The second is too much memory. Every conversation is kept and fed back, the agent reads a thousand lines before each answer, half of them out of date, and it confidently follows a rule you dropped three weeks ago.\u003C\u002Fp>\n\u003Cp>Good agent memory sits between the two, and it&#39;s mostly a writing problem, not a database problem: deciding what deserves a line, keeping it short, and keeping it true.\u003C\u002Fp>\n\u003Ch2 id=\"what-kinds-of-memory-does-an-agent-need\">\u003Ca class=\"anchor\" href=\"#what-kinds-of-memory-does-an-agent-need\" aria-label=\"Link to this section\">#\u003C\u002Fa>What kinds of memory does an agent need?\u003C\u002Fh2>\n\u003Cp>&quot;Memory&quot; covers several things that behave differently:\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Kind\u003C\u002Fth>\u003Cth>Holds\u003C\u002Fth>\u003Cth>Who writes it\u003C\u002Fth>\u003Cth>When it&#39;s read\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Instructions\u003C\u002Ftd>\u003Ctd>Its job, its rules, its tone\u003C\u002Ftd>\u003Ctd>You\u003C\u002Ftd>\u003Ctd>Every run\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Long-term memory\u003C\u002Ftd>\u003Ctd>Preferences, corrections, decisions, facts it&#39;ll need again\u003C\u002Ftd>\u003Ctd>The agent, as it learns\u003C\u002Ftd>\u003Ctd>Every run\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>About you\u003C\u002Ftd>\u003Ctd>Who you are, how you work, rules for every agent\u003C\u002Ftd>\u003Ctd>You and the agents\u003C\u002Ftd>\u003Ctd>Every run, by every agent\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Work log\u003C\u002Ftd>\u003Ctd>What it did, day by day, what&#39;s next\u003C\u002Ftd>\u003Ctd>The agent, after each run\u003C\u002Ftd>\u003Ctd>The last few days every run, the rest when needed\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Conversations\u003C\u002Ftd>\u003Ctd>Everything said\u003C\u002Ftd>\u003Ctd>Nobody, it&#39;s a transcript\u003C\u002Ftd>\u003Ctd>Only when searched\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Knowledge\u003C\u002Ftd>\u003Ctd>Docs, code, files, skills\u003C\u002Ftd>\u003Ctd>You and the agents\u003C\u002Ftd>\u003Ctd>When a task needs it\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>The first four are small and always loaded. The last two are large and only searched. Mixing them up is where most designs go wrong.\u003C\u002Fp>\n\u003Ch2 id=\"why-not-just-keep-every-conversation\">\u003Ca class=\"anchor\" href=\"#why-not-just-keep-every-conversation\" aria-label=\"Link to this section\">#\u003C\u002Fa>Why not just keep every conversation?\u003C\u002Fh2>\n\u003Cp>Because whatever is loaded is paid for, on every run, and competes for the model&#39;s attention:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Cost.\u003C\u002Fstrong> A memory read at the start of each run is billed each time. Ten thousand tokens of history on a routine that runs every hour adds up fast.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Staleness.\u003C\u002Fstrong> Conversations record what was true then. &quot;Use the staging database&quot; from a month ago is still in there after you moved to the new one.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Contradictions.\u003C\u002Fstrong> The longer the history, the more it disagrees with itself, and the model has to guess which version wins.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Dilution.\u003C\u002Fstrong> One important rule in a thousand lines of chat gets less attention than the same rule in a list of twenty.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Keep conversations, by all means, but as an archive the agent can search when it needs to, not as something it rereads every time.\u003C\u002Fp>\n\u003Ch2 id=\"plain-files-or-a-vector-database\">\u003Ca class=\"anchor\" href=\"#plain-files-or-a-vector-database\" aria-label=\"Link to this section\">#\u003C\u002Fa>Plain files or a vector database?\u003C\u002Fh2>\n\u003Cp>For what an agent reads every run, plain files. A short Markdown file of bullet points is:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Readable.\u003C\u002Fstrong> You can open it and see exactly what the agent believes.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Editable.\u003C\u002Fstrong> A wrong line is fixed in two seconds. Try that with an embedding.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Searchable.\u003C\u002Fstrong> The agent can grep its own work log like any other folder.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Portable.\u003C\u002Fstrong> It goes into git, a backup, or a teammate&#39;s copy of the agent, as is.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Vector search earns its place for the archive: finding a decision from five months ago in a thousand pages of notes, by meaning rather than by exact words. Even there, it&#39;s the search that changes, not the storage. The notes stay text.\u003C\u002Fp>\n\u003Ch2 id=\"what-deserves-a-line-in-an-agent-39-s-memory\">\u003Ca class=\"anchor\" href=\"#what-deserves-a-line-in-an-agent-39-s-memory\" aria-label=\"Link to this section\">#\u003C\u002Fa>What deserves a line in an agent&#39;s memory?\u003C\u002Fh2>\n\u003Cp>Save at the moment you learn it, one short line each, in plain words:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>A correction.\u003C\u002Fstrong> &quot;Don&#39;t open a pull request for typo fixes, commit them on main.&quot;\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A preference.\u003C\u002Fstrong> &quot;Weekly report as a table, revenue first.&quot;\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A decision, with its why.\u003C\u002Fstrong> &quot;Refunds only within 30 days: the payment provider charges a fee after that.&quot;\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A fact it will need again.\u003C\u002Fstrong> &quot;The staging site deploys from the \u003Ccode>next\u003C\u002Fcode> branch.&quot;\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>And leave out:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Progress on the task at hand.\u003C\u002Fstrong> That belongs in the work log, not in memory.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>One-off details.\u003C\u002Fstrong> The order number of yesterday&#39;s ticket won&#39;t matter next week.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>What the instructions already say.\u003C\u002Fstrong> Two copies of a rule drift apart.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Secrets.\u003C\u002Fstrong> A key in a memory file is a key in every prompt, every backup and every copy of that file.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>When something stops being true, delete the line. A memory with a wrong line is worse than a memory without that line.\u003C\u002Fp>\n\u003Ch2 id=\"why-cap-the-memory\">\u003Ca class=\"anchor\" href=\"#why-cap-the-memory\" aria-label=\"Link to this section\">#\u003C\u002Fa>Why cap the memory?\u003C\u002Fh2>\n\u003Cp>A cap is what keeps memory useful. Without one, an agent adds a line for everything and never removes any, and in two months it&#39;s back to the &quot;too much&quot; failure.\u003C\u002Fp>\n\u003Cp>With a cap, say 2,000 characters (around 500 tokens, a few dozen short lines), a full memory forces a choice: merge two lines, drop one that matters less, rewrite the whole thing shorter. That&#39;s exactly the work that keeps a memory true. And at that size it costs almost nothing to load on every run.\u003C\u002Fp>\n\u003Cp>Do the same for what the agent knows about you, kept apart and shared by every agent, so you don&#39;t teach each one your time zone and your dislike of emoji.\u003C\u002Fp>\n\u003Ch2 id=\"how-does-an-agent-remember-further-back\">\u003Ca class=\"anchor\" href=\"#how-does-an-agent-remember-further-back\" aria-label=\"Link to this section\">#\u003C\u002Fa>How does an agent remember further back?\u003C\u002Fh2>\n\u003Cp>With a log and a search, in that order:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>A work log by day.\u003C\u002Fstrong> After each run, one to three lines: what it did, what&#39;s next. Each day is a file. The end of the last day or two goes into the next run, so it picks up where it left off.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Search the log.\u003C\u002Fstrong> &quot;Do you remember when we changed the pricing?&quot; is a grep through the daily files. Every past day is still there, it just isn&#39;t loaded unless asked.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Search the conversations.\u003C\u002Fstrong> If the log doesn&#39;t have it, the transcripts might. Only then should the agent say it doesn&#39;t know.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>This is how people work, too. You remember the rules, you keep a diary, and you look things up in old mail when you have to.\u003C\u002Fp>\n\u003Ch2 id=\"who-should-see-and-edit-an-agent-39-s-memory\">\u003Ca class=\"anchor\" href=\"#who-should-see-and-edit-an-agent-39-s-memory\" aria-label=\"Link to this section\">#\u003C\u002Fa>Who should see and edit an agent&#39;s memory?\u003C\u002Fh2>\n\u003Cp>You should, always. An agent whose memory you can&#39;t read is an agent you can&#39;t correct: it keeps acting on a misunderstanding and you never find out why. Its memory, what it believes about you and its work log should be a click away, editable, with a way to tell it &quot;forget that&quot;.\u003C\u002Fp>\n\u003Cp>On a team, decide what travels. If teammates each run a copy of the same agent, its memory and its work log should sync, so a correction made on one machine reaches every copy. What it knows about \u003Cem>you\u003C\u002Fem> shouldn&#39;t: that&#39;s yours. See \u003Ca href=\"\u002Fblog\u002Fshare-ai-agents-with-your-team\">how to share AI agents with your team\u003C\u002Fa>.\u003C\u002Fp>\n\u003Ch2 id=\"how-does-claude-code-handle-memory\">\u003Ca class=\"anchor\" href=\"#how-does-claude-code-handle-memory\" aria-label=\"Link to this section\">#\u003C\u002Fa>How does Claude Code handle memory?\u003C\u002Fh2>\n\u003Cp>Claude Code starts each session with a fresh context and two ways for knowledge to survive: \u003Ccode>CLAUDE.md\u003C\u002Fcode> files you write for the project and for yourself, and auto memory, notes Claude keeps about your corrections in a \u003Ccode>MEMORY.md\u003C\u002Fcode>. \u003Ccode>\u002Fmemory\u003C\u002Fcode> opens them. It&#39;s the same split as above: rules you write, notes the agent writes, both plain files you can read. The \u003Ca href=\"\u002Fblog\u002Fclaude-md-guide\">CLAUDE.md guide\u003C\u002Fa> covers what to put where.\u003C\u002Fp>\n\u003Ch2 id=\"in-relais\">\u003Ca class=\"anchor\" href=\"#in-relais\" aria-label=\"Link to this section\">#\u003C\u002Fa>In Relais\u003C\u002Fh2>\n\u003Cp>Each Relais agent has three plain files. \u003Ccode>MEMORY.md\u003C\u002Fcode> in its folder holds what it should always remember, 2,000 characters at most; \u003Ccode>USER.md\u003C\u002Fcode> holds who you are and your rules, the same size, and every agent reads it. Its work log keeps one file per day, a few lines after each run, and the end of its last two days starts each new session. Agents save with \u003Ccode>remember\u003C\u002Fcode> the moment they learn something, drop lines with \u003Ccode>forget\u003C\u002Fcode>, and log with \u003Ccode>log_work\u003C\u002Fcode>; when a memory is full, the save is refused until the agent rewrites it shorter. To remember further back, an agent searches its whole log first, then its past conversations, before saying it doesn&#39;t know. You read and edit all three in the agent&#39;s details: Memory, About you, and the last seven days of its Work log. When an agent is shared with your team, its memory, work log and skills sync to every teammate&#39;s copy; \u003Ccode>USER.md\u003C\u002Fcode>, your keys and your conversations never do. More on \u003Ca href=\"\u002Ffeatures\u002Fshared-agents\">shared agents\u003C\u002Fa> and \u003Ca href=\"\u002Fagents\">the agents page\u003C\u002Fa>.\u003C\u002Fp>\n",[15,18,21,24,27,30,33,36,39],{"id":16,"text":17},"what-kinds-of-memory-does-an-agent-need","What kinds of memory does an agent need?",{"id":19,"text":20},"why-not-just-keep-every-conversation","Why not just keep every conversation?",{"id":22,"text":23},"plain-files-or-a-vector-database","Plain files or a vector database?",{"id":25,"text":26},"what-deserves-a-line-in-an-agent-39-s-memory","What deserves a line in an agent's memory?",{"id":28,"text":29},"why-cap-the-memory","Why cap the memory?",{"id":31,"text":32},"how-does-an-agent-remember-further-back","How does an agent remember further back?",{"id":34,"text":35},"who-should-see-and-edit-an-agent-39-s-memory","Who should see and edit an agent's memory?",{"id":37,"text":38},"how-does-claude-code-handle-memory","How does Claude Code handle memory?",{"id":40,"text":41},"in-relais","In Relais",[43,49,54],{"slug":44,"title":45,"description":46,"category":7,"categoryId":8,"keyword":47,"date":48,"minutes":11},"claude-code-agent-teams","Claude Code agent teams: subagents, teammates, parallel sessions and hand-offs","Five ways to make several Claude Code agents work together, from subagents and the experimental agent teams to worktree sessions, scripts and agents that hand work to each other, with what each one does well and what it costs.","claude code agent teams","2026-11-27",{"slug":50,"title":51,"description":52,"category":7,"categoryId":8,"keyword":53,"date":10,"minutes":11},"ai-weekly-growth-report","A weekly growth report an AI agent writes for you","What a useful weekly growth report holds, where its numbers come from, how to tell a real change from noise, and how an AI agent can write it every Monday.","weekly growth report",{"slug":55,"title":56,"description":57,"category":7,"categoryId":8,"keyword":58,"date":10,"minutes":59},"ai-agents-for-founders","AI agents for founders: hand off the other half of your product","Shipping is half of running a product. Posts, support, numbers and the inbox are the other half. Which jobs to give AI agents first, how to set them up, and what to keep.","ai agents for founders",4,1795902783273]