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¶
- Obtain the plugin
git clone https://github.com/zhaoxuejie/dsh-plugin-session-export.git
- Register it in the dsh profile
Edit thepackage.jsonof your dsh profile (typically located at~/.dsh/profiles/<profile-name>/package.json).
Add a local link dependency underdependencies, and register it indsh.profile.bundles:
{
"dependencies": {
"dsh-plugin-session-export": "link:/path/to/dsh-plugin-session-export"
},
"dsh": {
"profile": {
"bundles": ["dsh-plugin-session-export"]
}
}
}
- Install dependencies
cd ~/.dsh/profiles/<profile-name>
pnpm install
- 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, andpasswordin 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
settingsservice usesapplies: 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.
- Parameters:
session_stats(session?)- Parameters:
session(defaults to returning an overview of all sessions). - Purpose: Retrieve session statistics.
- Parameters:
session_clear(session?)- Parameters:
session(defaults to clearing all sessions). - Purpose: Clear session records.
- Parameters:
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, defaulttrue): Master switch for the plugin.autoRecord(boolean, defaulttrue): Automatic passive capture.maxContentLength(number, default2000): Maximum characters for exporting a single text item.includeToolArgs(boolean, defaulttrue): Whether to retain tool arguments.includeReasoning(boolean, defaulttrue): Whether to include the model reasoning process.exportFormat(enum, defaultmarkdown): Default export format for tools.htmlTheme(enum, defaultlight): Color theme for HTML reports.maxEventsPerSession(number, default500): 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¶
- Repository: https://github.com/zhaoxuejie/dsh-plugin-session-export
- Author: zhaoxuejie
- Category: Memory