DSH Shadow Mind
为 DeepSeek Harness 配置多个持久认知职责。主 Agent 正常工作;Shadow Mind 在回合结束时按策略启动独立 one-shot Subagent,检查架构、事实、测试、文档或完成度,并把有价值的结果回注主 Agent。
这是从 Pi Shadow Mind 移植到 DSH/Cordis 的实验版本,保留原项目 MIT License 和作者署名。
当前能力
- 自动接入当前及后续根 Agent,不递归激活 Shadow 子 Agent。
- 每轮结束执行可复现的概率 heartbeat,并限制并发和超时。
- 使用 DSH 原生 spawn Subagent、persona、结构化输出和工具 allowlist。
- Shadow 只看到去除 reasoning 的纯文本轨迹;工具结果会压缩为摘要。
- 新的真人输入会取消当前 Shadow,并丢弃过期报告。
- 报告按窗口合并:父 Agent 运行时 inject,空闲时 followup。
- Headless 模式会等待本轮 Shadow 完成并回注,再允许一次性进程退出。
- 提供 shadow_list、shadow_get、shadow_status、shadow_create、shadow_update、shadow_set_enabled、shadow_delete;写操作走 DSH approval。
- Web Profile 会自动加载专用 Settings 页面,可管理 Shadow CRUD、启停、调度配置和定义诊断。
安装到 DSH Profile
GitHub Release 安装:
~~~bash dsh plugin --profile web add \ https://github.com/dandibbert/dsh-shadow-mind/releases/download/v0.4.0/dsh-shadow-mind-0.4.0.tgz ~~~
从源码安装:
~~~bash git clone https://github.com/dandibbert/dsh-shadow-mind.git cd dsh-shadow-mind npm install npm run build dsh plugin --profile web add "$PWD" ~~~
包声明了标准 dsh.bundle,安装后会自动加入 profile 的 bundle 列表,不需要手动插入插件行。Headless profile 同理,把 web 改成 headless。
如需自定义数据目录,只在该 profile 的 cordis.patch.yml 中覆盖配置:
~~~yaml
- id: shadow-mind
config: dataDir: ~/my-shadow-minds ~~~
修改 profile 后重启或刷新对应 DSH 运行实例。
Web 管理界面
在 Web GUI 中打开「设置 → Shadow Mind」。页面支持新建、编辑、删除和启停 Shadow,也能修改 Heartbeat 概率、最大并发、默认超时和报告批处理窗口,并展示定义解析诊断。
Host 与浏览器之间使用 DSH Typert Remote 严格校验;页面写入与命令行管理工具共享同一数据目录。
数据目录
默认目录是 $DSH_HOME/shadow-mind,首次加载会创建 config.json。Shadow Markdown 文件也放在该目录。
~~~json { "heartbeat_probability": 0.3333333333333333, "max_parallel_shadows": 2, "default_shadow_timeout_seconds": 300, "result_batch_window_ms": 400 } ~~~
可选配置:default_shadow_model(provider/model)、default_max_tokens、random_seed。
Shadow 定义
~~~markdown --- id: architecture-review name: Architecture Review enabled: true activation_probability: 0.35 active_for_models: ["*"] run_with_model: deepseek-official/deepseek-v4-flash max_tokens: 3000 timeout_seconds: 180 tools: [read, grep, glob] ---
持续检查职责归属、扩展点、上帝组件和不必要的主流程分支。 只有发现会改变主 Agent 决策的具体问题时才报告,并引用相关路径。 ~~~
默认工具为 read、grep、glob。tools 只追加显式名称;未知工具会让该次启动明确失败。
验证
~~~bash npm run verify npm run build npm run smoke:bundle npm run smoke:client ~~~
smoke:bundle 会真实执行构建后的 YAML 配置/Shadow 解析路径,用来捕获“入口可以 import,但插件 apply 时因 ESM/CJS 兼容问题崩溃”这类启动故障。smoke:client 会执行构建后的 DSH 浏览器模块包装并校验插件导出。
已知限制
- 调度仍以概率为主,尚未加入文件变化、测试失败和完成审查等语义触发器。
- 每次激活都是新的 one-shot 子 Agent,没有跨激活记忆。
- 当前针对 DSH 0.1.0-rc.6 API。
- 尚未完成正式 A/B benchmark,不宣称必然提高成功率。
MIT License.