Skip to content

perf(tokens): compact session keys in dedup ledger - #846

Merged
antropos17 merged 3 commits into
masterfrom
codex/claude-ledger-session-key-20261011
Oct 10, 2026
Merged

antropos17 merged 3 commits into
masterfrom
codex/claude-ledger-session-key-20261011

Conversation

@antropos17

@antropos17 antropos17 commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

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.

@antropos17
antropos17 merged commit cbffd4a into master Oct 10, 2026
5 checks passed
@antropos17
antropos17 deleted the codex/claude-ledger-session-key-20261011 branch October 10, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant