Introduction¶
DeepSeek Harness (DSH) natively only auto-loads the instruction file chain (such as AGENTS.md / CLAUDE.md) and does not load the memory/ directory. Writing “read memory before the session starts” in an instruction file relies on the model’s self-awareness and is probabilistic. The dsh-memory-loader plugin turns this step into harness-level deterministic injection, ensuring that two-level memory is automatically loaded at the start of every new session.
Plugin Positioning¶
This is a deterministic memory injection plugin for DeepSeek Harness (DSH). It uses the agent/pre-step seam to automatically inject two levels of memory at the start of each new session: global MEMORY.md under ~/.dsh/memory/ and project-level MEMORY.md plus today’s YYYY-MM-DD.md under <cwd>/memory/. The plugin does not rely on the model “remembering to read” and supports independent byte-budget control.
Core Features¶
- Two-level memory injection: Automatically loads long-term memory (
MEMORY.md) and today’s notes (YYYY-MM-DD.md) from global and project scopes. - Automatic daily note injection: Matches the
YYYY-MM-DD.mdfile based on the current date. - Independent byte-budget control: 16KB total budget and a 64KB per-file limit.
- Session injection deduplication: Detects markers and avoids duplicate injection.
- Markdown content escaping safety: Prevents memory content from escaping the frame.
- Over-limit handling strategy: Files exceeding limits are dropped or truncated directly.
- Read-only behavior: The plugin only reads memory and performs no write-back operations.
Installation and Enablement¶
The bundle installation method is recommended. Run the following command in the terminal:
dsh plugin --profile web add https://github.com/wuruihi/dsh-memory-loader/archive/refs/heads/main.tar.gz
If you need the file:// mounting method, place dsh-memory-loader.mjs in the ~/.dsh/profiles/web/ directory and append the configuration to ~/.dsh/profiles/web/cordis.patch.yml. Changes are hot-applied by watchUserPatches, so no restart is required.
Configuration¶
The plugin supports controlling the budget via configuration options:
| Key | Default | Description |
|---|---|---|
maxBytes |
16384 | Total budget for the injection frame (bytes), independent of the 64KB budget for the AGENTS.md chain |
maxSourceBytes |
65536 | Per-file read limit (bytes); files exceeding the limit are treated as non-existent |
The budget policy aligns with the official dsh-agent-instructions: when over the limit, first discard the least specific files, then truncate the most specific file with a notice.
Typical Usage¶
After installation, the plugin automatically injects memory at the start of each new session. Users do not need to manually add memory-reading logic in instruction files. Memory content is injected as a durable user message immediately before the user’s first prompt.
Applicable Scenarios and Notes¶
This plugin suits developers who need long-term contextual consistency and automated memory management. Before use, verify the source code and license to ensure compliance with project security requirements. The plugin runs with the permissions of the current DSH process, so directory read/write permissions should be correct.
Conclusion¶
With the above configuration, DSH memory management becomes deterministic and controllable. For more details, see the GitHub repository or the plugin directory.