214f2b82db
Webhook/cron skill invocations concatenate a large static scaffold (activation note + expanded skill body) with a small volatile tail (ticket payload, timestamps) into one user string, and the Anthropic cache planner marked that whole string as a single atomic block — so a few changed tail bytes forced a full cache rewrite on every invocation. Instead of re-parsing scaffold marker strings out of the message at request time (fragile when a payload or skill body quotes the marker), the builders now register the exact stable-prefix bytes in a small process-local LRU registry at construction time. The cache planner splits a registered user string into [marked stable prefix, unmarked volatile tail] request-locally; canonical session history stays a plain string, and the failover stripper flattens the split back byte-exactly via an O(1) registry lookup. Unregistered messages keep the existing whole-message policy. Covers the single-skill builder (webhook + slash command + TUI) and the cron job prompt assembler (multi-skill, bundles, skipped-skill notice), with registration guarded against injection-scanner sanitization. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>