dsh-memory-relay
alertxsto/dsh-memory-relay
File-backed persistent agent memory with revision-fenced editors, owner approval for corrections and skills, and an opt-in review.
Instalar
dsh plugin --profile web add github:alertxsto/dsh-memory-relayREADME
DSH Memory Relay
Persistent, file-backed memory for DeepSeek Harness (dsh), plus an optional background review that can propose memory corrections and skills for your approval.
Memory is two plain Markdown files per profile. A live Agent reads a frozen snapshot at its first prompt assembly and can write through one native memory tool. Everything else — approval queue, review, skill proposals — is owner-controlled in Settings → Memory.
- Local by default. No network calls, no telemetry, no database.
- Bounded. Per-store character caps, entry validation, and a heuristic secret scanner.
- Opt-in egress. Review makes no model call, and sends nothing, until you enable it and give consent.
- Owner approval. Corrections and every skill change stage as an exact diff; nothing is rewritten silently.
Requirements
dsh0.2.2-rc.5 is the tested host. Newer or older hosts are unverified.- A POSIX host and a private
0700storage directory owned by you. If the plugin cannot establish that, it registers no tool, prompt section, or Settings section and logs one warning. - Node.js 24 for building from source.
Install
Not yet published to npm. Install from the GitHub release tarball, or build a local tarball from this checkout. Either way the yaml dependency resolves through your configured package registry (or an offline cache).
dsh --profile memory-try --from-default-profile web --dump-config
dsh plugin --profile memory-try add https://github.com/alertxsto/dsh-memory-relay/releases/download/v1.0.0/alertxsto-dsh-memory-relay-1.0.0.tgz
dsh --profile memory-try --host 127.0.0.1 --port 0 --no-open
To install from source instead:
npm install && npm run build
mkdir -p .scratch/pack
npm_config_cache=.scratch/npm-cache npm pack --pack-destination .scratch/pack
dsh plugin --profile memory-try add "file:$PWD/.scratch/pack/alertxsto-dsh-memory-relay-1.0.0.tgz"
Open the loopback URL the first block prints, enable DSH Memory Relay under Settings → Plugins, then open Settings → Memory.
To install into the profile you already use, replace memory-try with that profile name and restart it. Installing into a live profile changes what runs on your next session; memory files stay on disk if you uninstall.
Remove it with:
dsh plugin --profile memory-try remove @alertxsto/dsh-memory-relay
Uninstalling removes the tool, prompt section, routes, Settings section, and toast. It does not delete USER.md, MEMORY.md, staged records, review.jsonl, notify.json, or committed skills.
Quick start
- Open Settings → Memory → Agent memory, type a fact, and press Save. The resolved storage path is shown on the page.
- In a new session, the agent sees that memory in its prompt and can quote it.
- Ask the agent to remember something — for example “remember that this repo uses pnpm” — and it writes through the
memorytool. - Review staged changes in Pending; open a row to see the exact before/after before approving.
The current live Agent keeps its prompt snapshot. Edits and new entries appear in the next session, a reopened session, or the next plugin reload.
How it works
flowchart LR
A[Agent turn] -->|memory tool| B[USER.md / MEMORY.md]
B -->|first prompt assembly| C[Frozen snapshot]
C --> D[Next session or reload]
E[Settings editor] -->|revision-fenced save| B
F[Opt-in review] -->|add-only applies<br/>corrections stage| B
Memory is resolved per profile. Two profiles in one DSH home have separate files and separate roots; skills live in the DSH home and are shared across profiles.
Settings tabs
| Tab | What it does |
|---|---|
| Profile | Edits USER.md, owner notes loaded by new live sessions. |
| Agent memory | Edits MEMORY.md, the agent-curated store, and shows usage against its character cap. |
| Pending | Owner queue for staged memory corrections and skill proposals, with exact diffs. |
| Review | Opt-in background review: route, mode, consent, limits, recent outcomes, and Run review now. |
Every editor save is fenced by the revision it started from. If the file changed elsewhere, the save is refused and you can reload; the editor never silently overwrites a newer revision.
Approval and opt-ins
| Setting | Default | Effect |
|---|---|---|
writeApproval | off | When on, foreground tool writes and add-only review writes stage instead of committing. Corrections/removals always stage. |
| Review | off | No digest is collected and no model is called until you enable it, choose a route, and confirm consent. |
| Skill proposals | off | Reviewed create/update proposals are always staged for approval, even when enabled. |
With writeApproval off, an agent's ordinary add writes commit immediately and enter later sessions' prompts. Turn it on before relying on approval for foreground writes.
Open a Pending row to see the exact bytes that will be written. Approve applies that diff; Reject discards the record. A conflict (file changed, skill lock, shadowed name) refuses the decision and keeps the record for inspection.
Self-improvement review (opt-in)
Review runs outside the conversation, after a completed turn, and never inside the turn. It is off by default and makes no call until you configure it.
- Manual mode collects eligible turns and waits for Run review now. Automatic also queues them as turns close, subject to
reviewCooldownTurns. - The route is explicit: provider and model, with no fallback to the foreground model. Changing it cancels queued and active reviews and requires fresh consent.
- Only root, completed turns with enough human text are eligible. Tool calls, reasoning, attachments, system/developer text, and excluded sessions are never sent.
- A review applies add-only memory changes directly when
writeApprovalis off. Corrections, removals, and every skill proposal are staged. review.jsonlrecords session IDs, route, durations, and counts — never free text. The recent-outcome list and eligible turns live in the Host process and reset on restart.- The security scanner and redaction are heuristic. They reduce obvious secrets; they are not a guarantee.
Read the full outbound-data list, caps, and failure behavior in docs/DETAIL.md.
Privacy and local data
By default nothing leaves your machine except the prompts your own sessions already send.
- Memory files, pending records,
review.jsonl, andnotify.jsonlive under the resolved storage root shown in Settings. - Skills are written under the DSH home's skills root, shared with other profiles using that home, and created with private
0700/0600permissions. - Enabling review sends a bounded, redacted digest and filtered memory entries to the provider you name; with skill proposals enabled it also sends skill names and descriptions, and the current
SKILL.mdfor an update. That provider processes and may retain them under its own terms; the plugin cannot withdraw data already received. - Session search is not part of this plugin. Install the official
@deepseek-ai/dsh-experimental-session-searchplugin if you want recall over past sessions.
Limits
- Memory is per profile; skills are shared within one DSH home.
- Only cooperating in-process writers are serialized. An external editor or another DSH instance can change files; the plugin reports a conflict instead of overwriting.
- If a rename succeeds but the following directory sync fails, storage reports an ambiguous durability failure. Reconcile, do not blindly retry.
- The scanner is heuristic, not a sandbox.
- Review history and eligible turns are process-local. Toast detail is not verified; Windows file replacement is not verified.
- Tests and acceptance use disposable homes on loopback only; they never modify the active profile.
See docs/DETAIL.md for behavior, privacy, and known gaps, and docs/DELIVERY.md for the latest test evidence and unverified surfaces.
Development
npm install
npm run build # bundles src/client/index.jsx to lib/client.js; never edit lib/client.js by hand
npm run check # syntax and ModuleLoader envelope checks
npm test # unit and integration tests
The browser artifact is a CommonJS factory wrapped in window.__ModuleLoader__.load; React and react/jsx-runtime stay external. Disposable Host gates live in test/fixtures/ (check-m*.mjs) and run against loopback DSH homes, never the active profile.
Source layout:
| Path | Contents |
|---|---|
lib/core/ | Storage, canonical text, matching, validation, pending records, skills. |
lib/host/ | Native tool, prompt section, owner routes, review, notifications. |
src/client/ | Settings section and review toast. |
locale/ | English and Chinese UI strings. |