Loading lesson…
Courses›Cache-prefix discipline

Cache-prefix discipline

DetailedOverviewQuizFlashcard

Cache-prefix discipline

Build lab (Module 6, L6.5): provider prompt caches reuse work only for an exact shared leading prefix. Two in-memory prompt builders run the same 12-turn task: the disciplined layout (system, sorted tools, append-only history, volatile tail last) holds a byte-prefix hit rate of 0.930 while the sloppy one (timestamp first, shuffled tools, re-rendered history) falls to 0.011. Measure each breakage alone (timestamp first 0.012, shuffled tools 0.269, mutated history 0.672) and version the tool block so a real contract change misses on purpose (turn 7 drops to 0.232, the system-prefix share). No provider is called.

This Harness Engineering lesson is part of a paid plan. Sign in with a plan that includes this course to read it.