Skip to main content

dsh-memoir

17Stars2Forks0Issues0Watchers

Provides a local project memory layer for DSH Agent: persists work conclusions, lessons learned, and follow-up actions across sessions, with bounded Hot Memory auto-injection + BM25 ranking retrieval + web panel management.

Categories◆ Memory
Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
Apache-2.0
Branch
main
agentdeepseek-harnessdsh-pluginmemory

Install

cmdweb profile
$ dsh plugin --profile web add dsh-memoir

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin Qinling-Melon-Farmers/dsh-memoir for me: review the repository at https://github.com/Qinling-Melon-Farmers/dsh-memoir first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

dsh-memoir is DSH's local project memory layer: it deposits Agent's work conclusions, lessons learned, and follow-up actions to local files, allowing the next session to automatically inherit this "project experience package" — solving the pain point of "having to repeat project background every new session."

Core Features

  • Write three types of memories: Let Agent沉淀 (record) work logs, lessons learned, action guides, or notes via memoir_record
  • Edit existing memories: Use memoir_update to modify title/body/category/tags, or mark as superseded/archived — old entries are never deleted
  • Search history: Retrieve via memoir_read across current project, cross-project, or global scope with BM25 ranking, supporting Chinese/English phrases, code identifiers, and path keywords
  • Auto-inject context: At the start of each session, automatically inject Hot Memory within token budget into system prompt (default 900/1200 tokens)
  • Auto-wrap-up hints: At the end of each turn with actual tool calls, automatically prompt Agent to沉淀 (record) this round's conclusions — can be disabled with one click
  • Web panel management: DSH Web sidebar adds "Memory" panel, supporting project/global browsing, sorting/search, CRUD, pin, archive, Hot Memory preview, and search diagnostics

Technical Implementation

  • Language: TypeScript (host side src/host/*.ts, client side src/client/*.ts(x))
  • Key dependencies: @deepseek-ai/dsh-tools (defineTool), @deepseek-ai/dsh-system-prompt (injection segment), @deepseek-ai/dsh-host-webserver (routing), @deepseek-ai/dsh-llm (UserMessage), @deepseek-ai/dsh-client-runtime (client-side bundle injection)
  • Architecture pattern: Cordis dual-sided plugin with 9 pluggable config items; host side registers tools, system-prompt segment, web routes, agent/turn-stopping event listener; client side bundles via esbuild as single-file closure injecting DSH Web sidebar panel entry and panel. Retrieval uses local inverted index + BM25 (Chinese 2/3-gram + English words + code identifiers), zero embedding, zero external services
  • Entry files: src/host/index.ts (host side apply(ctx, config)) + src/client/index.tsx (client side apply(ctx)), exposed via package.json exports["."] and exports["./client"] respectively

Use Cases

People who work on long-term projects across multiple sessions in DSH: first-time pitfalls, project red lines, reusable deployment steps — record once and never have to repeat in new sessions; when taking over code written by someone else (or your past self from months ago) in medium-to-large projects, the project memory panel gives the接手者 (person taking over) a working background summary directly.

Prerequisites & Compatibility

DependencyMin VersionNotes
DSH0.1.0-rc.8+package.json declares peerDependencies @deepseek-ai/dsh-llm ^0.1.0-rc.8 and @deepseek-ai/dsh-tools ^0.1.0-rc.8; cordis.patch.yml injects web profile via dsh.bundle.patch
Node.js^22.19.0 or >=24.0.0Declared in package.json engines.node
PlatformmacOS / Windows / LinuxUnified source uses node:fs, node:http, node:crypto, node:os standard modules; Windows paths fully lowercase normalized at store layer
Native modulesNoneAll dependencies are Node.js built-in modules, no node-gyp / third-party native modules

Installation

dsh plugin --profile web add github:Qinling-Melon-Farmers/dsh-memoir

Configuration Options

Place in cordis.patch.yml under the config block of the entry with id: memoir (all optional, defaults to source code values if omitted).

ConfigTypeDescriptionDefault
enabledbooleanMaster switch; when disabled, no tools/routes/segments registeredtrue
announceToAgentbooleanWhether to announce this plugin in system prompt announcement segmenttrue
autoDistillbooleanAt end of each turn with actual tool calls, whether to auto-prompt for summarizationtrue
hotMemoryTokensnumberSoft target token count for Hot Memory injection (stop adding when exceeded)900
hotMemoryMaxTokensnumberHard upper limit token count for Hot Memory injection (never exceed)1200
readDefaultLimitnumberDefault number of results returned by memoir_read8
readMaxLimitnumberMaximum number of results per memoir_read call30
sessionSnapshotMaxnumberLRU upper limit for in-memory frozen session snapshots128
queryCacheSizenumberLRU cache size for ranked retrieval queries128

FAQ

Q: Can it be used directly without any configuration?

A: Yes. cordis.patch.yml marks all config items as optional with defaults (enabled/announceToAgent/autoDistill default to true, hotMemoryTokens defaults to 900, hotMemoryMaxTokens defaults to 1200). It works fine without a config block.

Q: Where is data stored? Does it go to the cloud?

A: All stays on the machine. Structured JSON stored in ~/.dsh/dsh-memoir.json (single source of truth), each project root automatically generates PROJECT_MEMORY.md human-readable projection (can be committed to git). Source code has no embedding API, vector database, or cloud memory service calls.

Q: Will all history be injected into system prompt?

A: No. Since v0.4, only Hot Memory within token budget (default soft target 900 tokens, hard limit 1200 tokens) is injected into system prompt; long-tail history is retrieved on-demand by Agent calling memoir_read with BM25 ranking.

Q: If I record something in the same session, will it take effect in the next round?

A: Not immediately. Injected text freezes after first-round construction in the same session (to ensure prompt prefix stability for prefix cache hits); this session won't re-read. The next new session will rebuild and see the latest records.

Q: If I run two DSH processes simultaneously, will there be data loss from conflicts?

A: No. Store reads/writes use ~/.dsh/dsh-memoir.json.lock for cross-process mutual exclusion (O_EXCL exclusive create + 25ms retry + 5s timeout). Within critical section, disk is forcibly re-read before write. Lock carries pid/createdAt/nonce metadata, only recycled when older than 60s and持有 (holding) pid is dead.

Q: Will Windows paths with different case be treated as different projects?

A: They are recognized as the same project. Canonical key lowercases the entire Windows path (C:\A, c:\a\, C:/A all map to same c:/a bucket), but display paths retain original case.

Q: How to mark an outdated memory? Does it delete history?

A: Use memoir_update to set status to superseded or archived, or click the corresponding button in Web panel. Source code explicitly doesn't delete history; superseded entries remain in store, Web panel can filter by status to view.

Q: How to uninstall?

A: Remove this plugin line from web profile bundle config (the memoir / dsh-memoir line in cordis.patch.yml), restart dsh web to take effect; plugin doesn't write to DSH source code, removing it immediately returns host to state without this plugin.

Learning Curve

Beginner — one command to install, no configuration needed; regular users just wait for Agent's auto prompt or verbally say "记住这个 (remember this)" when needed.

Known Issues & Limitations

  • Project activity judgment depends on cwd path: when session working directory is not in Agent session header, injection segment degrades to only output guiding text without injecting specific memories; also skips snapshot freezing, rebuilds each round.
  • Cross-process lock has 5-second timeout: when write conflicts are severe, memoir_record throws store lock timeout after 5000ms; when lock file is left by abnormal process exit, only processes older than 60 seconds with dead持有 (holding) pid get recycled.
  • Subagent / nested delegation sessions won't be disturbed by auto-wrap-up hints: auto-distillation listener only triggers on top-level sessions (origin !== 'subagent' and delegationDepth === 0), preventing subtasks from being repeatedly prompted for summarization.
  • No true multi-user isolation: store exists as single-tenant, ~/.dsh/dsh-memoir.json has no permission separation, all projects written to same file.
  • Default queryCacheSize=128 and sessionSnapshotMax=128 are in-memory LRU; long-running high-concurrency (hundreds of sessions) will trigger eviction, but retrieval on 100k-indexed entries remains in millisecond range.

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/Qinling-Melon-Farmers/dsh-memoir)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory