Plan safe prefix-cache reuse by finding shared immutable token prefixes inside one policy scope.
Required APIdef prefix_cache_plan(requests, min_shared):
return {'hits': ..., 'misses': ..., 'saved_tokens': ...}BehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
prefix_cache_plan([{'scope': 'a', 'tokens': [1, 2, 3]}, {'scope': 'a', 'tokens': [1, 2, 4]}], 2)shared immutable context avoids repeated prefill
prefix_cache_plan([{'scope': 'a', 'tokens': [1, 2]}, {'scope': 'b', 'tokens': [1, 2]}], 2)one tenant cannot reuse another tenant's context
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.