Vai al contenuto
Pathrule

articoli

Articoli
Ingegneria
/Sertan Helvacı/9 min di lettura

Questa pagina è disponibile solo in inglese.

Where Do Coding Agents Save Their Own Memories?

Several coding agents now write notes for themselves while they work.

We read the docs and the source of seven agents to find where those notes go, who can read them and how they leave.

In breve

Mostly on your machine, and rarely where a teammate can see it. Claude Code writes to ~/.claude/projects/<project>/memory/, Codex to ~/.codex/memories/ once you enable it, Gemini CLI to a private MEMORY.md or a GEMINI.md. GitHub Copilot is the exception: repository facts live on GitHub and expire after 28 days unused. OpenCode writes none.

Pathrule
Pathrule è il livello di intelligenza tra te, il tuo workspace e i tuoi agenti di programmazione.

Di cosa parla

  • Claude Code auto memory has been on by default since v2.1.59 and writes to ~/.claude/projects/<project>/memory/: a MEMORY.md index whose first 200 lines or 25KB load at session start, plus topic files read on demand; the files do not expire.
  • Codex memories are off by default; with [features] memories = true, Codex writes ~/.codex/memories/ in the background from chats idle for at least six hours, injects a summary capped at 2,500 tokens and stops consolidating entries unused for 30 days.
  • GitHub Copilot Memory, in public preview, stores repository facts on GitHub for everyone with Copilot Memory on that repository, checks each fact's code citations against the current branch before use and deletes entries unused for 28 days.
  • Gemini CLI removed its save_memory tool in May 2026 (v0.44.0); the model now writes GEMINI.md files or a private MEMORY.md with its file tools, and an experimental Auto Memory proposes patches to a review inbox.
  • Windsurf's Cascade memories were stored in ~/.codeium/windsurf/memories/; Devin Desktop removed Cascade in v3.9.19 and its Devin Local agent does not persist memories.
  • Cursor's Memories documentation now redirects to Rules, while cloud Automations keep a memory tool; OpenCode has no memory tool.
  • Pathrule stores agent-written memories at repository paths, attributed and versioned, shared across a team's agents, and flags drifted entries for review instead of editing them.

Confronto

AgentWrites memory itselfWhere it is storedWho can read itHow entries leave
Claude CodeYes, on by default since v2.1.59~/.claude/projects/<project>/memory/: MEMORY.md index plus topic filesYou, on this machine; all worktrees of one repo share itNever expire; you or Claude edit or delete them
Codex CLIYes, in the background, after you enable it (off by default)~/.codex/memories/You, on this machine; one store for every repo, entries tagged by folderUnused for 30 days: dropped from consolidation; /memories resets all
GitHub CopilotYes, through a memory tool (public preview)On GitHub, not in the repositoryRepository facts: everyone with Copilot Memory on the repo; preferences: only youDeleted after 28 days unused; citations checked before use
Gemini CLIWhen you ask; experimental Auto Memory (off by default) proposes patchesGEMINI.md files, ~/.gemini/GEMINI.md, or a private MEMORY.md under ~/.gemini/tmp/Committed GEMINI.md: the team; the other files: only youYou edit the files; inbox patches apply only when you approve
CursorNot documented in the editor today; cloud Automations have a memory toolAutomations: a named entry, MEMORIES.md by default, outside the working filesystemThat automation's runsView, edit and delete in the tool configuration
Windsurf (Devin Desktop)No longer: Cascade was removed in v3.9.19; Devin Local does not persist memoriesOld Cascade memories: ~/.codeium/windsurf/memories/You, in one workspaceMigrate the ones you rely on to skills
OpenCodeNo memory toolNothing of its own; /init writes an AGENTS.md for you to commitWhoever reads the committed fileLike any file in Git

Find out what your agents have written about you

  • Claude Code: run /memory and open the auto memory folder. Read MEMORY.md and the topic files; delete what is wrong. Set autoMemoryEnabled to false in a project's settings to stop it there.
  • Codex: check ~/.codex/config.toml for memories = true under [features]. If it is on, read ~/.codex/memories/ and use /memories to pause or reset.
  • GitHub Copilot: as a repository owner, open Settings, Copilot, Memory to review the stored repository facts. Your own preferences are under Copilot settings.
  • Gemini CLI: run /memory show to see what loads, and /memory inbox for pending Auto Memory patches. Look for a Gemini Added Memories heading in ~/.gemini/GEMINI.md from before v0.44.
  • Windsurf users now on Devin Desktop: run the Devin: Open Cascade Migration Wizard command to move the Cascade memories you rely on to skills.
  • For anything a teammate needs, move it out of the private notebook into a shared place with an author and a review.

Reading is the easy half

Most of what has been written about coding-agent memory is about reading: which instruction file loads, how big it can get, what the agent does with the rest. That is the half you control. You write CLAUDE.md or AGENTS.md, you commit it, and your teammates' agents read the same text.

The other half is newer. Several agents now write notes for themselves while they work: a correction you made, a preference you repeated, a fact about the repository they had to dig out. A developer on r/ClaudeAI put it plainly this week: reading notes at the start of a chat is the easy part, and the write is where it slips. Where those notes go decides who benefits from them, how long they last and whether anyone can check them.

We read the documentation and, where the docs were thin, the source code of seven agents: Claude Code, Codex CLI, GitHub Copilot, Gemini CLI, Cursor, Windsurf (now Devin Desktop) and OpenCode. Everything below was checked on October 20, 2026. This area changes almost monthly, so every fact links to where it comes from.

Claude Code: on by default, one notebook per repository

Claude Code's auto memory writes without being asked. It has been on by default since v2.1.59, and it saves notes based on your corrections and preferences. It does not save something every session; the docs say it keeps what would be useful in a future conversation. You see it happen as a Saved 2 memories line in the interface.

The notes live in ~/.claude/projects/<project>/memory/: a MEMORY.md index plus one markdown topic file per memory. The project path is derived from the git repository, so every worktree and subdirectory of one repo shares a single folder. The first 200 lines or 25KB of MEMORY.md load at the start of every conversation; topic files are read on demand.

Two properties matter for a team. Auto memory is machine-local: the files are not shared across machines or cloud environments, so a teammate's Claude never sees what yours learned. And it does not expire: the memory files are excluded from the transcript cleanup and stay until you or Claude edits or deletes them. /memory opens the folder and holds the on/off toggle; autoMemoryEnabled: false in a project's settings or CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 turns it off.

One write path in Claude Code is meant to be shared. A subagent with memory: project keeps its notes in .claude/agent-memory/<name>/ inside the repository, which the docs describe as shareable via version control. It is the only place where something Claude wrote reaches a teammate's checkout, and only through a commit someone can review.

Codex: off until you enable it, then written in the background

Codex memories work the other way round. They are off by default; you turn them on with memories = true under [features] in config.toml, and /memories controls them in the CLI. Once on, Codex does not write during your chat. It waits until a chat has been idle long enough, six hours by default in the config reference, then turns eligible past chats into memory files in the background, redacting secrets as it goes. It skips a pass when your rate-limit headroom is low.

The files live under ~/.codex/memories/: summaries, durable entries, recent inputs and supporting evidence. One store serves every repository on the machine, so the consolidation prompt in the source requires each entry to say which working directory it applies to. At the start of a session Codex injects a short summary, capped at 2,500 tokens, and searches the rest on demand.

The docs ask you to treat these files as generated state and not to rely on editing them by hand. A memory unused for 30 days becomes ineligible for consolidation, and /memories can reset everything. Like Claude Code's, the store is personal: the docs' advice is to review the files before sharing your Codex home directory, not to share them.

GitHub Copilot: memory that belongs to the repository, and expires

Copilot Memory is the only one of the seven that keeps what an agent learned where a teammate's agent can use it. It is still in public preview. Agents create memories through a tool they call when they find something likely to matter for future tasks, as GitHub's engineering write-up describes, and the memories are used by the cloud agent, code review, Copilot CLI and agentic autofix.

There are two scopes. Repository facts are available to everyone with Copilot Memory on that repository, and they are only created from the work of users with write access. User preferences follow one person across repositories and nobody else sees them. In the CLI, the permission prompt says which of the two an entry will be before it is stored. Either way the memory lives on GitHub, not in your repository; owners review and delete repository facts under Settings, Copilot, Memory.

Copilot is also the only one that treats staleness as the normal case. Each repository fact carries citations to the code that supports it, and before using one Copilot checks those citations against the current branch; only validated facts are used. Anything unused is deleted after 28 days, and the timer can reset when an entry is validated and used. Memory is on by default for individual plans; on organization and enterprise plans an administrator has to enable it first.

Gemini CLI: no memory tool any more, just files you approve

Many guides still describe Gemini CLI's save_memory tool, which appended facts under a Gemini Added Memories heading in ~/.gemini/GEMINI.md. That tool and /memory add were removed in May 2026; v0.44.0 was the first stable release without them.

Today the model writes memory with its ordinary file tools when you tell it to remember something. Its system prompt routes each fact to one of four places: the project GEMINI.md, committed and shared with the team; a subdirectory GEMINI.md; a private project file at ~/.gemini/tmp/<project-id>/memory/MEMORY.md that must not be committed; or the global ~/.gemini/GEMINI.md. When a fact could fit more than one, it asks you which, and it is told never to save transient session state or summaries of code changes. The file tools ask for your approval before they write.

An experimental Auto Memory, off by default, adds a background writer. It reads past sessions that have been idle for at least three hours and have at least ten user messages, and it writes what it proposes as patches to a review inbox. It cannot edit active memory files directly; you apply or drop each patch with /memory inbox.

Cursor, Windsurf and OpenCode: no memory in the editor

Cursor added Memories in 1.0 in June 2025: facts remembered from conversations, stored per project for one person, and from 1.2 background-generated memories needed your approval. Today the Memories docs page redirects to the Rules page, and we found no current documentation of the feature in the editor, nor a changelog entry announcing its removal. Where Cursor's agents do write memory now is cloud Automations: each automation can keep notes across its runs, stored as a named entry, MEMORIES.md by default, outside the agent's working filesystem.

Windsurf became Devin Desktop in June 2026, and its memories went with the old agent. Cascade stored auto-generated memories in ~/.codeium/windsurf/memories/, tied to one workspace and never committed. The changelog for v3.9.19 says Cascade has been removed, and the memories page says the Devin Local agent does not persist memories and suggests migrating the ones you rely on to skills. For anything durable or shared, the same page advises a rule or AGENTS.md instead, because rules are version-controlled.

OpenCode has no memory tool. Its built-in tools read, write, edit and search; what it knows between sessions is whatever sits in AGENTS.md or CLAUDE.md, and /init creates or updates an AGENTS.md that the docs tell you to commit to Git. Persistent memory comes from third-party plugins.

What the write path decides

Put the seven side by side and one pattern stands out. The agents that write on their own write to a private notebook: one person, one machine, sometimes one folder. That is a good home for your preferences and a poor one for a team decision. When your agent learns that the payments service must never retry a charge, the teammate who touches payments tomorrow gets nothing from your laptop's memory folder.

Four questions decide whether a self-written note helps or hurts. Who triggers the write: the agent mid-task, a background job, or you. Who can read it: you, everyone on the repository, or one automation. How a stale note leaves: Copilot checks citations and deletes after 28 days unused, Codex stops consolidating entries unused for 30 days, Claude Code keeps everything until someone deletes it. And whether anyone sees it before it shapes the next session: Gemini CLI asks before each file write and holds Auto Memory patches in an inbox, Copilot CLI asks before it stores a memory, and elsewhere you read and delete after the fact.

The vendors' own docs point the same way for shared knowledge. Windsurf's docs point it to a version-controlled rule, Gemini CLI routes team conventions to a committed GEMINI.md, and Claude Code's shareable subagent memory goes through version control. Self-written memory makes one person's agent better. Knowledge the whole team relies on still has to be written somewhere shared, with an author and a review.

Where Pathrule fits

Pathrule is built for that second kind. Your agent writes a memory through Pathrule's MCP tool when you ask it to, and it is asked to propose lasting knowledge before saving it. Each memory attaches to a path in the repository, such as /apps/api/payments, and surfaces when an agent works under that path, whether the agent is Claude Code, Codex, Cursor, Windsurf or Copilot.

The memory docs list the controls a private notebook lacks. Every record keeps who created it, who last edited it and its source, so memories an AI wrote are easy to spot. A save that would overwrite a newer version is refused, whether the other writer is a person or an agent, and a second memory with the same title at the same path is refused instead of saved twice. When an agent notices that a memory has drifted from the code, it flags it as a refresh task; Pathrule never edits or deletes the entry on its own.

Keep auto memory on for your own preferences; it is good at that. Put the decisions your team keeps repeating in review where every agent and every teammate will read them.