DSH Session Ledger: Traceable Session Evidence and User-Confirmed Long-Term Memory

Introduction

In DeepSeek Harness (DSH) development, Agents need to access historical sessions to build long-term memory. Existing capabilities can answer “which historical events match,” but often lack a unified provenance chain and auditable confirmation workflow: which session, which event, and which workspace does the historical evidence come from? On what basis did the Agent propose this long-term memory? Did the user explicitly confirm it? Which version of the content was confirmed? How is long-term memory marked when the original evidence is deleted or replaced? These concerns become especially pronounced in multi-workspace, permission-isolated, and index-lag scenarios.

What Is This

dsh-session-ledger is a plugin that provides traceable session evidence and user-confirmed long-term memory for DeepSeek Harness. Rather than re-implementing full-text session indexing, it builds upon Harness’s ctx.sessionQuery and ctx.storageDomain, adding memory semantics, provenance chains, confirmation states, deletion and auditing, plus index health and performance acceptance on top of existing capabilities.

Core Features

The plugin exposes a ctx.sessionLedger service on the Host side for retrieving historical evidence, creating candidates, issuing confirmation tokens, promoting long-term memories, managing memories and audit records, and running health checks:

interface SessionLedger {
  searchEvidence(request: EvidenceSearchRequest): Promise<EvidencePage>
  createCandidate(input: CandidateInput): Promise<CandidateRecord>
  issueConfirmation(candidateId: string): Promise<ConfirmationPreview>
  promote(candidateId: string, token: ConfirmationToken): Promise<MemoryRecord>
  listMemories(scope: MemoryScope): Promise<MemoryRecord[]>
  revoke(memoryId: string): Promise<void>
  delete(memoryId: string): Promise<void>
  health(): Promise<LedgerHealth>
}

It also provides ctx.sessionLedgerConfirmation.request() to present candidates and their provenance; only when the user chooses to save is the candidate promoted to a long-term memory—otherwise it transitions to dismissed.

The plugin establishes a session_ledger domain on ctx.storageDomain, persisting candidates, memories, audit logs, and metadata, with support for restart recovery and idempotent promotion.

Installation & Activation

Before installing, ensure the host profile already provides sessionQuery, storageDomain, and userQuestions, and that the confirmation token secret is configured:

export DSH_SESSION_LEDGER_SECRET="use-a-profile-specific-random-secret"
dsh plugin --profile demo add /absolute/path/to/dsh-session-ledger
dsh --profile demo --dump-config
npm test
npm run bench:m4

Typical Usage

During a query, the Agent calls searchEvidence() scoped to the currently authorized workspace, invokes ctx.sessionQuery to retrieve session hits, and reads the bounded event window. The plugin returns up to 20 evidence cards, each containing the session title (if available), session_id, event_seq, timestamp, matching snippet, and authorization status. After the user selects one or more pieces of evidence, the plugin creates a Candidate; the candidate text is presented to the user for editing or confirmation. The plugin then generates an HMAC confirmation token (derived from the candidate ID, content hash, evidence hash, and expiry). Upon user confirmation, promote() is called; the plugin validates workspace authorization, candidate hash, and token validity, and upon success writes a MemoryRecord along with an audit entry. Subsequently, memories can be retrieved and traced back to their sources via listMemories and searchEvidence.

Use Cases & Notes

Suitable for Agent / Harness developers who need auditable, traceable, and user-confirmed long-term memory.

The current version’s reference benchmark is 1.37 seconds and has not yet met the 1-second target; the UI relies on the Harness answerer to render approval intents; vector recall, automatic promotion, cloud sync, and unconditional prompt injection are not supported; workspace registry ID adaptation is still awaiting a stable upstream interface.

The plugin runs with the current DSH process’s permissions. Review the source code and license before installing.

Brief Closing

dsh-session-ledger builds upon existing session query and storage capabilities by adding an evidence chain, a confirmation workflow, and audit records, making the creation and use of long-term memory traceable. See docs/design/session-ledger.md and docs/release/0.1.0.md in the repository for related design and benchmark details.

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

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

Xiaoye