Skip to content

Claude Code Cache Performance Issues #2333

Description

@JJOne123

Describe the bug
I use Claude Code pointing to my local server running oMLX v0.5.3. I dont think it is specific to this version as I remember seeing similar behaviours with previous versions.

When I run Claude Code (CC) I set these variables in my claude settings.json file as is generally recommended when running locally:

...
"env": {
      "CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
      "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "95"
},
...

Recommended here: https://www.reddit.com/r/ClaudeCode/comments/1tfcnac/fix_your_cc_right_now_and_save_tokens/

What I am seeing is that during a session, oMLX will cache CC hefty system etc during the session. But every so often oMLX seems to re-read the entire session again as PP.
I understand that CC has a 5 minute cache timeout at Anthropic servers when using their APIs, but for oMLX I would have thought that it would continue to get the hot-cached data for each call and thus prevent long PP re-processing.

I've attached my server.log below. I noticed a large re-PP event around the 15:40 mark in the log (give or take a few minutes). At this point I had asked the model to write out its plan to a file IIRC.

Using Ornith-1.0-35B-MLX-oQ8 model on oMLX 0.5.3.

To Reproduce
Steps to reproduce the behavior:

  1. Use oMLX with Claude Code (currently using CC version 2.1.217)
  2. Do your normal work etc
  3. On the web UI, keep an eye on your prefill processing total tokens (after the initial code start of course)
  4. Periodically you should see a large prefill event take place again even though you have not issued a new large prompt.

Expected behavior
oMLX to use the cache to prevent large prefill events

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • macOS Version: 26.5.2
  • oMLX Version 0.5.3

Additional context
If this is a user issue, or if there are any additional Claude Code settings required, it might be useful to put them in the README say.

cc_caching_issue_server.log.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions