Preface

Coding agents often forget what they just did, or vector-based “auto-memory” products remember too much—drafts, wrong turns, and guesses. dsh-memory-ga takes a different path. It follows the discipline “No Execution, No Memory”: it only stores long-term facts after tools (or the user) have confirmed reality. It provides a small, trustworthy index of facts and rules, a session notepad, and a “settlement ritual” to turn lessons into Skills without silently poisoning memory.

Core Features

Based on verified facts, the plugin provides the following capabilities:

  • Verified only: Long-term writes happen only after tools (or the user) confirm reality.
  • Hard-injected L1: Each conversation turn hard-injects an index + RULES of ≤~30 lines, rather than a pointer that may never be opened.
  • Working notepad: When the session notepad key_info is non-empty, it is re-injected into the context.
  • Gated settlement: start_long_term_update initiates a protocol but does not automatically edit your files.
  • Skills stay Skills: Reusable procedures → DSH Skills. Memory is not a second SOP repository.
  • Local & auditable: All data is plain UTF-8 text under $DSH_HOME/memory, and can be diffed, backed up, and edited manually.

Directory Structure

The plugin maintains the following structure under $DSH_HOME/memory:

$DSH_HOME/memory/
  L0_memory_management.md   # 宪章(如何记忆)
  global_mem_insight.txt    # L1:导航 + RULES → 硬注入
  global_mem.txt            # L2:已验证的事实 → 按需读取(≤9 行的章节 + 指针)
  l3/<topic>.md             # L3:长篇事实档案(L2 章节指向此处)
  .working/<session>.txt    # 可选的会话记事本转储

The plugin does not include a notebook-style junk drawer, nor an L4 memory tree. l3/ only stores fact files; procedures belong to Skills (Skill = how to do it, L3 = what it is).

Provided Tools

Tool Name Description
update_working_checkpoint Replaces the session notepad (key_info)
start_long_term_update Returns L0 + settlement protocol (no automatic writes)
memory_status Shows the path, L1/L2 sizes, L3 file count, whether the notepad is empty, and nudge counters

The plugin provides optional soft nudges (enabled by default): after enough steps, it gently reminds to run a checkpoint or settlement. It never forces tool calls and never writes to L1/L2 automatically.

Installation and Enablement

In a DSH profile directory (for example, $DSH_HOME/profiles/web), install with pnpm:

pnpm add dsh-memory-ga@github:DiligenceLai/dsh-memory-ga

Ensure the profile loads the package (typically listed in dsh.profile.bundles, or automatically inserted by cordis.patch.yml inside the dependency package).

Configuration

Add the memory-ga plugin ID to the Cordis configuration:

- id: memory-ga
  config:
    # root: null            # 默认:$DSH_HOME/memory
    bootstrap: true
    injectL1: true
    injectWorking: true
    l1MaxChars: 1200
    workingMaxChars: 1200
    persistWorkingFile: true
    nudge:
      enabled: true
      workingEvery: 12
      settleAfterSteps: 15
      maxWorkingNudges: 3
      maxSettleNudges: 2

Hard dependency: The plugin declares inject: ["tools", "systemPrompt", "llm"]. The working notepad and nudge injection require @deepseek-ai/dsh-llm (with the createUserMessage capability) to be present in the host composition. If it is missing, the plugin still loads, but memory_status warns that the notepad/nudge was not injected.

Note: workingMaxChars is the single upper limit for both storing and injecting the session notepad, so memory_status.workingChars always reflects the content actually seen by the model.

Typical Usage

  1. Check status: After restarting DSH or reloading the profile, run memory_status in a session; you should see the $DSH_HOME/memory path and related counts.
  2. Update the notepad: Run update_working_checkpoint with a brief note; the next model step should include ### [WORKING MEMORY].
  3. Long-term update: Run start_long_term_update to view the protocol and the full L0 content. Files on disk do not change at this point until you manually edit them.
    • On first launch, missing L0/L1/L2 files are created from templates and existing files are not overwritten.

Use Cases and Cautions

  • Use cases: You need a controlled crystallization process and a Git-friendly source of truth, rather than automatic vector retrieval or automatic retention.
  • Note 1: This is not a vector database, TEMPR, or an automatic git retention product.
  • Note 2: This is not a replacement for DSH Skills.
  • Note 3: This is not a tool for automatically generating Skills.
  • Privacy: The repository contains only generic templates. Your real L1/L2 files live in $DSH_HOME/memory on your machine and are never included in this package. Do not commit personal memory files or absolute paths to a fork.

Summary

dsh-memory-ga provides DeepSeek Harness with a file-based, gated layered memory solution. It helps agents retain necessary facts while avoiding memory pollution through a hard-injected index, a session notepad, and a gated settlement protocol.