Repository navigation
Let custom styles override the cleanup rule that pins punctuation - #303
Merged
Merged
Conversation
A custom style asking for no capitals or commas was sent in llm_instruction but ignored: the base instruction's "Preserve the original punctuation, capitalization, and spacing on every word you keep" beat it despite the preamble's precedence clause. With a non-empty style, the base now leads as styledText: the same text with that sentence swapped for "Keep punctuation, capitalization, and spacing unless the style below says otherwise." The replacement is no longer than the original, so the style budget grows by 2 bytes rather than shrinking, and the combined prompt still fits the 2048 cap by construction. Requests with no style send the shipped text byte for byte. Co-Authored-By: Claude <noreply@anthropic.com>
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 & why
Before: A custom style asking for no capitals/commas (e.g. "Remove the comma and the capital letters. Never add a dot if it's just one sentence.") was ignored; output kept standard punctuation because the base cleanup rule said to preserve it. The style did reach
llm_instruction, and the preamble says the user's preferences win, but the base text's "Preserve the original punctuation, capitalization, and spacing on every word you keep." still prevailed.After: When a non-empty style is present, that sentence is replaced with "Keep punctuation, capitalization, and spacing unless the style below says otherwise." The rest of the base instruction, the safeguards, and the preamble stay the same. With no style, the prompt is byte-identical to today.
How:
CleanupInstruction.styledTextistextwith the preservation rule swapped, andsendable(appending:)leads with it only when a style is present. The replacement (84 bytes) is shorter than the original (86), socustomStyleBudget, now derived fromstyledText, grows by 2 bytes (387 → 389) instead of shrinking, and the combined prompt still fits the 2048-byte cap by construction. The prompt is shared by the engine, so this affects both macOS and iOS.Caveat:
styledTextis a hand edit of the GEPA winner and has not been scored. It only ships when a user style is appended, and the unedited rule was overriding that style in those cases. The unstyledtext, and the eval'sPRIOR_WINNER, are unchanged.How it was tested
scripts/check.sh --portablepasses on Linux. Swift build/tests can't run here, so CI on macOS verifies them.Unit tests in
CleanupInstructionTests:textstyledTextdiffers fromtextonly in that sentencestyledTextis no longer thantext, and the budget is at least the old headroomstyledTextI did not run
--verify-live. It needs macOSsayand an API key, and the harness has no style or Fast/Smart mode yet.scripts/check.shpasses (or CI will, if I'm not on a Mac)I read AGENTS.md and this doesn't reintroduce anything
deliberately removed
Docs updated if behavior changed (AGENTS.md style-profile paragraph)