Preface

Agents accumulate user preferences, project decisions, environmental differences, and user corrections during multi-turn conversations. If this information is only compressed into a summary, the summary may become distorted, and it may be unclear later where a specific memory originated. DSH already has lossless session logs. dsh-memory builds upon this to create cited memory: after a session ends, it writes distilled facts into human-auditable Markdown and allows every memory to be traced back to specific original log events.

Below, we introduce the positioning, capabilities, installation method, and typical usage of dsh-memory.

What is it

dsh-memory is a DeepSeek Harness (DSH) bundle maintained by Jesse-njx, with the repository name Jesse-njx/dsh-memory.

Its core value lies in:

  • Based on DSH lossless session logs;
  • Writing distilled facts into Markdown memory files;
  • Each memory comes with a citation, pointing to the precise sessionId and log event range;
  • Providing a compact recall index, memory_read, memory_expand, dsh-memory CLI, and the /memory command within sessions.

The license is MIT. The standalone dsh-memory binary is a pure Node.js implementation and requires Node >=20.

Core Features

Session End Distillation

After a session ends, dsh-memory asynchronously extracts persistent facts via a background distillation process and writes them into Markdown memory files.

The default paths are:

~/.dsh/memory/

Project memories are located at:

~/.dsh/memory/<project>/*.md

user memories are located at:

~/.dsh/memory/_user/*.md

The distillation pass updates or refutes existing memories and logs to:

<project>/_distill.log

This log file is in JSONL format.

Recall Index per Prompt Assembly

Each time prompt assembly occurs, dsh-memory renders a compact, token-limited recall index.

maxIndexTokens is the hard token ceiling for injecting the recall index.

Trace Back to Original Logs from Memory

Each memory comes with a citation, pointing to the precise sessionId and log event range.

It provides two tools:

memory_read(name)
memory_expand(name, [citation_index])

memory_read(name) is used to read the full memory file.

memory_expand(name, [citation_index]) is used to return the original log excerpt being referenced.

maxExpandBytes is the byte ceiling for the output of a single memory_expand.

Maintenance, Types, and Masking

dsh-memory supports three memory types:

  • user
  • project
  • feedback

Same-name project memories mask user memories.

It also provides:

dsh-memory list
dsh-memory show
dsh-memory edit
dsh-memory delete
dsh-memory distill-log

Commands provided within a session are:

/memory
/memory <name>

Installation and Enablement

The installation command is:

dsh plugin --profile web add @dsh-memory/bundle

Configuration fields are all optional. Here is a configuration example:

plugins:
  dsh-memory:
    enabled: true
    home: ~/.dsh/memory
    maxIndexTokens: 800
    maxExpandBytes: 8192
    distill:
      provider: deepseek-official
      model: deepseek-v4-flash
      maxTranscriptTokens: 16000

Field meanings:

  • enabled: Whether to enable;
  • home: Memory root path;
  • maxIndexTokens: Hard token ceiling for recall index;
  • maxExpandBytes: Byte ceiling for single memory_expand output;
  • distill.provider: Provider used for distillation;
  • distill.model: Model used for distillation;
  • maxTranscriptTokens: Limits the length of the transcript entering distillation; the oldest events are discarded if exceeded.

distill defaults to reusing the current session provider/model, but can be overridden using distill.provider and distill.model.

Typical Usage

Viewing within a Session

To view the list in a session, use:

/memory

To view a specific memory, use:

/memory <name>

Tool Invocation

To read the full memory:

memory_read(name)

To return the original log excerpt being referenced:

memory_expand(name, [citation_index])

citation_index is used to specify a citation in the memory.

CLI Management

The dsh-memory CLI supports the following commands:

dsh-memory list [--project P] [--json]
dsh-memory show <name> [--project P]
dsh-memory edit <name> [--project P]
dsh-memory delete <name> [--project P]
dsh-memory distill-log [--project P]

You can also use --home to override the memory root:

dsh-memory list --home /path/to/memory

Overriding Distillation Routing

If you need to specify the provider and model for distillation, configure it as follows:

plugins:
  dsh-memory:
    distill:
      provider: deepseek-official
      model: deepseek-v4-flash

Scenarios and Notes

Suitable for the following scenarios:

  • Wanting to remember user preferences, project decisions, environmental differences, and user corrections;
  • Wanting memory to be Markdown files for easy manual viewing, editing, and deletion;
  • Wanting every memory to be traceable back to original log events;
  • Wanting to avoid automatic injection of the full memory body.

Please note:

  • v0.1 explicitly does not include vector databases, knowledge graphs, cross-project global memory beyond the user type, memory sharing/synchronization, or automatic injection of the full memory body;
  • Same-name project memories mask user memories;
  • maxIndexTokens, maxExpandBytes, and maxTranscriptTokens limit the recall index, memory_expand output, and distillation transcript length;
  • peerDependencies include @deepseek-ai/cordis ^4.0.1, @deepseek-ai/schemastery ^3.18.1, etc.;
  • The plugin runs with the current dsh process permissions; source code and license should be checked before installation.

Conclusion

The value of dsh-memory lies in writing distilled facts into auditable Markdown and retaining references to original session logs. It does not automatically inject the full memory but instead provides a layer of traceable memory indexing between the recall index, memory_read, and memory_expand.

GitHub: https://github.com/Jesse-njx/dsh-memory

Directory Page: No verifiable directory page URL was provided for this material; please refer to the actual DSH community directory.