How do the top AI agent harnesses handle memory?

All seven harnesses read a hand-written instruction file such as AGENTS.md or CLAUDE.md. Only Claude Code, Codex and Hermes Agent document notes the agent writes for itself, and they differ in size and in how those notes load: Claude Code loads the first 200 lines of an index, Hermes Agent a 2,200-character file, Codex builds them in the background after a chat goes idle. Read 2026-11-06.

By Mackenzie Bowes · mackenzie@mackenziebowes.com · @_mackenziebowes on X

Contents

Short answer, from the docs read: every harness here has the same first layer of memory, a text file a person writes that is put in front of the model at the start of a session, and they split on the second layer, notes the agent writes for itself. Claude Code, Codex and Hermes Agent document that second layer.[1][2][3] Cursor's docs say plainly that models keep no memory between completions and treat rules as the substitute.[4] The docs read for OpenCode and pi describe instruction files and, for pi, summarizing a long session, but no agent-written notes.[5][6][7] For Antigravity, only the launch post mentions a knowledge base.[8] This is the second page in a series that began with a survey of the harnesses.

A harness is the program around a model. Agent memory here means anything that carries information from one session to the next, or from early in a long session to late.

Layer one is the instruction file

A person writes it, it is read at the start, and the agent treats it as context.

The docs differ on how strongly this layer binds. Claude Code says outright that it is not enforced.[1] Codex says required team guidance belongs in AGENTS.md or checked-in documentation, not in memories.[2]

Layer two is notes the agent writes for itself

Inside a long session

Memory also means what survives when one session grows past the model's context window. Pi documents two summarizing mechanisms. Compaction starts when the context passes the window minus a reserve of 16,384 tokens by default, and can be started by hand with /compact. Branch summarization, when the user moves to another branch of the session tree, summarizes the work being left and carries it into the new branch.[6] The other harnesses' docs on this were not read for this page.

What the comparison rules out

These are consequences of the docs read, not findings from a test.

Terms

Not yet proven

If you have chosen a harness for how it remembers and the docs misled you, I would like to hear it: mackenzie@mackenziebowes.com.

Sources

  1. Claude Code Docs, Memory. Saved 2026-10-22. code.claude.com/docs/en/memory
  2. OpenAI, Codex docs, Memories (now at learn.chatgpt.com/docs/customization/memories). Read in Rotunda 2026-11-06. developers.openai.com/codex/memories
  3. Hermes Agent docs, Persistent Memory, from a clone at commit 5894e750. Saved 2026-10-23. github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md
  4. Cursor Docs, Rules. Read in Rotunda 2026-11-06. cursor.com/docs/rules
  5. OpenCode docs, Rules. Read in Rotunda 2026-11-06. opencode.ai/docs/rules/
  6. Pi docs, Compaction Reference. Read in Rotunda 2026-11-06. pi.dev/docs/latest/compaction
  7. Mario Zechner, "What I learned building an opinionated and minimal coding agent", 2025-11-30. Read in Rotunda 2026-11-06. mariozechner.at/posts/2025-11-30-pi-coding-agent/
  8. Google Antigravity, "Introducing Google Antigravity". Read in Rotunda 2026-11-06. antigravity.google/blog/introducing-google-antigravity/
  9. OpenAI, Codex docs, Custom instructions with AGENTS.md (now at learn.chatgpt.com/docs/agent-configuration/agents-md). Read in Rotunda 2026-11-06. developers.openai.com/codex/guides/agents-md
  10. Google Antigravity Docs, overview. Read in Rotunda 2026-11-06. antigravity.google/docs/overview/
  11. Google Antigravity Docs, skills. Read in Rotunda 2026-11-06. antigravity.google/docs/skills/

Terms on this page

  • Agent memory: Information an AI agent writes down in one session and reads back in a later one.