Make incremental generation explicit with a key/value cache that appends one new position without recomputing the prefix.
Required APIdef append_kv(cache, key, value):
return new_cacheBehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
append_kv({'keys': [], 'values': []}, 'k1', 'v1')the first generated token creates cache state
append_kv({'keys': ['k1'], 'values': ['v1']}, 'k2', 'v2')past context must remain available
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.