dsh-dreams: DeepSeek Harness's "Dreaming" Memory

Introduction

In the DeepSeek Harness (DSH) runtime, the model receives the previous turn’s conversation history and system prompt on every round. As conversations grow longer, the history keeps ballooning; reprocessing all of that on every inference pass is both slow and prone to diluting the model’s attention. Meanwhile, the insights, preferences, and open threads that accumulate during a session, if they only live scattered across raw logs, are hard to quickly reuse the next time around.

The dsh-dreams plugin replays the original session content while DSH is idle, compresses the experience into a concise brief, and generates a batch of notes with verbatim citations. The brief is automatically injected into every session, while notes are retrieved only when needed. Every conclusion can be traced back to the source text, eliminating unfounded assertions.

Plugin Positioning

dsh-dreams is a memory plugin for DeepSeek Harness, developed by maintainer hehuifeng. It implements a “dreaming” mechanism: while the model is idle, it organizes session content and structures the experience into local storage for reuse in subsequent sessions. The plugin is categorized under “Memory.”

Core Features

Three-Layer Memory Structure

dsh-dreams divides memory into three layers, each with its own cost profile:

  • STATE.md: the brief, rewritten every round, approximately 0.6–2 KB, injected into every session
  • notes/*.md: cited notes, roughly 1–3 KB each, read only upon retrieval
  • session log: the raw session log, read-only, never modified

The brief only injects content that can change the next action: the user’s stable preferences, what’s in progress, active decisions, known pitfalls, and open threads. Reference-type knowledge is exclusively retrieval-based.

Every bullet in the brief must point to a verified (cited) and non-revoked note via → slug. When a pointer is dangling, the brief is rebuilt or cleared, so the brief never makes unsupported claims.

Six Tools

Tool Purpose
dream Run one consolidation pass: replay → propose → validate → persist → rewrite brief. focus narrows scope, force reruns, dry_run previews without changes
dream_recall Searches notes first (with citations); falls back to raw session logs when notes miss
dream_evidence Opens the event window by session#seq to verify the provenance of a memory entry
dream_remember Writes a note on the spot, marked as unverified; type: profile stores user preferences
dream_forget Soft-deletes to trash; purge removes along with history
dream_restore Lists versions, rolls back to the previous one

Panel

Left sidebar crescent moon icon → “Dreaming” page:

  • Current brief + brief budget bar
  • Notes list (type/confidence/unverified/revoked markers, click to view citations)
  • Topic pages
  • “Run Log”: last 10 passes, annotated with auto/manual trigger, per-round changes and rejection reasons, injected bytes and estimated tokens
  • Auto-dream: choose “Manual only” or “Daily schedule” — multiple time points supported, takes effect on save, no restart needed
  • Dream model: pick from DSH’s configured provider/model, or follow the agent’s default model
  • Cumulative cost and peak/off-peak display

Auto-Dream

The plugin supports three auto modes, configured in the profile’s cordis.patch.yml:

  • auto: false: manual only
  • auto: true: event-driven (triggers when the agent goes idle or a new session opens, with a 60-second debounce before running a pass)
  • auto: 'timer': interval-based (runs one pass every intervalMinutes)
  • auto: 'daily': daily at set times (configure time points in dailyTimes, multiple allowed)

In auto mode, if there’s no new content, the model is not called: it first compares against the watermark, and if there are no new events it returns nothing-new with zero cost. Time points when DSH is not running are skipped, not backfilled.

Memory Bank

Default path is %DSH_HOME%/storages/dsh-dreaming/ (macOS/Linux: ~/.dsh/storages/dsh-dreaming/):

bank/STATE.md               Injection layer (rewritten every round, do not edit by hand)
bank/INDEX.md               Index (not injected, for human browsing / retrieval seeding)
bank/notes/<slug>.md        Note: front matter + body + trailing <!-- evidence --> block
bank/wiki/<slug>.md         Topic pages, cross-linked via [[slug]]
bank/history/<slug>/<ts>.md Previous version saved before each write (20 kept per slug)
bank/trash/<slug>.<ts>.md   Soft-deleted entries
dreams/<id>.json            Per-pass report: sessions, tokens, rejection reasons, brief result
state.json                  Per-session watermark, lastDreamed, cumulative counters, panel cadence & model settings

Notes are plain markdown and safe to edit by hand: the next pass re-validates the brief, and notes without citations get demoted out of the injection layer. When upgrading from v1, automatic migration is performed (guesses type from tags, converts old sources to “has provenance but no citation,” so they don’t enter the brief until the next pass confirms them).

Installation & Enablement

Search for “dsh-dreams” or “dreaming” in the plugin marketplace and install with one click. You can also install manually:

  1. Plugins → Add Plugin → Local Directory → point to this repo’s root directory (clone it to a fixed path first; installation is a link, not a copy — do not move it after installing).
  2. Or: dsh plugin --profile <profile> add https://github.com/hehuifeng/dsh-dreams
  3. Restart DSH once. Depends on @deepseek-ai/dsh-session-query-sqlite (enabled by default).
  4. Verify: the six tools including dream appear, and the crescent moon panel shows up in the left sidebar. Default is manual dreaming only; a pass with no new content doesn’t call the model and incurs zero cost.

Typical Usage

Run a Manual Consolidation Pass

Call the dream tool in conversation; the system will replay the session, organize the brief, validate citations, and persist. The dry_run parameter lets you preview without making changes:

dream dry_run

Recall a Cited Note

When you need to recall something, search notes first:

dream_recall <query>

If notes don’t hit, it falls back to the raw session log to continue searching.

Write a Note On the Spot

Record a finding temporarily, marked as unverified:

dream_remember <content> --type profile

type: profile stores it as a user preference, giving it a chance to be confirmed in the next pass.

Check the Provenance of a Memory

If you’re unsure where a memory entry came from, verify it:

dream_evidence <slug>

Soft-Delete or Hard-Delete

Soft-delete to trash:

dream_forget <slug>

Hard-delete including history:

dream_forget purge

Restore a Previous Version

Each write saves the old version beforehand, enabling rollback:

dream_restore <slug>

Use Cases & Cautions

dsh-dreams is well-suited for agent development scenarios that require long-term context maintenance and experience accumulation. It compresses session experience into retrievable notes and briefs, allowing the model to quickly reuse knowledge in subsequent conversations and reducing redundant input.

Cautions

  • Memory is profile-level, not isolated per workspace; notes carry workspace tags, but the brief is a single global document.
  • No vector search: under 300 entries, it uses keyword + tag + time decay.
  • Two Harness instances writing simultaneously follow last-writer-wins; history retains two copies, no locking.
  • One pass performs a single synthesis; there’s no second-pass verifier. Machine validation relies on “verbatim citation + brief pointer.”
  • daily scheduling is an in-process timer; time points when DSH is not running are skipped, not backfilled.

Before installing, review the source code and license. The plugin runs with the current DSH process’s permissions — ensure write access to the config file and the memory bank directory.

Conclusion

dsh-dreams structures session experience and persists it, turning memory from scattered fragments in logs into a searchable, traceable asset. It strikes a balance between cost and effectiveness using the brief + notes approach: the brief is lightweight and quickly injected, while notes are detailed and available on demand. All memory is stored locally, no data is uploaded, and model calls go exclusively through the provider already configured in DSH.

Plugin directory: https://www.skillhub.cn/plugins/hehuifeng/dsh-dreams
GitHub: https://github.com/hehuifeng/dsh-dreams

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

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

Xiaoye