Introduction¶
In DeepSeek Harness (DSH) development practice, we commonly run multiple independent Agent sessions on the same host. When these sessions need to collaborate—for example, when a “Product” session dispatches tasks to a “Development” session, or when role-based sessions engage in multi-round conversations—direct network communication often introduces unnecessary complexity.
dsh-s2s is a plugin that solves this problem. Instead of relying on a cross-host network layer, it uses a same-host/single-process path and achieves direct delivery between sessions through an in-process Broker.
Core Positioning¶
This is a DeepSeek Harness plugin for connecting AI Agent sessions on the same machine. It is maintained by ashuai and focuses on solving multi-session collaboration within a single process. It supports session lifecycle management, wake-up of dormant sessions, and a budgeting mechanism to prevent loops.
Design Approach¶
The design of this plugin is inspired by a2a, but it is not a fork.
- Topology:
a2arelies on a Hub and WebSocket to build a cross-process/cross-host mesh network;s2suses a same-host single-process path. - Transport:
s2suses an in-process Broker for direct delivery, with zero ports, zero WebSocket, and zero reconnection. - Implementation: It borrows
a2a’s injection idioms (callingfollowupwhen idle and callinginjectwhen busy), but removes all network dependencies while retaining only in-memory communication.
Core Features¶
- In-process delivery: Uses
S2sBrokerto pass messages directly in memory, bypassing serialization and network I/O. - Name-based addressing: Addresses sessions by session title. Titles are read from the host’s zero-I/O projection cache.
- Wake-up of dormant sessions: Supports waking ended sessions, and the resumed session remains in a
live-idlestate without automatically sleeping. - Six model tools:
s2s_peers: Lists the currently active peers.s2s_sessions: Lists sessions (setall=trueto retrieve all).s2s_message: Sends a message to a specified session or wakes a session.s2s_resume: Explicitly resumes a specified session.s2s_history: Retrieves process-scoped history.s2s_schedule: Supports scheduled injection within a session.
- Persistent mailboxes: Messages are persisted under the
~/.dsh/s2s/mailboxes/<sessionId>/*directory, with support for atomic writes and self-healing from corruption. - Loop prevention and rate limiting: Configures
budgetto limit message hops (maxHops) and send rate (ratePerMinute).
Installation and Activation¶
Installing a new plugin must use the - insert: form, with name pointing to a resolvable ESM entry. The following configuration enables autoResume (allowing automatic wake-up of dormant sessions) and basic budget limits:
- insert:
- id: dsh-s2s
name: ./dsh-s2s/lib/index.js
config:
lifecycle:
autoResume: allow # Allow wake-up via s2s_resume by name
budget:
maxHops: 6 # Limit maximum message hops
ratePerMinute: 10 # Limit sends per minute
Typical Usage¶
In code or tool calls, use the name parameter for addressing:
// Explicitly wake the session named "开发"
s2s_resume(name: "开发", ...)
// Send a message to the session named "产品"
s2s_message(name: "产品", ...)
// View all peers
s2s_peers
// View all sessions (including dormant sessions)
s2s_sessions(all=true)
Notes¶
- When renames take effect: Because titles are read from the host cache, changing a session title does not take effect immediately; it takes effect at the next title checkpoint.
- Disambiguating sessions with the same name: If sessions share the same name, the system reports
ambiguous, and you must usesession_idto disambiguate. If no matching session is found,not-foundis displayed and candidate sessions are listed. - Feature activation: If the YAML is missing the
lifecycleorbudgetconfiguration block, the associated features will not be mounted (i.e., they remain disabled). - Persistence path: The persistent mailbox path is
~/.dsh/s2s/mailboxes.
Conclusion¶
dsh-s2s provides a lightweight same-host session collaboration solution. For scenarios that do not require cross-machine communication, it is lighter than introducing a2a and eliminates network-layer complexity.
- GitHub: https://github.com/ashuai/dsh-s2s
- Directory: https://www.skillhub.cn/plugins/ashuai/dsh-s2s