Introduction¶
DeepSeek Harness (DSH) adopts a pluggable architecture that allows behavior registration at the host composition layer. The dsh-plugin-persona-memory plugin solves the issue found in traditional memory management solutions (such as memory-boot, ptc-memory) where memories are injected only when specific presets are selected. This plugin registers persona settings and long-term memory management at the host composition layer, ensuring that memories take effect in every session for all agent presets. It replaces the legacy three-agent preset loading approach and provides a unified scheme for persona library management, global/project-level memory, and long-term log management.
Core Features¶
This plugin provides the following core capabilities:
* Persona Settings and Long-term Memory Management: Supports Create, Read, Update, Delete (CRUD) operations and switching for the persona library.
* Host Composition Layer Registration: Appended to dsh.profile.bundles upon installation and inserted into the host composition via cordis.patch.yml.
* Right-Side Management Panel: Provides a visual interface for managing personas, memory, and logs.
* Tools and Skills: Provides two global tools, memory and persona, as well as the persona-creator skill.
* Long-term Log (JOURNAL.l): Supports appending and retrieval, but does not inject into prompts.
Installation and Activation¶
Install using the built-in DSH plugin manager. The installation command is as follows:
dsh plugin --profile <profile> add github:hu568/dsh-plugin-persona-memory
After installation, this package is appended to the profile’s dsh.profile.bundles. To verify successful installation, you can request the interface within the agent:
GET /persona-memory/api/state
A return of 200 with ok: true indicates that the panel routes have been registered.
File Structure and Injection Logic¶
The plugin generates the following files and injection segments in the host environment:
* Persona Library: $DSH_HOME/personas/<id>/{persona.yml,SOUL.md,USER.md}
* Global Memory: $DSH_HOME/memory/FACT.md
* Project Memory: <project_root>/MEMORY.md
* Long-term Log: $DSH_HOME/memory/JOURNAL.l
The injected prompt segments use the memory: prefix (e.g., memory:soul, memory:user, memory:facts) and set interpolate: false. This ensures that these segments are retained even in slim modes (like router-standard), while avoiding errors from the host’s renderPrompt() regarding unregistered variables.
Write Limits¶
To prevent infinite context bloat, the plugin sets hard gates on the writing side (throwing an error if exceeded, rather than silently truncating):
| File | Limit Rule | Description |
|---|---|---|
Global FACT.md |
Lines AND Bytes | Default 100 lines / 8000 bytes (UTF-8). Write rejected if either limit is exceeded. |
Project MEMORY.md |
Character Count | Default 8000 characters. Consistent with the injection side maxChars. |
Long-term Log JOURNAL.l |
No Limit | Appended-only, not injected into prompts, used for journal storage. |
Sub-agent Behavior¶
The injection logic for sub-agent sessions differs from the main session:
* Not Injected: Personas (memory:soul/memory:user), Global Memory (memory:facts → FACT.md), and Long-term Logs (JOURNAL.l) are not injected.
* Injected Only: Project Memory (memory:facts → MEMORY.md) is injected, as this is the context required for the sub-agent to execute delegated tasks.
* Configuration: The legacy behavior (sub-agent matches main session) can be restored by setting subagentProjectOnly: false.
Tools and Panel¶
The plugin registers two global tools, memory and persona, along with a right-side panel.
Tool Commands¶
- memory:
action=read: Reads FACT.md and MEMORY.md, and reports current size.action=update, scope=global: Overwrites FACT.md (subject to line/byte limits).action=update, scope=project: Overwrites MEMORY.md (subject to character limits).action=append: Appends logs to JOURNAL.l.action=search: Searches logs by substring.
- persona:
action=list/current/show/use/create/update/delete: Manages the persona library.
Panel API¶
The right-side panel is served via HTTP routes, with a default prefix of /persona-memory:
GET /persona-memory/api/state
POST /persona-memory/api/persona/{show,use,save,delete,order}
POST /persona-memory/api/memory/save
POST /persona-memory/api/journal/{append,search}
Notes¶
- Uninstallation Does Not Clean Data: Executing
removewill not delete files under$DSH_HOME/personasand$DSH_HOME/memorydirectories; manual cleanup is required. - Update Operation: If the plugin content is updated but the installation spec string remains unchanged, DSH will report an
ambiguous-installerror. To update, you mustremovefirst, thenadd. - Dependencies: Depends on
schemasteryat runtime (aliased installationnpm:@deepseek-ai/schemastery@3.18.2). - Version Compatibility: Tested with DSH versions
0.1.5-rc.1to0.2.0-rc.2.