Introduction

The Chain of Thought (CoT) of reasoning models is valuable for debugging and evaluation, but in chat interfaces, it usually scrolls away quickly: after the answer ends, it is often difficult to find an entry point to look back at “how the model thought at that time,” requiring you to dig through raw logs.

dsh-think-summary solves this problem. It is a DSH (Cordis architecture) dual-sided plugin: it detects the model’s long thinking, segments and produces summaries in real-time while thinking, displays them in the chat area, and includes a settings page and history persistence. Below, it is introduced in the order of features, installation, verification, and notes.

What is this

The plugin is named dsh-think-summary, the repository is located at https://github.com/oakcakerolls/dsh-think-summary, the license is MIT, and the current version is 0.1.2.

It consists of two halves: the Host half (src/host/*, TypeScript) is responsible for detection, segmentation, summarization, refinement, and persistence; the Client half (src/client/*, pure JS) is responsible for the real-time panel, summary bar, view, and settings cards. One point needs to be emphasized: the summary is not written back to the session context, it is only for display, resulting in zero pollution to the conversation.

Core Features

Long Thinking Detection and Semantic Segmentation

The Host half observes reasoning-delta in real-time within the llm/stream waterfall, using lightweight token counting (CJK adaptive, raw count not rounded) to measure the amount of thinking. When exceeding the threshold (default 2000 tokens), it automatically enters segmentation mode; by default, streams with a non-empty purpose (compression, title generation, etc.) are filtered out.

Segmentation uses dual thresholds: a minimum window of 1500 tokens, after which it waits for a semantic boundary before cutting; a hard cap of 3000 tokens, at which point it forces a cut back to the end of the nearest sentence or line. Segmentation is aware of Markdown structure: a fence state machine ensures code blocks are atomic, tables are kept whole, and lists are only cut at item boundaries. The buffer only caches the unsummarized remainder, is memory-bounded, and uses state-level hash deduplication.

Segment-by-Segment Summary and Refinement

Each segment is first produced with a heuristic extraction summary (0 tokens, immediately available). When refinement is enabled, segments that can be refined will regenerate the summary using the session provider’s minimum available model, with an input budget and three-tier clipping (head/tail / tail only / full keep, default headtail). The refinement concurrency pool defaults to 3; tasks do not interrupt each other. Timeouts release concurrency slots, and exceptions automatically fall back to heuristic and mark the reason on the segment. The segment header simultaneously displays the raw output tokens and the refined actual tokens.

Code blocks and tables have three-state processing: ignore (default, content not written to memory, cards show no traces), keep-skip (keep and perform structured summary, skip refinement), keep-refine (keep and refine).

Three Positions on the Interface

  1. Real-time Panel: Located above the composer, it displays thinking progress and scrolling appended segment summaries. It is only visible in the “Conversation” view. The client polls /api/think-summary/state every 1.5 seconds.
  2. Summary Bar in Chat Stream: Appears at the end of every reply (turnTail slot), displaying the thinking summary for that turn, grouped by each thinking step (step), and collapsed by default.
  3. Summary View: The “Summary” tab in the session header lists all recorded thinking for the current session. It is collapsible, auto-scrolls to the bottom, and the collapsed state is persisted via localStorage.

Fallback and Optional Self-Generated Summary

When the session/event event stream breaks or encounters an exception, the plugin runs the segmentation summary again. Fallback segments are also queued for refinement (using the session’s default model), ensuring no summary is lost.

There is also a main model self-generated summary, disabled by default: setting selfSummary to prompt injects a summary instruction into the system prompt and captures the 【思考小结】 tag directly in the stream for display. This is only a display-level supplement and does not affect external segmentation.

Persistence and Cleanup

Thinking summaries are saved to ~/.dsh/dsh-think-summary.json using atomic writes (tmp+rename). State changes are synced to disk immediately, allowing history to be viewed even after restarting dsh. Automatic/manual cleanup for archived sessions is supported: automatic cleanup is off by default, archival retention is 30 days by default, and immediate cleanup has a grace period of 24 hours by default.

Settings Page and HTTP Interfaces

The settings page is located in the sidebar under “Settings → Plugin Config → think-summary” (collapsible groups). Since the official settings bridge only serves whitelisted namespaces, this plugin has built its own loopback settings bridge, meaning changes take effect immediately without requiring a restart. Main default values: Long thinking threshold 2000, segment minimum window 1500, segment hard cap 3000, refinement enabled (budget 1024 tokens, concurrency 3, timeout 60 seconds, model auto), code block/table processing ignore, self-generated summary off.

The Host provides six HTTP interfaces with direct browser same-origin connection:

GET  /api/think-summary/state               Session thinking state view
GET  /api/think-summary/models              Refinement model dropdown data source
POST /api/think-summary/settings/describe   Settings namespace view
POST /api/think-summary/settings/mutate     Set/unset per field
POST /api/think-summary/clear-archived      Clear archived session summaries
POST /api/think-summary/pause               Toggle global pause

Among these, the settings, clear-archived, and pause interfaces are loopback-only and reject non-origin requests.

Installation and Enablement

Installation is completed with a single command using the npm package:

dsh plugin --profile web add dsh-think-summary

Local development installation (recommended with ⭐ in README, requires local pnpm):

dsh plugin --profile web add link:/absolute/path/to/dsh-think-summary
# Windows example:
dsh plugin --profile web add link:D:/Files/zzj/Programs/webs/dsh-plugins/dsh-think-summary

This command writes a link: dependency in ~/.dsh/profiles/web/, creates a symbolic link, and adds the package to dsh.profile.bundles. Uninstall using dsh plugin --profile web remove dsh-think-summary.

If you only need the Host side, you can also manually add a line to cordis.yml:

- path: /absolute/path/to/dsh-think-summary
# or
- pkg: dsh-think-summary

Note: The manual cordis.yml method only loads the Host side; detection, segmentation, summarization, refinement, and persistence are all available, but there is no settings page or real-time panel.

Usage and Verification

  1. Ask the model a question requiring deep reasoning, allowing the amount of thinking to exceed the long thinking threshold.
  2. During thinking, a real-time panel ● Thinking · N tok · M segments appears above the composer, with segment summaries scrolling and appending; segments that have been refined are later marked “Refined”.
  3. When thinking ends, the panel changes to “Thinking Ended”; the accumulation period for the next thought retains the previous summary as a reference.
  4. A collapsible “Summary” bar appears at the end of each reply, grouped by step; the “Summary” tab in the session header allows viewing all history summaries for the current session.

Short thinking within the threshold does not produce segments and does not disturb normal conversation.

Local Development and Debugging

After cloning the repository, execute npm install, npm run build, and npm run typecheck sequentially to build. For the debug loop, use npm run watch:all to listen on both ends in parallel: changes to the client side refresh the browser immediately, while changes to the Host side (src/host) require restarting dsh web. The repository also includes two regression scripts:

node scripts/seg-check.mjs    # Segmentation algorithm regression
node scripts/order-check.mjs  # Client bundle module order check

Suitable Scenarios and Notes

Suitable for developers and evaluators who use reasoning models heavily on DSH web and need to review and check the model’s reasoning process.

Points to note:

  1. The summary does not write back to the session context and will not affect the model’s subsequent input; short thinking within the threshold does not produce segments.
  2. The manual cordis.yml or manual patch method only includes the Host side, so the settings page and real-time panel are not visible.
  3. The settings / clear-archived / pause interfaces are limited to local access, which is an intentional security boundary.
  4. The plugin runs with the permissions of the current dsh process; it is recommended to read the source code and license (MIT) before deciding whether to enable it.

Conclusion

Through the steps above, dsh-think-summary transforms the scrolling long thinking into a record that can be observed in real-time, reviewed after the fact, and persisted, while maintaining zero pollution to the session context. Project address: https://github.com/oakcakerolls/dsh-think-summary ; it can also be viewed in the community directory: https://www.skillhub.cn/plugins/oakcakerolls/dsh-think-summary (this directory is an independent community site and has no official affiliation with DeepSeek or HF).