Skip to content

Let custom styles override the cleanup rule that pins punctuation - #303

Merged
alexkroman merged 1 commit into
mainfrom
claude/style-overrides-punctuation
Nov 5, 2026
Merged

alexkroman merged 1 commit into
mainfrom
claude/style-overrides-punctuation

Conversation

@claude

@claude claude Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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.styledText is text with the preservation rule swapped, and sendable(appending:) leads with it only when a style is present. The replacement (84 bytes) is shorter than the original (86), so customStyleBudget, now derived from styledText, 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: styledText is 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 unstyled text, and the eval's PRIOR_WINNER, are unchanged.

How it was tested

  • scripts/check.sh --portable passes on Linux. Swift build/tests can't run here, so CI on macOS verifies them.

  • Unit tests in CleanupInstructionTests:

    • the existing no-style tests still pin the unstyled prompt to text
    • new: the styled prompt omits the original rule and carries the qualified one, and the safeguards are still present
    • new: styledText differs from text only in that sentence
    • new: styledText is no longer than text, and the budget is at least the old headroom
    • the existing append, trim, emoji and budget-arithmetic tests now run against styledText
  • I did not run --verify-live. It needs macOS say and an API key, and the harness has no style or Fast/Smart mode yet.

  • scripts/check.sh passes (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)

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>
@claude
claude Bot requested review from alexkroman and he-james November 4, 2026 19:52
@claude
claude Bot marked this pull request as ready for review November 4, 2026 20:29
@alexkroman
alexkroman merged commit bf7b73c into main Nov 5, 2026
13 checks passed
@alexkroman
alexkroman deleted the claude/style-overrides-punctuation branch November 5, 2026 01:15
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