perf(rules): compact large edit prompts - #47
Open
Hiro-Chiba wants to merge 1 commit into
Open
Conversation
Hiro-Chiba
force-pushed
the
agent/compact-large-edit-prompts
branch
from
July 18, 2026 11:33
40739c8 to
0cc913f
Compare
Hiro-Chiba
marked this pull request as ready for review
July 18, 2026 11:58
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.
What
This is an initial attempt at reducing the input that
enforceTddsends for a localized Edit in a large file.Adapters still produce the same canonical Write with the full post-edit content. They also retain the already validated Edit descriptor as non-serialized metadata. For post-images of at least 64 KiB,
enforceTdduses that descriptor only when it is at least four times smaller than the full content. Smaller or broad edits keep the existing full-context path.Would this projection and fallback threshold fit the rule's intended trade-off between context and validator latency?
Why
A one-line Edit currently makes the validator receive the complete post-image. In a local 50 MiB case, that produced a 52,435,726-character prompt even though the actual replacement was small.
The projected prompt was 7,191 characters. Prompt construction dropped from 35.03 ms to 0.26 ms, while the canonical full post-image remained available to every other rule.
Compatibility
Actionshape and JSON representation are unchanged.fastPathretain the full before/after behavior.Verification
npm run checks