Skip to content

Commit 69e95a9

Browse files
committed
docs(readme): strictScope 口径对齐 explicit-only 语义(issue #170 复核项 1)
- 内层 README:特性表与 strictScope 配置行改为「显式声明收窄的归属硬隔离; 载体自动标注只降权;物理隔离请用 sensitivity」;配置行标注 v0.8.1 起语义 - 根 README 中英:特性段与快速配置表同步(explicit hard blocking only) - 历史 changelog/路线图行保持原样(如实描述 v0.8.0 已发布行为,0.8.1 变化 留待发版说明) - conflict-freeze.test.js:重写「已解决对再次 pending」用例到新语义 (裁决后未变化被抑制,内容变化后重入)
1 parent e037c05 commit 69e95a9

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
- 🧾 **可回放、可追责** — 每次自动整理都留一张「决策凭证」:输入快照 + 决策明细 + 结果哈希,同样的整理可复现回放,**不默默吞错、不留无法追溯的改动**。
4747
- ⚖️ **矛盾先冻结,等你裁决**(可关)— 两条记忆打架时,不擅自替你做主。可疑冲突会**挂起待审**,状态页冲突队列里并排对比、一键裁决(保留 A / 保留 B / 仅标记),确认后才生效。复杂判断,人永远在线。
48-
- 🔐 **记忆按 agent 与工作区隔离**(可关)— `scopeEnabled` 开启后,每条记忆标注由哪个 agent、在哪个工作区写入;检索时本会话作用域优先(命中加权,他 scope 降权仍可见);`strictScope` 再进一步——带他者作用域的记忆在检索/注入里完全不可见。多 Agent、多项目互不串台。
48+
- 🔐 **记忆按 agent 与工作区隔离**(可关)— `scopeEnabled` 开启后,每条记忆标注由哪个 agent、在哪个工作区写入;检索时本会话作用域优先(命中加权,他 scope 降权仍可见);`strictScope` 再进一步——**显式声明**收窄到他者作用域的记忆在检索/注入里完全不可见(载体自动标注只降权,不硬挡)。多 Agent、多项目互不串台。
4949
- 🌙 **夜深人静才动手**(可关)— 空闲时自动分层归档:常看的留在热区、久不用的压成摘要、陈旧的彻底归档。记忆库**越用越精炼,不膨胀**。
5050
- 🧠 **本地语义检索,默认离线** — 自带本地 Embedding 与精排,不强求 API Key,网络断了也能检索。
5151
- 📝 **Markdown 双向同步** — 记忆就是本地 `.md` 文件,随时打开编辑;**人工改动会被优先尊重**,不会被机器覆盖。
@@ -72,7 +72,7 @@ dsh web
7272
| 完全离线运行 | `embedProvider` | `openai` | 改为 `local` |
7373
| 删除对话时保留记忆 | `sessionLifecycleEnabled` | `false` | 改为 `true` |
7474
| 自动提取结构化实体 | `entityExtractionEnabled` | `false` | 改为 `true` |
75-
| 多 Agent / 多项目记忆隔离 | `scopeEnabled`(硬隔离再加 `strictScope`) | `false` | 改为 `true` |
75+
| 多 Agent / 多项目记忆隔离 | `scopeEnabled`(需要更强隔离再加 `strictScope`,硬隔离只对显式声明生效) | `false` | 改为 `true` |
7676

7777
> 以上均在 DSH 设置面板 → 记忆库设置 中修改。完整配置见 [配置章节](dsh-mneme/README.md)。
7878
@@ -205,7 +205,7 @@ Every time you start a new chat, the AI acts like it's never met you?
205205

206206
- 🧾 **Replayable, accountable** — every consolidation leaves a "decision receipt": input snapshot + decision detail + result hash. The same run reproduces the same outcome. **No silent mis-merges, no untraceable changes.**
207207
- ⚖️ **Conflicts freeze, you decide** (opt-in) — when two memories contradict, it does not take sides for you. The suspected conflict is **parked for review**, compared side-by-side in the status-page conflict queue, and resolved with one click (keep A / keep B / mark reviewed). On hard judgments, a human stays in the loop.
208-
- 🔐 **Memories isolated by agent & workspace** (opt-in) — with `scopeEnabled`, every memory is stamped with which agent wrote it and in which workspace; retrieval favors the current scope (weighted hits, out-of-scope demoted but visible); `strictScope` goes further — memories scoped to other agents/workspaces become invisible to search and injection. Multiple agents and projects, zero cross-talk.
208+
- 🔐 **Memories isolated by agent & workspace** (opt-in) — with `scopeEnabled`, every memory is stamped with which agent wrote it and in which workspace; retrieval favors the current scope (weighted hits, out-of-scope demoted but visible); `strictScope` goes further — memories **explicitly** scoped to other agents/workspaces become invisible to search and injection (auto carrier labels are demoted only, never hard-blocked). Multiple agents and projects, zero cross-talk.
209209
- 🌙 **It works while you sleep** (opt-in) — idle time triggers tiered archiving: frequent memories stay hot, stale ones compress to summaries, old ones archive. The store **stays lean as it grows**.
210210
- 🧠 **Local semantic search, offline by default** — built-in local Embedding + reranking. No API key required; retrieval still works without a network.
211211
- 📝 **Two-way Markdown sync** — memories are local `.md` files you can open and edit; **human edits are respected**, never clobbered by the machine.
@@ -232,7 +232,7 @@ It works out of the box. To feel its value in five minutes:
232232
| Fully offline | `embedProvider` | `openai` | Change to `local` |
233233
| Keep memories when deleting sessions | `sessionLifecycleEnabled` | `false` | Change to `true` |
234234
| Structured entity extraction | `entityExtractionEnabled` | `false` | Change to `true` |
235-
| Memory isolation per agent / workspace | `scopeEnabled` (hard isolation: add `strictScope`) | `false` | Change to `true` |
235+
| Memory isolation per agent / workspace | `scopeEnabled` (add `strictScope` for stronger isolation — hard blocking applies to explicit declarations only) | `false` | Change to `true` |
236236

237237
> All of these live in DSH Settings → Memory Settings. Full config docs in the [Configuration section](dsh-mneme/README.md) (Chinese, bilingual file).
238238

‎dsh-mneme/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
| ① 写入 | ② 存储 | ③ 进化 |
2323
|--------|--------|--------|
24-
| 对话中模型主动记录(`memory_save`,可带敏感度与事件时间);会话结束自动提炼(`autoSummarize`) | SQLite 主库 + 人类可编辑 Markdown 镜像;实体 / 属性 / 时间轴三层结构化;记忆带 agent / workspace / 敏感度 / 发生时间标注 | 新会话自动注入相关记忆(按当前作用域加权,strictScope 开启后硬隔离);autoDream 后台去重 / 合并 / 归档,冲突冻结待人工裁决 |
24+
| 对话中模型主动记录(`memory_save`,可带敏感度与事件时间);会话结束自动提炼(`autoSummarize`) | SQLite 主库 + 人类可编辑 Markdown 镜像;实体 / 属性 / 时间轴三层结构化;记忆带 agent / workspace / 敏感度 / 发生时间标注 | 新会话自动注入相关记忆(按当前作用域加权,strictScope 开启后显式收窄的归属硬隔离);autoDream 后台去重 / 合并 / 归档,冲突冻结待人工裁决 |
2525

2626
```bash
2727
# 30 秒上手
@@ -461,7 +461,7 @@ dsh web
461461
| `memoryQualityFilter` | `{enabled:true, archiveThreshold:30, degradeThreshold:60, minContentLength:10, exemptImportance:4}` | 记忆质量过滤(v0.4.6,默认开):写库前启发式打分 0-100,元记忆词汇/自指/过短/重复/近似重复扣分;≥60 正常存储,30-60 降权(注入排序按 importance×quality/100),<30 归档标记 `low_quality`(显式搜索仍可召回,永不自动注入;`exemptImportance` 豁免:importance ≥ 该值只降权不归档,#135) |
462462
| `llmAudit` | `{enabled:true, retentionDays:90}` | LLM 消耗审计(v0.4.6,默认开):每次后台 LLM 调用(autoDream/autoSummarize)写 `llm_audit_logs`(tokens/duration/status/source);失败记 error 不阻塞;只读 API `/api/dsh-mneme/semantic/llm-audit` + `/llm-audit/stats` |
463463
| `scopeEnabled` | `false` | 作用域隔离总开关(v0.8.0,issue #17):memory_save 按会话身份写入 agent / workspace 标注(agentPreset / 工作区路径,registry 反查取不到回退 header.cwd,再取不到 NULL);去重键扩展含作用域三元——跨作用域同标题不再物理合并;检索按当前会话作用域加权(命中 ×1.25、他 scope ×0.5 保留可见)。也走 feature_flags 白名单(面板可启停) |
464-
| `strictScope` | `false` | 作用域硬过滤(v0.8.0,依赖 `scopeEnabled`):检索 / 注入 / 列表 / 单取四路过滤,带他者作用域的记忆完全不可见;会话身份解析不到时 fail-closed 只见未标注行。关闭时为软隔离(降权保留可见)。也走 feature_flags 白名单 |
464+
| `strictScope` | `false` | 作用域硬过滤(v0.8.0 引入,v0.8.1 起只认显式声明;依赖 `scopeEnabled`):检索 / 注入 / 列表 / 单取四路过滤,**显式声明**收窄到他者作用域的记忆完全不可见;载体自动标注只降权保留可见——真正的物理隔离请用 sensitivity。会话身份解析不到时 fail-closed 只挡显式行。关闭时全部为软隔离(降权保留可见)。也走 feature_flags 白名单 |
465465
| `conflictFreezeEnabled` | `false` | 冲突冻结(v0.4.4):dream 发现矛盾对不自动裁决,冻结进冲突队列;状态页「冲突队列」支持并排对比与人工确认(保留 A / 保留 B / 仅标记已处理,v0.8.0) |
466466
| `escapePromptVariables` | `true` | 注入文本花括号转义(v0.8.0 恢复,issue #162):注入边界把 `{{...}}` 转义,防止 hot memory / 记忆原文里的 Go template / Vue 语法触发宿主 interpolate 抛错卡死会话(v0.7.4 曾修复、v0.7.11 误删) |
467467

‎dsh-mneme/test/conflict-freeze.test.js‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,23 @@ test("store: countConflictPending 只统计未决行", () => {
111111
store.close();
112112
});
113113

114-
test("store: 已解决的同一对后续可再次 pending", () => {
114+
test("store: 已解决的同一对在内容变化后才可再次 pending(issue #170 复核项 4)", async () => {
115115
const store = openStore();
116-
const p1 = store.saveConflictPending({ memory_a: "a", memory_b: "b", reason: "r" });
116+
const a = store.save({ type: "project", title: "对A", content: "内容A" });
117+
const b = store.save({ type: "project", title: "对B", content: "内容B" });
118+
const p1 = store.saveConflictPending({ memory_a: a.id, memory_b: b.id, reason: "r" });
117119
store.resolveConflictPending(p1.id, { winner: "a" });
118-
// 去重只看未决行 —— 已解决后再现同一对应产生新 pending
119-
const p2 = store.saveConflictPending({ memory_a: "b", memory_b: "a", reason: "again" });
120-
assert.notEqual(p2.id, p1.id, "已解决行不参与去重");
120+
// 内容未变 → 已裁决对不重新入队:「保留双方」是有效决定,不是待办。
121+
const suppressed = store.saveConflictPending({ memory_a: b.id, memory_b: a.id, reason: "again" });
122+
assert.equal(suppressed, undefined, "未变化的已裁决对被抑制");
123+
assert.equal(store.countConflictPending(), 0);
124+
// 任一侧被改过(updated_at 晚于 resolved_at)→ 重新入队产生新 pending。
125+
// 留真实时间间隔:updated_at/resolved_at 毫秒精度,同毫秒算未变。
126+
await new Promise((resolve) => setTimeout(resolve, 5));
127+
store.update(a.id, { content: "内容A(改)" });
128+
const p2 = store.saveConflictPending({ memory_a: b.id, memory_b: a.id, reason: "changed" });
129+
assert.ok(p2, "内容变化后的对重新入队");
130+
assert.notEqual(p2.id, p1.id, "新 pending 是新行");
121131
assert.equal(p2.resolved_at, undefined);
122132
assert.equal(store.countConflictPending(), 1);
123133
store.close();

0 commit comments

Comments
 (0)