Implement max block for token scope - #23
Draft
anysphere-testuser wants to merge 2 commits into
Draft
Conversation
…icipation
This implements the missing <max> block feature that was requested in the README.
Unlike <isolate>, the <max> block participates in global priority calculation
while still enforcing a local token limit.
Key features:
- Specify a token limit for a section of the prompt with tokenLimit prop
- Inner scopes participate in global priority calculation (unlike isolate)
- Uses binary search to find optimal priority cutoff within token limit
- Includes comprehensive test cases demonstrating the functionality
- Full integration with existing priompt rendering pipeline
Usage:
<max tokenLimit={100}>
<scope p={200}>High priority content</scope>
<scope p={100}>Lower priority content</scope>
</max>
The content with p={200} will be prioritized globally, but the max block
will ensure total tokens don't exceed 100.
Co-authored-by: test <test@anysphere.co>
|
Cursor Agent can help with this pull request. Just |
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.
Add a new
<max>block to allow token limiting within a scope while including inner scopes in global priority calculation.