feat(usage): Show live orchestrator tokens on the statusline - #113
Merged
Merged
Conversation
Use harness-aware totals in run usage and query buckets. Expose worker and orchestrator totals while keeping the statusline fallback for older daemons. Co-Authored-By: Codex <noreply@anthropic.com>
Define bounded transcript ingestion, path validation, and token-ledger reconciliation for live orchestrator usage. Co-Authored-By: Codex <noreply@anthropic.com>
…-tokens-spec-e174
Align the live-token spec and design with the approved simplifications. Add task ownership, dependencies, interfaces, and scoped verification gates. Co-Authored-By: Codex <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@anthropic.com>
…-cli-b09d' into ra/orchestrator-live-tokens-spec-e174
Co-Authored-By: Codex <noreply@openai.com>
…-live-tokens-spec-e174
Co-Authored-By: Codex <noreply@openai.com>
…e-tokens-spec-e174
Track queued reconciliations by session and native id so repeated statusline requests do not reread earlier transcripts. Co-Authored-By: Codex <noreply@openai.com>
…e-tokens # Conflicts: # plugin/statusline.sh # tests/statusline.test.ts
|
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
In
codedeck open, the statuslinetokfield counted worker tokens only, so a run with no workers showed0 tokwhilerun $already included the orchestrator. The statusline payload'scontext_windowtokens describe the current window, not the session, so they cannot be summed. This PR reads the orchestrator transcript incrementally and records its cumulative tokens through the same high-water ledger as cost.transcript_pathas--transcript <session_id>=<path>;tok= workertotalTokens+orchestrator.totalTokens; with an active run and no valid summary,tokis omitted instead of showing the smaller context-window snapshot--transcriptflag and optionaltranscriptparam onusage.getconsumeTranscriptChunk, 1 MiB chunk cap, 4 MiB pending-line cap, dedupe bymessage.id+requestIdacross chunks~/.claude/projects, be named<id>.jsonland be a regular file; reset on inode change or shrink; ledger commit before the cursor moves; earlier-id reconciliation runs after the response and is not duplicated while in flightSpec, design, tasks and the run report are in
.specs/features/orchestrator-live-tokens/.Known risk (spec open question): an assistant line without
message.idorrequestIdis counted again if the transcript is replaced or shrinks.Test plan
npx vitest run tests/statusline.test.ts tests/usage-statusline-contract.test.ts tests/usage-cli.test.ts: 3 files, 53 tests passednpx vitest run tests/orchestrator-usage-daemon.test.ts tests/usage-daemon.test.ts tests/claude-transcript.test.ts tests/pricing.test.ts tests/usage.test.ts tests/usage-query.test.ts tests/usage-ledger.test.ts: 7 files, 103 tests passednpx tsc --noEmit -p .: cleancodedeck opensession against a real transcript