Repository navigation
Token report: say what the RTK and Headroom counters actually count (client-visible RTK view, Headroom ledger presence) - #282
Merged
seathatflowsinourveins merged 5 commits intoSep 25, 2026
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- RTK: when rtk_database is configured, the global snapshot adds a client_visible view. It re-counts each retained row as a client first shows the output: whole up to 30,000 characters, otherwise a 2,000-character preview (Claude Code 2.1.282 defaults, overridable). It reports the top-10 share and the net, and the boundary text says so. The view is a model: it excludes later reads of saved files, and Codex has its own limits. - Headroom: record ledger_present from the path the report itself names. An absent ledger is labelled rather than read as a measured zero. - Coverage-matrix boundaries and the README say the same, including Context Mode's lifetime = retained events x 256. Evidence: the independently reviewed host receipts in #270. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- RTK: state the floor at zero (max(0, raw - filtered)) and why the
signed client view differs from it.
- Name the Claude Code 2.1.282 defaults and list the model's
assumptions: ASCII, preview at most, wrapper text and saved-file
reads not counted, script rows included.
- Validate the client limits (inline 4000-128000).
- Report shares as n/a on a zero total.
- Omit the view with an issue when the configured database holds fewer
rows than rtk gain reported.
- View problems (sqlite, value, type, OS) are the view's own issues and
no longer fail the rtk gain counter.
- Headroom: use only the path the report names, resolve a relative path
from the configured project (Headroom's working directory), and label
an absent ledger only when the reading is zero.
- HTML: the RTK card shows the client-visible net and the reporter's
boundary; the Headroom card marks an absent ledger and shows its
boundary.
- Tests pin the inline limit (<=), ceil, the top-ten ranking, zero
totals, overrides, the mismatch and error paths, the Headroom path
branches and connection closing. Seven targeted mutations are killed.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins
force-pushed
the
claude/token-report-counter-semantics-20260925
branch
from
September 25, 2026 20:25
743611a to
6c6d2b4
Compare
- The component-table RTK boundary states max(0, raw - filtered). - The boundary says "by default" only when both client limits are the Claude Code 2.1.282 defaults, and the preview must stay below the inline limit. - The row cross-check allows 1% fewer rows than rtk gain counted, for retention pruning between the two reads. - Tests cover the configured-limits wording, the preview limit and the pruning tolerance. A real-host refresh with the revised code exited 0 with no issues and a client_visible block. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins
force-pushed
the
claude/token-report-counter-semantics-20260925
branch
from
September 25, 2026 20:41
6c6d2b4 to
3d8afbb
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins
force-pushed
the
claude/token-report-counter-semantics-20260925
branch
from
September 25, 2026 20:43
3d8afbb to
ebb74b0
Compare
seathatflowsinourveins
enabled auto-merge (squash)
September 25, 2026 20:43
seathatflowsinourveins
deleted the
claude/token-report-counter-semantics-20260925
branch
September 25, 2026 20:57
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.
Scope
rtk_databaseis configured, the global snapshot gets aclient_visibleview.bashOutputMaxCharsdefault and saved-output preview (Rwe), overridable withclient_inline_charsandclient_preview_chars.ledger_presentcomes from the path the report itself prints. An absent ledger is labelled instead of being read as a measured zero.f5812d3f(origin/main, rebased)lane:foundationtools/token-report/token_manifest.py,test_token_manifest.py,README.mdandtoken_manifest.full.html.in. The RTK card now shows the client-visible net and the boundary; the Headroom card marks an absent ledger; the hot filemanifests/evidence.json, re-registered in the last commit.Evidence-class table
ceil(bytes/4)of raw minus filtered outputsource_review+native_provenestimate_tokens/trackat v0.49.0; receiptwsl-authoring-20260923--rtk--use--20260925-2(#270)source_review(installed 2.1.282 binary)y2e(g, Rwe)withRwe=2000native_provenwsl-authoring-20260923--headroom--use--20260925-2(#270)local_integrationrtk_client_visible(~/.local/share/rtk/history.db): 80,726 rows, top-10 74.3%, net 8,936,430 (1.20%)syntheticorigin/main's reporter (AttributeError: … rtk_client_visible) and pass with this changeIndependent review
An
evidence-reviewer(Opus 5.5 at max) reviewed three rounds.Its two non-blocking notes are also applied: a precise code comment, and a test that pins the 1% threshold. Seven targeted mutations are killed by the tests.
A real-host refresh with the revised code, against a copy of this host's report config with outputs redirected, exited 0 with no issues:
client_visiblenet 8,985,531 (1.21%), 80,978 rows and top-10 74.3%;ledger_present: false, with the absent note;Local commands run
Checklist
🤖 Generated with Claude Code