DeepSeek Harness Cross-Session Memory Plugin

Preface

Context plugins in DeepSeek Harness (DSH), such as billion-context, only perform in-session compression and summarization. Once a session is closed, those summaries are lost. When long-term memory that persists across sessions is needed, existing solutions either rely on vector retrieval or write data to a remote service.

dsh-rosemary-memory offers a different approach: maintaining an auditable, local memory layer outside of sessions. It does not invoke a model, does not connect to a server, and does not depend on vectors. Instead, it compresses memory through deterministic summarization and interpretable weighting, then recalls it on demand in the next session.

Plugin Positioning

dsh-rosemary-memory is a DeepSeek Harness plugin maintained by HZYqwq, categorized under “Memory.” It compresses runs and notes from a session into weighted memory units, supports full-page browsing in the sidebar, recall by error string or command, and every step is explainable.

Data Flow & Structure

The plugin maintains a three-tier structure outside of sessions:

L0 raw messages ──► L1 in-session folded summary (handled by plugins like billion-context)
                    │
                    └──► L2 run (one per turn)
                          │
                          └──► L3 note (conclusion / root cause / fix)
                                │
                                └──► weighted unit (similar notes merged, weights interpretable)

Reading raw notes one by one is meaningless—the same lesson gets recorded across multiple sessions. The plugin uses similarity clustering and weight calculation to merge similar notes into an expandable “compressed entry,” preserving the original text that was compressed and listing them in the sidebar.

The plugin deliberately avoids vector retrieval due to the precision requirements of workflow memory:

  • Vectors excel at synonym matching (“login error” ≈ “authentication failure”)
  • Workflow memory needs exact symbols: UnknownHostException, session-8c0b7bb4, lib/units.js:103

Vectors would map UnknownHostException and “network error” into the same neighborhood, yet workflow memory most needs to distinguish between the two. The plugin therefore adopts deterministic scoring with “exact-match priority + character trigram fallback,” without relying on vectors.

Weighted Compression Rules

When a cluster contains ≥ compactThreshold notes and the merged weight is ≥ compactWeight, it is promoted to a weighted compression entry. The weight formula is:

weight = frequency (log, capped at 6) × 0.35
       + cross-session count (capped at 4) × 0.25
       + manual weight × 0.2
       + freshness (45-day half-life) × 0.2

Similarity is computed as token intersection ÷ the shorter one (containment-based: short phrases are not drowned out by long paragraphs).

Installation & Activation

Install in the DSH profile directory:

cd ~/.dsh/profiles/<profile>
npm install dsh-rosemary-memory

Register it in the bundles list within the same package.json:

{
  "dependencies": { "dsh-rosemary-memory": "^0.3.0" },
  "dsh": { "profile": { "bundles": ["...", "dsh-rosemary-memory"] } }
}

After reloading DSH, a “🧠 Memory” entry will appear in the left sidebar.

Local Directory Install

plugin_manager install_bundle  target: "D:/path/to/dsh-rosemary-memory"

Or use a link reference in package.json:

{
  "dependencies": { "dsh-rosemary-memory": "link:D:/path/to/dsh-rosemary-memory" },
  "dsh": { "profile": { "bundles": ["...", "dsh-rosemary-memory"] } }
}

Install from Source

git clone https://github.com/HZYqwq/dsh-rosemary-memory
cd dsh-rosemary-memory
python -X utf8 tools/make_repo.py --check

The plugin has zero dependencies, no build step, and is ready to run once node --check passes.

Typical Usage

The sidebar provides a memory list (weighted units + weight bars + occurrence count + cross-session count + expandable compressed originals), a thresholds page (re-compression threshold, bili context threshold), and “Digest New Turn” / “Re-compress” buttons.

Tool Calls

The plugin exposes four host tools:

Tool Purpose
memory_digest Summarize (dry-run by default; use dryRun:false to actually write)
memory_recall Cross-session retrieval, returning scores and match reasons
memory_remember Explicitly write a long-term memory entry
memory_brief A concise summary injectable as a stable prefix (default 1200 tokens)

HTTP Endpoints

Same-origin HTTP endpoints are available for mobile access:

GET  /dsh-rosemary-memory/status          GET  /dsh-rosemary-memory/brief?budget=1200
GET  /dsh-rosemary-memory/recall?q=       GET  /dsh-rosemary-memory/notes?limit=50
POST /dsh-rosemary-memory/digest          POST /dsh-rosemary-memory/remember
GET  /dsh-rosemary-memory/units?q=        POST /dsh-rosemary-memory/compress
GET|POST /dsh-rosemary-memory/settings

The legacy /dsh-memory/* prefix remains available.

Threshold Configuration

Threshold Default Purpose
compactThreshold 2 How many similar notes are needed before promoting to a compressed entry
compactWeight 0.4 Minimum merged weight
similarity 0.55 Similarity threshold
nudgeGrowthTokens 50000 bili: how many new tokens trigger a fold consideration
maxContextLimit 75% bili: what fraction of the window triggers a per-turn fold nudge

The first three are stored in data/state.json; the latter two are written to the compress section of ~/.config/billion-context/billion-context.json.

Data Storage

The data directory is located at data/ under the plugin directory:

<plugin_dir>/data/
  runs.jsonl   one entry per turn
  notes.jsonl  one entry per conclusion
  units.json   re-compression snapshot
  state.json   digest timestamp, thresholds

All files use an append-only format—grep-able and manually editable. The location can be overridden via DSH_ROSEMARY_MEMORY_DIR or the storeDir config option. Data will never be committed to a repository.

Use Cases & Limitations

The plugin is well-suited for scenarios requiring long-term, explainable, local memory, such as workflow automation, debugging knowledge accumulation, and cross-session knowledge reuse.

Boundaries and limitations:

  • No vector search—synonym rephrasings (e.g., “can’t log in” vs. “authentication failure”) will likely not be recalled
  • No conflict resolution—two contradictory conclusions will both be retained
  • No benchmarking
  • DeepSeek Harness only; not compatible with other agents
  • UI is Chinese-first
  • Digest quality depends on heuristic rules and may miss or incorrectly include items

Summary

dsh-rosemary-memory is ideal for scenarios in DeepSeek Harness that require long-term, auditable, locally stored memory. It compresses memory through deterministic summarization and interpretable weighting, supports recall by error string or command, and every step is traceable. If you need out-of-the-box automatic capture-and-store behavior, consider the more mature claude-mem; if you need to know why something was remembered, why it was forgotten, and when compression happened, this plugin is worth considering.

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

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

Xiaoye