[codex] add token usage diagnostics#1393
Draft
peyton-alt wants to merge 6 commits into
Draft
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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.
Contributor
There was a problem hiding this comment.
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 tokensfor reporting token usage + recommendations for a session. - Adds
entire checkpoint tokensfor reporting token usage + recommendations for a committed checkpoint (including multi-session aggregation). - Updates help text/tests and expands
.gitignorefor 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/). |
Entire-Checkpoint: 1cf96d1dbe7e
Entire-Checkpoint: 79bf8e72decd
Entire-Checkpoint: ab4dd5b77ca7
Entire-Checkpoint: a9f752ac37df
Entire-Checkpoint: 9682839e2ddc
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.

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.SessionsandAgentsinstead of attributing aggregate totals to the latest session.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 checkfmtlintgo test -tags=integration,authfilestore -race ./...vogon: 59 passedroger-roger: 4 passedgit diff --checkgo run ./cmd/entire/main.go checkpoint tokens 0009b566bbbc