Repository navigation
perf: store the session cache in day pieces - #1550
Merged
Merged
Conversation
Layout v10: a provider's files live in pieces by the UTC day of their newest call, each with a key file, and an index row per file (piece, fingerprint, call span, v9 month) read on every load. A ranged load reads the index, the key files and only the members it reports on; a save rewrites only the pieces it touched. Rows keep v9's full-load order and month scope, so orphans, the first-paint snapshot and dedup see what they saw on v9. The v9 month shards re-lay out once, streaming, and are removed after v10 publishes.
v9 could not see them, so every narrow query re-parsed each older Claude transcript it discovered and republished the cache. The index knows their fingerprint; an unchanged one needs nothing, a changed one still re-parses as if uncached.
… months before a whole-file parse
This was referenced Sep 24, 2026
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.
Second stage of bounded cache loading, on top of #1542.
What changes
todaystreams only today's pieces; a save rewrites only the pieces it touched. Pieces are plain stage-1 line-format shards, so the line reader, memo and full loads are reused.overview -p todayand every menubar refresh (a June file re-parses on each poll). The index knows every cached file's fingerprint, so unchanged ones are skipped.Verification
Figures against main, frozen pricing, fresh and upgrade (v9 -> v10): 66/66 commands identical on a real corpus (2.1 GB Claude, 4 GB Codex), 66/66 on a synthetic heavy corpus, 78/78 and 98/98 on two edge corpora (sessions across midnight and months, moved/shrunk/deleted files, forks and resumed copies of out-of-scope transcripts in both discovery orders, spawn anchors, WSL-offline members, June files), under local, Pacific/Kiritimati and America/Adak time zones. Member diff and load order equal main after every command. Longer ranges never total less than shorter ones inside them.
Robustness: SIGKILL at 7 points during migration then rerun, outputs equal main; truncated, empty, garbage and deleted key files, outputs unchanged; 12 concurrent processes plus a serve child with random SIGKILLs during saves, no crash, no unreadable file, outputs equal main.
Speed and memory, warm, median of 5:
overview -p todayoverview -p todayThe heavy corpus passes
overview -p todayand the menubar payload at a 384 MB heap cap (main fails at 1 GB). The first run after upgrading streams the migration: peak heap 784 MB instead of #1542's 2.7 GB, about 10 s once. A save that rewrites every piece (every fingerprint changed at once, e.g. a restored home folder) takes ~520 ms instead of ~230 ms.tsc clean; full suite green except
RootDeepProjectLabels.test.tsx, which fails identically on main in this checkout;test:locks36/36. Six new tests fail on #1542's source: piece selection, lost key file, cross-day move, lossless migration, migration write failure, old-file reconcile, plus the out-of-scope fork dedup test.Not covered
The Codex results file is still parsed and rewritten whole when a rollout changes (on the real corpus a warm
todaypoll goes from 0.5 s / 240 MB to 0.9 s / 870 MB after one append). That cache has its own version and migration and is the next stage. Windows and live WSL roots were not run.