Trim repeated schema descriptions -> save tokens -> profit #250
Open
tmustier wants to merge 2 commits into
Open
Trim repeated schema descriptions -> save tokens -> profit #250tmustier wants to merge 2 commits into
tmustier wants to merge 2 commits into
Conversation
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.
feat/acceptance-finalization/v0.28.0, which looks newer thanmain. Happy to rebaseHey Nico!
I was doing a context scrub for my Pi and noticed the
subagenttool schema has quite a bit of repeated nested description text esp. foracceptance, chain steps, parallel & dynamic fanout.It looks like this was mostly added around 0.26/27 dynamic fanout + acceptance-contract.
Adding this small PR to keep the same behaviour but trim nested description fields.
Gets 32% fewer chars (25k->17k). Comparing OpenAI+Ant reported before/after tokens, I get:
Used/tested it a bunch locally today and seems to be working well. Let me know what you think!
Thomas
Pi description:
Summary
descriptionfields from the exportedSubagentParamstool schema while keeping top-level parameter descriptions$ref/$defsSize impact
SubagentParamsserialized schema:24,359→16,564chars7,795chars (~32.0%) in the source JSON Schemahi, and only thesubagenttool enabled:11,604→9,142total tokens (11.6k→9.1k), saving2,462tokens (~21.2%)11,598→9,136cache-write tokens2,967→2,576input tokens (3.0k→2.6k), saving391tokens (~13.2%), while some old-schema runs counted as high as5,006input tokensTest plan
mise x node@24.16.0 -- npm test— 510/510 passingmise x node@24.16.0 -- npm run test:integration— 377/377 passingmise x node@24.16.0 -- npm run test:all— unit + integration passingmise x node@24.16.0 -- npm pack --dry-runNotes
feat/acceptance-finalizationbecause that branch containsv0.28.0;maincurrently appears to lag atv0.26.0, which would make the PR unnecessarily noisy.