DEV Community

Cover image for MEMORY.md did nothing for my local Claude Code: 7/45 with it, 7/45 without. One hook made it 32/45
JustJinoIT
JustJinoIT

Posted on Edited on AI-assisted

MEMORY.md did nothing for my local Claude Code: 7/45 with it, 7/45 without. One hook made it 32/45

On the same MLX server and the same 4B model, changing only how Claude Code's memory reaches the model took correct answers from 7 to 32 out of 45.

claude-code-local is a popular way to run Claude Code on local models on a Mac. I wanted to know whether it is the right starting point for a 16GB MacBook, so I ran it next to my own setup on the same M5 MacBook with 16GB RAM.

Short answer: its server fits in 16GB (peak 6.9 to 9.7GB in my runs), but its 16GB launcher turns memory off, and its 16K context is tight for agent work. Out of the box it rarely knows anything about your past work. What decided accuracy was how memory reached the model.

The hook and its install script are here: https://github.com/JustJinoIT/claude-local-kit

Two terms first. Claude Code keeps notes about past work in memory files and puts an index of them (MEMORY.md) into every request; the index is mostly links to files. The recall hook is a small script I wrote that, for each prompt, attaches only the memory lines related to it (up to 2,400 characters) instead of the index.

The test was 45 questions about my own past work, each with a known correct answer, written by a separate agent from my memory files (78 files).

The results

For each question, six answers were shuffled and graded blind against the gold answer by two judges, Sonnet and Opus. They agreed on 264 of 270 labels; the table uses Opus.

Setup Correct (45) Made-up Median time
1. claude-code-local 16GB tier as shipped (Qwen3.5-4B bf16, 16K, --bare) 7 2 55s
2. Same server + full MEMORY.md index 7 5 119s
3. Same server + recall hook 32 3 50s
4. Same server + Qwen3.5-9B 4bit, 64K + recall hook 28 3 28s*
5. Ollama qwen3.5:9b Q4_K_M, 64K + recall hook 38 1 56s*

*Measured in a separate block or on an earlier day, so compare time only within rows 1–3.

A made-up answer states a specific fact about my records that the memory files contradict. The hook picks lines with a local embedding model (bge-m3) plus keyword search.

How to read it

Rows 2 and 3 are the clean comparison. Same server, same model, same day; only the memory handling changes. 7 → 32, far beyond chance (McNemar p<0.0001). Row 3 was also faster than row 2 on 36 of the 50 timed questions (the 45 plus 5 unrelated ones). The full index made the first request about 8.3k tokens instead of 4.5k, and it added no correct answers: the index is mostly links to files, not facts.

Row 1 is not an accuracy score for claude-code-local. Its 16GB launcher runs Claude Code with --bare, which turns hooks, auto-memory and CLAUDE.md off on purpose. The row shows what you get out of the box on questions about your own past work.

Rows 4 and 5 are not "MLX vs Ollama". Both use a 9B model and the hook, but that server rewrites Claude Code's system prompt and slims the tool descriptions, and the Ollama answers come from earlier runs (re-graded in the same blind batch). The 38 vs 28 gap is unlikely to be chance (p=0.02), but any of those differences could explain it.

Two smaller findings:

  • The 9B 4bit model on that server peaked at 6.9GB; the 4B bf16 model the 16GB tier ships with peaked at 9.7GB.
  • I also gave the shipped tier and the 9B setup five small coding tasks with tests, twice each. With 16K context, 9 of 10 runs of the shipped tier stopped when the conversation outgrew the context limit, and none passed. The 9B setup at 64K never hit the limit and passed 3 of 10.

How I kept it honest

Risk What I did
Tuning to the test Criteria written before measuring; questions from an agent that never saw the retrieval code
Judge bias Six answers shuffled per question, two judges, labels compared
Order effects The three same-day setups rotated through all six orders
Sleep, power Charger and sleep state logged per run; no sleep during the run
Mid-run bugs A script error stopped the 9B block after one question. Fixed and resumed with the same questions and settings, and logged
Harness vs shipped tool Re-ran the 45 questions through the launcher I ship. The first re-run scored 26/45 because the launcher also loaded my global Claude Code plugins (8.2k tokens instead of 3.5k on a sample first request). Fixed the launcher, re-measured, logged both

All of this is one Mac, one person's memory files, and LLM judges.

Try the hook

My earlier post covers how the hook was built and measured on Ollama alone (20 → 37 correct on the same questions): https://dev.to/justjinoit/claude-code-on-a-16gb-mac-with-ollama-90s-56s-by-attaching-only-relevant-memory-5332

The hook, install script, preregistration log and scripts are in the repo: https://github.com/JustJinoIT/claude-local-kit

git clone https://github.com/JustJinoIT/claude-local-kit && cd claude-local-kit
./install.sh        # Ollama qwen3.5:9b (64k) + bge-m3
claude-local

# already running claude-code-local's MLX server? point the kit at it instead:
CLAUDE_LOCAL_BACKEND=mlx claude-local
Enter fullscreen mode Exit fullscreen mode

I also re-ran the same 45 questions through the launcher the kit ships (claude-local) instead of my test harness, with the kit's generic rules file instead of my personal one. Result: 36 of 45 on Ollama, and 36 of 45 on claude-code-local's 4B 16K server.

To check the grading, Opus re-graded my test-harness answers blind in the same batch: 32 for the server setup (same as the table) and 39 for the Ollama setup (38 in the table; one label changed).

Before you pick a local setup

  • Does your launcher turn memory off (--bare)?
  • How many tokens does your first request carry before the question?
  • Does your memory index hold answers, or only links to files?
  • Did you compare setups on the same questions, on the same day?

Written with help from an AI assistant (Claude). I checked every number against my measurement logs.

Top comments (6)

Collapse
 
gimalay profile image
Dmytro Halichenko •

The line that stood out is that the MEMORY.md index was mostly links to files, not facts. If each memory file carried a status and a one-line summary in frontmatter, the hook could build its slice from those lines and you'd have a deterministic baseline to compare the embedding slice against, which also splits retrieval misses from model misses. On the misses, did you log whether the right fact made it into the 2,400 characters?

Collapse
 
lauraflorey profile image
Laura •

Thank you for keeping the server and model the same and changing only the memory path. That makes the result easy to trust. I run local models on a Mac Studio with MLX too, and seeing a full index dumped into context do worse than a small, relevant slice matches my gut. Did you play with the 2,400 character cap at all, or was that the sweet spot from the start?

Collapse
 
justjinoit profile image
JustJinoIT • • Edited

Thanks! Honestly, no. 2,400 characters (roughly 800 tokens of Korean text) is the number I picked in the first version, and I never tuned it. In practice it rarely binds: on these 45 questions the median slice was about 1,300 characters, and only 4 came close to the cap. So I can't call it a sweet spot. Tuning it on these questions would leak the test set, so if I try other values, it'll be on a fresh question set.

If you're running claude-code-local's MLX server, the kit can sit on top of it: CLAUDE_LOCAL_BACKEND=mlx claude-local.

Collapse
 
reidmarlow profile image
Reid Marlow •

The index-versus-retrieved-lines comparison also changes whether the answer is directly in the prompt. I'd log, for each question, whether the gold fact made it into the 2,400-character slice before scoring the answer. That separates retrieval misses from cases where the fact was present but the model still missed it.

Collapse
 
justjinoit profile image
JustJinoIT • • Edited

Good call, and I have part of that. I ran the same hook offline on the same 45 questions and checked whether the gold answer was in the slice: it was for 36 of 45. Crossing that with the graded answers:

  • 9B on Ollama: fact in the slice → 34 of 36 correct; fact missing → 4 of 9.
  • 4B on claude-code-local's server: fact in the slice → 30 of 36; fact missing → 2 of 9.

So for the 9B-on-Ollama setup, most misses are retrieval misses; the 4B-on-server setup also missed 6 of the 36 it was handed. Model size and runtime both differ there, and 6 vs 2 is small, so I wouldn't read much into that part yet. One caveat: the slice check was a separate offline run with the same hook, not logged inside each graded run. I'll add per-run logging next time.

Collapse
 
izgorodin profile image
Edward Izgorodin •

The column I would look at twice is the made-up one. The full index added no correct answers and took made-up answers from 2 to 5. My guess is that a list of links tells the model which notes exist without saying what is in them, and it fills the gap from the file names. With 45 questions that is three answers, too few to rely on. I would still watch it, since the index goes into every request.