Introduction¶
DeepSeek Harness (DSH) long sessions easily reach the context window limit, causing automatic compression stalls or progress loss. This plugin solves session interruption and context overflow issues through structured handoff documents and active pruning.
Installation¶
dsh plugin --profile web add github:snow-The/dsh-session-handoff
After installation, you need to restart dsh web.
Core Modules¶
Session Handoff¶
The plugin provides structured handoff document export and restoration, supporting seamless session switching at breakpoints.
- Export and Restore: handoff_export parses the session into a Markdown document, writes it to <workspace>/.dsh-handoff/handoff-<session>.md, and generates a reusable handoff bundle (when OpenViking/archify enhancements are available). handoff_resume is used to load the document in a new session and continue the work.
- Status View: handoff_status outputs a session overview, including turn count, messages, tool usage, checkpoints, and context pressure.
Active Context Pruning¶
Uses the official compression API to actively compress consumed history before the context window fills up, avoiding stalls.
- Pressure Monitoring: acp_status checks usage, surface sequence mapping, and limits (soft/hard pressure levels).
- Manual Compression: acp_compress {start} {end} {summary} replaces the specified range with a summary.
- Configuration Adjustment: acp_set_limit proactively sets new soft/hard limits and persists them to the configuration file. Default soft/hard limits are 60% / 70%.
- Auxiliary Functions: acp_decompress (read hidden text), acp_search (search compressed history).
Session Management¶
Move sessions to the recycle bin, restore them, or permanently clear them to prevent data loss.
- Operation Tools: session_list lists sessions; session_trash archives and moves a session to the recycle bin (recoverable); session_restore restores a session from the recycle bin; session_purge permanently deletes a session and its recycle bin entry.
- Trash Persistence: Recycle bin entries are persisted as JSON under $DSH_HOME/dsh-session-handoff-trash/, keeping the latest 10 entries.
Model Routing¶
Supports switching the same model ID across providers and plans, solving management issues for a single model ID across multiple providers.
- Route View: model_routes lists all registered routes (provider, baseURL, key family).
- Route Switch: model_switch {route} switches the current model to the specified route. Supports the --vision option to use the vision wrapper.
Web Interface¶
The plugin includes a hand-written web client (no build step), providing graphical management.
- Model Routing Panel: Adds a “Model Routes” panel to the settings page, supporting drag-and-drop sorting, deletion, and adding routes.
- Automatic Failover: If the current route encounters an error, it automatically switches to the next route in the priority list, without interrupting work.
- Interactive Controls: Provides a “Handoff Export” button and compression threshold sliders (soft/hard limits), with one-click default value filling.
Typical Usage¶
In the old session:
handoff_export # 导出交接文档
In the new session:
handoff_resume # 加载交接文档,继续工作
In a long session:
acp_status # 检查压力
acp_compress {start} {end} {summary} # 剪枝已消耗的范围
acp_set_limit # 主动调整软/硬限制
When switching providers:
model_routes # 查看路由
model_switch deepseek # 使用 Ark 路线
model_switch deepseek-official # 使用官方路线
model_switch deepseek --vision # 使用视觉包装器
Notes¶
- The plugin core has zero dependencies; memory and graph features are automatically enabled when corresponding enhancements (e.g., OpenViking, archify) are detected.
- The host routing logic is shared with the proxy tools and will not drift.
- The web client has no build step.
- Trash entries are persisted as JSON under
$DSH_HOME/dsh-session-handoff-trash/(keeping the latest 10 entries).
Conclusion¶
This plugin is designed to solve memory and context management challenges in DSH development, and is suitable for long-cycle, multi-session collaborative development scenarios.