dsh-project-memory: Cross-Session Project Memory for DeepSeek Harness

Introduction

DeepSeek Harness (DSH) is an agent framework built on the “everything is a plugin” philosophy. In practice, each workspace tends to accumulate facts, decisions, constraints, and practices over time, which later sessions need to reuse. However, DSH has no native persistent memory capability—during long-running tasks, context is easily flushed, and historical conclusions become hard to reproduce. zirscard/dsh-project-memory provides a cross-session persistent “project memory” for each workspace: when a new session starts, core memory is automatically loaded; when work is done, reusable conclusions are written back.

What It Is

dsh-project-memory is a memory plugin for DSH, delivered by maintainer zirscard, categorized under “Memory.” It maintains a memory store per workspace, containing facts, decisions, constraints, practices, risks, and open questions. The storage layer uses pure Markdown + YAML frontmatter (no vector DB, no external services). Every entry is required to carry a source (traceable origin) and asOf (when the fact became true). Deduplication is performed before writes; conflicts are resolved via a “supersede chain” rather than overwriting, ensuring reproducibility.

Core Features

File-Based Storage, Zero Dependencies

The plugin depends on neither Postgres nor a vector database—it uses only pure Markdown + YAML frontmatter. The storage directory defaults to $DSH_MEMORY_HOME/<workspace-key>/ (default: ~/.dsh/memory/), containing core.md (core memory), entries/*.md (source of truth), index.json (index), and log.jsonl (audit log). This design keeps memory human-readable, diffable, and git-versionable, well suited to scales ranging from a few hundred to a few thousand entries.

Three Inviolable Rules

  1. No source, no write: Every memory entry must carry a source (file path#anchor / URL / command reference). If missing, the write is rejected.
  2. Time-anchored, dual-axis: Every entry must carry asOf (event axis: when the fact became true) and observedAt (ingestion axis: when it was observed). Backtesting and forecasting must filter on both axes simultaneously to avoid look-ahead bias. The leak-check command audits leakage on both axes.
  3. Conflicts never overwrite: A new entry is created via supersede, pointing to supersedes. The old entry is marked superseded and back-filled with superseded_by. Old entries are never deleted, ensuring any conclusion can be traced back to its original basis.

Single Root & Proliferation Control

Memory data is allowed to exist in exactly one location: $DSH_MEMORY_HOME/<workspace-key>/, preventing multiple copies of the same content. The migrate command moves legacy per-workspace memory directories into the single root. doctor scans for stray workspace remnants and duplicate content (grouped by sha256), with metrics including memory_roots, stray_workspace_dirs, and duplicate_content_groups.

Derived vs. Source-of-Truth Layering

entries/*.md and log.jsonl are the source of truth and must not be manually edited. index.json and core.md are derived artifacts, rebuildable via reindex and rebuild-core. Derived files carry a first-line marker: generated by dsh-project-memory — derived artifact, do not edit manually. The verify command checks that derived artifacts have not drifted from the source of truth.

Single Egress Point

export produces a single-file memory export (committable, shareable, backup-ready); import restores from a file. Export is the sole egress path—there is no scenario where “each workspace ships its own memory directory.”

Retrieval & Injection

recall supports querying by query, asOf, knownAt, type, scope, scene, and limit. Core memory is injected dynamically via ctx.systemPrompt.section({ text }); on each prompt assembly, core.md is read by path and sanitized before injection (HTML comments, spoofed tags, zero-width and bidirectional control characters are stripped). Entry bodies must use interpolate: false to avoid host-side variable resolution errors.

Installation & Activation

Local plugin form (relative symlink + profile declaration):

P=~/.dsh/profiles/desktop

# 1. Create symlink (relative path)
ln -sfn "../../../../wps云盘/插件区/plugins/dsh-project-memory" "$P/node_modules/dsh-project-memory"

# 2. Add one line each to ~/.dsh/profiles/desktop/package.json in two places
#    dependencies:  "dsh-project-memory": "link:<plugin-dir>/dsh-project-memory",
#    dsh.profile.bundles:  "dsh-project-memory",

# 3. Restart DSH

Once installed, the project_memory tool is auto-registered, and the ## Project Memory section automatically appears in the system prompt.

Direct CLI Usage

The engine is a stdlib-only Python file and can be invoked without the plugin runtime:

PY=~/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/python/bin/python3
ENGINE=~/.dsh/.../plugins/dsh-project-memory/core/memory.py

$PY $ENGINE --workspace "$PWD" recall --query "华丰 估值"
$PY $ENGINE --workspace "$PWD" write --type fact --title "..." --body "..." \
    --as-of 2026-06-30 --source "file.xlsx#B12"
$PY $ENGINE --workspace "$PWD" leak-check --as-of 2026-06-30 --known-at 2026-06-30
$PY $ENGINE --workspace "$PWD" doctor --scope files     # proliferation audit
$PY $ENGINE --workspace "$PWD" export --to "$PWD/记忆导出.md"   # single egress point

Use Cases & Cautions

Best suited for DSH workspaces that need to reuse facts, decisions, and constraints across sessions—especially long-cycle tasks, backtesting, and post-mortem reviews. Always run with the current DSH process privileges; inspect source code and license before installation. Memory files can become a target surface for persistent prompt injection; the plugin sanitizes content before injection.

Ecosystem Context

The DSH philosophy is “everything is a plugin.” The community catalog has no official affiliation with DeepSeek or High-Flyer.


  • Plugin catalog page: https://www.skillhub.cn/plugins/zirscard/dsh-project-memory
  • GitHub: https://github.com/zirscard/dsh-project-memory
羽毛球分组比赛记分
小程序二维码

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

Xiaoye