Introduction¶
The DeepSeek Harness (DSH) ecosystem emphasizes a plugin-based architecture. When developing agents, conversational context is usually limited to the current session; after a new session starts, the agent needs to relearn the background information. The dsh-hindsight-memory plugin integrates Hindsight into DSH’s pipeline, providing pipeline-level long-term memory. It uses DSH’s hook mechanism to automatically inject and retain memory before and after model invocations, without exposing any agent tools.
Key Features¶
- Pipeline-level long-term memory: embeds memory capabilities into DSH’s agent pre-step and post-step processes.
- Automatic injection and retention: automatically recalls before model invocations and retains after conversations end.
- Fault isolation: a recall failure does not affect injection for the current step; a retain failure only logs the error and does not interrupt the chat.
- Layered configuration: supports editing in the settings UI and configuration layering (defaults, composition layer, user layer).
Installation¶
Install the plugin using the official command, or specify a local path.
dsh plugin --profile web add dsh-hindsight-memory
After installation, restart DSH Web. The host logs should contain the plugin activation message:
hindsight-memory: active (api=… bank=… enabled=true)
Configuration¶
After restarting, an independent Settings → Hindsight Memory Plugin section appears in the DSH settings sidebar. The main controls include:
- Enable switch: controls turning injection and retention on/off.
- API URL: the Hindsight API address.
- API KEY: Bearer Token; if left empty, no authentication is used.
- BANK ID: memory bank name; multiple clients pointing to the same bank can share memory.
- Recall Budget: recall strategy; options are low / mid / high.
Layered configuration follows DSH semantics: schema defaults ← composition layer configuration ← user layer overrides. All fields take effect in the next turn after saving, without a restart.
Configuration example (optional):
- insert:
- id: hindsight-memory
name: dsh-hindsight-memory
config:
apiUrl: http://127.0.0.1:28888
apiKey: ""
bankId: dsh
autoRecall: true
autoRetain: true
recallBudget: low
recallTypes: [observation]
maxQueryChars: 800
recallTimeoutMs: 8000
maxMemories: 8
maxBlockChars: 4000
retainContext: conversation between the DSH agent and the user
retainTags: [source:dsh]
includeSubagents: true
retainEveryNTurns: 1
verbose: false
How It Works¶
The plugin implements its functionality through two core hooks:
-
Auto-Recall (agent/pre-step):
Triggered before the first LLM call in each turn (step 1). The system takes the latest user message (≤800 characters) as the query to call Hindsight’s recall API, and appends the relevant memories to the step batch. Subsequent steps do not repeat recall. Consistent with Hermes semantics, casual acknowledgments (such as “okay/uh/ok/thanks/continue”) and slash commands are skipped. -
Auto-Retain (session/event):
Each append dispatches an event. The system accumulates User and Assistant text in the orderturn/start → user/message / assistant/message → turn/end. Atturn/end, it asynchronously stores the content in Hindsight. Seeded historical events are not republished, so old turns are not retained again.
Usage Verification¶
- Start a new session, tell the agent a fact (for example: “My server is called atlas”), then complete a normal turn.
- Open the Hindsight UI (port 29999 on the deployment machine) and enter the bank
dsh. You should now see the recently retainedUser: … / Assistant: …memory. - Start another completely new session and directly ask “What is my server called?” The agent’s answer should include the answer directly, without invoking any tools during the whole process.
Notes¶
- Runtime requirement: the DeepSeek Harness version must be
0.2.0-rc.1. - Dependency checking: the plugin declares the relevant packages as peers in
package.json; the profile compatibility gate directly refuses to load on incompatible DSH versions rather than silently failing at runtime. - Message filtering: only messages with
source.kind === "user"are treated as “human input”; context injected by Harness (time context, skill catalog, etc.) is used neither as a recall query nor included in retained content. - Sub-agents: sub-agent / fork sessions participate in memory flow by default and can be disabled via
includeSubagents. - Uninstall: to remove it, use
dsh plugin --profile web remove dsh-hindsight-memory.