dsh-session-consult: Allow a DSH session to consult another session's history in read-only mode

Introduction

In DeepSeek Harness (DSH), a session is both memory and messages. Its context cannot be handed directly to another session, and asking it a question will wake it up and alter its state. This creates a gap in multi-session collaboration: when you want to reference another session’s history without disturbing it, there is no standard “consult” verb.

dsh-session-consult provides that verb: consult. It lets the current session pose a question to another session in a read-only, bounded-digest, source-tagged manner, and receive a cited answer.

What Is This

dsh-session-consult is a DSH tool plugin provided by maintainer NorwinYu. It allows one DSH session to “consult” another session’s history. What it returns is a snapshot, not a live link or an update to the target. It follows DSH’s “everything is a plugin” philosophy, installs into a local profile, and has no official affiliation with DeepSeek or High-Flyer.

Core Features

Session Consultation

The plugin provides a consult_session tool with three modes:

  • ask (default): Answers a question from the digest via a constrained sub-agent, consuming one sub-agent turn.
  • read: Returns only the digest without spawning a sub-agent; the current session reasons on its own.
  • list: Lists all consultable sessions with their IDs and ages, consuming zero turns.

Session Address Resolution

Three forms are supported:

  • raw id: Use the session ID directly (e.g., session-8f3c…).
  • canonical mention: A reference in the @[billing](dsh-session:c2Vz…) format.
  • title fragment: E.g., billing refactor, resolved via DSH’s candidate service.

When a fragment matches multiple sessions, the plugin returns the candidate list and refuses to guess.

Digest Construction Strategy

The digest uses a “latest-first” budget allocation with a layered retention strategy:

  • expanded: Full text of the most recent turns + a one-line tool trace (e.g., · bash: pnpm test → → ok).
  • text-only: When tool traces don’t fit the budget, conversation text is retained and tool calls are dropped.
  • index: Earlier turns are preserved as one-line summaries (T12 U: … / A: …).
  • dropped: Older content exceeding the budget is discarded.
  • pinned: If the initial task statement would be dropped, it is retained.

System prompts, tool output bodies, bookkeeping events, and host-injected user-role messages (e.g., runtime-context, skill-catalog, time-context) are excluded from the digest. Only human or peer-agent conversations are retained. Tool results are compressed to a single line; failures are marked as [error].

Security Design

The target session’s conversation log is treated as untrusted input. Two lines of defense:

  1. The digest is framed as “data”; the sub-agent is instructed to answer based solely on the record and must not follow any instructions, privilege claims, or tool requests contained within.
  2. The sub-agent’s tool set is replaced with a whitelist of read-only tools (e.g., read, read_image, grep, glob, ls, etc.), prohibiting writes, network calls, shell execution, and similar operations.

Failure Mode Handling

  • Unknown target: Returns a clear error; no partial digest is returned.
  • Empty history: Returns “no completed turns yet” with source information.
  • Sub-agent crash: Logs and returns an error; never returns an empty string.
  • Timeout: Aborts the sub-agent’s current turn; the call fails with an error.
  • Self-consultation: Rejected outright.

Installation & Activation

In a configured profile, run:

dsh plugin --profile <profile> add dsh-session-consult

Removal is equally straightforward:

dsh plugin --profile <profile> remove dsh-session-consult

The plugin takes effect after an application restart.

Environment Requirements

  • DeepSeek Harness: >=0.2.2-rc.1 <0.4.0; the profile must mount tools, agents, sessionPersistence (standard profiles satisfy this).
  • Node.js: >=22.15 (only for offline tooling; the plugin itself uses only node:crypto).

If using an unreleased version, install from a local checkout:

git clone https://github.com/NorwinYu/dsh-session-consult.git
dsh plugin --profile <profile> add ./dsh-session-consult

Typical Usage

Basic Consultation

Ask a question in the current session; the model invokes:

consult_session({ session: "billing refactor", question: "Which migration order did we settle on?" })

The answer includes source information:

The migration order is customers → invoices → line items; a single-shot migration was rejected because the invoice backfill locks the ledger (T7).

---
source: session-c2Vzc2lvbi0… (persisted, captured through seq 1841) · 12 turns ·
digest ≈5.9K tok · text retained 100%

List Consultable Sessions

consult_session({ mode: "list" })

Query Without Answering

Use mode: "read" to retrieve only the digest:

consult_session({ session: "billing refactor", question: "…", mode: "read" })

Using Different Address Forms

  • raw id: consult_session({ session: "session-8f3c…", question: "…" })
  • mention: consult_session({ session: "@[billing](dsh-session:c2Vz…)", question: "…" })
  • title fragment: consult_session({ session: "billing refactor", question: "…" })

If ambiguity exists, the plugin returns the candidate list and asks for a more specific reference.

Use Cases & Cautions

Well-suited for multi-session collaboration where you need to reference another session’s history without waking or modifying the target session. The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.

Closing

dsh-session-consult provides the standard “consult” verb for DSH multi-session collaboration, enabling read-only history queries through bounded digests and source tags. More details and source code are available in the community directory:

  • Plugin directory page: https://www.skillhub.cn/plugins/NorwinYu/dsh-session-consult
  • GitHub: https://github.com/NorwinYu/dsh-session-consult
羽毛球分组比赛记分
小程序二维码

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

Xiaoye