Skip to content

[codex] add token guidance and checkpoint comparison#1400

Merged
peyton-alt merged 29 commits into
tokensfrom
tokens-agent-brief
Jun 23, 2026
Merged

[codex] add token guidance and checkpoint comparison#1400
peyton-alt merged 29 commits into
tokensfrom
tokens-agent-brief

Conversation

@peyton-alt

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

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/547

Stacked on #1393.

Summary

  • add --agent-brief to entire session tokens for compact agent-native next-step guidance
  • add --compare to entire checkpoint tokens so users can measure observed token deltas between checkpoints
  • make JSON output and agent brief mutually exclusive
  • add tests for agent brief priority, comparison reduction/increase/no-change, missing token data, multi-session aggregate comparison, zero-baseline metrics, subcommand routing, and flag validation

Validation

  • real session smoke test: GOCACHE=/private/tmp/entire-go-cache go run ./cmd/entire/main.go session tokens --agent-brief
  • real checkpoint smoke test: GOCACHE=/private/tmp/entire-go-cache go run ./cmd/entire/main.go checkpoint tokens f1dfd807cfdc --compare ab4dd5b77ca7
  • real checkpoint JSON smoke test: GOCACHE=/private/tmp/entire-go-cache go run ./cmd/entire/main.go checkpoint tokens f1dfd807cfdc --compare ab4dd5b77ca7 --json
  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run TestCheckpointTokensCmd_.*Comparison -count=1
  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run TestCheckpointTokensCmd|TestTokensCmd|TestSessionsCmd_TokensSubcommand|TestSessionsCmd_HelpIncludesTokensSubcommand -count=1
  • mise run lint
  • GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -count=1
  • mise run check
  • git diff --check

Real checkpoint comparison observed

  • f1dfd807cfdc compared against ab4dd5b77ca7 showed observed_increase, not reduction: total tokens up 28.1%, cache/context replay up 26.9%, API calls up 30.5%.
  • The output explicitly qualifies that token deltas do not prove quality was preserved or degraded; users still need to verify task outcome/tests.

Follow-up lane

Historical profiling/memory recommendations, e.g. entire tokens profile, is intentionally left out of this PR. That should aggregate repeated high cache replay, high API calls, broad search/read loops, subagent-heavy sessions, and cases where usage rose after recommendations.

Copilot AI review requested due to automatic review settings June 10, 2026 03:45

@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 f0a30be. Configure here.

Comment thread cmd/entire/cli/session_tokens.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 an --agent-brief output mode to entire session tokens to provide compact, agent-oriented next-step guidance, while preventing conflicting output modes.

Changes:

  • Added --agent-brief flag to session tokens with brief output formatting (usage line, next best action, signals).
  • Enforced --json and --agent-brief mutual exclusivity.
  • Added test coverage for agent-brief prioritization, cache-replay-only scenarios, missing token data, subcommand routing, and flag validation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cmd/entire/cli/session_tokens.go Adds --agent-brief flag handling and implements brief-format output helpers.
cmd/entire/cli/sessions_test.go Adds tests validating agent-brief output content, routing, and mutual exclusivity with JSON.

@peyton-alt peyton-alt changed the title [codex] add agent brief for token diagnostics [codex] add token guidance and checkpoint comparison Jun 11, 2026
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch from 5e86ec3 to f7bd582 Compare June 13, 2026 09:22
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch from f7bd582 to c26b87f Compare June 13, 2026 10:30
@peyton-alt peyton-alt marked this pull request as ready for review June 17, 2026 15:19
@peyton-alt peyton-alt requested a review from a team as a code owner June 17, 2026 15:19
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch 8 times, most recently from 158cc79 to fe471f4 Compare June 22, 2026 22:18
Entire-Checkpoint: f1dfd807cfdc
Entire-Checkpoint: cea04e74bd49
Entire-Checkpoint: 210fe202c7ca
Entire-Checkpoint: abbcd842b704
Entire-Checkpoint: 7a1b83ebd234
Entire-Checkpoint: 70741de008a8
Entire-Checkpoint: 65d01316b402
Entire-Checkpoint: 84e842d92745
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch from dc21b4e to dd4bc64 Compare June 23, 2026 16:25
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch from 9f8f867 to b11488c Compare June 23, 2026 17:40
Entire-Checkpoint: cdebea3708fd
Entire-Checkpoint: e945a42148c6
Entire-Checkpoint: c04a3bb165a4
Entire-Checkpoint: aa9d6a1ab8b0
Entire-Checkpoint: e46d5e136530
Entire-Checkpoint: 1051aa7485b2
Entire-Checkpoint: 1869a59c64b1
Entire-Checkpoint: caff12e75277
Entire-Checkpoint: 642c25c2fd0c
Entire-Checkpoint: 1bbc15069665
@peyton-alt peyton-alt force-pushed the tokens-agent-brief branch from d7b4bc4 to b7a0bf6 Compare June 23, 2026 19:49
@peyton-alt peyton-alt merged commit 11be2bd into tokens Jun 23, 2026
8 checks passed
@peyton-alt peyton-alt deleted the tokens-agent-brief branch June 23, 2026 20:46
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.

3 participants