Repository navigation
feat(cli): expose context-window occupancy in headless JSON; emphasize no-poll guidance - #18
Merged
Merged
Conversation
The headless JSON result line carried only cumulative usage tokens. Add a
context object ({input_tokens, max_tokens}) sourced from collect_window — the
same view /context renders — so consumers can read the final window occupancy,
not just total token spend.
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.
Two small, independent changes bundled into one PR.
1. Headless JSON — final context-window occupancy (
cli)The headless JSON
resultline carried only cumulativeusagetokens (total spend across all calls), with no way to read how full the context window ended up. Add acontextobject sourced fromcollect_window(agent)— the same view/contextrenders:resultline; theis_errorline and text mode are untouched.input_tokensisnullwhen no LLM call happened (honest).agent.context/short-term memory surviveaclose(), so reading the window after cleanup is safe.2. Background-task no-poll emphasis (
harness, app)Uppercase the "DO NOT NEED TO POLL OR CHECK PROACTIVELY" guidance in the
background_tasktool description and the prompt section, to more firmly discourage the agent from polling for results that are delivered automatically.Test
ruff check src tests— cleanmypy src— clean (207 files)pytest tests/unit— 2592 passed