dsh-memory-anchor: Capturing Only the Decisions and Root Causes Code Cannot Describe

Introduction

When DeepSeek Harness (DSH) agents read code, they can often understand symbol locations, call relationships, and commit history—but they cannot grasp why the code was written a certain way, which approaches were rejected, or which edge cases previously caused failures. This implicit knowledge is lost the moment a session ends, unless someone manually documents it.

dsh-memory-anchor targets exactly this gap. It records only the information an agent cannot derive from code itself: decisions, rejected alternatives, and root causes. Every memory entry comes with an executable verification step, and the system reports where memories have become stale, enabling iterative improvement.

What It Is

This is a plugin that provides memory capabilities for DSH, maintained by JhengFire and categorized under “Memory.” It does not store facts that code can answer (such as symbol locations or git history); it records only the decision rationale and root causes that code cannot express. Each memory entry requires a verification step, and the system detects stale memories and reports them.

Core Features

Scope: Defining the Memory’s Boundaries

The plugin supports scoping memories via a scope field:

  • []: Global—recallable from anywhere
  • ["workspace"]: The current working directory and its subdirectories
  • ["src/surface/**"]: A specific path and its subtree
  • ["workspace", "src/api/**"]: Matches if any entry matches

workspace is resolved to the current directory at recall time. It is recommended over absolute paths to avoid breakage when the repository is moved.

Embedding Model: From Surface Matching to Semantic Understanding

By default, the plugin uses local character-hash vectors—zero dependencies, fully offline. However, it can only match surface forms: synonym-rewrite recall is roughly 20%, and cross-language recall is 0%. For example, “unit tests must pass before commit” will not match “automated tests need to be run before merging code.”

Once an embedding provider is configured, semantic retrieval becomes available. The plugin ships with Volcengine Ark as a built-in example and includes a connection test feature. If the API is unreachable, writes still fall back to local vectors and are flagged for upgrade; once the API recovers, reindex can recompute embeddings.

memory Tool: A Unified Tool Interface

The plugin registers a single memory tool, with different operations dispatched via the action parameter:

action Purpose
find Recall memories by query, filtered by the current working directory’s scope first
add Record a decision, constraint, gotcha, or rejected entry; no other types are accepted
verify Report whether a recalled memory still holds; mark as stale if it does not
resolve Resolve a conflict between two memories—keep one, or keep both as provisional
use / miss Report whether a recalled memory actually helped, driving memory decay
stats Check how many memories are missing a verification step
eval Report statistics on memory-failure types

Conflict Detection & Auto-Resolution

Two memories can be nearly identical yet contradictory (e.g., “SNAPSHOTs are forbidden in production” vs. “SNAPSHOTs are allowed in production”). Similarity cannot distinguish agreement from opposition, so when the plugin encounters a conflict it refuses to add the new entry, displays both contents, and waits for resolve. During the conflict, both memories are marked as provisional, and every search surfaces the conflict.

Pure corrections (e.g., a date changed from yesterday to the day before) are applied automatically. The old entry is preserved as superseded to keep the change traceable.

Staleness Reporting: Seven Failure Types

The plugin detects seven failure types from tool-call records:

Failure Type Signal
F1: Not recalled An empty search, followed by the same topic being added within a few minutes
F2: Recalled but unused Results were returned, but use was never called
F3: Verification failed verify reports the memory no longer holds
F4: Decision re-opened A second active decision appears under the same tag set
F5: Conflict Two memories contradict each other
F6: Task incomplete Requires an external outcome signal (optional)
F7: No feedback Results were returned, but neither use nor miss was ever called

F7 is reported separately because it can mask F2 (it is impossible to distinguish “recalled but nobody reported” from “recalled but nobody used”).

Lightweight Design

  • No content is injected into the system prompt by default; a single line of usage guidance is injected only when needed. Turns that do not call the tool incur zero overhead.
  • Writes are restricted: only four situations allow creating a record (decision, rejected alternative, root cause, correction of a wrong belief).
  • Every memory is verifiable: verify provides an executable check rather than relying on trust.
  • Decay is outcome-based: use and miss determine whether a memory is retained, not elapsed time.
  • Single-file storage: records are saved in a human-readable, verifiable, persistent JSON file—no background service or vector database required.

Installation & Setup

The plugin requires DeepSeek Harness >=0.2.1-rc.3.

# From npm
dsh plugin add dsh-memory-anchor

# Or from a local checkout
git clone https://github.com/JhengFire/dsh-memory-anchor.git
dsh plugin add ./dsh-memory-anchor

You can also install it via the GUI under Plugins > Add plugin in Harness, pointing to a local package directory.

After installation, the plugin adds a Memory section to the Settings page, containing a toggle and a record list. No configuration is required before first use.

Configuration

Under Settings → Memory anchor, the following options are available:

Field Default Meaning
limit 5 Number of results returned by find
staleDays 180 Threshold (in days) after which an unverified memory is marked stale
retireMisses 3 Threshold for unused-and-unverified counts after which a memory is removed
conflictWindowSec 1800 Time window (in seconds) for conflict detection

All values are stored in the profile patch and persist across upgrades.

Embedding Configuration

Under Settings → Memory anchor → Embedding model, select a provider, paste the API key, click Test connection, and then save. The key field is masked; the page will not display the full key.

Reindexing

If the API is unavailable, writes still fall back to local vectors and are flagged. Once the API recovers, you can run:

memory action=reindex              # dry run—reports the number of entries needing recomputation
memory action=reindex apply=true   # execute; supports resuming from where it left off

Use Cases & Caveats

This plugin suits developers who want their agent to remember the why—especially in scenarios focused on decision rationale, rejected alternatives, root causes, and correction processes.

The plugin runs with the permissions of the current DSH process. Review the source code and license before installing. All records are stored locally; the plugin continues to work without any network dependency.

Conclusion

dsh-memory-anchor records only the decisions and root causes that code cannot express, and provides a verification step for every memory. This helps agents maintain consistency within a session and reuse correct experience across sessions. The staleness report exposes weaknesses in the memory system, forming an iterative improvement loop.

Directory

  • https://www.skillhub.cn/plugins/JhengFire/dsh-memory-anchor

GitHub

  • https://github.com/JhengFire/dsh-memory-anchor
羽毛球分组比赛记分
小程序二维码

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

Xiaoye