Repository navigation
perf(tokens): compact session keys in dedup ledger - #846
Merged
Merged
Conversation
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.
The Claude Code dedup index repeated a 32-byte session digest in every message and subagent-tail row. Under a 64 KiB cap, a fixed 1,000-message workload could not commit its usage. Store the session digest once, allocate a run-local integer key for that session, and use the smaller key in subordinate rows. Session creation, IDs and cursors remain in the existing transaction; the 16 KiB minimum index cap and public adapter API remain unchanged.
The same workload now commits all 1,000 messages in a measured 61,440-byte SQLite file. Tests cover main/subagent replay deduplication, session isolation after rollback, and capacity filling with the new integer key. This delays exhaustion of the fixed 128 MiB production index; it does not provide durable restart accounting or unlimited exact deduplication. Issue #637 and packaged long-duration qualification remain open.
Validation: 47/47 focused ledger/adapter tests, 6/6 affected storage-pause tests, scoped ESLint/Prettier,
typecheck:main,git diff --check, and independent GPT-6.1 Sol reviews. No local full suite or Windows VM run.