Lightweight cross-session memory plugin for DeepSeek Harness: approval-gated `memory` tool (save/recall/list/forget) + Settings card UI to browse, add, delete (two-click, trash/restore) and idempotent import/export. | DeepSeek Harness 跨会话记忆插件:审批门控 memory 工具 + 设置页UI「记忆库」卡片(查看/新增/删除、两击确认、回收站恢复、导入/导出记忆——幂等迁移、冲突拒绝)。
在 DeepSeek Harness 终端运行:
dsh plugin --profile web add pacoyi/dsh-memory-liteLightweight cross-session memory for DeepSeek Harness — one memory tool (save / recall / list / forget) plus a Settings "记忆库" card with an import wizard and export panel, scope isolation, approval-gated writes, and an audited, crash-safe store.
English | 中文
A dsh session starts with a blank slate: the transcript lives on disk for audit, but the model never sees it again. This plugin gives the agent a small, explicit memory tool so durable facts — user preferences, project decisions, key constraints — survive restarts, upgrades, and profile changes.
Design goals, in order:
@deepseek-ai/cordis, @deepseek-ai/dsh-tools).~/.dsh/memory-lite.json. Open it, edit it, back it up, delete it. No database, no index.Requires the dsh CLI. Install into a profile (e.g. web):
dsh plugin --profile web add github:pacoyi/dsh-memory-lite
Or from a local checkout:
git clone https://github.com/pacoyi/dsh-memory-lite.git
dsh plugin --profile web add file:./dsh-memory-lite
Restart the profile (dsh --profile web) and the memory tool is live.
The store file is local. The recalled content is not local-only.
recall and list results are normal tool results: they enter the model-visible conversation surface, are sent to your configured model provider on the next model step, and are persisted into the Session log like any other tool output.recall / list / forget see only the current project scope plus entries explicitly saved as global — one project cannot read or delete another project's entries.save and forget request host approval (tools/pre-execute → ask). In the web profile this shows the standard approval card; a deployment without an approval channel denies both operations (fail closed).pending intent line is written before the atomic store publish, a committed line after. If the process dies in between, the next startup's reconciliation closes the orphaned intent into an explicit reconciled-applied / reconciled-orphan record — the audit trail can detect and name a crash window instead of silently missing it.~/.dsh/.memory-lite.audit.jsonl: timestamp, operation, store revision, phase, entry id, scope, source (agent / user / import), outcome.forget moves entries to a trash list (restorable from the Settings card); permanent deletion is a separate, confirmed action.mkdir + PID liveness + stale takeover), so two hosts sharing one OS home lose no writes..memory-lite.bak and a best-effort directory fsync..memory-lite.corrupt.json) and all mutations fail closed — corruption never silently downgrades to an empty store and overwrites your only copy.Just talk to the agent — it decides when to save and recall (and the approval card asks you first):
"记住:这个项目用 pnpm,不要用 npm"
"我之前跟你说过什么关于部署的事?"
The tool schema it uses:
| Param | Applies to | Description |
|---|---|---|
operation |
all | save | recall | list | forget |
text |
save | The note to remember — self-contained, specific, ≤ 2000 chars |
tags |
save | Optional tags, e.g. ["preference", "project-x"] |
query |
recall | Keyword, matched case-insensitively against text and tags |
tag |
recall | Match entries carrying this exact tag |
limit |
list/recall | Max entries to return (default 10, max 100) |
id |
forget | The entry id to move to trash |
The Settings card ships a three-step wizard for migrating curated memories from other coding agents (Claude Code CLAUDE.md, Codex AGENTS.md, or any pasted text):
~/.claude/CLAUDE.md, ~/.codex/AGENTS.md) are probed automatically, or paste anything. Choose the destination scope.Re-runs are idempotent and conflict-aware: each entry carries provenance (source path + document/item digests). Re-importing an unchanged source skips already-imported items; importing the same path after the source changed is refused with a conflict report — curated facts are never silently overwritten or duplicated.
The same card carries an export panel: render the live entries (whole store or one scope) as a plain markdown list — content and tags only, no ids or timestamps — and copy it to the clipboard. The output pastes cleanly into another agent's memory file, and re-importing it here is a no-op: content digests make export → import round-trips idempotent for every entry, whatever its source (agent, manual, or imported).
The web client ships a "记忆库" card in Settings: entries grouped by scope with source and timestamps, two-click delete confirmation, a trash view with restore / permanent-delete, and the import wizard and export panel above. Everything the card can do, editing ~/.dsh/memory-lite.json directly can also do — but only while the host is stopped, since the plugin owns concurrent writes.
This is a "two-half" dsh plugin:
index.js — the agent half: registers the memory tool, the approval gate, the import-wizard pure helpers (parse / rule-like classification / batch classification), and the browser RPC bridge.storage.js — the storage engine: locking, atomic publish, two-phase audit + startup reconciliation, quarantine, budgets, dedup, batch import.client.js — the web half: lazy-loaded by the browser module loader, renders the Settings card with host-provided React.cordis.patch.yml — the bundle layer that inserts the plugin row.package.json — declares dsh.bundle (patch) and dsh.client (inject list) under the dsh key.SPEC.md — maintainer spec: requirements, security-contract traceability, design decisions, version history (Chinese).Run the contract tests (concurrency, crash safety, audit reconciliation, corruption, budgets, scope isolation, import/export round-trip idempotency — zero dependencies, node:test) plus a client.js render smoke suite (structure assertions for every card surface against a hook-mocked React — the layer RPC tests cannot see, where a stray ) once swallowed the import result step without failing any syntax check):
npm test
For the fastest loop, install your working copy into a profile via file: (as above) — edits take effect on profile restart.
MIT © pacoyi
登录后即可为该插件评分和评价。
还没有人评价这个插件,来抢个沙发吧!