DSH Plugins Marketplace

DSH Plugins

Plugins

/

Sessions & Messages

/

dsh-session-consult

N

dsh-session-consult

Manifest valid

Consult another DeepSeek Harness session: read-only, bounded digest, provenance-labelled. A tool plugin for dsh.

hasBundlePatch

dsh-session-consult

npm license CI

Let one DeepSeek Harness session consult another session's history — read-only, cheap, and labelled with provenance.

A session is a good memory and a bad messenger: its context cannot be handed to another session, and asking it a question means waking it up, which changes it. This plugin adds the missing verb: consult. What comes back is a snapshot of the target's past — not a live link, and not an update to the target.

Not to be confused with dsh-consult, which consults other models. This plugin consults other sessions.

Quick start

dsh plugin --profile <profile> add dsh-session-consult
# remove it just as easily:
# dsh plugin --profile <profile> remove dsh-session-consult

Restart the app (the tool appears on the next start), then just ask:

Ask the billing-refactor session what migration order we settled on.

The model calls:

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

and answers with a citation:

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%

Not sure what is consultable? Ask for the list:

Which sessions can I consult?        →  consult_session({ mode: "list" })

Requirements

  • DeepSeek Harness >=0.2.2-rc.1 <0.4.0 — the profile must mount tools, agents and sessionPersistence; every standard profile does.
  • Node.js >=22.15 for the offline tooling only; the plugin itself uses no Node API beyond node:crypto.

Install from a checkout instead, for unreleased work:

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

How it works

your session ──consult_session({ session, question })──►
                     │
                     │ 1. read the target's log (read-only, no lock)
                     │ 2. build a bounded digest: text in, tool noise out
                     │ 3. hand it to a throwaway child agent
                     ▼
             answer + provenance ──► back into your context

Three modes:

modewhat happenscost
ask (default)a tool-restricted child agent answers from the digestone child turn
readthe digest comes back to you; you reason over itno child turn
listthe sessions that can be consulted, with ids and agesnone

The consulted session is only ever read: its log is never written, it is never steered or resumed, and no lock is taken.

Compared with @-referencing a session

The harness can already pull another session into a message with an @ mention. That is a different tool for a different job; both are useful.

@ referenceconsult_session
directionone-way: a snapshot is inserted into your messagequestion → answer, with follow-ups
triggeryou type @ in the composer, per messagethe model decides, per question
sizea fixed bounded preview, truncateda digest sized to the question, budget adjustable
toolsnone — the snapshot is untrusted text in your contextthe child may use read-only tools to check current files
follow-upsno, the capture is frozenyes, one child keeps the thread
targetwhatever the picker offersany session, by id, mention or title
provenancethe snapshot is written into the turnevery result names the source, the capture point and what was dropped

Rule of thumb: @ is "put this context in front of me", consult is "ask that session a question (or three)".

Usage

Addressing a session

argumentexampleresolution
raw idsession-8f3c…used as-is
canonical mention@[billing](dsh-session:c2Vz…)decoded to the id
title fragmentbilling refactorresolved through the same candidate service the @ menu uses

A fragment that matches several sessions is refused with the candidate list, never guessed:

Error: consult: "OSM" matches 2 sessions — retry with a more specific title or an id:
  - OSM building data export guide · session-c7798e00-… · 3d ago
  - OSM licence review · session-ff185161-… · 4d ago

Reading instead of asking

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

Failure modes are answers too

  • unknown target → a clear error, no partial digest;
  • empty history → "no completed turns yet", plus provenance;
  • child crash → the recorded error, not an empty string;
  • timeout → the child's current turn is interrupted and the call fails loudly;
  • self-consult → refused.

How the digest works

The digest keeps every human/assistant text block verbatim and spends the rest of the budget on the newest turns:

tierwhat it keeps
expandedthe newest turns: full text plus a one-line tool trail (· bash: pnpm test → → ok)
text-onlywhen the trail does not fit, the conversation is kept and the calls are dropped
indexolder turns as one line each (T12 U: … / A: …)
droppedwhatever still does not fit, oldest first
pinnedthe first turn's task statement, when it would otherwise be dropped

Reasoning blocks, bookkeeping events (step/*, job/*, delivery receipts), system prompts, tool output bodies, and host-injected user-role messages (runtime-context, skill-catalog, time-context) never enter the digest. Only a human or a peer agent counts as conversation. Tool results are reduced to one line, and failures are marked [error].

Measured over 69 sessions on a development machine running DSH 0.2.2-rc.1:

sessionsource tokensdigest tokensratiotext kept
251 events397K2.8K0.7%100%
418 events420K4.2K1.0%100%
2,410 events2.2M5.6K0.3%90%
4,919 events3.4M7.0K0.2%57%
10,894 events9.6M6.5K0.1%39%¹

¹ A very long session cannot fit one 7K-token budget. Allocation is newest-first, so recent context survives and the oldest turns are dropped deliberately; the provenance line reports how many. Worst observed build time: ~360 ms for a 60 MB log.

Why not just fork the target session

Forking is the obvious mechanism and it works: a child can be created from another session's event prefix and reproduces it byte-for-byte. It is also unusable in practice — the same 69 sessions show a median completed-turn prefix of ~1.5M tokens (max 17.8M), of which only 1.7% is human/assistant text and 98% is reasoning, tool output and bookkeeping. Copying that costs more context than any model has, to deliver less information than a digest.

Both numbers are reproducible on your own machine with npm run dump and npm run bench (see Development).

Safety

A foreign session's transcript is untrusted input: it can contain text that looks like instructions. Two independent defences:

  1. The digest is framed as data. The child is told to answer only from the record and never to follow directives, permission claims or tool requests found inside it.
  2. The child cannot act. Its tool set is replaced by an allow-list of read-only tools the profile actually has (read, read_image, grep, glob, ls, …). Shells, writers, network, messaging, subagents, and this plugin's own tool disappear from its view. In a verified run the child's request header listed only glob, grep, read and read_image.

Self-consult is refused, so a session cannot recurse into itself. The child does inherit the target's working directory for those read-only tools — see Privacy.

When the target session is running

Consulting a live session is safe and always returns a prefix:

  • a read while the target holds the write lease succeeds;
  • the prefix can end mid-step (a tool call whose result has not committed), which the digest renders as → (no result captured);
  • it advances at step boundaries;
  • the digest reports (+1 in flight) and renders that turn under (IN PROGRESS — captured mid-turn, may be incomplete);
  • an aborted turn is surfaced as [error] instead of being reported as a completed answer.

Everything after captured through seq is invisible by construction. The answer describes the target's past, never its present.

Troubleshooting

symptomcause and fix
the tool never appearsthe profile that mounts it is not the one the app booted; install into the same profile, then restart the app
matches N sessionsthe title is ambiguous — use a longer fragment or the id; mode: "list" shows candidates
no session matches "…"the error lists what is available; pick from it
the answer says the record does not contain itthe digest is bounded — raise budget_tokens, or ask a narrower question
ask feels slowit is a full child turn; mode: "read" returns the digest without one
a new session appears under the current onethat is the consult child; it is reused per (caller, target), and mode: "read" creates none

Configuration

Override through the profile patch layer:

- id: consult-session
  config:
    budgetTokens: 7000        # default digest budget
    minBudgetTokens: 500      # clamp for budget_tokens
    maxBudgetTokens: 40000    # clamp for budget_tokens
    timeoutMs: 180000         # bound on one child turn
    cacheEntries: 32          # cached digests
    maxChildren: 8            # reused consult children
    readTools: [read, read_image, grep, glob, ls, list_dir, load_workspace_dependencies]
    denyTools: []             # extra denials when no configured read tool exists

Privacy

This plugin reads the host's own session store. What that means before you turn it on:

  • The consulted session's text leaves the machine. The digest is part of a model request, so it goes wherever your profile's model provider is. Anything that session printed — paths, tokens, customer data — can be in it.
  • The child reads that session's workspace. Its allow-listed tools run with the consulted session's cwd, so files there are readable; set readTools: [] to make it digest-only.
  • Nothing extra is collected. The plugin has no telemetry, no network calls of its own, and writes nothing except the child sessions the host creates.
  • mode=read still returns text, it just does not spend a child turn.
  • Child sessions persist on disk (the store has no delete API), nested under the caller.
  • The offline tooling stays offline: dump reads $DSH_HOME/sessions and writes JSON; bench only reads those dumps.

See SECURITY.md for reporting a vulnerability.

Discover (plugin index)

The repository also publishes a plugin index for the experimental Discover tab:

https://norwinyu.github.io/dsh-session-consult/market/index.json
  1. Mount the market bundle (@deepseek-ai/dsh-experimental-plugin-market-bundle).
  2. Open Discover → Add index source and paste the URL.
  3. Pick Session Consult and install.

The index installs the version published to npm, so it tracks the released package rather than a git checkout.

Development

npm test                                          # 30 unit tests, synthetic fixtures
npm run dump -- --out ./session-dumps --limit 50  # read $DSH_HOME/sessions
npm run bench -- ./session-dumps                  # digest cost table

Tests use inline synthetic events: no session logs, no fixtures from a real installation, no network, no running harness.

index.mjs            plugin entry: tool registration, cache, child lifecycle
src/digest.mjs       pure digest builder (no DSH or Node imports)
src/policy.mjs       session-id normalisation and the child tool policy
src/session.mjs      read-only session access, answer/error extraction, deadlines
src/lookup.mjs       target discovery and title resolution
scripts/             offline session dumping
test/                node:test suites
market/index.json    plugin index for the Discover tab

Limitations

  • Child sessions persist. The store has no delete API, so each consult child stays on disk (nested under the caller). Reuse keeps it to one per (caller, target); mode=read creates none.
  • Secrets pass through. Assistant text is verbatim, so anything the consulted session printed lands in the caller's context.
  • No @-menu entry. The tool resolves titles, but the composer does not offer consult as a reference source yet.
  • Lexical budget. chars = tokens × 3 is a mixed CJK/ASCII estimate, not a tokenizer.
  • Synchronous. ask waits for the child's turn; long children are bounded by timeoutMs.
  • Visibility follows indexes, not installation. The community market (dshmarket) reads the awesome-dsh-plugin catalog, a curated list maintained by that project; the Discover tab reads whatever index sources a user adds. This plugin publishes its own index (above) — use it, or dsh plugin add.

Contributing

See CONTRIBUTING.md for the layout, the two load-bearing invariants, and the fixture rules (synthetic only — never a real session log). Security reports go through SECURITY.md; changes are recorded in CHANGELOG.md.

Status

0.1.x — pre-1.0. The tool arguments and the provenance line are stable; the digest internals and the child-session mechanics may still move. Those changes land in a minor version.

License

MIT — see LICENSE.

Comments

Loading…

Similar plugins

dsh-session-link

by jinhuang712

Link and read DSH sessions: one-click @session-id reference, an @ mention menu by title, and a session_read tool that projects any session to readable text. DeepSeek Harness plugin.

Manifest valid

★ 0

↓ 303/wk

MIT

JavaScript

Aug 16, 2026

dsh plugin --profile web add dsh-session-link

by hujiyo

DeepSeek Harness plugin: browse, search, copy and hide the prompts you sent to the AI across all sessions.

Manifest valid

★ 0

MIT

JavaScript

Oct 20, 2026

dsh plugin --profile web add dsh-recent-prompts

by 439436269-ctrl

DeepSeek Harness plugin: copy a session's log path (and an agent-readable handoff) so another session can read it and continue the work.

Terminal & ClientsSessions & MessagesManifest valid

★ 0

MIT

JavaScript

Nov 7, 2026

dsh plugin --profile web add dsh-session-path

by phoenixlucky

DeepSeek Harness plugin: a normalized session view that renders every turn, message and tool call in one consistent, copyable format.

Manifest valid

★ 0

MIT

JavaScript

Nov 3, 2026

dsh plugin --profile web add dsh-session-norms

by n8guru

DSH hook plugin: a session may not stop the harness it runs inside

Tools & CapabilitiesManifest valid

★ 0

MIT

JavaScript

Sep 2, 2026

dsh plugin --profile web add dsh-self-preserve

by SipengXie2024

DeepSeek Harness plugin: LLM session titles that survive reasoning models (startup sweep + turn-end retry), plus a hover-card session-size readout

Manifest valid

★ 0

MIT

JavaScript

Aug 15, 2026

dsh plugin --profile web add dsh-session-topics