mirror of
https://github.com/teamchong/pxpipe.git
synced 2026-07-22 02:02:51 +02:00
a19ce30a48
Snap the collapse cutoff to a `collapseChunk`-sized grid (default 50) so the rendered history image stays byte-identical for a full window of turns. That lets Anthropic's prompt cache `cache_read` the history prefix (0.1x) instead of re-billing `cache_create` (1.25x) every turn. The cutoff floors at `minCollapsePrefix` (clamped to the raw cutoff) so short conversations still collapse without the boundary drifting. Also log `history_image_sha8` per request -- a sha8 of the concatenated history-image base64. An unchanged hash across consecutive collapsed events is ground-truth proof the prompt cache is being hit; a hash that moves every turn signals the cache-key drift regression is back.