DSH Session Mailbox: Cross-Session Messages and Persistent Session Tree

Preface

In the multi-session workflow of DeepSeek Harness (DSH), independent sessions lack message passing and persistent parent-child relationship management, making inter-session collaboration and task distribution difficult. The plugin provides cross-session messaging, session tree management, and persistent links, enabling multiple top-level sessions to communicate with each other while maintaining a clear session hierarchy.

Plugin Positioning

DSH Session Mailbox is a workflow plugin maintained by kanekogaido. It provides cross-session message passing and persistent session linking capabilities for DeepSeek Harness, allowing independent top-level sessions to send messages to each other via session IDs. The recipient can see the source session of the message and reply directly. The plugin also maintains parent/child link relationships between sessions, ensuring that subordinate sessions report only to their parent, while the main session can view and adjust the entire session tree.

Core Features

Cross-Session Message Passing

The plugin provides the send_session_message tool, which allows sending messages by session ID. The recipient sees the from-session (and associated from-parent) information in the session-message envelope and can reply directly using the sender’s ID. If the target session is inactive, it is woken up via ctx.sessionController.prompt to process the message.

The plugin maintains parent/child hierarchy relationships between sessions, providing the attach_session, detach_session, and list_session_tree tools. Links are stored in a configuration file and updated on every attach, detach, or reorder operation. This relationship acts as a soft access control list (ACL): child sessions can send messages to their parent or their direct siblings; top-level sessions can send messages to any session; sibling sessions, grandparent sessions, grandchild sessions, and other unlinked sessions are not directly accessible.

Native Sidebar Session Tree

The plugin’s client.js replaces DSH’s sidebar.workspaces slot, rendering a SessionBrowser component that displays the session tree in the native DSH sidebar. Features include:

  • Arrows on parent session rows to expand or collapse child sessions
  • Dragging a child session to the upper or lower half of another child session to reorder siblings
  • Dragging a child session to a different session row to reattach its parent
  • Dragging a child session to the bottom “Drop here to leave parent session” strip to detach the session
  • Archiving or unarchiving sessions via the row menu (running sessions will prompt whether to stop activity)
  • Archiving a parent session hides its entire subtree without unlinking
  • An “Archived N” entry in the toolbar to restore sessions
  • Undo prompt to immediately restore a session
  • Archived sessions are hidden from the active tree, consistent with the native workspace browser

Agent Behavior

The plugin defines a new session creation intent. Regular “create a new session / open a new session / one more session” requests are handled by the assistant via the create_child_session tool, creating a child session within the current session’s subtree. Only explicit “create a sub-agent / child proxy” requests use native sub-agents; there is no additional “New Session” button in the sidebar.

When a child session completes its task, the Host automatically forwards its final text as a session-message with auto-report="true" back to the parent session; the parent does not poll or wait. Auto-reports and manual child-to-parent messages use the native agent-message source, displayed as a collapsed Agent row trigger in Chat; expanding the row reveals the full report. Regular user messages are unaffected.

Coordinator-first main sessions: unless the user explicitly requests the main session itself to act or modify, production work is delegated via dispatch_task. This tool reuses a direct child session with a matching stored role, title, or recent task; if no match exists, a new child session is created under the main session. Child sessions do not delegate further unless their task explicitly requires it.

Tool List

The plugin registers the following tools, available in all sessions of the profile where the plugin is enabled:

Tool Parameters Description
get_current_session None Returns sessionId and parentId (parentId is empty for top-level sessions)
create_child_session prompt?, cwd?, role? Creates a child session and queues the first prompt without blocking the caller; role is a routing label such as design or testing; omitting prompt keeps the child session idle
dispatch_task task, role?, child?, cwd?, createIfMissing? Coordinator default: routes a self-contained production task to a matching direct child session (by role/title/recent task) or creates a new one; returns immediately; the child session auto-reports at the end of its turn
send_session_message to, message Queues a message for session to and returns immediately; when to is a direct child, the child’s final turn text is auto-reported back to the sender
attach_session child, parent Places child under parent, replacing any existing parent; rejects self-links and cycles
detach_session child Removes child from its current parent, making it a top-level session
list_session_tree None Returns all persistent links { sessionId, parentId } and root session IDs
set_session_leader leader Alias: attaches the calling session under leader

Installation and Activation

The plugin is installed via its GitHub repository:

dsh plugin add github:kanekogaido/dsh-session-mailbox

Once enabled, the plugin automatically registers the tools listed above and replaces the sidebar.workspaces slot in the sidebar to display the session tree.

Persistent Storage

Session links are persistently stored per profile at the following path:

<DSH_PROFILE_DIR>\session-mailbox\groups.json

Or when DSH_PROFILE_DIR is not set:

%USERPROFILE%\.dsh\profiles\<DSH_PROFILE or desktop>\session-mailbox\groups.json

The full path can be overridden via the environment variable DSH_SESSION_MAILBOX_STATE. The file is loaded when the plugin is activated and rewritten on every attach, detach, or sibling reorder operation. Each record stores parentId, updatedAt, and order; sibling ordering is determined by the order field, not by timestamps. This is a small JSON file, not SQLite.

Typical Usage

Create a Child Session and Delegate a Task

// In the main session
dispatch_task({
  task: "Analyze market data and generate a report",
  role: "analysis",
  createIfMissing: true
});

The assistant finds or creates a direct child session with the role analysis and queues the task on it. Upon completion, the Host automatically reports the child’s final text back to the main session as a session-message.

Send a Cross-Session Message

// In session A
send_session_message({
  to: "<target session ID>",
  message: "Please check the status of the task above"
});

Upon receiving the message, the target session sees the source session ID and can reply immediately.

View the Session Tree

// In any session
const tree = list_session_tree();
// tree returns { sessionId, parentId } mapping and a list of root session IDs

The returned data contains only session IDs and parent session IDs; DSH’s SessionSummary does not have a title field.

Use Cases and Notes

This plugin is suitable for scenarios requiring collaboration among multiple independent sessions, persistent session hierarchy relationships, and message passing via session IDs rather than UI operations. The plugin runs with the current DSH process permissions; verify the source code and license (MIT) before installation.

The plugin achieves native sidebar integration by replacing the sidebar.workspaces slot, but native workspace browser operations (such as pinning, forking, creating/renaming workspaces) are still provided by the native UI. The archive functionality is provided by the plugin sidebar, using the native archiveSession/unarchiveSession API.

Summary

DSH Session Mailbox provides cross-session message passing, persistent session tree management, and native sidebar integration capabilities, making DSH’s multi-session workflow more controllable and collaborative. Through well-defined tool interfaces and an ACL model, developers can build complex multi-agent collaboration systems while maintaining good integration with the native UI.

Plugin Directory Page | GitHub

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

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

Xiaoye