dsh-wb-memory: Using Workspace Markdown to Provide Cross-Session Long-Term Memory for DSH Agents

Preface

When running agents in DeepSeek Harness (DSH), a common issue is that the context only covers the current session: after changing days, closing the page, or starting a new conversation, you have to re-explain project conventions, pitfalls encountered, and conclusions from the last time. Some people write key points into repository documents, but in every conversation, they still have to rely on the model to “remember” to read them; others connect to vector databases or external memory services, but this increases deployment and permission costs.

Below is an introduction to the community plugin dsh-wb-memory (maintainer miseryrua). It places the source of truth in pure Markdown within each workspace, with no vector database and no third-party runtime dependencies. Each turn injects profiles, pinned items, relevant long-term memories, and logs into the systemPrompt in layers according to a character budget, while background processes handle digesting, summarization, distillation, curation, and governance. It is categorized as a “Memory” plugin in the DSH ecosystem directory. The current repository version is 0.13.0 (MIT, Node.js 22+, README confirms testing on Windows + Node 24).

What is this

dsh-wb-memory brings WorkBuddy-style file-based memory mechanisms to DSH: long-term entries, daily logs, user pins, and global profiles are all stored on disk as Markdown (and a small amount of JSON state files). Agents use these materials through the injection layer and the native tool memory_search. Distillation, summarization, curation, and profile merging invoke the LLM routing specified in your panel; if the routing is unavailable, it will not silently switch to the main Agent model.

The plugin joins the profile stack via a Cordis patch and provides a Web settings panel (Overview, Recall Diagnostics, Memory Files, Automation & Governance). The HTTP management interface is under /api/wb-memory/*, and since 0.12.1, it explicitly uses host Connection authentication for every actual handler.

Core Features

Layered Context Injection (Synchronous, Read-only)

The injection path does not call the LLM or write state. It assembles layers according to the total budget injectionMaxChars (default 12000, minimum 4000):

Layer Content Default Char Budget
Global Profile Plugin directory USER.md 2000
User Pins Workspace PINNED.md (must be explicitly requested by user) 1000
Long-term Summary Entry titles and first lines (when no relevant recall) 1500
Long-term Relevant Entries Current task top-K, mutually exclusive with Summary Base 800 per entry, max 2000 dynamic
Today’s Log Keep the latest tail records 1500
Recent Log Review Zero LLM, default last 6 days 1200

Long-term recall uses continuous Chinese bigrams, Chinese-English stop words, and IDF field scoring; the first round of user tasks can also participate in retrieval. Relevant entries and Summary are mutually exclusive. This is a character limit, not a precise token limit; full text can be read on demand via file tools or memory_search.

Memory Storage Layout

Workspace side (automatically matched if session cwd falls under the configured workspace root, otherwise activeProject in the panel can be used as a fallback):

<workspace>/.workbuddy/memory/
├── MEMORY.md              # Long-term entries
├── YYYY-MM-DD.md          # Daily logs
├── PINNED.md              # Pins, not involved in curation or governance
├── summary-pending.json   # Session summary recovery snapshot (contains private fragments, needs protection)
├── heat.json              # Exposure statistics (not involved in retrieval scoring)
├── archive/
└── .trash/<timestamp>/

Plugin directory side: USER.md (Global Profile), USER-CANDIDATES.md, config.json, distilled.json, etc. Since 0.12.0, it supports preview, confirmation of ID completion, explicit correction, and withdrawal chains for long-term memories. Writes include revision and backup, and conflicts return 409.

Automation Pipeline

  1. auto-digest (Zero LLM): After a round ends normally, append “User Request -> Conclusion” to the logical daily log, with deduplication and daily limits.
  2. Session Summary (LLM): Generated after round completion if idle for 10 minutes (default) and accumulated user text is at least 300 characters (default). Max 8 times per logical day (default). Not generated during shutdown; snapshots are used for recovery after a normal restart.
  3. Log Distillation (auto-distill): Default hourly inspection, fair rotation across workspaces and dates. Failures do not advance the consumption cursor; persistent backoff caps at 2/4/8/16/24 hours.
  4. Curation & Profile (LLM): Curation triggered when long-term memory exceeds a threshold (backup before writing). Global profile is merged from candidate files via inspection; the Agent does not directly modify USER.md.
  5. Governance: Archives expired logs by TTL, cleans up trash and archive copies. Can be skipped with gcEnabled=false. Pins are excluded.

Tools & Diagnostics

  • memory_search: Parameters q, optional workspace, date_from, date_to. Searches both long-term memory and recent logs.
  • GET /api/wb-memory/status?workspace=<workspace>: Read-only status; top-level runtimeRevision confirms the loaded host version.
  • POST /api/wb-memory/recall-preview: Read-only simulated recall (known workspace, q of 1–4000 chars), does not overwrite actual assembly records.
  • 0.13.0 Recall Diagnostics provides fixed synthetic corpus evaluation: GET /api/wb-memory/recall-eval?candidateK=1 (requires Connection authentication).

The panel allows viewing the actual number of assembled candidates, filter reasons, sorting scores, and character budgets. Selection for sorting does not guarantee the model will adopt the specific text segment.

Installation & Activation

The DSH ecosystem follows “everything is a plugin.” The community directory page skillhub.cn/plugins/miseryrua/dsh-wb-memory and the GitHub repository are independent of each other and are not an official DeepSeek / High-Flyer app store.

Install and add to the bundle in the dependencies of your DSH profile. Example local development link from README:

{
  "dependencies": {
    "dsh-wb-memory": "link:C:/Users/<you>/.dsh/plugins-dev/dsh-wb-memory"
  },
  "dsh": {
    "profile": {
      "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-wb-memory"]
    }
  }
}

After installing or updating plugin source code, you must completely exit and restart the DSH host; simply refreshing the browser is not enough. Source code changes require a restart; config items that require plugin reload (like modifying memorySearchTool) are the same.

Recommended activation steps:

  1. Specify workspace root: Environment variable DSH_WORKSPACE_ROOT takes precedence over workspaceRoot in config. If unspecified, README only supports the legacy Windows root D:/datas/Deepseek Harness; other platforms should explicitly configure an absolute path.
  2. Turn on the wb-memory master switch (enabled) in the settings panel, select activeProject (if needed).
  3. Select the distillation model in the panel; the curation model can be selected independently. The repository provides config.example.json: copy it to the plugin directory if you don’t have a local config yet and fill it in. The example defaults autoDistill and sessionSummary to off to avoid background costs when no model is selected. Do not overwrite existing configurations.
  4. Use GET /api/wb-memory/status to verify the running version and fields like distillation pending dates (note that distill.pendingDates belongs only to the currently resolved workspace, not the total backlog of the whole library).

Local configurations, profiles, and cursors are not committed to Git; when upgrading from old commits that still track config, back up the plugin directory config before upgrading/restoring.

Typical Usage

Confirm plugin is loaded

GET /api/wb-memory/status?workspace=<your_workspace_name>

Check runtimeRevision and the distillation/diagnostic summary for the current workspace.

Agent-side memory retrieval

Via the native tool registered by the plugin (requires enabling memorySearchTool in config and reloading):

  • q: Query string
  • Optional workspace, date_from, date_to

Manually simulate what would be recalled this turn (no disk write, no model call)

POST /api/wb-memory/recall-preview

Request body must include known workspace and q (length 1–4000) and satisfy same-origin validation.

Trigger a full-library inspection (including curation & profile candidates, not read-only)

POST /api/wb-memory/distill

Governance cleanup has real deletion side effects. Use POST /api/wb-memory/gc and confirm the policy in the panel; do not treat it as a status poll.

Use Cases & Notes

Who it is for

  • DSH users who want memory to be git-backupable, manually diffable, and not bound to vector databases or external SaaS.
  • Multi-workspace parallelism, needing to recall long-term entries by current task while retaining recent logs and zero-LLM log reviews.
  • Willing to separately configure distillation/curation model routing and accept pruning caused by idle gates, batch limits, and character budgets.

Must Know

  • The plugin reads/writes workspace and plugin directories with current DSH process permissions; summary-pending.json etc. may contain chat fragments. Read source code and MIT license before installation, and assess local data privacy.
  • Writes use guardedWrite and single-host writer constraints, not cross-process atomic CAS, and no fsync power-loss guarantee.
  • Long-term retrieval and log keyword search mechanisms differ; shared words may cause false recall, and pure version numbers etc. may miss logs.
  • Management API requires login and Connection authentication; returns 503 on missing method or exception, no degraded pass.

Conclusion

dsh-wb-memory places the source of truth for cross-session memory on Markdown in .workbuddy/memory/, serving the current turn via layered injection and memory_search, and using background pipelines to precipitate conversations into governable long-term files. For a brief intro and categorization, visit the directory page https://www.skillhub.cn/plugins/miseryrua/dsh-wb-memory; for installation, configuration, and version notes, refer to the GitHub repository: https://github.com/miseryrua/dsh-wb-memory.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye