dsh-plugin-session-insights: Cross-Session Activity Statistics

The DeepSeek Harness (DSH) plugin ecosystem emphasizes modularity and functional decoupling. During development debugging or usage analysis, developers often need cross-session model call statistics (such as Token distribution and model usage preferences), while existing billing plugins only focus on fund flows. dsh-plugin-session-insights focuses on activity statistics, recording every model call through a Host-side sidecar file and providing visualized command-line queries and CSV export.

Core Functionality

This plugin runs on the Host side, appending each model call (whether billable or not) to monthly JSONL sidecar files.

  • Overview command: /insights
    • Displays total session count and total Token volume.
    • Shows daily trends for the last N days (ASCII bar chart).
    • Lists the Top most expensive sessions.
    • Shows model distribution.
  • Export command: /insights-export <YYYY-MM>
    • Exports data for the specified month to CSV in BOM+CRLF format, ensuring Excel can open it directly.
  • Division of labor with billing plugins
    • This plugin handles activity: statistics on Tokens, turns, and model distribution for all model calls; unbilled events are also recorded.
    • Unlike dsh-plugin-cost-ledger, which focuses on money, unbilled events are directly discarded.

Installation and Setup

The installation process requires three steps. Ensure pnpm is already in your PATH.

  1. Install the plugin package
    dsh plugin --profile web add github:121212165/dsh-plugin-session-insights
This command will fetch the package via pnpm and automatically run the build.
  1. Modify the configuration file
    Merge the content of cordis.patch.yml from the root directory of this repository into $DSH_HOME/profiles/web/cordis.patch.yml.
    This file defaults to an empty array []. Please merge the content into the same array; do not simply append. Appending will cause YAML parsing errors with the message end of the stream or a document separator is expected.

  2. Restart and verification
    Both the configuration layer and client need to be restarted to take effect (browser hard refresh is ineffective).
    After restarting, verify the mount status with the following command:

    dsh --profile web --dump-config | grep dsh-plugin-session-insights

Data Model and Usage

The plugin maintains monthly JSONL sidecar files on the Host side, with the path defaulting to ~/.dsh/session-insights/insights-YYYY-MM.jsonl. Each line record contains session ID, timestamp, model ID, Provider, turns, Token bucket statistics (input, cache read, output, cache write), and billing information (if available).

Example data structure:

{"v":1,"sessionId":"…","at":"2026-09-15T02:00:00.000Z","day":"2026-09-15",
 "modelId":"deepseek-v4-pro","provider":"deepseek","turn":3,
 "buckets":{"uncachedInput":100,"cacheRead":900,"output":50,"cacheWrite":0},
 "costMicros":1200000,"currency":"CNY"}

Use Cases and Notes

  • Use cases: Developers who need to analyze model usage habits, track long-term Token consumption trends, and export structured data for secondary analysis.
  • Runtime mechanism: Runs on the Host side, no Web UI interface, all interactions are completed through the command line.
  • Boundary limitations:
    • This plugin has no historical backfill capability; it can only count session data after installation.
    • If the sidecar file has half-line data caused by crashes, the plugin will skip that line and count it without rewriting the file.
    • Live mount during runtime is not currently supported.

Summary

dsh-plugin-session-insights is a lightweight cross-session analysis tool. It fills the gap between activity statistics and billing statistics in the DSH ecosystem, making it suitable for developers who need fine-grained control and analysis of model call traffic. For more plugins and directories, please refer to GitHub and SkillHub Plugin Directory.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye