Back to home@LZMW

dsh-memory

Persistent long-term memory plugin for DeepSeek Harness (dsh): single memory tool, markdown storage, auto session summary, curator governance, user-profile injection.

Stars
0
Language
JavaScript
Created
Aug 24, 2026
Updated
Aug 27, 2026

Introduction

dsh-memory

中文 | English

Persistent long-term memory for DeepSeek Harness (dsh) agents — a single Cordis plugin that gives every session save / search / summarize / curate over markdown-backed memories, auto-summary at context pressure, and session-start injection of your user profile.

Features

  • One tool, not five. A single memory tool with an action argument (save | search | list | delete | summarize | curate) keeps the tool-schema and system-prompt footprint minimal.
  • Markdown-file storage. One file per memory with id/tags/created/updated/scope frontmatter. Human-editable, git-friendly, no database.
    • Project scope: <projectRoot>/.dsh/memory/ (wins search ties)
    • Global scope: $DSH_HOME/memory/
    • Project root = nearest .git ancestor of the agent's cwd (same rule dsh uses for skills)
  • Automatic session summary. At 50% context pressure, on compaction, or on demand ("请开始回忆"), a one-shot analyst subagent runs a structured CoT (reusable knowledge / user preferences / lessons / constraints) over the session transcript and persists the four sections as rolling-merged memories — old versions archived to .trash/.
  • Memory curation. A curator subagent reorganizes accumulated memories (merge / rewrite / delete / new) under a strict, validated plan (KEEP/REWRITE/DELETE/NEW), with a full backup to .trash/curate-<ts>/ before anything is touched. Runs automatically every N summaries or on demand ("梳理记忆").
  • Strict scope isolation. Project workspaces can read global memories (user profile) but never edit or curate them — enforced in code, not prompts. Global curation uses a stricter rule set and maintains the special 用户画像 (user profile) category.
  • Session-start injection. High-value profile/constraint memories are spliced into the first step of every session (same mechanism as AGENTS.md), budget-capped (default 4000 chars). Knowledge memories stay retrieval-on-demand.

Install

The plugin lives as a flat package in the dsh profile's shared node_modules:

git clone https://github.com/LZMW/dsh-memory.git
Copy-Item -Recurse dsh-memory "$env:USERPROFILE\.dsh\profiles\node_modules\dsh-memory"

Then register it in each profile you use (~/.dsh/profiles/<name>/cordis.patch.yml):

- insert:
    - id: dsh-memory
      name: dsh-memory

Restart your dsh session. A memory tool appears.

Configuration (in cordis.patch.yml insert entry)

keydefaultmeaning
memoryDir""override the global memory root
autoThresholds[0.5]context-pressure ratios that trigger auto-summary
curateEvery5run auto-curation after N saved summaries
injectOnStarttruesplice profile memories into the session's first step
injectMaxChars4000injection budget

Trigger phrases

  • "请开始回忆" → on-demand session summary
  • "梳理记忆" → on-demand curation

Data layout

<projectRoot>/.dsh/memory/
  20260824-dae50633.md     # one memory per file
  .trash/                  # soft-deleted + pre-merge + pre-curation backups
  .curation-state.json     # auto-curation counter
$DSH_HOME/memory/          # global store (user profile etc.)

License

MIT