Skip to main content

dsh-task-memory

6Stars0Forks0Issues0Watchers

Provides task-isolated long-term memory for DeepSeek Harness: each task's memory is stored separately, with memory read, write, retrieval, and prompt injection only effective within the current task.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki

Install

cmdweb profile
$ dsh plugin --profile web add github:wangyihao0001-oss/dsh-task-memory

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 wangyihao0001-oss/dsh-task-memory for me: review the repository at https://github.com/wangyihao0001-oss/dsh-task-memory 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 Positioning

Provides task-isolated long-term memory for DeepSeek Harness: each task gets an independent vault, with memory write, read, retrieval, and prompt injection all scoped within the current task boundary, preventing memory leakage across different projects.

Core Capabilities

  • Per-task storage: Each task maintains an independent vault under ~/.dsh/storages/task-memory/<task-id>.json, with memory never automatically leaking across tasks
  • 8 memory tools: Models can fully manage memory via memory_bind_task / memory_remember / memory_recall / memory_search / memory_forget / memory_current_task / memory_list_tasks / memory_clear_task
  • Automatic default task derivation: When unbound, generates a stable task ID from the session's working directory (cwd) hash, enabling "directory isolation" without manual configuration
  • Session-scoped prompt injection: Each agent's system prompt only injects memory from that session's task, prioritizing pinned entries then recent entries, constrained by character budget
  • Capacity and concurrency safety: Vault capacity is configurable; pinned entries are never evicted; explicit error on new key overflow instead of silent dropping; same-task writes serialized via in-process async lock
  • Atomic writes and crash recovery: Each save uses "temp file + atomic rename"; cleans up crash residual tmp files older than 1 hour on startup

Technical Implementation

  • Language: TypeScript (src/index.ts / src/store.ts / src/search.ts, compiled to lib/index.js, type: module ESM)
  • Key dependencies: Host peer dependencies @deepseek-ai/cordis ^4.0.1, @deepseek-ai/dsh-agent ^0.1.0-rc.8, @deepseek-ai/dsh-tools ^0.1.0-rc.6, @deepseek-ai/dsh-system-prompt ^0.1.0-rc.6, @deepseek-ai/dsh-home-paths ^0.1.0-rc.6, @deepseek-ai/schemastery ^3.18.1; runtime only uses Node built-ins node:fs/promises / node:path / node:crypto
  • Architecture pattern: Cordis single-side plugin — export const name = 'task-memory', export const inject = ['tools', 'systemPrompt']; via dsh.bundle.patch pointing to cordis.patch.yml to inject into host layer, registering 8 tools + 1 fixed systemPrompt section + 1 agent-scoped systemPrompt.context
  • Entry file: src/index.ts (exports apply(ctx, config), completing tool registration, prompt injection, session-task binding cleanup, tmp cleanup, and default task cache warmup)

Use Cases

Users maintaining multiple projects in the same DSH (frontend + backend + experiment scripts), using DSH as a long-term R&D assistant, and不希望模型把 A 项目的技术栈约定误用到 B 项目. Pain point is most DSH memory plugins are either globally shared or workspace-based, unfriendly to people running multiple parallel tasks in the same working tree; this plugin uses task as the boundary, with a side benefit solving "session-level prompt pollution" — each agent session's system prompt only sees its own task's memory.

Prerequisites & Compatibility

DependencyMin VersionDescription
DeepSeek Harness (DSH)>= 0.1.0-rc.8Determined by @deepseek-ai/dsh-agent ^0.1.0-rc.8 in package.json#peerDependencies; other dsh-* peers are ^0.1.0-rc.6
Node.js>= 20Declared in package.json#engines.node
@deepseek-ai/cordis^4.0.1Peer dependency, provided by host DSH
@deepseek-ai/dsh-tools^0.1.0-rc.6Peer dependency, wraps defineTool to help register 8 tools
@deepseek-ai/dsh-system-prompt^0.1.0-rc.6Peer dependency, provides systemPrompt.section / systemPrompt.context injection points
@deepseek-ai/dsh-home-paths^0.1.0-rc.6Peer dependency, used to resolve resolveDshHome() to get ~/.dsh
@deepseek-ai/schemastery^3.18.1Peer dependency, validates Config with schema
PlatformCross-platformOnly depends on Node.js built-ins fs / path / crypto, no native modules
Native modulesNoneAll uses Node built-in APIs, no node-gyp compilation artifacts
Installation profileweb (or any profile that loads Host tools)cordis.patch.yml injected into host's tools and system prompt layer

Installation

dsh plugin --profile web add github:wangyihao0001-oss/dsh-task-memory

Configuration Options

Configuration is in the config field of cordis.patch.yml, Schema validated by Config in src/index.ts, all fields have defaults and can run with zero config:

ConfigTypeDescriptionDefault
injectLimitnumberMax number of memory entries injected into current task's system prompt8
injectMaxCharsnumberSoft character budget for entire injection block (stops adding new entries when exceeded)2400
injectMaxEntryCharsnumberCharacter limit per single memory entry in injection block (truncates if exceeded)400
injectPromptbooleanWhether to inject pinned/recent facts for current task (per agent scope)true
maxEntriesnumber (>= 1)Entry limit per vault; evicts oldest non-pinned entries when exceeded500
storageRootstringOptional, overrides default storage root ~/.dsh/storages/task-memory"" (empty string uses default)

Restart dsh web (or restart profile) after modification for Cordis to reload.

FAQ

Q: Will memory files remain after uninstalling the plugin?

A: Yes. Memory is stored as plain JSON in ~/.dsh/storages/task-memory/<task-id>.json; removing the bundle from profile does not delete these files; manual backup or deletion of the directory is needed for complete cleanup.

Q: Will injected prompts cross-task contaminate?

A: No. Injection is registered per agent scope (agent.ctx.systemPrompt.context), each session's system prompt only contains memory from its own task; memory from other tasks, sessions, or agents is never visible.

Q: Does keyword search support Chinese?

A: Yes. Search does English tokenization + Chinese bigram (adjacent two-character combination) matching (see src/search.ts#tokenize), but it's still lexical matching, no vector search or semantic similarity.

Q: What happens when vault is full and a new key is written?

A: Write fails with a clear error (prompting to forget or unpin some entries), never silently drops the just-written fact; however, in-place updates (upsert) to existing keys won't be rejected due to capacity, and will try to shrink non-pinned entries.

Q: Do I need to manually specify taskId?

A: Not by default: when unbound, a stable task ID is generated from the session's working directory (cwd) hash. When running multiple projects simultaneously, call memory_bind_task to explicitly switch.

Q: How to pin a version in production?

A: Append 40-digit commit SHA to the package name during installation, e.g., dsh plugin --profile web add "github:wangyihao0001-oss/dsh-task-memory#<sha>", to avoid upstream updates being auto-pulled.

Q: Do I need to restart DSH after upgrade/uninstall?

A: Yes. The plugin injects into host's Cordis layer via cordis.patch.yml; after installation or removal, must restart dsh web (or restart profile) for Cordis to reload.

Q: Can I write sensitive information into memory?

A: Not recommended. Both README and the 8 tool descriptions explicitly warn against writing keys, tokens, or personal privacy; vault is plain JSON, backups or manual edits will also be persisted to disk.

Getting Started Difficulty

Beginner — after installation, no configuration needed to get "automatic per-cwd task separation + 8 memory tools + prompt injection" capability; all preferences can be adjusted via the config field in cordis.patch.yml as needed.

Known Issues & Limitations

  • Search is lexical matching: English tokens + Chinese bigrams, no vector search or semantic similarity (src/search.ts:8-50)
  • No Web UI for browsing vault: Currently a Host-only combo package, vault can only be managed via tools or direct JSON file editing
  • Isolation boundary only applies to this plugin's task id: Does not sandbox other DSH plugins or workspaces themselves
  • Conservative tmp cleanup: On startup only cleans crash residual tmp files > 1 hour old, to avoid accidentally deleting in-progress writes from other processes (src/store.ts:189-208) — the trade-off is tmp files within 1 hour persist until next startup
  • Uninstall does not delete data: Removing from profile does not clear ~/.dsh/storages/task-memory/, manual backup or cleanup required
  • Capacity limit is transparent for existing keys but strict for new keys: When vault is full and only pinned entries can be evicted, new key writes fail (to avoid "just written but immediately evicted" silent loss), need to first forget or unpin
  • Same-task writes use in-process lock: Not cross-process/machine mutually exclusive, vault files can be manually copied but concurrent writes need manual coordination
  • Tool descriptions consume context: Descriptions of 8 tools like memory_bind_task / memory_search are loaded into model context with tool list, frequent task switching or parallel multi-tasking can consume significant token budget

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/wangyihao0001-oss/dsh-task-memory)

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