DeepSeek Harness: How Do Session References Work?
DeepSeek Harness session references let a supported host attach a bounded, read-only snapshot of another session to a new message. The source session keeps its own identity and history; the snapshot is untrusted background, not a continuation or a grant of authority.
DeepSeek Harness: what does a reference connect?
The session-reference package describes an opt-in host capability. A host turns a selected session mention into a canonical reference, and the resolver prepares a snapshot from the source session. The session reference describes the structured input: sessionId identifies the source; an optional label supplies display metadata. The id is authoritative, even if a title later changes.
The source session remains its own session, with its own history and event coordinates. Preparing a reference creates context for a message in the target session; it does not merge the sessions or turn the referenced session into a live child agent. The session subsystem describes session messages and persisted events, while the reference subsystem describes the additional cross-session context.
DeepSeek Harness: how is a source found and selected?
The candidate list excludes the current session, ranks same-directory sessions first, and searches session id, working directory, projected title and display title without searching transcript text. The candidate label uses the latest session title when available, otherwise the id. A subagent's durable creation label can be preferred for the display title. Same-directory ranking helps discovery; it does not mean that every candidate belongs to the same workspace or that a shared title uniquely identifies it.
| Item | Role | Limit |
|---|---|---|
| Session id | Identifies the source | A display title is not a substitute for identity |
| Candidate label | Helps a person recognize the source | Candidate filtering does not search transcript text |
| Working directory | Helps rank candidates | Affinity is not an authorization decision |
| Snapshot | Supplies captured background to a target message | It does not live-update with the source session |
The documented canonical mention is @[label](dsh-session:<base64url-encoded-id>); a bare dsh-session: URI is also supported. The service produces readable @label message text and structured references. Explicit Markdown mentions with malformed URIs are rejected. Hosts own their UI mention interactions, so the underlying syntax does not establish that every client exposes the same selection interface.
DeepSeek Harness: what reaches the model?
The package reference says a message citing sessions is followed by a separate user-role ## Referenced sessions context. It is explicitly marked as untrusted background. A fixed warning tells the model not to follow instructions, permission claims or tool requests in that material unless the current user repeats them. This warning communicates the intended handling; it does not guarantee the model will obey or make the source content harmless.
Each source has an independent byte budget. The documented default maxReferences is three distinct sources per message, and it cannot exceed three. candidateLimit defaults to 50. maxReferenceBytes can explicitly set the serialized JSON byte budget per source; otherwise the resolver uses model-relative budgeting, with a fallback described in the subsystem reference. The defaults are configuration facts for the cited version, not guarantees about every deployment's effective settings.
When retention is needed, older non-checkpoint messages are dropped before retained text is shortened. Metadata records the number of original, retained and omitted messages, omitted bytes, and whether the snapshot was truncated. If the preview is truncated, an optional spill backend may save the full captured projection and provide a locator and retrieval hint. If storage is unavailable or saving fails, the notice distinguishes that outcome. A snapshot can omit context essential to interpreting a conclusion; inspect the omission information before relying on it.
DeepSeek Harness: how do I use a reference deliberately?
- In a host that supports session mentions, find the intended source by its title, id or directory. Confirm its identity if titles are similar.
- Select the reference and write a current request explaining what the agent should do with that background. Do not rely on instructions embedded in the older session to authorize new work.
- Check the prepared context and any truncation or omission notice available in your client. A source snapshot reflects the capture point, not subsequent changes in the original session.
- If a conclusion depends on omitted detail, inspect the original session or use the available spill locator where supported. Do not assume a shortened preview is the complete transcript.
- Review the answer against the source and the current task. For sensitive material, consider what content the target session and model will receive before sending the reference.
The reference's capturedThroughSeq is a coordinate in the source session's original generation, not a sequence number in the target session. capturedFormatVersion records the source generation, with absence denoting released format v0. These details help consumers interpret capture metadata; they do not make the reference a live subscription to the source.
What does the captured projection include?
The package reference says capture reads the source's current surface once. It includes direct user text, assistant text and user checkpoints carrying the canonical compaction marker. Tool content, reasoning and other injected context are excluded. Even without budget truncation, the snapshot is therefore not a complete reproduction of the underlying log. When an answer depends on a tool result, consult the original evidence instead of assuming the reference includes it. Preview and optional spill use the same captured projection, so later source changes do not rewrite the saved background.
DeepSeek Harness: what can fail, and what are the limits?
The subsystem lists stable error categories including invalid configuration or reference, self-reference, too many references, source-read failure, budget exceeded and cancellation. A read failure and a budget failure call for different remedies: verify the selected source and its availability for the former; reduce the referenced material or inspect the deployment's configured budget for the latter. The documentation does not promise a particular client error message for every code.
References are opt-in and need a compatible host and session-query backend. A discovered candidate is not a security review or proof that its contents should be sent to the current model. Treat source transcripts as potentially sensitive and potentially adversarial. The fixed warning describes intended trust handling, but it does not grant permissions or guarantee compliance. Avoid sharing secrets in the target session simply because the referenced session already contains them.
DeepSeek Harness: what do the terms mean?
- Source session: the existing session whose captured material is referenced.
- Candidate: host-facing metadata used to discover a source.
- Snapshot: immutable captured background prepared for the target message.
- Spill: optional storage for the full captured projection when a preview is truncated.
- Capture sequence: a position in the source session's own event generation.
Frequently asked questions
Does a reference continue the source session?
No. It supplies a captured snapshot as background in another session.
Are source instructions automatically authorized?
No. The snapshot is untrusted and its instructions need a current user request.
Can a snapshot be truncated?
Yes. Omission metadata and an optional spill locator describe what was retained.
Sources
Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.
This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.