Skip to main content

dsh-memento

59Stars1Forks0Issues0Watchers

Add bounded, hierarchical, approval-gated, auditable cross-session memory to DeepSeek Harness: local

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
Apache-2.0
Branch
main
agent-memoryapprovalauditcordisdeepseek-harnessdshdsh-pluginllm

Install

cmdweb profile
$ dsh plugin --profile web add dsh-memento

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin PerryLink/dsh-memento for me: review the repository at https://github.com/PerryLink/dsh-memento first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

dsh-memento is a cross-session memory capability seam plugin for DeepSeek Harness. It treats memory as a typed service (ctx.memory), allowing DSH to automatically inject past preferences and project conventions into the system prompt each time a new session starts, and enforces human approval gates before every write.

Core Capabilities

  • Add, rewrite, delete, consolidate, or retrieve memory entries within sessions via the memory tool; all write paths go through a unified approval gate
  • During the first prompt assembly of each session, freeze a snapshot of current memories and inject it into systemPrompt; the snapshot doesn't change within the session
  • Every write is logged (including rejected cases), and approval pairs write the full payload to session logs for later reconstruction
  • Maintains two tracks (user / agent) × two layers (user-global / workspace) × agent-isolated memory spaces, with hard character budgets to prevent overflow
  • Connects third-party memory formats (mem0, Hermes memory.md, CLAUDE.md) through the ctx.memoryAdapters registry; import/export both go through approval
  • Auto-generates pending memory proposals after session compression succeeds; require user confirmation before landing

Technical Implementation

  • Language: JavaScript (pure ESM, .mjs; no TypeScript compilation step, type contracts provided via .d.ts)
  • Key Dependencies: @deepseek-ai/cordis, @deepseek-ai/dsh-tools, @deepseek-ai/dsh-session, node:sqlite (Node built-in SQLite synchronous driver)
  • Architecture Pattern: Three-role seam — Service Definition (ctx.memory, MemoryService in index.mjs) + Provider (lib/store.mjs local SQLite, WAL mode, permissions 0600) + Consumer (memory tool + systemPrompt.section frozen snapshot); integrated into host via inject: ['tools', 'systemPrompt', 'approval'], when disabled (enabled:false) the entire capability disappears
  • Entry File: index.mjs (the only file the plugin exposes to the host, lib/ maintains zero DSH dependencies)

Use Cases

When you want DSH to remember user preferences across sessions (language, style, landmines), project conventions (build commands, directory structure), and lessons learned, but don't want the model to quietly stuff things into the system prompt—this plugin provides a "approve first, land later, auditable" workflow. It's especially suitable for developers and teams maintaining the same project long-term—the next time you open DSH, you won't need to repeat the background, all context is ready by layer.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
DeepSeek Harness0.1.0-rc.6+Declared in package.json#dshWorkshop.compatibility.dshVersions
Node^22.19.0 || >=24.0.0package.json#engines.node
PlatformCross-platformWindows / macOS / Linux, zero native code compilation
Native Modulenode:sqliteNode built-in SQLite synchronous driver, zero external native dependencies
Peer Dependencies@deepseek-ai/cordis ^4.0.1, @deepseek-ai/dsh-tools >=0.1.0-rc.6, @deepseek-ai/dsh-session >=0.1.0-rc.6, @deepseek-ai/schemastery >=3.0.0Provided by host

Installation

dsh plugin --profile web add github:PerryLink/dsh-memento

Configuration Options

ConfigTypeDescriptionDefault
enabledBooleanMaster switch; when set to false, tools, injection, service, and approval answerer all disappeartrue
dbPathStringAbsolute path to memory database file; empty uses $DSH_HOME/dsh-memento/memory.db (falls back to ~/.dsh on Windows when $DSH_HOME is missing)''
budgets.user.userGlobalNumberHard character budget for "global" layer of user-related facts2000
budgets.user.workspaceNumberHard character budget for "workspace" layer of user-related facts2000
budgets.agent.userGlobalNumberHard character budget for "global" layer of environment/project facts4000
budgets.agent.workspaceNumberHard character budget for "workspace" layer of environment/project facts4000
writePolicyask | auto | offGlobal write approval policy (invisible and unmodifiable by model)ask
writePoliciesDictionaryGranular write policy, keys can be track/scope or source:<name>{}
languageen | zhLanguage for snapshot text, /memory commands, tool descriptions, and panelsen
snapshotOrderNumberOrder of snapshot section in systemPrompt (smaller values appear earlier)-50
maxEntriesPerQueryNumberUpper limit for single memory query default return (Provider hard-capped at 1000)20
commandListLimitNumberNumber of entries rendered per /memory list / query50
commandAuditLimitNumberNumber of audit rows rendered per /memory audit10
recall.historyLimitDefaultNumberDefault number of historical sessions scanned by memory_recall tool8
recall.snippetCapNumberUpper limit of history snippets returned per session5
recall.snippetCharsNumberCharacter limit per snippet300
recall.windowDaysNumberDays to look back for history snippets30
panelEntriesLimitNumberWeb panel entry pagination size200
panelAuditLimitNumberWeb panel audit default row count20
auditRetentionDaysNumberDays to retain audit rows, 0 means permanent0
proposals.enabledBooleanWhether to auto-generate pending proposals after session compressiontrue
proposals.maxCharsNumberCharacter limit per proposal2000
proposals.maxPendingNumberUpper limit for pending proposals8

FAQ

Q: What happens when the budget is full? Does it auto-compress?

A: It doesn't auto-compress. Exceeding the budget throws a structured BUDGET_EXCEEDED error (carrying current usage and limit). Please use consolidate to merge multiple entries, or remove to delete unnecessary entries, then retry writing. The Provider layer never silently truncates.

Q: Can the model bypass write approval?

A: No. The approval gate is implemented inside the write methods of the ctx.memory service (MemoryProtocolCore), not at the tool layer. Any path (memory tool, /memory command, future plugins) calling add/replace/remove/seed must go through ctx.approval.request; writePolicy is a model-invisible configuration.

Q: Where is memory data stored? Is it uploaded to the network?

A: Stored by default in $DSH_HOME/dsh-memento/memory.db, POSIX permissions 0600, pure local SQLite. The plugin manifest explicitly declares network:none / credentials:none, and the entire lifecycle makes no network requests.

Q: Does uninstalling the plugin lose memory data?

A: No data loss. dsh plugin --profile web remove dsh-memento only uninstalls the plugin; the SQLite database and session logs are preserved. The plugin also never appends unregistered event types to session logs, so old sessions can load normally.

Q: If memory is modified mid-session, does the model's snapshot update immediately?

A: No. The snapshot is frozen once during the first systemPrompt assembly of each session; mid-session writes only land to disk and log, they don't rewrite to the already-injected system section—this stabilizes prefix caching and is part of "what the model sees is rebuildable from session logs."

Q: Does it support substring search for Chinese (CJK) memory entries?

A: Yes. Retrieval uses case-insensitive instr instead of FTS5, because SQLite's built-in tokenizer isn't friendly to single-character CJK indexing; instr is naturally correct for Chinese scenarios with zero plugin dependencies.

Q: What happens when two DSH processes under the same $DSH_HOME write simultaneously?

A: SQLite serializes writes within a single process via busy_timeout; cross-process consistency isn't guaranteed—first writer wins. This is inherent to SQLite file sharing behavior, consistent with official warnings from Hermes and similar terminal memories.

Q: What's the relationship with the officially recommended MCP memory server?

A: They can coexist. dsh-memento is DSH's native local first-party implementation (zero network, no external process dependency); MCP memory is the external server route recommended in official documentation; both target the same goal, are non-exclusive, and users can choose either or enable both based on the scenario.

Learning Curve

Advanced — Many configuration options (budgets, approval policies, adapters), but default config works out of the box; advanced users need to understand the "track × layer × agent isolation" model and approval waterfall to tune the most fitting policy.

Known Issues & Limitations

  • rc.6 session events not actually emitted: The plugin declares five SessionEventMap vocabulary types (memory/added|updated|removed|recalled|snapshot) merged in types.d.ts, but DSH 0.1.0-rc.6 lacks plugin event registration surface; runtime doesn't append by default; audit chain is handled by approval pairs' approval/asked + approval/decided and the plugin's own audit table, will auto-enable once harness includes memory/*.
  • ask policy requires a human answerer: When the profile doesn't configure a UI/ACP-style approval answerer, writes under ask policy fail closed; for unattended writes, change to auto or explicitly use off to disable entirely.
  • No FTS5 index: Retrieval uses instr substring matching (case-insensitive, CJK-friendly); in large data scenarios, query efficiency is lower than full-text search—use limit parameter to narrow the scope.
  • Race conditions when sharing same $DSH_HOME across processes: SQLite file locks guarantee serialization within a single process, but cross-process consistency isn't guaranteed; multiple terminals editing the same directory simultaneously need external coordination.

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/PerryLink/dsh-memento)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory