Prefix content is serialised non-deterministically
PrefixAudit rule unstable-serialisation · v0.1.0
Why it breaks your cache
If the prefix embeds a random or freshly generated value, or a structure serialised in an unstable key order, logically identical input produces different bytes. The cache key changes and the whole prefix re-bills, even though nothing meaningful changed.
How to fix it
Serialise with a stable order (sorted keys or a fixed key list) and keep random or generated values out of the cached span. Hash the rendered prefix in CI and fail on a change you did not intend.
How common is it?
This rule needs request or runtime context that an extracted prompt cannot supply, so it is excluded from the corpus study. It still runs in the auditor when you supply that context.
Estimated impact
Modelled as invalidating 0% of the cached prefix.
Is your prompt affected?
Paste it and find out. Static analysis, in-browser, nothing leaves the page.
Run the audit →