Repository navigation
Measure tool_tokens — a stale comment hid 28% of the window - #2157
Merged
Merged
Conversation
…window The accounting closes. `after_framing` reads 4,634 on a 16,384 window, and `16384 − 4096 reserve − 3045 framing − 4,634` leaves ~4,609 for the native tool schemas. There was never a missing term: I had been computing `after_framing` by hand as `16384 − 4096 − 3045 ≈ 9,243`, forgetting the tool reserve entirely, and calling the difference a phantom. `describe_tool_tokens` was the suspect I raised and then dismissed — because its own doc says "a SINGLE tiny schema … a few dozen tokens, not the 4-5k the old full-registry dump cost." That sentence was written when the native surface WAS a two-tool discovery pair. #206 deliberately removed that clamp (a native-tool model can only call what it was offered; the amputated surface stranded it in a `commands/help` loop and wrote nothing), restoring ~a dozen tools offered in FULL. The comment did not follow. Reading it is what killed the right answer. Same failure as `BOOTSTRAP_WORKING_SET`: a comment that outlived its code, trusted because it was specific. So the number is now MEASURED on the probe as `tool_tokens` instead of asserted in prose, and the prose says what it actually is. What this exposes, stated as a question rather than a claim: the tool surface is paid TWICE — once as these native schemas (~4,609) and again as the human-readable menu inside `compose_system` (inside `framing_tokens`, ~1,000+). Together that is over a third of a 16k window spent describing tools before one message is read. Whether the duplication is intended is not something I can settle from here. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
The token accounting closes with no missing term.
after_framing= 4,634 on a 16,384 window, and16384 − 4096 reserve − 3045 framing − 4634leaves ~4,609 for the native tool schemas.I had been computing
after_framingby hand as16384 − 4096 − 3045 ≈ 9,243— omitting the tool reserve — and calling the difference an unexplained gap.describe_tool_tokenswas raised as a suspect and then dismissed, because its doc says "a SINGLE tiny schema … a few dozen tokens, not the 4–5k the old full-registry dump cost." That was written when the native surface was a two-tool discovery pair. #206 deliberately removed that clamp and restored ~a dozen tools offered in full. The comment didn't follow, and reading it killed the right answer — the same failure mode asBOOTSTRAP_WORKING_SET.tool_tokensnow measured ondelib.context.renderinstead of asserted in proseOpen question, not a claim: the tool surface is paid twice — native schemas (~4,609) plus the human-readable menu in
compose_system(~1,000+, insideframing_tokens). That's over a third of a 16k window on tool description before a single message. Whether that duplication is intended needs someone who knows the native-vs-text-model tradeoff.Tests green (prompt_shaping 18/0).
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo