Skip to content

Lifetime token-counter receipts on the WSL authoring laptop, with what each counter actually counts - #270

Merged
seathatflowsinourveins merged 5 commits into
mainfrom
claude/token-lifetime-receipts-20260925
Sep 25, 2026
Merged

seathatflowsinourveins merged 5 commits into
mainfrom
claude/token-lifetime-receipts-20260925

Conversation

@seathatflowsinourveins

@seathatflowsinourveins seathatflowsinourveins commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Scope

  • What this PR changes: host receipts on the WSL authoring laptop (wsl-authoring-20260923) for the four token tools that keep an upstream savings counter: RTK, Context Mode, jCodeMunch and Headroom.
    • Each receipt reads its counter with the tool's own command.
    • Each checks what the counter actually counts against the installed source.
    • Each exercises the tool's own job.
  • Base commit: dcd6f0cf (origin/main). Generation 2 was recorded at this commit in a detached worktree.
  • Lane: lane:foundation
  • Owned paths touched:
    • evidence/hosts/wsl-authoring-20260923/: 4 generation-1 receipts plus 4 generation-2 receipts that supersede them
    • regenerated: catalogs/landscape/component-evidence-matrix.json and docs/component-evidence-matrix.md
    • manifests/evidence.json, in the last commit under the hot-file protocol
  • Not touched: the token-practice documents owned by open PRs Token-efficiency coverage check: adoption profile plus value-free --client-wiring for every host #264 and Token report: take the Codex hook engine from the stable hooks flag; drop the removed plugin_hooks step #265. The counter semantics below are offered to those PRs as comments.

What the counters mean (generation 2, native_proven, independently reviewed: agree ×4)

Counter Upstream command Reading on 2026-09-25 What it counts
RTK 0.49.0 rtk gain --format json; --project 741.28M global; 608.51M agent-lab (a subset) Per command: ceil(bytes/4) of raw output minus that of filtered output, floored at zero, uncapped. The ten largest commands hold 74.4% and one grep 28.7%. Claude Code 2.1.282 shows up to 30,000 characters inline, otherwise a saved file with a preview of at most 2,000 characters. Modelled on what the client would show first, the net is 8.77M (1.18%). This is the receipt's own model, not a bound, and it excludes later reads of saved files.
Context Mode 1.0.169 status line; persisted stats-*.json 5.44M native Claude, 3.56M native Codex, 6.78M Desktop; status line: 80.1 MB kept out tokens_saved_lifetime = retained session events × 256, both in the plugin bundle Claude runs and in the ecosystem build. It is not a byte measurement. A sandboxed ctx_execute_file use returned the host-computed count and sha256 exactly.
jCodeMunch 1.108.319 order → get_session_stats (MCPorter stdio) 59,640 Whole-file bytes/4 counterfactual on one unmixed basis. All of it is from get_symbol_source since 2026-09-20, including acceptance reads. The Claude and Codex agent-lab registrations launch the same binary and index.
Headroom 0.37.0 headroom savings --json 0 The global ledger file does not exist, so the zero comes from an absent ledger. Positive control in an owned workspace: MCP compress 16,820 → 11,429 tokens with byte-identical retrieval, and the owned ledger then shows 1 call / 5,391 saved. The lifetime field is clamped to 30 days in code.

These are upstream estimates with different bases and scopes. They are not provider token measurements, and they must never be summed.

Independent review

  • Reviewer: a separate headless Claude Code session on Opus 5.5 at effort max, session 68da9901…. It re-ran every command and recorded its verdicts with scripts/host_receipts.py review.
  • Generation 1: needs_changes ×4. The four findings:
    • RTK: its 30,000-character cap overstated what the client shows past the limit.
    • Context Mode: no functional use, and one grep passed on either of two alternatives.
    • jCodeMunch: its assertion checked neither the basis nor the unattributed count.
    • Headroom: it read an absent ledger as an empty one and had no positive control.
  • Generation 2: agree ×4. Every command reproduced, and the earlier findings are resolved. Generation 1 stays byte-identical with its dissent, following Record token-stack host receipts on the workstation: RTK hook path, repomix, toon, Context Mode, jCodeMunch, Serena, ccusage #263's practice.
  • Review cost, from the headless result messages: $5.72 (62 turns) plus $10.08 (22 turns).

Local commands run

$ python3 scripts/host_receipts.py validate
{"receipts": 98, "status": "passed"}
$ python3 scripts/validate.py
{"components": 69, "hashed_files": 5612, "profiles": 4, "receipts": 147, "status": "passed"}
$ python3 scripts/component_matrix.py --write
{"flip_rule_violations": 0, "rows": 32, "status": "written"}
$ gitleaks git --log-opts="origin/main..HEAD" --redact .   (guarded ecosystem wrapper)
no leaks found

The matrix changes only receipt counts for rtk and headroom on linux-wsl2-x86_64: pass, independently reviewed pass, dissented and latest. No platform_status changes.

Checklist

  • python3 scripts/host_receipts.py validate passes.
  • Independent review is recorded in every receipt.
  • No platform_status change is made from a host receipt alone.
  • No workflows changed, no secrets, and no billing surface.
  • Peer-owned files and worktrees were preserved.

🤖 Generated with Claude Code

@seathatflowsinourveins seathatflowsinourveins added the lane:foundation Foundation lane: Claude/Codex setup, hosts, memory, RAG, research, workers label Sep 25, 2026
Four host receipts on wsl-authoring-20260923 for the token tools that keep
an upstream savings counter, each read with the tool's own command:
rtk gain (global and agent-lab project), context-mode's status line and
persisted stats, jcodemunch-mcp get_session_stats over MCPorter, and
headroom savings --json. Each receipt also checks what its counter
means against the installed source: RTK counts uncapped bytes/4 and its
ten largest commands hold most of the total; Context Mode's lifetime
field is retained events x 256; Headroom's lifetime is a 30-day window.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…receipts

A separate headless session re-ran every command and returned
needs_changes on all four; the superseding generation follows.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Generation 2 of each receipt addresses the independent needs_changes
findings:
- RTK: count what Claude Code 2.1.282 actually shows (30,000 characters
  inline, otherwise a 2,000-character preview). This is 1.18% of the
  upstream total, not 2.1%, and is no longer called a bound.
- Context Mode: add a sandboxed ctx_execute_file use, and check each
  formula statement exactly once in both builds.
- jCodeMunch: assert the basis and a zero unattributed count, and show
  the resolved path and both registrations.
- Headroom: show that the global ledger is absent rather than empty. Add
  an isolated MCP compress/retrieve positive control that increments an
  owned ledger, and check the 30-day clamp in code, not comments.

Recorded at origin/main dcd6f0c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Receipt counts change for rtk and headroom on linux-wsl2-x86_64; no
platform_status changes (flip_rule_violations 0).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@seathatflowsinourveins
seathatflowsinourveins force-pushed the claude/token-lifetime-receipts-20260925 branch from 1c6631d to 243b391 Compare September 25, 2026 19:09
@seathatflowsinourveins
seathatflowsinourveins marked this pull request as ready for review September 25, 2026 19:12
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@seathatflowsinourveins
seathatflowsinourveins enabled auto-merge (squash) September 25, 2026 19:12
@seathatflowsinourveins
seathatflowsinourveins merged commit 2bc7804 into main Sep 25, 2026
24 of 26 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/token-lifetime-receipts-20260925 branch September 25, 2026 19:21
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- 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]>
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
…client-visible RTK view, Headroom ledger presence) (#282)

* Token report: state what the RTK and Headroom counters actually count

- 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]>

* Resolve the independent review of the token report semantics

- 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]>

* Resolve the second review of the token report semantics

- 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]>

* Pin the 1% row tolerance and state what it does not detect

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Re-register the token report hashes

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: seathatflowsinourveins <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lane:foundation Foundation lane: Claude/Codex setup, hosts, memory, RAG, research, workers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant