# Memory for coding agents

> How built-in agent memory, memory servers, and memory SDKs compare for Claude Code, Codex, and Cursor, and where Hansard's local archive and recall fit.

A memory layer for AI coding agents carries what an agent learned or did into
its next session. Coding agents already include one kind: instruction files
such as `CLAUDE.md` and `AGENTS.md`, plus notes Claude Code and Codex write for
themselves. Memory servers and SDKs add facts that persist across tools or
inside apps you build.

Hansard is a local-first memory layer that keeps the full record instead. It
archives every conversation and memory file from your coding agents on your
computer, and every agent you connect can search it.

## Which memory layer is best for AI coding agents?

No single memory layer is best for every setup. Choose by what you want
remembered and where you allow it to be stored. Most setups combine two or
three of these:

- **Rules for a repository:** start with instruction files. `AGENTS.md` at the
  repository root is read by Codex, Cursor, GitHub Copilot, Amp, and Devin, and
  by Claude Code when the folder has no `CLAUDE.md`. Instruction files cost
  nothing and travel with the repository.
- **Preferences one agent learns:** turn on that agent's own memory, such as
  Claude Code auto memory or Codex Memories. Both stay on your computer and
  serve only that agent.
- **Facts several agents read and write:** use a memory server such as Mem0,
  Supermemory, claude-mem, agentmemory, Basic Memory, or Cognee. Check where
  each one stores your data, since some run locally and some need a hosted
  account.
- **Memory inside an application you build:** use an SDK such as Mem0, Letta,
  Zep, Graphiti, or Cognee.
- **Everything your agents did, in every harness:** use Hansard. It keeps whole
  conversations rather than extracted facts, so an agent can read what was
  tried, decided, and reverted in the original messages, whichever harness
  did the work.

These kinds work together. Hansard backs up the instruction files and built-in
memories your agents keep, and a memory server can run beside it.

## Kinds of agent memory

| Kind                             | What it keeps                                  | Where it lives                                           | Examples                                                         |
| -------------------------------- | ---------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------- |
| Instruction files                | Rules you write                                | The repository and your home folder                      | `AGENTS.md`, `CLAUDE.md`, Cursor project rules                   |
| Built-in agent memory            | Notes an agent writes for itself               | Your computer                                            | Claude Code auto memory, Codex Memories                          |
| Memory servers                   | Facts or notes extracted from sessions         | Your computer or a hosted service, depending on the tool | Mem0, Supermemory, claude-mem, agentmemory, Basic Memory, Cognee |
| Memory SDKs                      | Memory inside an app you build                 | Your infrastructure or the vendor's cloud                | Mem0, Letta, Zep, Graphiti                                       |
| Conversation archive with recall | Every conversation and memory file, as written | Your computer                                            | Hansard                                                          |

## How the options compare

| Option             | What it stores                                                                                                           | Where the data lives                                                                                                                                                       | License                                                  | Coding agents                                                                                                                |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Claude Code memory | `CLAUDE.md` instructions, and auto memory notes. The first 200 lines or 25 KB of `MEMORY.md` load at each session start. | Local files. Auto memory is not shared across computers.                                                                                                                   | Part of Claude Code                                      | Claude Code                                                                                                                  |
| Codex memory       | `AGENTS.md` instructions, up to 32 KiB combined by default, and optional Memories summarized from earlier chats          | Local files under `~/.codex`                                                                                                                                               | Part of Codex                                            | Codex                                                                                                                        |
| Cursor rules       | Project, user, and team rules, plus `AGENTS.md`. Cursor's documentation no longer describes Memories.                    | The repository, Cursor settings, and the team dashboard                                                                                                                    | Proprietary                                              | Cursor                                                                                                                       |
| Mem0               | Facts a model extracts from conversations                                                                                | The library stores memories locally and sends text to a model provider, OpenAI by default. Its coding-agent plugins and hosted MCP server keep memories in a Mem0 account. | Apache-2.0, with a hosted platform                       | Claude Code, Codex, and Cursor plugins, and a hosted MCP server                                                              |
| Supermemory        | Extracted facts, profiles, documents, and connector data                                                                 | A hosted service by default, or a local server whose source is not public                                                                                                  | MIT repository, with hosted plans                        | Plugins for Claude Code, Codex, Cursor, OpenCode, and others                                                                 |
| claude-mem         | Observations and summaries a second model writes from each tool call                                                     | `~/.claude-mem`, with opt-in cloud sync                                                                                                                                    | Apache-2.0, with paid hosted features                    | Claude Code, Codex, Cursor, OpenCode, and others                                                                             |
| agentmemory        | Observations, session summaries, facts, and workflows                                                                    | A local server                                                                                                                                                             | Apache-2.0. It runs on iii-engine, licensed Elastic-2.0. | Claude Code, Codex, Cursor, and others through plugins, hooks, and MCP                                                       |
| Basic Memory       | Markdown notes linked into a knowledge graph                                                                             | `~/basic-memory`, with an optional hosted cloud                                                                                                                            | AGPL-3.0                                                 | MCP for Claude Code, Codex, Cursor, and others                                                                               |
| Cognee             | A knowledge graph of documents, code, and conversations                                                                  | Local by default, self-hosted, or Cognee Cloud                                                                                                                             | Apache-2.0, with a hosted cloud                          | Claude Code and Codex plugins, and MCP for Cursor and others                                                                 |
| Letta              | Agent memory as a git-versioned folder of Markdown files                                                                 | Letta Cloud by default, or local                                                                                                                                           | Apache-2.0, with hosted plans                            | Letta's own coding agent, not a plugin for other agents                                                                      |
| Zep and Graphiti   | A knowledge graph of entities and facts that tracks when each was true                                                   | Zep Cloud. Graphiti is self-hosted.                                                                                                                                        | Zep is proprietary. Graphiti is Apache-2.0.              | Zep's MCP server for Claude Code, Codex, and Cursor. Graphiti has a reference MCP server.                                    |
| Hansard            | Every conversation as written, with tool calls, plus revisions of memory and instruction files                           | `~/.hansard` on your computer                                                                                                                                              | MIT                                                      | Recall over MCP in Claude Code, Codex, Cursor, and more than a dozen other agents. Imports history from dozens of harnesses. |

Each row was checked on 2026-11-08 against the project's own documentation,
README, or license file. Plugin lists and plans change often, so follow the
links under [Sources](https://www.hansard.dev/getting-started/agent-memory/#sources) for current details.

## How do I give Claude Code and Codex the same memory?

Share the rules through `AGENTS.md`, and the history through Hansard recall.

1. Put shared rules in `AGENTS.md` at the repository root. Codex reads it.
   Claude Code reads it when the folder has no `CLAUDE.md`. If you keep a
   `CLAUDE.md`, add the line `@AGENTS.md` to it, or type `/config` in Claude
   Code and set **Project instructions** to `claude-md-and-agents-md`.

2. Install Hansard recall in both agents:

   ```sh
   hansard integrations add-to claude
   hansard integrations add-to codex
   ```

3. Ask either agent about earlier work. It searches both agents' conversations
   with `search_past_sessions`, and both agents' memories with
   `search_memories`, so a Codex session can use a preference Claude Code
   recorded.

4. To merge duplicate memories and settle contradictions between the agents,
   run `/unify-memories` in Claude Code, or ask Codex to unify your memories.

See [Recall in your agents](https://www.hansard.dev/guides/agent-integrations/) and
[Memories](https://www.hansard.dev/guides/memories/).

## What Hansard does

- Imports conversations from dozens of harnesses, and keeps a copy of each
  original file, so history stays after a harness deletes its own. See
  [Supported harnesses](https://www.hansard.dev/imports/supported-sources/).
- Backs up memory and instruction files every 15 minutes while the watcher
  runs, with a revision history of each file.
- Gives agents read-only recall tools over MCP: `search_past_sessions`,
  `get_past_session`, `search_memories`, `get_memory`, `code_history`, and
  `work_context`. See [Recall tools](https://www.hansard.dev/reference/recall-tools/).
- Drafts lessons from what failed and what was fixed once you turn on
  dreaming, and adds a lesson to a file only after you approve it. See
  [Review proposed lessons](https://www.hansard.dev/guides/memories/#review-proposed-lessons).
- Runs on your computer without an account. Search by meaning uses a local
  embedding model that you turn on.

## What Hansard does not do

- Hansard is not an SDK or a hosted memory API for apps you build. Use a memory
  SDK for that.
- Hansard does not add remembered facts to every prompt. An agent searches the
  archive when it needs earlier work.
- Hansard keeps conversations and memory files, not a separate store of
  extracted facts.
- A Team shares conversations, not memories. Memories stay on each computer.
  See [Teams](https://www.hansard.dev/sync/teams/).
- Chats in a browser, such as ChatGPT on the web, cannot call the tools
  installed on your computer. They reach your archive through the
  [AI assistants](https://www.hansard.dev/guides/ai-assistants/) connection, which works while
  Hansard is running on your Mac.
- What an agent reads from the archive goes to that agent's model provider,
  like any other context. See
  [What leaves your machine](https://www.hansard.dev/privacy/data-boundaries/).

## Sources

- Claude Code: [How Claude remembers your project](https://code.claude.com/docs/en/memory)
- Codex: [AGENTS.md](https://learn.chatgpt.com/docs/agent-configuration/agents-md) and [Memories](https://learn.chatgpt.com/docs/customization/memories)
- Cursor: [Rules](https://cursor.com/docs/rules)
- Mem0: [repository](https://github.com/mem0ai/mem0), [Claude Code integration](https://docs.mem0.ai/integrations/claude-code), and [hosted MCP server](https://docs.mem0.ai/platform/mem0-mcp)
- Supermemory: [repository](https://github.com/supermemoryai/supermemory) and [local and enterprise options](https://supermemory.ai/docs/self-hosting/local-vs-enterprise)
- claude-mem: [repository](https://github.com/thedotmack/claude-mem)
- agentmemory: [repository](https://github.com/rohitg00/agentmemory)
- Basic Memory: [repository](https://github.com/basicmachines-co/basic-memory)
- Cognee: [repository](https://github.com/topoteretes/cognee) and [Claude Code integration](https://github.com/topoteretes/cognee-integrations/tree/main/integrations/claude-code)
- Letta: [Letta Code repository](https://github.com/letta-ai/letta-code) and [MemFS](https://docs.letta.com/concepts/memfs/)
- Zep and Graphiti: [Graphiti repository](https://github.com/getzep/graphiti) and [Zep in Claude, ChatGPT, and coding agents](https://help.getzep.com/v4/use-zep-in-claude-chatgpt)
