Background memory consolidation (auto dream) for DeepSeek Harness: periodically reviews recent sessions and existing memories to dedupe, refresh stale entries, remove contradictions and rebuild the MEMORY.md index, with hybrid/volume auto triggers, /dream command and a settings-panel config card.
Install
# from a prebuilt release tarball
dsh plugin --profile web add -w "https://github.com/yihefeikong-rgb/dsh-cc-haha-dream/releases/download/v0.1.0/dsh-dream-0.1.0.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:yihefeikong-rgb/dsh-cc-haha-dream
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
DSH 自动做梦插件:后台定期回顾近期会话与已有记忆,整合去重、更新过时、删除矛盾、修剪重建索引。
复刻 CC-HAHA 的 autoDream(后台记忆整合)行为,
与已安装的 dsh-memory 并存——dsh-memory 负责"随手记"(extractMemories),dsh-dream 负责"睡前整理"。
[!IMPORTANT] 本项目不是 CC-HAHA 官方组件,也不隶属于 CC-HAHA 或 DeepSeek。自动做梦的 门控链与整合流程参考 CC-HAHA(见 THIRD_PARTY_NOTICES.md), 插件代码使用 DSH 原生能力(会话查询、子代理、命令、工具、设置)独立实现。
[!IMPORTANT] 独立插件,不修改 dsh-memory;与它共享同一个
~/.dsh/memory/目录,文件格式与MEMORY.md索引完全兼容。
功能
- 自动定时:默认 24 小时 + 积累 5 个会话后,后台静默执行一次记忆整合(五重门控,不阻塞对话)。
从未做过梦(没有
.dream-lock)时不会冷启动即触发:启动后的首次检查只把锁盖成"当前时刻", 从此刻开始计minHours,之后的判断仍走原有门控。 - 手动触发:
/dream命令,或 agent 调用memory_dream工具,立即整合一次(任何时候都可手动触发,不受上面的冷启动守卫影响)。 - 整合内容(对齐 CC-HAHA autoDream 4 阶段,执行用 fork 子代理):
- 插件 fork 一个子代理(模型路由见下;可用
provider/model/maxTokens覆盖) - 子代理按 4 阶段提示词(定向 → 收集近期信号 → 整合 → 修剪索引)输出动作 JSON
- 插件在 host 侧安全落盘:合并重复(
merge/update)、修正过时/删除矛盾(delete)、 从近期会话提炼新记忆(create)、重建MEMORY.md索引(按## <项目>→### <类型>分节, 与 dsh-memory 的输出逐字节一致)
- 插件 fork 一个子代理(模型路由见下;可用
- 安全:所有写操作限制在记忆目录内;动作整批预检通过后才开始写入;删除/覆盖前自动存
.history/历史版本, 索引在原子覆盖前也会快照到.history/_index/(保留最近 20 份);LLM 输出严格 JSON 校验;.dream-lock防并发。
安装
dsh plugin --profile web add C:\Users\huangxinyang\.dsh\plugins\dsh-dream
# 或从源码目录:
dsh plugin --profile web add D:\claude\...\dsh-dream
安装后重启 DSH:
dsh web
配置
有两种方式,效果一致(设置面板写入的是用户层,覆盖 patch 默认值;applies: restart,重启后生效):
- 设置面板(推荐):打开 DSH 设置 → 插件 → 插件配置 选项卡 → 自动做梦 卡片,直接编辑并保存。
卡片字段含说明与"已覆盖/恢复默认"标记;保存后写入
~/.dsh/settings.yaml的dsh-dream:段。 - patch 文件:编辑
cordis.patch.yml的默认配置。
| 选项 | 默认 | 说明 |
|---|---|---|
enabled |
true | 后台自动做梦总开关 |
minHours |
24 | 距上次整合最小间隔(小时) |
minSessions |
5 | 距上次整合后最少新会话数 |
triggerMode |
hybrid | hybrid=时间或内容量先到先触发 / gates=仅固定间隔 / volume=仅按内容量 |
minVolumeChars |
30000 | 内容量触发阈值(近期待整合会话文本估算字符数) |
scanIntervalMinutes |
10 | 后台门控检查间隔(分钟) |
scopes |
auto | auto=近期活跃项目+通用 / all=全部 / current=当前项目+通用 |
maxDigestChars |
60000 | 近期会话摘要上限(字符) |
maxMemoryChars |
80000 | 记忆正文参考上限(字符) |
maxTokens |
8192 | 子代理整合输出上限;0=不传,由宿主/模型决定 |
agentTimeoutMs |
900000 | 做梦子代理总超时(毫秒) |
agentTools |
[](= read/grep/glob) |
做梦子代理可用的只读工具;宿主不支持时自动退回零工具 |
provider / model |
huoshang / deepseek-v4-flash-ga-260731 |
由 cordis.patch.yml 固定走火山(用户偏好,勿继承官方 deepseek-official);在设置面板清空则回退为"继承会话模型" |
manualOnly |
false | true=只允许手动/工具触发 |
storageDir |
~/.dsh/memory |
记忆存储目录(与 dsh-memory 共享) |
设置卡片属于插件浏览器端(client bundle)。新增或更新设置卡片后需重启 DSH, 让宿主重新扫描插件的
dsh.client声明(pkgMeta缓存只在进程启动时刷新)。
使用
- 手动整合一次:发送
/dream(可选all/current指定作用域范围)。 - agent 主动触发:调用
memory_dream工具。
整合结果会作为一条系统消息出现在当前会话;日志以 [dsh-dream] 前缀输出。
与 CC-HAHA 的关系
参考 CC-HAHA src/services/autoDream/ 的门控链与整合流程(autoDream.ts / consolidationPrompt.ts /
consolidationLock.ts),使用 DSH 原生能力(ctx.sessionQuery 读会话、ctx.subagents 派生子代理
(spawn → 不可用时回退 fork)做整合推理、ctx.commands / ctx.tools 入口)独立实现;
ctx.llm 仅用于枚举已注册 provider 以校验模型路由。
License
MIT
Links
More in this category
vectorize-io/hindsight#coding-agents★ 63857
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 42946
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
MemTensor/MemOS#memos-local-plugin★ 12527
Local-first memory plugin for DeepSeek Harness: layered L1/L2/L3 memory with automatic capture, manual memos_* retrieval tools, and a built-in memory viewer.
agentscope-ai/ReMe#dsh★ 3860
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2956
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1686
Cross-session memory and context recovery across forty-five other coding agents (45+) on this machine, reading session files they already wrote before install (Claude Code, Codex, Cursor, Windsurf, Trae, Antigravity, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Qoder, Cline, Zed, Magpie and more): six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall injected into runtime context. Local BM25 CLI/MCP index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.