Trail Finding and Pi Review Token Deduplication

Implemented.
Changed:
-
cmd/entire/cli/trail_cmd.go- Root
entire trailhelp now explicitly mentionsentire trail finding. - Shared trail blurb via
trailContextBlurb().
- Root
-
cmd/entire/cli/lifecycle.go- Agent context injection now uses the same blurb, so agents learn about
entire trail finding.
- Agent context injection now uses the same blurb, so agents learn about
-
Tests updated/added:
TestTrailRootPrintsHelpTestEntireTrailContextInjectionMentionsFindings
Verified:
go test ./cmd/entire/cli -count=1
A little, but only in messaging—not functionality.
What changed:
- Added
entire trail findingto theentire trailhelp blurb. - Reused that same blurb for the agent context injection.
- Added tests to lock both surfaces.
No new commands, API behavior, flags, or UX flows were added.
The only arguable scope expansion is that I updated both the CLI help text and the agent-injected hint, because they previously duplicated the same sentence. If you wanted the fix limited strictly to the context injection or strictly to help output, I can narrow it.
Done.
- Pulled/rebased
origin/review-pi-reviewer - Resolved autostash conflicts
- Ran
go test ./cmd/entire/cli -count=1 - Committed:
e52b748b4 Mention trail findings in trail help - Pushed to
origin/review-pi-reviewer
Entire Trail review comment ID: 019f1ebb-8946-708f-9454-999bd43c3017 URL: https://entire.io/gh/entireio/cli/trails/467/review-pi-reviewer Severity: low Context: cmd/entire/cli/agent/pi/reviewer.go:193 Selected context:
addPiReviewTokens adds usage.Input + usage.CacheRead + usage.CacheWrite into total.In. For OpenAI-shaped usage, cache-read tokens are reported as a subset of input tokens (the codex reviewer in this repo explicitly avoids summing subset fields to prevent double-counting), and Pi normalizes across providers including OpenAI (gpt-5). If Pi's Input already includes cached tokens, this inflates the reported input count. Confirm Pi's input/cacheRead/cacheWrite are mutually exclusive before summing.
Addressed and pushed.
- Changed Pi reviewer token aggregation to use only
usage.InputforTokens.In, avoiding double-counting cache subset fields. - Left cache-specific accounting to transcript token usage, where cache fields are stored separately.
- Updated Pi reviewer tests.
- Ran:
go test ./cmd/entire/cli/agent/pi -count=1 - Commit:
6699ec40a Avoid double counting Pi review cache tokens - Pushed to
origin/review-pi-reviewer
Entire Trail review comment ID: 019f1ec1-3e28-7373-81b8-bbf656ff9184 URL: https://entire.io/gh/entireio/cli/trails/467/review-pi-reviewer Severity: low Context: cmd/entire/cli/agent/pi/reviewer.go:179 Selected context:
emitPiReviewTokens only dedupes usage when env.MessageID() is non-empty. The realistic stream fixture (TestPiReviewer_ParseJSONEventStream) shows message_end carrying usage with no id/message.id, so MessageID() returns "" and the dedup guard is skipped entirely. If Pi also emits a turn_end (which this parser explicitly reads usage from) for the same turn without an id, the input/output tokens would be counted twice. Consider a per-turn/per-type dedup fallback when no id is available.