Skip to content

[codex] add token profile history diagnostics#1417

Draft
peyton-alt wants to merge 3 commits into
tokens-agent-brieffrom
tokens-profile
Draft

[codex] add token profile history diagnostics#1417
peyton-alt wants to merge 3 commits into
tokens-agent-brieffrom
tokens-profile

Conversation

@peyton-alt

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

Copy link
Copy Markdown
Contributor

Summary

  • add top-level entire tokens profile for historical checkpoint token diagnostics
  • default profile scans to latest 50 checkpoints, with --limit and --all for scope control
  • aggregate token usage, repeated cache/API/subagent/missing-data signals, recommendations, JSON output, and public-checkpoint-safe limitations

Verification

  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run 'TestTokensProfileCmd' -count=1
  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run 'Test.*Tokens|Test.*Token' -count=1
  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -count=1
  • mise run lint
  • mise run check
  • real checkpoint smoke over public/local checkpoint refs: entire tokens profile --limit 5 and default entire tokens profile both completed successfully over 4,306 available checkpoints

Note

Low Risk
Read-only local git checkpoint metadata analysis with no auth or data writes; main risk is slow runs when using --all on very large histories.

Overview
Adds a top-level entire tokens command group with profile, which scans committed checkpoint metadata only (no transcripts) to aggregate historical token usage and surface repeated patterns.

By default it analyzes the latest 50 checkpoints; --limit and --all control scope. Output includes aggregated totals, repeated signals (cache/context replay hotspots, high API call counts, subagent-heavy checkpoints, missing token data), actionable recommendations, explicit limitations, and optional --json. Token rollup reuses the same formatting/aggregation helpers as existing session/checkpoint token commands.

Tests cover text and JSON output, limit scoping, and empty checkpoint history.

Reviewed by Cursor Bugbot for commit 93eb40f. Configure here.

Copilot AI review requested due to automatic review settings June 11, 2026 06:19

@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 1 potential issue.

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 93eb40f. Configure here.

Comment thread cmd/entire/cli/tokens_profile.go

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 a new top-level entire tokens command group with a profile subcommand that scans committed checkpoint metadata to produce historical token-usage diagnostics (aggregates, repeated signals, recommendations, limitations) with optional --json output.

Changes:

  • Introduces entire tokens profile with default scope of the latest 50 committed checkpoints and --limit / --all scope controls.
  • Implements reporting: aggregated token usage, repeated signal detection, recommendations, limitations, and JSON/text renderers.
  • Adds unit tests covering text output, JSON output, limit scoping, and empty history behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
cmd/entire/cli/tokens_profile.go New tokens command group and profile implementation, including report building + renderers.
cmd/entire/cli/tokens_profile_test.go New tests for entire tokens profile output modes and scoping behavior.
cmd/entire/cli/root.go Registers the new tokens noun-group command in the root CLI.

Comment thread cmd/entire/cli/tokens_profile.go
Entire-Checkpoint: cdebea3708fd
Entire-Checkpoint: e945a42148c6
Entire-Checkpoint: c04a3bb165a4
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