sliding-window-chat-truncation
Installation
SKILL.md
Sliding Window Context Truncation (Token Budget Governor)
Overview
In long interactive pair-programming sessions or multi-step autonomous projects, conversation transcripts naturally expand to 50 to 100+ turns.
An unmanaged 80-turn conversation re-sends 120,000+ tokens on every single turn, causing:
- Exponential Cost Inflation: Cost per turn explodes from $0.005 to $0.35.
- Severe Attention Degradation ("Lost in the Middle"): Critical instructions given at Turn 1 get lost in a sea of intermediate bash logs and code snippets.
- Context Limit Crashes: Hits provider hard token ceilings (128k/200k), causing total session failure.
The Sliding Window Context Truncation Protocol divides the conversation into 3 distinct memory zones, keeping active context strictly bounded within a fixed token budget ($< 12,000\text{ tokens}$) regardless of session length.