dsh-cwl: A Structured Context Eviction Scheme for DeepSeek Harness

dsh-cwl is a DeepSeek Harness plugin designed to address context window pressure in long conversations and replace traditional LLM-based summarization and compression. Based on the Context Window Lifecycle (CWL) theory, it automatically infers tool trajectories into two types—exploration (`expl`) and action (`act`)—and executes a zero-LLM staged eviction strategy when context pressure exceeds the threshold. This approach prioritizes retaining user messages and combines content truncation with whole-episode eviction to keep the causal chain structure intact. The plugin provides a `cwl_recall` tool for on-demand retrieval of evicted content and supports flexible configuration of budgets and eviction order through environment variables, making it suitable for scenarios that require long-horizon dialogue and context replay validation.

Read More