coding-agents
vectorize-io/hindsightHindsight:会学习的 Agent 长期记忆系统,自动召回/保存、知识页、深度反思与按仓库隔离的记忆银行。
因果记忆插件:零依赖的 MCP stdio 桥,把 causal-memory 服务的 17 个工具以干净名(无 mcp__ 前缀)挂载——本地 SQLite 记录「决策 → 结果」因果边(caused / enabled / prevented),压缩后记忆仍存活——另注入一段常驻系统提示词。需先将 causal-memory 服务端装到 PATH(pip install causal-memory,或下载预编译包)。
DeepSeek Harness 原生记忆插件:把 causal-memory 的 17 个工具以干净命名
(无 mcp__ 前缀)挂到 DSH 的 ctx.tools,并注入一条系统提示词段落
(order 300),告诉模型何时查阅因果记忆库。
插件按 DSH 惯例解析服务端二进制(不写死路径),四选一:
pip install causal-memory
会把 causal-memory 命令装到 PATH 上,插件自动解析到它。causal-memory 放到 PATH 上(如 ~/bin 或 /usr/local/bin)。cargo build --release --bin causal-memory
插件会自动找到 <仓库>/target/release/causal-memory。config.command 配置项或 CAUSAL_MEMORY_BIN 环境变量。cd <causal-memory 仓库路径>
dsh plugin --profile web add "$PWD/dsh-plugin"
以 link: 方式安装(pnpm link)——修改本目录代码即时生效,无需重装。
本包声明了 dsh.bundle manifest(cordis.patch.yml),通过
dsh plugin add 安装时 insert 会自动合并,无需手工配置。
仅当以 link: 方式做开发安装时需要手工确认
~/.dsh/profiles/web/cordis.patch.yml 的 insert 列表包含:
- id: causal-memory-plugin
name: causal-memory-dsh-plugin
重启 dsh web 后生效。
| 字段 | 默认 | 说明 |
|---|---|---|
command | 自动解析 | 二进制路径:config.command → CAUSAL_MEMORY_BIN → 仓库 target/release → PATH 裸名 |
dbPath | ~/.local/share/causal-memory/causal.db | SQLite 路径(或 CAUSAL_MEMORY_DB) |
toolCallTimeoutMs | 60000 | 单次工具调用超时 |
exclude | [] | 不挂载的工具名数组 |
failOnStartupError | true | 启动连接失败时是否让插件激活失败(默认失败并附安装提示;显式设 false 则降级为仅记日志) |
env | {} | 透传给服务端子进程的额外环境变量(优先级高于当前环境)。非字符串值会被丢弃并记一条 warn,因此 !!js 表达式算出 undefined 不会毒死子进程 |
env 打开 LLM 能力(可选)服务端从环境变量读 LLM / Embed 配置。缺了它,依赖 LLM 的工具会静默降级成规则回退——resolve_updates、reconstruct_lesson 的叙事与 calibrate、以及 remember 的自动抽取都会被影响:
- id: causal-memory-plugin
name: causal-memory-dsh-plugin
config:
env:
# 注意:此值是 base URL,源码会自行追加 /chat/completions
CAUSAL_MEMORY_LLM_API: https://api.deepseek.com/v1
CAUSAL_MEMORY_LLM_KEY: !!js process.env.DEEPSEEK_API_KEY || ''
CAUSAL_MEMORY_LLM_MODEL: deepseek-chat
⚠️ CAUSAL_MEMORY_LLM_API 必须填 base(https://api.deepseek.com/v1)。填成完整路径 .../v1/chat/completions 会被再拼一次,得到 .../chat/completions/chat/completions → 404,而工具不会报错,只会悄悄退回规则路径。密钥建议走环境变量或 vault,不要明文写进本文件。
record_decision · record_fact · remember · search_causal ·
search_facts · search_memory · search_patterns · causal_directory ·
trace_cause · trace_cause_chain · intervention_query ·
counterfactual_query · prediction_report · invalidate_decision ·
invalidate_pattern · resolve_updates · reconstruct_lesson
(工具列表运行时从服务端动态发现,服务端升级后无需改插件。)
dsh plugin --profile web remove causal-memory-dsh-plugin
# 并从 ~/.dsh/profiles/web/cordis.patch.yml 删除对应 insert 行
apply 为 async:与 DSH 官方 @deepseek-ai/dsh-mcp-client 同款时序
(cordis 4.x 会等待 async apply 的 promise,工具在激活前完成握手与发现)。@deepseek-ai/dsh-mcp-client,工具名 mcp__causal-memory__*)
二选一启用,避免双份工具。