给你的 Harness 一棵会生长的记忆树 A growing memory tree for your Harness

dsh-memlite 把 memlite 的因果树记忆装进 DeepSeek Harness:每轮 agent/pre-step 同步召回,标题级记忆以 source=memlite 的 user 消息追加——不占 tool 调用;规则 section 恒定注入。侧栏「插件」里还有完整的图形配置页。数据落本地 JSONL,与 Rust memlite 双向互通。 dsh-memlite brings memlite's causal-tree memory into DeepSeek Harness: synchronous recall in agent/pre-step appends title-level memories as source=memlite user messages — no tool calls — while a static rules section is always injected. A full GUI settings page ships in Sidebar → Plugins. Data stays as local JSONL and interoperates with Rust memlite.

v0.3.2 GUI 配置页 16 个命令 5 个模型工具 与 Rust 互通 Obsidian 导入/导出 81 测试 MIT
开始使用 查看源码Source
user message 用户消息 user message agent/pre-step 召回 + 体检 + 敏感闸 recall + status + gate source=memlite 标题 + id8 追加 title + id8 appended assemble rules section LLM step turn-stopping 收尾自查 turn-stopping wrap-up tools: recall / show / remember / update / attach

召回发生在 agent/pre-step,用预算/阈值裁到标题级后作为 user 消息追加,不占 tool 调用;memlite:rules(order 850)恒定注入 9 条行为契约。turn-stopping 每轮最多一次收尾提醒,不查库。 Recall runs in agent/pre-step, trimmed by budget/threshold to title level and appended as a user message — no tool call. memlite:rules (order 850) always injects the 9 behavior rules. turn-stopping nudges at most once per turn and never reads the store.

01它做什么What it does

六个机制,全部落在你自己的机器上。

🧠

pre-step 召回

pre-step recall

每轮在 agent/pre-step 同步召回,按条数/阈值/字符预算裁到标题级,以 source=memlite 的 user 消息追加——零 tool 调用。正文按需用 memlite_show 展开。

Synchronous recall in agent/pre-step: trimmed by count/threshold/char budget to title level and appended as a source=memlite user message — zero tool calls. Expand bodies on demand with memlite_show.

🌳

因果树

Causal tree

记忆是父子链:父=因、子=果。命中即见前因后果,防环 64 层封顶;/memlite-chain 一把取回整条链。

Memories form parent-child chains: parent = cause, child = effect. Hits show their causes and effects; cycles capped at 64 levels; /memlite-chain retrieves a whole chain.

⚙️

GUI 配置页

GUI settings

侧栏「插件」→ Memlite 记忆行 → 配置。插件自带浏览器半区,表单暂存草稿、只读生效值,保存才写入 profile 的 cordis.patch.yml;召回参数即时生效,目录/嵌入/同步变化自动重建引擎。

Sidebar → Plugins → the Memlite Memory row → Configure. The plugin ships its own browser half: the form stages a draft, shows effective values, and only Save writes the profile's cordis.patch.yml. Recall parameters apply live; directory/embedding/sync changes rebuild the engine.

🛡️

敏感闸

Sensitive gate

写前扫描明文口令、API 密钥、身份证、银行卡(Luhn)、手机号、JWT、PEM 私钥——命中即拒,提示改存位置指针。

Pre-write scan for plaintext passwords, API keys, ID numbers, bank cards (Luhn), phone numbers, JWT, PEM keys — hits are rejected with a pointer suggestion.

📝

Obsidian 桥

Obsidian bridge

配置页的 Obsidian 桥 可直接预览/导入 vault、把记忆库导出为 vault、检查 synced/outdated/missing;/memlite-import、/memlite-export 做同样的事。单向工具,不是双向同步。

The Obsidian bridge in the settings page previews/imports a vault, exports the library as a vault, and checks synced/outdated/missing states; /memlite-import and /memlite-export do the same. One-way tools, not two-way sync.

🔄

git 同步

Git sync

白名单 add + pathspec commit(不卷走你已暂存的改动)+ rebase --autostash + push 后 ls-remote 双通道 sha 核验。

Whitelist add + pathspec commit (never sweeps your staged work) + rebase --autostash + push with ls-remote dual-channel sha verification.

02数据互通Interoperability

存储就是 memory.jsonl + emb.f32 侧车——Rust memlite CLI 写的库,插件直接读;插件写的库,Rust 直接 recall。同一份记忆,CLI、Harness、未来的 Kimi/ZCode 插件共享。

plur-ai/dshdsh-memlite
存储StorageYAML(自有)JSONL(Rust 互通)
结构Structureengram 列表因果树(parent_id 链)
同步Sync本地localgit 白名单同步git whitelist sync
项目隔离Project scope全局global项目级 + 用户级回退project-level + user fallback
评测BenchLongMemEval-S Hit@5=76.7%与 Rust 对齐(hit@1=85%)aligned with Rust (hit@1=85%)

03命令Commands

DSH 命令名为单 token——13 个核心 dash 名 + 3 个 Obsidian 命令,全部返回 CommandResult。

命令Command作用Purpose
/memlite概览与快速上手Overview & quick start
/memlite-recall <query> [--limit N] [--bm25] [--project P]检索(语义/词面/RRF 自动选档)Recall (semantic/lexical/RRF auto)
/memlite-remember <content> [--title T] [--tags a,b] [--parent ID]存记忆并认因Store with optional parent
/memlite-show <id>全文 + 因果视界Full text + causal view
/memlite-forget <id>删(墓碑)Delete (tombstone)
/memlite-update <id> [--title T] [--content C]就地改(追加新版本)Update (append new version)
/memlite-attach <child> --parent <parent>挂链(防自挂防环)Attach (cycle-guarded)
/memlite-tree [--from ID] [--depth N] [--outline]因果树渲染Render the causal tree
/memlite-chain <id> [--depth N]因链全文 + 果链下探Ancestors + descendants
/memlite-syncgit 白名单同步Git whitelist sync
/memlite-status库状态Library status
/memlite-reembed旧记忆回填向量Backfill embeddings
/memlite-bench命中率评测(20×20)Hit-rate bench (20×20)
/memlite-import <vault-path> [--dry-run]Obsidian vault 灌入记忆库(建议先 dry-run)Import an Obsidian vault (dry-run first)
/memlite-export <output-path> [--overwrite]记忆库导出为 vaultExport library as a vault
/memlite-vault-status <vault-path>同步态查询(synced/outdated/missing)Sync states (synced/outdated/missing)

04配置Configuration

侧栏「插件」→ Memlite 记忆行 → 配置:插件自带浏览器半区,表单暂存草稿、只读生效值,保存才写入 profile 的 cordis.patch.yml。密钥走 credentials——永不写入配置文件或数据仓。

字段Field默认Default说明Notes
enabledtrue总开关;关闭后立即停注入/召回/提醒,工具与命令回执拒绝Master switch; disables rules, recall, nudges, tools and commands immediately
dataDir''留空自动解析(MEMLITE_DATA > 项目级 > 用户级 > ~/memlite-data);修改会重建引擎Empty = auto-resolve (MEMLITE_DATA > project > user > ~/memlite-data); changing it rebuilds the engine
recallLimit5单次召回上限(1–50)Recall limit (1–50)
recallThreshold0召回分数阈值(0–1,0=不筛)Score threshold (0–1, 0 = no filter)
budgetChars1500自动注入字符预算(200–20000)Injection char budget (200–20000)
minPromptChars2短于该长度的提示词跳过召回Shorter prompts skip recall
storeNudgeEvery1收尾提醒频率(每 N 轮);0 关闭Wrap-up nudge every N rounds; 0 disables
sync{auto:false}挂载/重建时自动 git 同步,可选 remoteAuto git sync on mount/rebuild, optional remote
embeddingnoneprovider(none / openai-compatible / host)、apiBase、model、credentialRef、timeoutMsprovider (none / openai-compatible / host), apiBase, model, credentialRef, timeoutMs
sensitiveGatetrue写前敏感扫描Pre-write sensitive scan
表单只投影 volatile 配置:根 Config 声明 .volatile(),保存不重挂插件——召回参数下一次调用即生效,dataDir/embedding/sync/sensitiveGate 变化由插件重建记忆引擎。密钥只存 DSH credentials(credentialRef),绝不写入配置文件或数据仓。 The form projects only volatile config: the root Config declares .volatile(), so saving never remounts the plugin — recall parameters take effect on the next call, while dataDir/embedding/sync/sensitiveGate changes rebuild the memory engine. Keys live only in DSH credentials (credentialRef), never in config files or the data store.
展示名称来自包内 locale/zh.json / locale/en.json 的 meta.title「Memlite 记忆」/「Memlite Memory」;缺失时回退 package.json 的 name/description,再回退完整包名。改展示名只需改 locale JSON 并重启该插件行。 Display name comes from meta.title in locale/zh.json / locale/en.json ("Memlite 记忆" / "Memlite Memory"); missing fields fall back to package.json name/description, then the full package name. Renaming only needs a locale JSON edit and a row restart.
嵌入三档:none(默认,纯 BM25 零外网)→ openai-compatible(独立嵌入服务,密钥走 credentials)→ host 在 DSH 0.2.x 暂不可用(宿主无 embeddings API,插件加载时告警并自动回退 BM25——明示降级,不静默)。 Three embedding tiers: none (default, pure BM25, zero network) → openai-compatible (dedicated service, key via credentials) → host is unavailable on DSH 0.2.x (no embeddings API; the plugin warns and falls back to BM25 — explicit, not silent).
Obsidian 桥(GUI):同一配置页可直接预览/导入 vault、把记忆库导出为 vault、检查 synced/outdated/missing。路径是主机上的路径(支持 ~);请求走 /api/memlite/obsidian/{import,export,status},由 DSH connection 服务完成浏览器认证与 Host/Origin 信任栅栏,仅 owner Peer 可用;同一时刻只允许一个导入/导出任务。 Obsidian bridge (GUI): the same settings page previews/imports a vault, exports the library as a vault, and checks synced/outdated/missing states. Paths are on the host (with ~ expansion); requests go to /api/memlite/obsidian/{import,export,status}, authenticated and Host/Origin-fenced by DSH's connection service for the owner Peer only; one import/export task at a time.

05安装与上手Install & quick start

# 本地开发装载(npm 发布前)
pnpm -C dsh-memlite build     # 宿主 + 浏览器 bundle(dist/index.js、dist/client.js)
dsh plugin --profile <profile> add ./dsh-memlite

# 发布后
dsh plugin --profile <profile> add @rsrsai/dsh-memlite

# 图形配置:侧栏「插件」→ Memlite 记忆 → 配置
# 对话里
/memlite-remember nginx 504 排查手册 --title nginx题
/memlite-remember 下游结论 --parent <id>
/memlite-recall 网关超时
/memlite-tree --outline

记住一条因,补一条果——下次相关对话开始时,记忆已经在 prompt 里。

060.3.1 实测记Field notes

从 0.1.0 的 API 漂移,到 0.3.1 的 GUI 配置页与展示名——每一条都先在真机坐实,再回写代码与文档。