---
title: Compare self-hosted memory tools for coding agents
description: Compare Git instructions, file-backed MCP memory, and Loom on one coding example. Check cross-session recall, project access, source changes, and portability.
seo:
  title: Memory tools for coding agents compared
lastModified: '2026-11-27T00:02:02.000Z'
---

Choose memory by what the next coding session needs. Put reviewed rules in a Git-tracked
`AGENTS.md`. Use a file-backed MCP memory server when clients on the same host need a
shared store of observations. Use Loom when readers need separately issued credentials,
warnings tied to indexed source changes, or a SQL audit of who changed a decision.

Use the [coding-agent memory selector](https://loom.clickhouse.com/agent-memory-selector)
to choose a setup and copy a checklist for your repository.

## Three setups on the same repository

The fixture contains a Python retry function. A writer saves that `should_retry`
retries on HTTP 503 and points to the source revision. A fresh reader retrieves the
same decision. The fixture then changes the function to retry on HTTP 429, without
changing the saved decision. After reading it again, the reviewer records a correction.

| What the reader checks                      | Git-tracked `AGENTS.md`                                                                           | File-backed MCP reference server                                                                           | Loom                                                                                                   |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Did the decision survive a fresh session?   | A fresh checkout contained the exact note and source revision.                                    | A separate MCP process retrieved the exact observation from the shared JSONL file.                         | A separate MCP session retrieved the same memory ID, value, and source revision.                       |
| Did the read warn that the source changed?  | The note was unchanged. Comparing its recorded revision to the current revision exposed the edit. | The read still returned the original observation. Comparing the recorded revision in Git exposed the edit. | After indexing, the original lesson returned `changed` and the exact commit that altered the function. |
| Could an operator attribute the correction? | `git log` reported both commit authors for the note.                                              | The graph returned both observations. Those records carried no writer or revision fields.                  | A scoped SQL reader retrieved the two values, version numbers, and authenticated writer identities.    |

The Git author is commit metadata. The Loom SQL actor is the subject of the credential
that performed the write. The reference server's second observation was explicitly
appended by the reviewer. It does not establish which statement is current.

## Check access across projects

The authorized reviewer retrieved the decision by key over HTTP. A third identity
with viewer access to a different project namespace in the same organization made the
same request and received `403`. The other two setups use access to the repository or
storage file. The fixture does not test repository or filesystem permissions.

When separate teams share a deployment, check both an allowed handoff and a refused
read before adding project data. Use the [cross-client access checks](/docs/getting-started/evaluate#shared-memory-across-clients)
to test semantic search, lookup by memory ID, and expired credentials as separate cases.

## Operating trade-offs

- **Git instructions.** Put rules every checkout needs under existing repository review
  and access controls. Readers need the relevant checkout. Record a source revision
  when a decision refers to code that can change independently of the instruction file.
- **File-backed MCP memory.** Give both clients access to the same durable storage path
  and back up that file. The test used sequential processes on one host. Configure
  filesystem permissions for the people and processes allowed to read it.
- **Loom.** Run the server and ClickHouse, provision scoped credentials, and configure
  the repository index if you need code-change checks. Back up the stores you operate.
  A code change is surfaced after indexing. The reviewer still validates the current
  behavior before using the lesson.

To try the Loom workflow yourself, [pass a decision between coding clients](/docs/getting-started/connect-a-coding-agent#verify-shared-memory-between-claude-code-and-codex),
[check what happens after its code changes](/docs/use-cases/memory-linked-to-code#check-a-lesson-after-a-code-edit),
or [read a correction's version history in SQL](/docs/use-cases/self-hosted-clickhouse#audit-a-changed-decision-with-sql).

If the team is deciding between options, run a small pilot on a repository it maintains.
Keep the same tasks, starting revisions, and acceptance tests. Count model use, indexing,
maintenance, and human review time before assigning a budget. See the
[paired coding-task scorecard](/docs/getting-started/evaluate#compare-coding-agents-with-and-without-memory).

## What changed in a paired coding-agent test?

Claude Code answered 36 file-location questions on the ClickHouse repository in ten
pairs of runs per question. Both setups had the same local tools. The Loom setup
also had the plugin and indexed code tools. The correct file appeared among the
first three named files in 96.4% of Loom runs and 91.4% of baseline runs.

Mean session model cost fell from $0.096 to $0.076 per question. Mean elapsed time
rose from 19.7 to 25.0 seconds. The cost covers the agent's model bill. Include
server model calls, indexing, and hosting when estimating the full cost of a deployment.
The test scored file identification. Use your repository's acceptance tests to
measure whether the resulting patches pass review and CI.

The [paired benchmark](/docs/benchmarks/results#with-and-without-loom) includes the
setup, raw runs, and answer-quality results for other repository questions.

## Move a saved decision to a fresh setup

The fixture copies the corrected retry decision into fresh storage, then reads it
with a new checkout or client. This checks what a team can take when it moves its
memory setup.

| Setup                            | What the new reader recovered                                                                                                                                                                                          |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Git-tracked `AGENTS.md`          | A fresh checkout contained the corrected rule. Its Git history still contained the earlier rule.                                                                                                                       |
| File-backed MCP reference server | A new server read both observations from a copy of the JSONL file. A reader still had to decide which one applied.                                                                                                     |
| Loom                             | A source viewer exported the corrected rule as Markdown. A separate writer imported the bundle into an empty namespace. A viewer there read the corrected value under the same key and saw the importer as its writer. |

The Loom test moves the current decision within one deployment. A Markdown export
omits the source namespace's grants and full version history. Use the [portability walkthrough](/docs/features/integrations/okf#test-agent-memory-portability)
to repeat the check with different deployments.

## Shared memory between Claude Code and Codex

In two local trials, Claude Code stored a different value over MCP and a fresh Codex
session retrieved it by key. The clients used the same local model and separate writer
and viewer credentials for the same namespace. The reader received only the key and
namespace. An independent MCP read confirmed each write before the reader started.

Tool configuration affects the handoff. An initial Claude Code attempt made no tool
call. Both trials succeeded when the prompt named the write tool as registered by
the client and the test allowed only that tool. The reverse attempt stopped when
Codex's approval policy refused the write. A successful read therefore verifies the
reader's access. A handoff also requires the writer to execute the write.

Use the [cross-client handoff procedure](/docs/getting-started/connect-a-coding-agent#verify-shared-memory-between-claude-code-and-codex)
with your own clients, model, and credentials. Check the tool result for the exact
value and writer identity as well as the agent's final answer.

## Reproduce the comparison

The [source-change playground](https://loom.clickhouse.com/playground/source-change)
replays the code and memory states recorded by the comparison. To run the full
evaluation on GitHub, fork the repository and open **Actions** in the fork. Enable
workflows if prompted, select **Coding-agent memory evaluation**, then choose
**Run workflow**. The run page shows the results
and offers the JSON artifact. The workflow uses a temporary ClickHouse container
on the hosted runner and needs no credentials from you.

Clone the [Loom repository](https://github.com/ClickHouse/loom) and run these commands
from its root. Use Docker, Node.js 24 or later with npm, Git, `jq`, `curl`, and `uv`.

```bash
uv sync --locked --python 3.12 --extra dev --extra code
bash examples/run_coding_agent_memory_comparison.sh
```

The runner creates a temporary repository, storage file, local server, and ClickHouse
container. It installs `@modelcontextprotocol/server-memory@2.2.1` as the MCP reference
arm and prints the two source revisions, the fields returned by the graph, the
project-access and portability results, and the observed author and version records.
If a default port is taken, set
`COMPARISON_CH_HTTP_PORT`, `COMPARISON_CH_NATIVE_PORT`, or `COMPARISON_API_PORT` to
unused ports before running it.

The runner uses separate MCP sessions to check exact-key reads, project access, source
changes, and portability in one storage fixture. The [paired coding-agent test](#what-changed-in-a-paired-coding-agent-test)
measures file identification, session model cost, and elapsed time separately.

[Read how Loom tracks code-linked decisions](/docs/use-cases/memory-linked-to-code) or
[query memory history with SQL](/docs/use-cases/self-hosted-clickhouse#audit-a-changed-decision-with-sql).
