Skip to content

[codex] add token usage diagnostics#1393

Draft
peyton-alt wants to merge 6 commits into
mainfrom
tokens
Draft

[codex] add token usage diagnostics#1393
peyton-alt wants to merge 6 commits into
mainfrom
tokens

Conversation

@peyton-alt

@peyton-alt peyton-alt commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds token visibility commands for sessions and checkpoints:

  • entire session tokens [session-id] reports token usage, likely contributors, limitations, and optimization recommendations for live session state.
  • entire checkpoint tokens <checkpoint-id> reports committed checkpoint token usage with the same usage-first layout.
  • Multi-session checkpoints are reported as checkpoint-wide aggregates with Sessions and Agents instead of attributing aggregate totals to the latest session.
  • Checkpoint aggregation now preserves nested subagent token totals for diagnostics.
  • Session and checkpoint help text now includes the new token commands.

Why

Users need a simple way to see where token usage went during or after a session before building broader aggregation or optimization workflows. This starts with deterministic local visibility from data Entire already captures.

Validation

  • mise run check
    • fmt
    • lint
    • go test -tags=integration,authfilestore -race ./...
    • E2E canary vogon: 59 passed
    • E2E canary roger-roger: 4 passed
  • git diff --check
  • Real checkpoint smoke test: go run ./cmd/entire/main.go checkpoint tokens 0009b566bbbc

Copilot AI review requested due to automatic review settings June 9, 2026 02:18
@peyton-alt peyton-alt changed the title tokens [codex] add token usage diagnostics Jun 9, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9447b36. Configure here.

Comment thread t1.txt Outdated
Comment thread cmd/entire/cli/session_tokens.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds token-usage diagnostics to the CLI by introducing new tokens subcommands for both sessions and checkpoints, along with tests and updated help/ignore rules.

Changes:

  • Adds entire session tokens for reporting token usage + recommendations for a session.
  • Adds entire checkpoint tokens for reporting token usage + recommendations for a committed checkpoint (including multi-session aggregation).
  • Updates help text/tests and expands .gitignore for additional generated artifacts.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
t1.txt Adds a new text file (appears unrelated to the PR’s stated goals).
cmd/entire/cli/sessions.go Registers the new tokens subcommand under session and updates help text/examples.
cmd/entire/cli/sessions_test.go Adds extensive coverage for session/checkpoint token reporting behaviors and ordering.
cmd/entire/cli/session_tokens.go Implements entire session tokens report (text + JSON), contributors, and recommendation rules.
cmd/entire/cli/checkpoint_tokens.go Implements entire checkpoint tokens report (text + JSON) and aggregation across checkpoint sessions.
cmd/entire/cli/checkpoint_group.go Registers the new tokens subcommand under checkpoint and updates help text/examples.
.gitignore Ignores additional generated directories (.clawpatch/, entire-external-cp-test/, skills/).

Comment thread t1.txt Outdated
Comment thread cmd/entire/cli/checkpoint_tokens.go Outdated
Comment thread cmd/entire/cli/session_tokens.go Outdated
Entire-Checkpoint: 0c902d094d5c
Entire-Checkpoint: 1cf96d1dbe7e
Entire-Checkpoint: 79bf8e72decd
Entire-Checkpoint: ab4dd5b77ca7
Entire-Checkpoint: a9f752ac37df
Entire-Checkpoint: 9682839e2ddc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants