high

Tool definitions can change between calls

PrefixAudit rule tool-churn · v0.1.0

Why it breaks your cache

Tools are part of the cached prefix and are ordered BEFORE the system prompt. Adding, removing, reordering, or re-serialising a tool with a different JSON key order breaks the cache for the entire request. OpenAI reports this as reason "tools_changed".

How to fix it

Freeze the tool list and its order for the life of a session. Sort JSON keys deterministically when serialising. To restrict a tool at runtime use tool_choice/allowed_tools instead of mutating the schema you send.

How common is it?

Detected in 2 of 236 production system prompts (0.8%) across 16 vendors.

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 →

← All 14 rules