Whale Memory: A Local Long-Term Memory Hub for DeepSeek Harness

Introduction

In the DeepSeek Harness (DSH) environment, conversations often lack memory continuity across sessions. After switching context, previous dialogue details are easily forgotten, and rules are difficult to reuse across different sessions. Conventional approaches either rely on external services or hardcode memory into code or configuration files, resulting in high maintenance costs and poor extensibility.

Whale Memory provides a local-first long-term memory solution: it centrally manages memory nodes, rule sources, and session retrospectives. Through local SQLite storage, automatic recall, and a six-tab panel, it gives conversations cross-session memory capabilities while using local git to manage rules, preventing configuration loss.

What It Is

Whale Memory is a plugin that provides local long-term memory and rule sources for DeepSeek Harness. It maintains a local SQLite database as a search mirror for memory and rules. Rules themselves are stored as Markdown files in a local git repository (default path ~/.dsh/rules/). At the end of a session, decisions and open items can be converted into memory candidates and rule suggestions. The plugin runs inside the DSH process, depends on no external services, and does not upload any data to the network.

Core Features

Automatic Recall and Memory Injection

Before each turn of dialogue, the plugin searches for relevant nodes in the local memory database based on the user’s message and injects them into the conversation context when the relevance exceeds a threshold (default minRel=0.34). Recall results are visible only to the current session and expire after 120 seconds. If the search times out (2 seconds) or yields no hits, no injection occurs. Intent budget limits: 3 for chat, 5 for troubleshooting, 4 for recall, 0 for image-text creation.

Six-Tab Panel

The panel is divided into six tabs: Overview, Memories, Rules, Recall, Writes & Relations, and Settings.

  • Overview: Displays the latest session retrospective report and provides a “Wrap now” button.
  • Memories: Search, edit, and archive memory nodes; supports import/export and a node relationship view.
  • Rules: View and manage rule files—create, edit, deactivate/activate, and clean up; review pending proposals and historical diffs/rollbacks; check git status; and run the /rules/health check.
  • Recall & Writes: Configure injection parameters, candidate filtering, auditing, and adoption status.
  • Settings: Grouped configuration for backend, rules, wrap, and panel options.

Rule Source and Rule Injection

Rules are stored as Markdown files in a local git repository, with the default directory being ~/.dsh/rules/. Once a rule is read, nodes marked with origin=rule:<key> are used only for the panel and auditing purposes and do not participate in automatic recall. A colloquial rule mentioned in conversation is converted into a proposal and does not take effect automatically—it must be confirmed from the Rules tab or by replying include <p...>. When applying a rule, the plugin generates an execution plan (including file guards, old hash, and planned hash), writes it in a single transaction, and rolls back on failure to avoid partial write states. Rule injection can be scoped via role: / workspace:, injected in matching sessions, and injectChars=0 disables injection entirely.

Session Retrospective and Reflection

When a session ends, the plugin automatically converts key decisions and open items from the conversation into memory candidates and rule suggestions, generating a retrospective report. Version 2 adds session selection, a click queue (202 + progress), a per-session automatic retrospective toggle, and an optional Reconcile phase (disabled by default). The reflection feature is triggered when more than 7 consecutive non-memory tool calls are made in a single turn, or when the session enters an idle state (disabled by default). Reflection writes carry source=self and origin=reflect, following the same persistence policy.

Multi-Layer Memory and First-Turn Profile

Memory writes carry a layer: fact (facts/decisions), lesson (procedural experience), user (preferences). The memory_remember tool infers the layer based on memory_type, and memory_update recalculates the layer upon rewrite. Direct panel writes and legacy records retain NULL, while rules have no layer. During the first turn of a session, the plugin generates a profile of up to 800 characters from the user/lesson/fact nodes of the current session identity (taking the top 5, 5, and 3 respectively), injects it once via systemPrompt.context, and does not repeat it afterward. It is skipped for sub-agents or when the identity is undetermined.

Model-Side Memory Tools

The model can invoke five tools: memory_remember, memory_search, memory_read, memory_update, and memory_forget. When tools are called, the identity is always the current session (userId/roleId obtained from the plugin identity rules + host login, workspace from the session cwd). A missing identity raises IDENTITY_REQUIRED, and IDs from other partitions appear as NODE_NOT_FOUND. remember follows the same value gating as automatic ingestion (persist → active, task/one-off → NOT_MEMORY, ambiguous → review candidate). update supports CAS (NODE_CHANGED) and rejects protected targets. forget only archives. Each turn allows at most tools.maxWritesPerTurn (default 5) write attempts; sub-agents are rejected. Setting tools.enabled=false disables the tool set at invocation time.

Local-First and Zero Dependencies

The plugin runs entirely locally, using the Node.js built-in SQLite, with no dependency on external services or network requests. The rule library is a local git repository, and the database serves only as a search mirror, allowing rollbacks when editing rules. Write operations are logged in an audit log, and write adoption signals are supported.

Installation and Activation

The installation method depends on your use case:

  • Market: Add this project’s index source in the DSH plugin marketplace, then search for dsh-whale-memory to install.
  • GitHub Release: Install the released tarball using the command:
  dsh plugin --profile <profile> add <release-tarball.tgz>

Or select the corresponding tarball on the Plugins page.
- Local Development: Use link: via the plugin manager to install from a local directory:

  dsh plugin link:<repository-directory>

Run pnpm install locally before installation. After code changes, a rebuild and DSH restart are required.

After installation, local storage, automatic recall, and the six-tab panel are enabled by default. No additional services or API keys are required.

Typical Usage

Automatic Memory Injection

During a conversation, the plugin automatically retrieves memory nodes relevant to the user’s message and injects them. For explicit control, adjust injection parameters in the Recall tab of the panel, or use /rules/health to check rule health status.

Creating Rule Proposals

After mentioning a rule in conversation, it enters the pending proposal queue. You can view the proposal in the Rules tab, click “Apply,” or reply include <p...> to confirm. Once applied, the rule is written to the local git repository and injected into matching sessions.

Session Retrospective

When a session ends or a retrospective is triggered manually, the plugin generates a retrospective report listing key decisions, open items, and rule suggestions. You can view the report in the Overview tab, click “Wrap now” to generate a retrospective immediately, or click “Queue” for a specific session to add it to the queue.

Viewing and Editing Rules

Rules are stored as Markdown files in the ~/.dsh/rules/ directory and managed with local git. In the Rules tab, you can view the file list, edit content, roll back to historical versions, or deactivate rules. /rules/health checks the consistency of files, manifests, tombstones, chains, and the mirror.

Applicable Scenarios and Notes

Whale Memory is well suited for DSH session scenarios requiring long-term memory and rule reuse, such as code review assistants, technical documentation generation, and multi-turn debugging workflows. It depends on no external services, and all data remains local, making it ideal for privacy- and security-sensitive environments.

The plugin runs with the current DSH process permissions. Before installation, review the source code and license (MIT). Configuration options include rule toggles, rule directory, git requirement, proposal mode, and more. For detailed configuration, refer to the plugin README and documentation.

Conclusion

Whale Memory enables long-term memory capabilities for DeepSeek Harness sessions through local SQLite, automatic recall, and rule management, while keeping rules auditable and rollback-capable. It is ready to use immediately after installation with no additional services required. Plugin links: GitHub | Directory

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

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

Xiaoye