Repository navigation
core: scaffold ds4-compatible disk KV cache - #4
Merged
Merged
Conversation
KVC file format (48-byte header) + SHA1-keyed rendered-prefix storage with save / load / LRU eviction. Foundation only; wiring into the existing PrefixCacheManagerV2 (cold / continued / evict / shutdown save hooks + load-before-prefill) lands in a follow-up. Format matches antirez/ds4 KVC so cache files are portable between hanzo-engine and zen5-server. 5 unit tests cover header round-trip, SHA1 stability, save/load round-trip, missing-key None, and LRU eviction. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Code Metrics Report━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Language Files Lines Code Comments Blanks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ C Header 5 305 210 52 43 CSS 5 1462 1288 39 135 CUDA 60 20622 16570 1656 2396 Dockerfile 1 38 21 8 9 JavaScript 19 3972 3089 488 395 Jinja2 7 694 656 5 33 JSON 27 9400 9397 0 3 Makefile 1 6 5 0 1 MDX 1 147 0 132 15 Metal Shading Lan| 34 13466 10542 1117 1807 PowerShell 1 300 227 30 43 Python 131 10161 8357 462 1342 Shell 4 948 765 106 77 Plain Text 3 3723 0 2413 1310 TOML 30 1427 1237 46 144 TypeScript 11 1607 1371 66 170 YAML 4 41 39 2 0 ───────────────────────────────────────────────────────────────────────────────── HTML 4 782 695 38 49 |- CSS 1 578 544 14 20 |- JavaScript 1 24 23 0 1 (Total) 1384 1262 52 70 ───────────────────────────────────────────────────────────────────────────────── Jupyter Notebooks 3 122 83 23 16 |- Markdown 1 60 30 22 8 |- Python 1 122 113 1 8 (Total) 304 226 46 32 ───────────────────────────────────────────────────────────────────────────────── Markdown 210 19178 0 13456 5722 |- BASH 123 1399 1090 190 119 |- Dockerfile 3 6 6 0 0 |- JSON 35 1175 1175 0 0 |- PowerShell 5 7 7 0 0 |- Python 45 1717 1459 65 193 |- Rust 64 2423 2048 56 319 |- TOML 16 318 250 4 64 |- YAML 3 18 17 1 0 (Total) 26241 6052 13772 6417 ───────────────────────────────────────────────────────────────────────────────── Rust 602 259959 229293 6654 24012 |- Markdown 400 9599 454 7977 1168 (Total) 269558 229747 14631 25180 ───────────────────────────────────────────────────────────────────────────────── Svelte 18 1831 1696 50 85 |- CSS 1 4 4 0 0 |- JavaScript 18 876 727 24 125 (Total) 2711 2427 74 210 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Total 1181 368517 293488 35197 39832 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
zeekay
pushed a commit
that referenced
this pull request
Jul 26, 2026
core: scaffold ds4-compatible disk KV cache
hanzo-dev
added a commit
that referenced
this pull request
Jul 27, 2026
core: scaffold ds4-compatible disk KV cache
zeekay
added a commit
that referenced
this pull request
Sep 15, 2026
core: scaffold ds4-compatible disk KV cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foundation for punch-list item #1 (SHA1-keyed rendered-prefix disk KV cache).
mistralrs-core/src/disk_kv_cache.rs(~270 LOC):KvcHeader(48 bytes, ds4-compatible),DiskKvCachewithsave/load/evict_to_budget, SHA1 keying viakey_for(). Atomic writes via tmp+rename. LRU eviction bylast_used_unix.sha1 = "0.10"tomistralrs-core/dependenciesandtempfile = "3"to dev-dependencies.Format matches
antirez/ds4KVC so cache files are portable between hanzo-engine and zen5-server.What this does NOT do (follow-up)
PrefixCacheManagerV2(cold / continued / evict / shutdown save hooks + load-before-prefill). That's a separate, larger change that touches the engine main loop.--kv-disk-dir DIR/--kv-disk-space-mb NCLI flags. Will land alongside the wiring.KTMtool-id replay map tail section (punch-list item port ds4 613e9b2: default min-p filtering at 0.05 #3). The header already reserves a bit for it.Tests
5 tests cover header round-trip, SHA1 stability, save/load round-trip, missing-key returns None, and LRU eviction.
🤖 Generated with Claude Code