Agents in DeepSeek Harness start from scratch in every session: pitfalls encountered in previous rounds, preferences explicitly stated by the user, and validated effective methods are all lost. Stuffing long-term memory into AGENTS.md leads to unbounded growth and eventually drowns in noise.
This plugin provides a maintainable memory channel—writes are tiered by source and credibility, reads are weighted by importance and freshness, and when capacity is insufficient, entries are evicted by score rather than silently truncated.
Core Features¶
The plugin manages the Agent’s long-term memory and experience consolidation through tiering and weighting mechanisms.
- Memory mechanism: Supports cross-session memory and workspace-scoped storage; memory is classified into five types:
fact,preference,lesson,resource, andmethod. Reads are weighted by importance, freshness, and hit count. - Governance and security: Provides memory governance, supports dual-temporal invalidation (mark rather than delete), automatic merge and deduplication, and line-level eviction when limits are exceeded; includes built-in poisoning protection, isolates imperative statements during writes, and performs secondary detection during injection; memory injection is delivered through the system prompt with zero context cost.
- Reflection and evolution: Supports immediate after-error reflection, session-end reflection, and sleep-phase consolidation. Reflection outputs can be consolidated into an SOP skill library (real skills with progressive disclosure) or improvement proposals, forming a closed loop.
- Reliability: Provides loss-preventing durable persistence, incremental snapshots during runtime, and automatic recovery after process restart; supports session handoff and automatically handles unfinished sessions.
Installation¶
Install as a DSH profile plugin:
dsh plugin add /path/to/dsh-self-improvement
Place this directory under ~/.dsh/plugins-src/, and register it into the profile layer stack via cordis.patch.yml. After installation, restart dsh web (or the corresponding profile process) to activate it.
Usage¶
After the plugin loads, it starts working automatically and usually requires no additional action. Common entry points are as follows:
- State preferences directly in conversation: The model calls the
remembertool to record them. /selfip: View the current experience scope and configuration file location./selfip scope both: Switch the experience reuse scope./memory <keyword>: Search memories./forget <keyword>: Invalidate matching entries (mark them as invalid while preserving history)./retro: Immediately perform a reflection for the current session./promote: Manually promote generic entries to the global store./proposals: Review or process pending improvement proposals.
Configuration and Scope¶
Memories are by default stored in separate databases by workspace. To reuse experience across workspaces, change scope:
workspace(default): Read and write only the current workspace store; experience does not cross workspaces.global: Write uniformly to the global store; all workspaces share the same experience.both: Continue accumulating in the current workspace, also read from the global store, and at session end promote generic entries to the global store.
Configuration source precedence: environment variables > workspace configuration > global configuration > defaults.
Configuration file locations:
* Global configuration: ${DSH_HOME}/self-improvement/config.json
* Workspace configuration: <workspace>/self-improvement/config.json
After changes, no restart is required; they take effect on the next memory refresh.
Promotion rules: Automatic promotion is conservative to avoid broadcasting one workspace’s bias to all workspaces. Only entries sourced from user/agent or without a source marker are promoted; workspaces under system temporary directories do not participate in broadcasting; entries are selected by importance + freshness + hit count, with at most 3 promotions per session end, and entries below 10 points are not promoted.
Tools¶
The plugin provides the following tools for model invocation:
remember: Record a persistent fact/preference/lesson.memory_search: Search memories by keyword.playbook_use: Record the usage result of an SOP, used to track success rate.selfip_proposal: View or process improvement proposals pending user confirmation.selfip_config: View or set the experience reuse scope.selfip_status: Plugin self-diagnosis (memory store status per workspace, sandbox policy, write/read errors, and run counts).
Data Location¶
Memory and configuration files are stored in the following directory:
<工作区>/self-improvement/
config.json 本工作区配置
memory/ 记忆(facts / lessons / methods / resources / principles / hypotheses)
quarantine/ 被隔离的可疑内容
logs/ 会话日志、快照、交接简报、待复盘队列、自诊断状态
playbooks/ SOP(带使用统计与 front-matter)
proposals/ 改进提案与状态
The global store has the same directory structure.
Use Cases¶
- DSH Agent development that requires maintaining context across sessions.
- Long-running scenarios that require automatic consolidation and reuse of experience and SOPs.
- Complex applications that require secure governance and memory management.
Note: The plugin runs with the permissions of the current dsh process. Review the source code and license before installation.