Skip to content

Implement max block for token scope - #23

Draft
anysphere-testuser wants to merge 2 commits into
mainfrom
cursor/implement-max-block-for-token-scope-cd06
Draft

Implement max block for token scope#23
anysphere-testuser wants to merge 2 commits into
mainfrom
cursor/implement-max-block-for-token-scope-cd06

Conversation

@anysphere-testuser

Copy link
Copy Markdown

Add a new <max> block to allow token limiting within a scope while including inner scopes in global priority calculation.


Open in Cursor Open in Web

cursoragent and others added 2 commits October 15, 2025 00:59
…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

cursor Bot commented Oct 15, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants