Introduction¶
The philosophy of DeepSeek Harness (dsh) is “everything is a plugin,” and the community maintains a wide variety of extensions. When building agents, a common problem is unbounded memory growth, which causes context window overflow. The dsh-memory-hermes plugin is designed based on the memory system of Nous Research’s Hermes Agent and provides a “bounded curated memory” approach. It does not aim for an ever-growing memory store; instead, it forces the model to maintain a concise list of long-term facts and freezes injection at the start of each session, improving prompt-cache friendliness.
Core Features¶
This plugin provides the following capabilities:
* Dual-file memory: Maintains MEMORY.md (agent notes) and USER.md (user profile) separately.
* Frozen snapshot: Reads memory into the prompt at session start; writes during the session are persisted to disk in real time, and only enter the snapshot in the next session.
* Background self-review: Re-examines sessions through fork loops and routes results into two paths (memory path + skill path).
* Skill library: Distills technical experience into a skill library and supports curator maintenance.
* Security scanning: Scans at write time, injection rendering time, and error payloads.
* Approval gate: Configures whether each write operation prompts an approval request.
* Concurrency safety: Uses in-process promise-chain serialization, cross-process .lock file locking, and atomic writes.
* Inspectable self-review: Records where reviews are written; viewable in the “Activity” tab of the settings page.
Installation and Enablement¶
Ensure the prerequisites are met: Node 22+ (dsh requires ^22.19 || >=24), and the dsh CLI is available.
cd dsh-memory-hermes
npm install
npm run build
npm pack
dsh plugin --profile web add "./dsh-memory-hermes-<version>.tgz"
When installing, two hard rules must be followed:
1. Install using the tgz generated by npm pack; do not use a bare directory or link:. Linking installation may cause Node to resolve the plugin’s local devDeps node_modules, resulting in the host not recognizing the service and panel RPC returning 404.
2. Install it into the built-in profile (web/tui/headless); do not manually add @deepseek-ai/dsh-web-app inside a custom profile. A copy in a custom profile can shadow the shared layer, causing the tool dispatcher’s Symbol lookup to be empty and failing the entire round of tool calls.
Configuration¶
Starting from v2, configuration is handled by the dsh settings service. The plugin registers the memory-hermes namespace; the entry config in the bundle patch acts as the base, and the same-named section in $DSH_HOME/settings.yaml acts as the user-level override.
Add the following to $DSH_HOME/settings.yaml:
memory-hermes:
memoryCharLimit: 3000
The configuration options include (schema defaults as fallback):
* memoryCharLimit: Maximum length for MEMORY.md (default 2200).
* userCharLimit: Maximum length for USER.md (default 1375).
* securityScan: Whether security scanning is enabled.
* approval: Whether the approval gate is enabled.
* backgroundReview: Master switch for background self-review.
* reviewTrigger: Trigger strategy (every-turn | token-delta | manual).
* skillReview: Whether skill-path routing is enabled.
* curatorEnabled: Master switch for the library maintenance layer.
Note: ID-level override replaces the entire config; it does not perform deep merging. Changes take effect immediately after saving (hot-apply), without restarting.
Usage and Commands¶
After installation, you can use it through slash commands and the settings page:
/memory: View/manage memory./memory review [focus]: Manually trigger background self-review./memory compact: Merge memory entries./memory skills: Manage the skill library.
On the “Memory” page of the dsh web settings navigation, you can view file contents and activity records (including step-by-step tool-call traces).
Implementation Details¶
- Frozen snapshot: Memory is read into the prompt at session start; writes during the session are persisted to disk in real time and enter the snapshot only in the next session. This makes it prompt-cache friendly.
- Overflow discipline: Oversized growth writes are not persisted; an error is returned and merge-and-retry is requested. Shrinking operations are always allowed.
- Security scanning: The same rule table (invisible Unicode characters, injection phrases, etc.) is applied at write time, injection rendering time, and error payloads.
- Background self-review: After each completed turn ends, an independent LLM call is initiated according to the trigger strategy (
token-deltaorevery-turn). It supports fork loops (default 8 steps) for memory/skill routing. - Memory/skill routing:
- Memory path: Store user profile, behavior expectations, and current state.
- Skill path: Distill technical experience and workflow corrections.
- Concurrency safety: Ensures multi-process safety through promise-chain serialization,
.lockfile locking, and atomic writes.
Considerations¶
- The plugin runs with the permissions of the current dsh process. Check the source code and license before installation.
- If
approval: true, background review triggering is suppressed because background writes cannot prompt approvals. - Combined with dsh’s built-in session-query, it enables cross-session search (optional).
Summary¶
dsh-memory-hermes provides a bounded, concise, and concurrency-safe memory management solution. It addresses agent memory bloat and context confusion through frozen snapshots, background self-review, and skill-library routing. It is suitable for development scenarios that require long-term maintenance of stable state and knowledge accumulation.