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: a2a relies on a Hub and WebSocket to build a cross-process/cross-host mesh network; s2s uses a same-host single-process path.
  • Transport: s2s uses an in-process Broker for direct delivery, with zero ports, zero WebSocket, and zero reconnection.
  • Implementation: It borrows a2a’s injection idioms (calling followup when idle and calling inject when busy), but removes all network dependencies while retaining only in-memory communication.

Core Features

  1. In-process delivery: Uses S2sBroker to pass messages directly in memory, bypassing serialization and network I/O.
  2. Name-based addressing: Addresses sessions by session title. Titles are read from the host’s zero-I/O projection cache.
  3. Wake-up of dormant sessions: Supports waking ended sessions, and the resumed session remains in a live-idle state without automatically sleeping.
  4. Six model tools:
    • s2s_peers: Lists the currently active peers.
    • s2s_sessions: Lists sessions (set all=true to 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.
  5. Persistent mailboxes: Messages are persisted under the ~/.dsh/s2s/mailboxes/<sessionId>/* directory, with support for atomic writes and self-healing from corruption.
  6. Loop prevention and rate limiting: Configures budget to 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 use session_id to disambiguate. If no matching session is found, not-found is displayed and candidate sessions are listed.
  • Feature activation: If the YAML is missing the lifecycle or budget configuration 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