Introduction¶
In long-running DeepSeek Harness (DSH) sessions, the default LLM summarization backend can lead to window exhaustion, attention dilution, and lossy summaries that permanently lose exact error strings, command output, and code signatures. dsh-codex-context is a solution to this problem. It replaces the default backend with a token-budget sliding window while preserving persistent working notes and cold history search capabilities.
Core Features¶
dsh-codex-context provides the following capabilities:
- Token-budget sliding window: When the active window exceeds the configured
targetActiveTokens, the engine traces back and masks older nodes until the tail fits within the budget. Cuts are aligned to safe boundaries whenever possible. - Zero-orphan boundaries: Leverages Codex’s
normalizeinvariant to ensure that tool calls are never separated from their results. - Model-agnostic checkpoints: During routine window operations, it writes template checkpoints instead of calling an LLM, reducing cost.
- Emergency parachute: When pressure exceeds the threshold (default 0.85), it generates a structured summary via an LLM; if that fails, it falls back to a template checkpoint.
- Tools:
update_notes: Updates persistent working notes anchored at the top of model requests, unaffected by window sliding.search_history: Performs regex/keyword searches over the full session log, enabling cold history retrieval.
Installation and Enablement¶
This plugin is a dsh bundle. It disables the default compaction-basic line via cordis.patch.yml and mounts a codex-context line.
Local installation:
dsh plugin --profile demo add /path/to/dsh-codex-context
dsh --profile demo --dump-config # 检查 base compaction-basic 行是否被禁用,codex-context 行是否已挂载
dsh --profile demo
Git installation (recommended):
dsh plugin --profile demo add github:dvaJi/dsh-codex-context#<sha>
You need to add allowBuilds: dsh-codex-context: true to pnpm-workspace.yaml.
Packaged installation:
pnpm pack
dsh plugin --profile demo add ./dsh-codex-context-0.1.2.tgz
Tools layer only:
If you want to keep the original summarization backend and add only the notes and search tools:
- insert:
- id: codex-context-tools
name: dsh-codex-context/tools
Notes¶
- Tool name conflicts: Do not mount both the full bundle entry and
codex-context-toolsin the same context, as their tool names conflict. - Query restrictions:
search_historyrejects empty or whitespace-only queries; it rejects regex patterns containing nested unbounded quantifiers (such as(a+)+) to prevent catastrophic backtracking. - Permissions and provenance: The plugin runs with the permissions of the current DSH process. You should review the source code and license (MIT) before installing.
- Persistence mechanism: Notes persistence does not require custom session event types; it relies on the existing
user/messagesource snapshot and folding logic.
Summary¶
dsh-codex-context addresses information loss and window-management difficulties in long DSH sessions by introducing a Codex-style lossless retrieval architecture. It provides reliable cold history search and anchored working notes, making it suitable for development scenarios that require handling large amounts of context and preserving precise historical records.
Resources:
* GitHub repository: https://github.com/dvaJi/dsh-codex-context
* Ecosystem catalog: https://www.skillhub.cn/plugins/dvaJi/dsh-codex-context