dsh-memory: Plain Text Memory Across Sessions in the Same Workspace

Introduction

In DeepSeek Harness (DSH), when opening a new session, the agent is unaware of why changes were made in the previous round, what pitfalls were encountered, or where the todo list stands. The common practice is to manually restate the background or paste the key points into the system prompt—this resumes context but is hard to maintain and doesn’t persist within the workspace.

Below is the community plugin dsh-memory (maintained by HluckyRing): it saves every round of conversation in the same workspace as readable, editable Markdown; in a new session, it automatically injects long-term memory, task progress, and relevant history into the context based on a strategy, providing three tools: memory_note / memory_search / memory_status. Implementation-wise, it doesn’t rely on databases, vector retrieval, extra model calls, or node_modules; default data stays in the local workspace directory.

What is it

dsh-memory is a DSH Host plugin (single file index.js, MIT license, current repo version 1.1.0, requires Node >= 20). It focuses on a single task: automatically record every round of conversation as text, and automatically read it back in new sessions. Memory exists as plain text Markdown in .dsh-memory/ (or falls back to ~/.dsh/dsh-memory/<workspace_name>-<hash> if the workspace is not writable), without network requests or telemetry.

The plugin belongs to the “Memory” category of capabilities in the DSH ecosystem; you can view the entry in the community directory: skillhub.cn/plugins/HluckyRing/dsh-memory, source code: github.com/HluckyRing/dsh-memory.

Core Capabilities

Capabilities can be divided into two categories: automatic pipeline and model tools.

Auto Record and Inject

Capability Trigger Result
Auto Scaffold New workspace / New session Create .dsh-memory/, complete MEMORY.md, PROGRESS.md (only create if missing, do not overwrite existing content)
Round-by-round Record End of each turn turn/end Write user points, assistant conclusions, tool calls, errors, todo progress to sessions/
New Session Read Session creation agent/created Inject long-term memory + progress + relevant history into context via <dsh_memory>
Relevance Selection Default injectMode: relevance Select relevant history blocks using local keyword scoring, loading more relevant content within the same character budget
Session Index Written at the first turn of the session Update index.md (date, short session id, first user input)
Session Recap Session end agent/disposed Write to recaps/, can be injected as “last session summary” next time
Todo Snapshot Receive todo/write Root session updates TODOS.md
Archive Dir Configure archiveDirs Inject recent archived entries and include them in memory_search search scope

The default injection limit is 8000 characters (maxInjectChars). Empty scaffolds (only headers, no body) will not be injected to avoid filling the model with empty templates.

Model Tools

Tool Function
memory_note Write to MEMORY.md (facts/decisions/preferences) or PROGRESS.md (progress/errors/todos); single entry limit 2000 characters
memory_search Perform case-insensitive substring search in memory text, returns file:line: content
memory_status Show memory directory, session count, and the injection text that will be seen in a new session

The relevance mode scores locally using the current user input (Chinese adjacent characters, English by word), without calling the model; it falls back to recent mode (fixed recent sessions and turns) when the query is empty or all scores are 0.

What Does the Memory Directory Look Like

The default path is .dsh-memory/ under the workspace:

<workspace>/.dsh-memory/
├─ MEMORY.md
├─ PROGRESS.md
├─ index.md
├─ TODOS.md
├─ recaps/
├─ sessions/
│  └─ 2026-10-25_ab12cd34.md
└─ ...

Session logs are appended round by round, directly viewable or editable in an editor. The plugin places a .gitignore containing * inside the memory directory to reduce the risk of accidental commits; if you enable the accompanying guard in your business repo, you can configure git config core.hooksPath .githooks and run a secret scan before committing.

Installation and Enablement

DSH installs this bundle via the local directory method: install_bundle writes the repo as link: in the profile’s package.json and adds dsh-memory to dsh.profile.bundles; default plugin lines and config come from the repo’s built-in cordis.patch.yml.

  1. Checkout the repo to any local directory (the README example is cloning then entering the directory; you can also use an existing copy).

  2. In DSH, let the agent execute the plugin installation (replace path with your actual checkout location):

plugin_manager(action: "install_bundle", target: "D:\\vibe-coding\\plugin\\dsh-memory")
  1. Verification: Open a new session in the workspace, call memory_status, you should see the memory directory and the content to be injected; chat two rounds and check if .md files for today’s session appear in <workspace>/.dsh-memory/sessions/.

If you want to change default behavior, override dsh-memory’s config in the profile’s cordis.patch.yml (wait for Harness to reload or restart after changing). Common item examples:

- id: dsh-memory
  name: dsh-memory
  config:
    injectMode: relevance
    maxInjectChars: 8000
    scaffoldDocs: true

For full field descriptions, see the repo docs/CONFIG.md.

Typical Usage

New Session Context Continuation: Open a new agent session in the same workspace (same cwd), no need to restate; the injection block will mark history as untrusted text, taking current code and user instructions as the standard.

Active Decision Recording: Let the agent call memory_note, e.g., write architectural decisions to kind: decision, write unresolved errors to kind: error.

Check Old Details: When the injection block isn’t enough, call memory_search to locate specific files and line numbers with keywords.

Predictable Injection: When having long multi-session but wanting stable injected content, set injectMode to recent, and adjust recentSessions, recentTurns.

Applicable Scenarios and Notes

Suitable for DSH users who need to iterate long-term in the same workspace but don’t want to maintain an external memory library or vector services. The advantage is transparent data, manually editable, zero extra dependencies; the cost is no semantic search, historical relevance relies on local keyword scoring, and there is inevitably some pruning within the character budget.

Please note before use:

  • The plugin reads and writes the workspace with current DSH process permissions; please review index.js and the MIT license yourself before installation to confirm it fits your security policy.
  • Only records text; user/assistant content is truncated by default (e.g., 500/700 characters); if tool output contains tokens and is repeated by memory_note, it might end up in MEMORY.md, it is recommended to check long-term memory files periodically.
  • If a new session cannot read memory, first confirm the workspace is consistent, then call memory_status; only records rounds containing real human input, pure sub-agent rounds are not written separately by default (can be adjusted with config like captureSubagents).
  • Uninstall: Remove from plugin manager or delete the dsh-memory line in the profile patch; to clear memory for a specific workspace, just delete its .dsh-memory/ directory.

Closing

dsh-memory incorporates “record every round and bring it back to new sessions” into the DSH workflow using pure Markdown, suitable for developers who want memory to stay local, readable, deletable, and without introducing a database.

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

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

Xiaoye