Introduction to the DeepSeek Harness Plugin: dsh-ledger-memory (Ledger Memory)

The core philosophy of DSH (DeepSeek Harness) is “everything is a plugin.” In engineering development, common pain points include how to seamlessly continue new sessions from old progress and how to transform the value of single outputs into long-term assets. dsh-ledger-memory addresses this scenario by providing a host-side memory management solution for DSH.

It does not manage raw conversation records; instead, it establishes an independent, retrospectable long-term memory carrier for each project — the ledger. Centered around the ledger, the plugin provides activity logging, context compression, and cross-session handover capabilities.

Core Mechanisms

1. Session Continuation & Injection

When a new session begins, the plugin injects the full text of the active ledger into the context. If the content has not changed, it will not be injected again to avoid disrupting the prompt cache.
At the end of a turn, the plugin instructs the model to write back the status of this turn’s output (Completed / Blocked / Next Steps) to the active ledger.

2. Context Compression & Verbatim Capsules

Ledger content grows with the session. When the usage level reaches a threshold (default 70%), the plugin triggers compression.
Before compression, the plugin persists the user’s original words, raw error messages, and the list of changed files as verbatim capsules. The compressed content, along with capsule pointers, is injected back into the context to ensure details are not lost.

3. Triage Compression

Compression is not simply truncation; instead, it uses ledger_triage to sort content into three buckets:
* Keep: Current status, unverified hypotheses. Injected back verbatim after compression.
* Stash: Basis for content that may need to be referenced later. Written to the _stash/ directory and never injected.
* Drop: Superseded content, only logged.

4. Cross-Session Handover

The plugin generates a handover sheet and provides a pointer in the first injection of a new session, allowing the new conversation to take over without the user actively querying it.

Installation & Activation

Environment requirement: Node.js ≥ 22.19.

# Install via npm
npm install dsh-ledger-memory

# Or use DSH's built-in plugin command
dsh plugin add dsh-ledger-memory

After installation, the client must be restarted to take effect. The kernel does not automatically reload loaded plugins due to file changes.

Usage

No additional configuration is required after installation. Start working in a project directory, and the plugin will automatically detect the ledger status.

Common Commands

Type /ledger in the conversation (a card pops up without arguments), or use subcommands:

  • /ledger status: View status (Ledger existence, files used, line count, Git status).
  • /ledger show: Output the full text of the current active ledger.
  • /ledger init: Initialize the ledger (AI designs the structure based on the project type).
  • /ledger update: Have the AI write back the progress of this session to the ledger.
  • /ledger archive: Move the oldest completed entries to the archive directory.
  • /ledger compact: Immediately perform a full compression.
  • /ledger light: Lightweight compression (only compresses a section of the previous reply, requires explicit use).
  • /ledger log: View activity logs (L0-L4).
  • /ledger handoff: Generate a handover sheet.
  • /ledger lock [path]: Lock this conversation to a specified project directory (for sub-project management within a master workspace).
  • /ledger principles: View fundamental principles (only for the user themselves).

Locking Sub-projects

If the session is based on a master workspace containing multiple projects, the plugin defaults operations to the current directory. You can specify the target by locking:

/ledger lock 20-DSH插件/04-其余插件/10.项目台账

After locking, all tool calls in this conversation will fall within that directory. The lock status persists across restarts.

File Structure

The plugin manages the following files with semantic separation:

  • LEDGER.md: Current Status, injected every turn.
  • JOURNAL.md: Turn Chronicle, append-only, not injected.
  • decisions/: Long-term decisions, one card, one file.
  • _ledger-log/: Activity logs L0-L4, append-only, never injected.
  • _stash/: The “Stash” part of triage, append-only.
  • _handoff/: Handover sheets.
  • goals/: Goal tree.
  • lessons/: Experiences and lessons, one card, one file.
  • PRINCIPLES.md: Fundamental principles, modifiable only by the user.

Notes

  • No Automatic Writing: The plugin is responsible for injecting instructions to the model at appropriate times; the model then calls tools like ledger_write to persist to disk. If the model ignores the instruction, the turn is not persisted. The plugin will request it again in subsequent steps (gate mechanism).
  • Logs Not Injected: Activity logs (L0-L4) are mainly for troubleshooting and are never injected into the context.
  • Principle Modification: /ledger principles is strictly for the user to execute; the model can only propose or request an authorization window.

Summary

dsh-ledger-memory solves the problems of memory fragmentation, context truncation, and difficult project handovers in DSH engineering scenarios through its ledger, capsule, and triage compression mechanisms. It allows every conversation to become part of the project’s long-term assets.

  • Plugin Directory: https://www.skillhub.cn/plugins/18477514055/dsh-ledger-memory
  • Source Code: https://github.com/18477514055/dsh-ledger-memory
羽毛球分组比赛记分
小程序二维码

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

Xiaoye