context_digest: Compress DSH Conversation History into Reusable Markdown Context Summaries

Introduction

Sessions in DeepSeek Harness (DSH) accumulate over time, but feeding the full history directly to the model often exceeds the context budget and can distract the model with irrelevant details. Manually organizing session summaries is time-consuming and prone to omissions.

What It Is

context_digest is a DSH plugin that compresses historical conversations into a structured Markdown context digest, preserving titles, objectives, follow-up requirements, final conclusions, and tool usage statistics—making it easy to hand off, archive, or feed into the next round of tasks.

  • Maintainer: jaki001
  • Category: Memory
  • License: MIT

Core Features

The plugin introduces a new tool context_digest that supports three data-fetching modes:

  • recent (default): the most recent N sessions
  • live: the session(s) currently open in DSH
  • session: a single session by sessionId

The Markdown output includes: title / time range / objective / follow-up requirements / final conclusion / scale / tool statistics. An optional saveTo parameter writes the result to a .md file, enabling long-term accumulation of a context library.

The plugin accesses the session store in read-only mode—it never modifies or deletes any sessions.

Installation & Activation

Install from npm (recommended):

dsh plugin add dsh-plugin-demo

Install from a local directory or tarball:

dsh plugin add ./dsh-plugin-demo-0.1.0.tgz

After installation, restart DSH, or launch with the patch flag: dsh web --patch.

Configuration

The default configuration is located in cordis.patch.yml:

- insert:
    - id: demo-context-digest
      name: dsh-plugin-demo
      config:
        recentLimit: 3
        maxChars: 600
        logOnStart: false
Key Default Description
recentLimit 3 Default number of sessions fetched in recent / live mode (1–20)
maxChars 600 Truncation length for each field (objective, follow-up, conclusion) (80–4000)
logOnStart false Reserved; intended for startup self-check logging

Typical Usage

Ask the model to summarize the last few conversations:

帮我用 context_digest 把最近 5 个会话整理成一份交接摘要,存到 notes/handover.md

Only the currently open session:

用 context_digest(mode=live)看看我现在开着哪些会话,各自做了什么

A single session:

用 context_digest(mode=session, sessionId=xxx)总结这个会话

Tool name: context_digest; parameters: mode, sessionId, limit, maxChars, saveTo.

Output Example

# 会话上下文摘要

生成时间:2026-11-20 18:40 · 会话数:2

## 1. 排查插件安装失败 · 0307108a

- 时间:2026-11-17 22:12 → 2026-11-20 18:40
- 目标:为什么安装插件总是失败呢?
- 后续要求:切换到官方 discover
- 最后结论:版本闸门拒绝了 peer 版本不满足的插件,装兼容版即可。
- 规模:12 轮 / 35 条用户消息 / 480 个事件
- 工具:96 次调用(bash×61, read×14, grep×9, write×5)

Each session gets its own section with fixed fields, making it easy to parse programmatically or paste directly into a new session as background context.

Design Trade-offs

  • Only calls the official sessionQuery read-only interface; does not parse sessions/*.zstd files directly, avoiding breakage from format drift
  • recent mode follows the session store’s “newest first” ordering, without relying on filesystem modification timestamps
  • Field-level truncation (maxChars) ensures long sessions never blow the context budget
  • live mode returns a hint instead of an error when no sessions are open, allowing the model to fall back to recent automatically

Dependencies & Development

  • Requires the host to provide a sessionQuery service (the DeepSeek Harness base bundle ships with dsh-session-query-sqlite)
  • Requires @deepseek-ai/dsh-tools (shipped with the host; declared as a peer dependency only)

Local self-check:

npm run selfcheck   # No host dependency; validates extraction and rendering logic

Use Cases & Notes

Suitable for users who need to periodically aggregate, hand off, or archive session context. Be sure to review the source code and license (MIT) before installing.

In Short

context_digest compresses DSH historical conversations into a reusable Markdown context digest, helping you reuse session information within a limited context budget. The catalog page and source code are linked below.

  • Catalog: https://www.skillhub.cn/plugins/juki001/wqr-dsh
  • GitHub: https://github.com/juki001/wqr-dsh
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye