Summary
On Claude Code 2.1.235 (Linux x64 native install) with tweakcc 4.3.3, tweakcc --apply cannot locate 86 of 677 system prompts, reporting e.g.
Could not find system prompt "System Prompt: Action safety and truthful reporting" in cli.js (using regex ...)
The cause looks like a whitespace mismatch on ${...} ternary interpolations: the generated locator regex expects the ternary spaced, but the shipped bundle has it minified.
Evidence
For System Prompt: Action safety and truthful reporting, the locator regex contains:
look at the target\$\{([\w$]+)\(([\w$]+)\) \? "" : "\. If what you find contradicts how it was described, or you didn't create it, surface that instead of proceeding"\}
i.e. it expects ${f(x) ? "" : "..."} — spaces around ? and :.
The actual text in the bundle (grep -o on the JS extracted from the native binary) is:
look at the target${z2d(e)?"":". If what you find contradicts how it was described, or you didn't create it, surface that instead of proceeding"}
i.e. ${z2d(e)?"":"..."} — no spaces. Every other character of the paragraph matches; only the ternary spacing differs, so the regex fails.
Scope
In a single --apply run on 2.1.235:
- 86 distinct prompts fail to locate.
- 82 of those 86 have a
${...} interpolation in their regex.
- 69 of those 86 have a spaced ternary (
\? ... :) in their regex.
Note that an interpolation alone is not sufficient to trigger it — 255 of the 677 prompt files declare a variables: block, and most still apply fine. Prompts whose interpolation is a bare ${var} appear to match; the ones carrying a ternary are the ones that break. I verified the exact character-level mismatch only for Action safety and truthful reporting; the counts above are a correlation across the rest of the failures, not 86 individually confirmed diagnoses.
Possibly related: #922 and #921, which also concern ${...} interpolation handling in the prompt pipeline. #942 reports non-system-prompt patches failing to find patterns on 2.1.227, which may or may not share a cause.
Suggested fix
When generating (or matching) the locator regex, make whitespace inside ${...} flexible — e.g. emit \s* around ? and : rather than a literal space, so the pattern tolerates both the pretty and minified forms.
Workaround
For anyone else blocked on this: tweakcc adhoc-patch --script @file.js works, since it operates on raw bundle text rather than the generated locator. The script has to re-emit the ${...} interpolation it captured rather than hardcoding it — the callee is a minified identifier (z2d here) that changes between Claude Code versions.
Environment
- Claude Code 2.1.235 (native binary, npm global install)
- tweakcc 4.3.3
- Linux x64, Node v24.17.0
Summary
On Claude Code 2.1.235 (Linux x64 native install) with tweakcc 4.3.3,
tweakcc --applycannot locate 86 of 677 system prompts, reporting e.g.The cause looks like a whitespace mismatch on
${...}ternary interpolations: the generated locator regex expects the ternary spaced, but the shipped bundle has it minified.Evidence
For
System Prompt: Action safety and truthful reporting, the locator regex contains:i.e. it expects
${f(x) ? "" : "..."}— spaces around?and:.The actual text in the bundle (
grep -oon the JS extracted from the native binary) is:i.e.
${z2d(e)?"":"..."}— no spaces. Every other character of the paragraph matches; only the ternary spacing differs, so the regex fails.Scope
In a single
--applyrun on 2.1.235:${...}interpolation in their regex.\? ... :) in their regex.Note that an interpolation alone is not sufficient to trigger it — 255 of the 677 prompt files declare a
variables:block, and most still apply fine. Prompts whose interpolation is a bare${var}appear to match; the ones carrying a ternary are the ones that break. I verified the exact character-level mismatch only forAction safety and truthful reporting; the counts above are a correlation across the rest of the failures, not 86 individually confirmed diagnoses.Possibly related: #922 and #921, which also concern
${...}interpolation handling in the prompt pipeline. #942 reports non-system-prompt patches failing to find patterns on 2.1.227, which may or may not share a cause.Suggested fix
When generating (or matching) the locator regex, make whitespace inside
${...}flexible — e.g. emit\s*around?and:rather than a literal space, so the pattern tolerates both the pretty and minified forms.Workaround
For anyone else blocked on this:
tweakcc adhoc-patch --script @file.jsworks, since it operates on raw bundle text rather than the generated locator. The script has to re-emit the${...}interpolation it captured rather than hardcoding it — the callee is a minified identifier (z2dhere) that changes between Claude Code versions.Environment