Introduction

The philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” In agent development, debugging often suffers from missing information: you may only see the input and final output, but not the intermediate reasoning process, tool call chain, or error cause.

dsh-plugin-session-export is a plugin maintained by zhaoxuejie and belongs to the “Memory” category. It captures session events through passive side-channel listening without interfering with normal Agent operation. When you need to review, debug, or share a workflow, it can generate a structured review report with one click.

Installation and Enablement

Prerequisites

  • DeepSeek Harness (dsh) is installed and running.
  • Node.js >= 18.

Steps

  1. Obtain the plugin
    git clone https://github.com/zhaoxuejie/dsh-plugin-session-export.git
  1. Register it in the dsh profile
    Edit the package.json of your dsh profile (typically located at ~/.dsh/profiles/<profile-name>/package.json).
    Add a local link dependency under dependencies, and register it in dsh.profile.bundles:
    {
      "dependencies": {
        "dsh-plugin-session-export": "link:/path/to/dsh-plugin-session-export"
      },
      "dsh": {
        "profile": {
          "bundles": ["dsh-plugin-session-export"]
        }
      }
    }
  1. Install dependencies
    cd ~/.dsh/profiles/<profile-name>
    pnpm install
  1. Restart dsh
    dsh web
After startup, a “Session Black Box” button should appear in the navigation bar on the upper right.

Core Features

  • Full event capture: Subscribes to session/event, maintains isolated event timelines per session, and covers turn start/end, user input, model replies, tool calls/returns, and request errors.
  • Snapshot backfill: After the plugin loads, it automatically backfills events that occurred before loading to avoid loss of historical conversations.
  • Dual-format export: Supports exporting structured Markdown text and self-contained HTML single files.
  • Real-time statistics: Tracks turn count, tool call distribution, total duration, average turn duration, errors/interruptions, and Token usage.
  • Smart truncation: If a single text item exceeds maxContentLength, it is automatically truncated and marked.
  • Sensitive data masking: Fields such as api_key, token, and password in tool arguments are automatically masked.
  • Web panel: A button in the navigation bar on the upper right displays statistics cards and charts, with one-click export/clearing.
  • Configuration hot reload: The settings service uses applies: live, so changes take effect immediately.

Usage

Natural Language

Directly issue the following commands to the model:
* “Export the current session”
* “Generate a review report”
* “Session statistics”
* “Clear session records”

Tool Calls

  • export_session(session?, format?)
    • Parameters: session (session ID, defaults to the most recently active session), format (markdown / html / both).
    • Purpose: Export a review report for the current session.
  • session_stats(session?)
    • Parameters: session (defaults to returning an overview of all sessions).
    • Purpose: Retrieve session statistics.
  • session_clear(session?)
    • Parameters: session (defaults to clearing all sessions).
    • Purpose: Clear session records.

Web Panel

Click the “Session Black Box” button in the upper right. The panel displays real-time statistics cards, a bar chart of tool call frequency, and export/clear buttons.

Configuration Options and Report Structure

Configuration Options

The following settings can be adjusted in the dsh settings panel (hot reload supported):

  • enable (boolean, default true): Master switch for the plugin.
  • autoRecord (boolean, default true): Automatic passive capture.
  • maxContentLength (number, default 2000): Maximum characters for exporting a single text item.
  • includeToolArgs (boolean, default true): Whether to retain tool arguments.
  • includeReasoning (boolean, default true): Whether to include the model reasoning process.
  • exportFormat (enum, default markdown): Default export format for tools.
  • htmlTheme (enum, default light): Color theme for HTML reports.
  • maxEventsPerSession (number, default 500): Maximum number of events per session.

Report Structure

The exported report includes the following:
1. Session Overview: ID, start/end time, total duration, turns, tool calls, errors, Token usage.
2. Turn Timeline: Horizontally visualizes duration and status for each turn.
3. Per-turn Review: User input → tool call chain → model reply → status and duration.
4. Tool Call Statistics: Tool name, call count, average duration, maximum duration.
5. Error Summary: Time, turn, type, error message.
6. Raw Event Stream: Full captured timeline.

Use Cases and Cautions

This plugin is suitable for developers who need detailed reviews of Agent behavior. Installation uses a local link dependency and requires editing the profile’s package.json. Be sure to review the source code and license (MIT) before using it in production. The plugin runs with the permissions of the current dsh process, and sensitive information is automatically masked.

dsh-plugin-session-export