Skip to content

feat: keep-system-text mode — never image session config (compressSystem option)#105

Open
adrade2 wants to merge 1 commit into
teamchong:mainfrom
adrade2:keep-system-text
Open

feat: keep-system-text mode — never image session config (compressSystem option)#105
adrade2 wants to merge 1 commit into
teamchong:mainfrom
adrade2:keep-system-text

Conversation

@adrade2

@adrade2 adrade2 commented Jul 11, 2026

Copy link
Copy Markdown

System-prompt-shaped content rendered inside user-message images trips Anthropic's reasoning_extraction refusal classifier (stop_reason: refusal on cold-start hellos; the same heuristic behind the banner/stub wording notes in transform.ts). Measured on production Claude Code traffic (events.jsonl 2026-07-11): 88/3448 (2.6%) refusals on reminder-imaged requests, 1/219 on other compressed, 0/6533 uncompressed. Wording tweaks lower the classifier score; keeping the config out of images clears it.

  • New TransformOptions.compressSystem (default true = unchanged). false skips the slab gate/render, the system-field rewrite, the first-message splice/5a, and env relocation; tool_result (5b) and history (6) compression still run, so discovery bulk keeps its savings.
  • PXPIPE_KEEP_SYSTEM_TEXT=1 env var (or config.json keepSystemText: true) makes the proxy pass compressSystem/compressTools/compressReminders all false — tool docs and reminders are config too and stubbed tools previously retripped the classifier (see 2026-07-02 wording note).
  • New HistoryCollapseOptions.preserveReminderText (default false = unchanged), set by the transform in keep mode: text blocks in the protected head survive verbatim instead of tombstoning — without slab pages, that head text is the only copy of the session config (CLAUDE.md, memory index), and demoting it drops the operating instructions from context.

Verified against captured production traffic: a previously-refused cold-start request forwards with system/tools/reminders as native text and zero images; a long session still images tool_results and collapses history (10 turns -> pages) with the opening reminder intact; default mode output is byte-identical to before.

…tem option)

System-prompt-shaped content rendered inside user-message images trips
Anthropic's reasoning_extraction refusal classifier (stop_reason: refusal
on cold-start hellos; the same heuristic behind the banner/stub wording
notes in transform.ts). Measured on production Claude Code traffic
(events.jsonl 2026-07-11): 88/3448 (2.6%) refusals on reminder-imaged
requests, 1/219 on other compressed, 0/6533 uncompressed. Wording tweaks
lower the classifier score; keeping the config out of images clears it.

- New TransformOptions.compressSystem (default true = unchanged). false
  skips the slab gate/render, the system-field rewrite, the first-message
  splice/5a, and env relocation; tool_result (5b) and history (6)
  compression still run, so discovery bulk keeps its savings.
- PXPIPE_KEEP_SYSTEM_TEXT=1 env var (or config.json keepSystemText: true)
  makes the proxy pass compressSystem/compressTools/compressReminders all
  false — tool docs and reminders are config too and stubbed tools
  previously retripped the classifier (see 2026-07-02 wording note).
- New HistoryCollapseOptions.preserveReminderText (default false =
  unchanged), set by the transform in keep mode: <system-reminder> text
  blocks in the protected head survive verbatim instead of tombstoning —
  without slab pages, that head text is the only copy of the session
  config (CLAUDE.md, memory index), and demoting it drops the operating
  instructions from context.

Verified against captured production traffic: a previously-refused
cold-start request forwards with system/tools/reminders as native text
and zero images; a long session still images tool_results and collapses
history (10 turns -> pages) with the opening reminder intact; default
mode output is byte-identical to before.
@teamchong

Copy link
Copy Markdown
Owner

Thanks for the contribution. I like the idea of allowing users to opt out of imaging the system prompt. The exact scope is open for discussion: it could preserve only the system prompt, or all session configuration, including tools and reminders. The current name suggests system-only behavior, while the implementation is broader. I’m open to either approach.

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