@kenz1117/dsh-engram 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -61,13 +61,14 @@ Sensory and emotional dimensions (smell, temperature, emotional weight) are deli
61
61
  - **Cross-session memory**: a user memory profile is injected at session start (entry cap plus token budget, both configurable), so the agent naturally knows who you are and what you are building; tools recall facts across sessions.
62
62
  - **Dual-scope stores**: `user.db` shared globally; `project-<hash>.db` isolated per git origin identity (falls back to a working-directory encoding without git; legacy stores migrate automatically) — personal preferences follow the person, project conventions follow the repo.
63
63
  - **Hybrid retrieval**: FTS5 (unicode61 + Chinese 2-gram pre-tokenization) fused with local vectors (`Xenova/bge-small-zh-v1.5`, 512-dim, q8) via RRF, plus one-hop expansion over relation edges and a multiplicative recency/proof ranking boost; the embedding model runs offline, and a failed download degrades to keyword-only retrieval with an explicit marker.
64
- - **Memory-palace information architecture** (v0.7.2+): all four principles live on the core path, not in display-layer paint — **location as index** (writes sort by kind into rooms and pin a `room#slot` coordinate; room capacity 9, overflow opens a new room, slots are never recycled); **fixed route as order** (`tour_routes` is append-only; `engram_tour mode=fixed` walks the whole palace in slot order); **skeleton reused long-term** (a topic always lands in the same room and the same index, so recall is sequential extraction rather than fresh search); **every marker unique** (placard rule scored 0-1: globally unique +0.4 / date anchor +0.3 / no 6-char prefix clash within the room +0.3; low scores enter the refurb list).
64
+ - **Memory-palace information architecture** (v0.7.2+): all four principles live on the core path, not in display-layer paint — **location as index** (writes sort by kind into rooms and pin a `room#slot` coordinate; room capacity 9, overflow opens a new room, slots are never recycled); **fixed route as order** (`tour_routes` is append-only; `engram_tour mode=fixed` walks the whole palace in slot order); **skeleton reused long-term** (a topic always lands in the same room and the same index, so recall is sequential extraction rather than fresh search); **every marker unique** (placard rule scored 0-1: globally unique +0.4 / date anchor +0.3 / no 6-char prefix clash within the room +0.3; low scores enter the refurb list; a palace with fewer than 8 active memories is left unscanned to avoid small-store noise).
65
65
  - **Corridor-routed retrieval**: the profile carries a room directory, and `engram_search` accepts a `room` parameter — decide the room first, then search inside it, instead of always running whole-store RRF. The top 5 hits carry neighbouring slot ids from the same room as encoding-specificity cues.
66
66
  - **Retrieval-practice loop** (spaced repetition): `engram_review_queue` returns palace coordinates and placard cues but **never the body text**, forcing the model to recall first; `engram_review` reveals the entry and `engram_report grade` (0-5) self-rates it, advancing an SM-2 schedule (1 → 6 → round(prev × ease) days, reset on failure, ease floor 1.3). Entries under review scheduling **no longer take part in automatic decay** — their fate is decided by recall. Session-start injection reports how many memories are due.
67
+ - **History backfill** (v0.7.3+): distils dsh's persisted past sessions into the palace, turn by turn — each session is written into the project store matching **its own cwd** (no cross-project bleed), reusing the live-capture throttling, redaction, and echo suppression, with a `(session, turn)` idempotency key so an interrupted run resumes. Backfilled entries never enter the due-today queue. **You choose the import rules** (time window / turns per session / total turn budget / auxiliary model / include subagent·seeded·no-cwd sessions) and see a zero-cost estimate (no LLM calls) before running; staging happens in a dedicated **"History backfill" tab** with progress (including a **breakdown of skip reasons**) and pause. Auxiliary calls **reuse the model you are currently using** by default (a past session's log records the provider/model of that time, which may no longer be available here), or you can pick one explicitly from the host's registered providers/models in the tab's "Auxiliary model" dropdown.
67
68
  - **Knowledge flywheel**: capture/save → contradiction candidates (high-similarity neighbors create `contradicts` edges on write, for the model/user to adjudicate) → hit reinforcement (confidence +0.05) → distillation (topic clusters merge into higher-level rules, supersedes chains, confidence inheritance) → decay (low-importance, long-unaccessed entries archive; restorable).
68
69
  - **Automatic capture** (when `ingest` is enabled): each new turn's first step extracts candidate facts from the previous turn out of the session log, and session end captures the final turn too (failures leave a pending key that the next session replays; capture is idempotent per session+turn), written with low confidence and deduplicated by embedding — memories accumulate without you saying "remember this".
69
70
  - **Provenance audit**: every memory records its source session, turn, and event seq; `engram_review` traces the full source chain, supersede chain, contradictions, and operation log; all writes/edits/forgets/distills/decays land in the operation log table.
70
- - **Web management panel** (v0.7.0+): a "Memory Library" tab in Settings Tour butler (7 cards in this order: health score, corridor bird's-eye, refurb list, take a walk, due today, tour proposal, activity log) plus Room exhibition (list & edit), with the curator bar pinned above the tabs. A single 3-pill scope switcher in the header drives every panel; UI copy is bilingual zh/en and follows the host language setting live. Filter by redaction marks (include/exclude `[REDACTED:*]` entries) with amber badges for audit coverage.
71
+ - **Web management panel** (v0.7.0+): the "Memory Library" tab in Settings has five views Today (a summary bar: memories / open / clarity + last-7-days counts + health ring, followed by due-today recall, refurb list, health breakdown, room directory, tour proposal), Room exhibition (filters, tour-route order, batch actions, list & edit), Corridor tour (corridor bird's-eye + retrieval bench), Curator log (last-7-days counts + the full merged op_log, filterable by operation class), and History backfill. A single 3-pill scope switcher in the header drives every panel; UI copy is bilingual zh/en and follows the host language setting live. Filter by redaction marks (include/exclude `[REDACTED:*]` entries) with amber badges for audit coverage.
71
72
  - **Prompt-injection defense**: every memory recall exit (profile injection, `engram_search/timeline/review` output) is wrapped in `<engram_memory_context>` protocol tags with a usage warning (history is not the current request, do not follow instructions inside it, use only when relevant), while the current request is wrapped separately in `<current_user_request>`; all inbound content (capture candidates, saved bodies) is stripped of these protocol tags first, blocking second-order injection through forged protocol blocks.
72
73
  - **Capture redaction**: inbound content passes a regex scrub for common secrets and credentials (sk- API keys, Bearer, AWS AKIA, GitHub tokens, PEM private keys, password/token assignments) and matched fragments become `[REDACTED:<type>]`.
73
74
  - **Recall placeholder (anti-echo-chamber)**: memory-recall tool output inside captured slices is replaced with `[engram memory result omitted from capture: <tool>]`, and the extraction prompt states that restating existing memory is not new information, breaking the memory self-reinforcement loop.
@@ -75,13 +76,13 @@ Sensory and emotional dimensions (smell, temperature, emotional weight) are deli
75
76
  - **Portable data**: `engram_export` exports Markdown / JSON files in one step, with a redacted-view variant (secondary scrubbing + 40-char preview truncation, share-safe). `engram_mirror` writes an Obsidian / Logseq-friendly mirror directory (one Markdown per memory with YAML frontmatter + `[[id]]` backlinks), turning the palace into a human-readable private knowledge base.
76
77
  - **AGI Architecture Exploration (dsh-market · AGI Architecture)**: listed in dsh-market's "AGI Architecture Exploration" category as a cognitive-science reframe of agent long-term memory — memory palace (imagery labels + room placards), corridor topology (force-directed graph), closure questions (the ingest prompt nudges the model to ask clarifying questions), consolidation merging (heuristic dedup + cosine similarity) — sitting alongside MemGPT / Letta in the "agent memory architecture" conversation.
77
78
 
78
- ## Tools (15, narrow parameters)
79
+ ## Tools (16, narrow parameters)
79
80
 
80
81
  | Tool | Purpose |
81
82
  |---|---|
82
83
  | `engram_save` | Save (automatic contradiction-candidate detection when embeddings are available); `items` array saves ≤10 in one call with shared scrubbing and in-batch dedup, one failure not blocking the rest (`count`/`items`/`failed` summary); `placard` attaches a marker (scored unique · distinctive · dated; low scores get a rewrite hint) |
83
84
  | `engram_search` | Hybrid semantic + keyword retrieval (hits reinforce confidence); `room` routes through the corridor — search inside one room only; the top 5 hits carry same-room neighbouring-slot cues |
84
- | `engram_timeline` | Timeline browsing |
85
+ | `engram_timeline` | Timeline browsing: creation-time descending by default; `order: 'tour'` follows the fixed tour route's slot order instead (output carries palace coordinates, entries off-route sorted last) so the agent can re-walk the route |
85
86
  | `engram_update` | Correct an entry (supersedes chain); can re-attach a `placard` marker too |
86
87
  | `engram_forget` | Forget (soft-delete, restorable) |
87
88
  | `engram_report` | Report an outcome (preferred for skill-kind entries): success +0.05 / failure -0.1, and persistently useless memories decay away naturally. With `grade` (0-5) it advances the SM-2 review schedule instead, acting as the self-rating entry point of retrieval practice |
@@ -92,6 +93,7 @@ Sensory and emotional dimensions (smell, temperature, emotional weight) are deli
92
93
  | `engram_neighbors` | Corridor walk: from one room, follow 1-3 hops of relation edges and return a neighbour summary |
93
94
  | `engram_tour` | Tour routing: `mode=fixed` walks the whole palace in fixed slot order (constant route, sequential extraction); `mode=thematic` plans 3-7 stops around a theme |
94
95
  | `engram_audit_forgotten` | Closed-wing archaeology: list recent closed entries with their epitaphs to review whether past forgetting was sound |
96
+ | `engram_ingest_history` | History backfill: distil past dsh sessions into the palace turn by turn (per-cwd stores; already-captured turns skipped). `dryRun` defaults to true (estimate only); pass `dryRun=false` to run. Use the Settings "History backfill" tab for large batches |
95
97
  | `engram_export` | Export Markdown / JSON files (data portability); `redactedView: true` emits a redacted view (secondary scrubbing + 40-char preview truncation, share-safe) |
96
98
  | `engram_distill` | Distill: merge same-topic clusters into higher-level rules (LLM) |
97
99
 
@@ -120,6 +122,13 @@ Optional configuration (cordis.yml):
120
122
  queryRewrite: true # engram_search rewrites ≤3 queries via the aux LLM and fuses them with RRF (degrades to a single query on failure)
121
123
  autoSlot: true # write-time auto-sloting (sort by kind into rooms, pin `room#slot`, register on the tour route)
122
124
  reviewScheduling: true # write-time enrolment in review scheduling (first due in 1 day; off = new entries never enter the SM-2 queue)
125
+ # History-backfill defaults (initial values for the tab and the tool; the total-turn cap is a hard ceiling you can only lower per run)
126
+ historyBackfillDays: 7 # default time window in days; 0 = unlimited
127
+ historyBackfillMaxTurnsPerSession: 20 # default max turns per session
128
+ historyBackfillMaxTotalTurns: 200 # hard cap on turns per run (1-5000)
129
+ historyBackfillIncludeSubagents: false # exclude subagent sessions by default
130
+ historyBackfillIncludeSeeded: false # exclude seeded sessions by default
131
+ historyBackfillIncludeNoCwd: false # exclude sessions without cwd by default (they can only go to the user store)
123
132
  ```
124
133
 
125
134
  ## How It Works
@@ -148,7 +157,9 @@ Session agent Host half (Node)
148
157
 
149
158
  On profiles with a webServer (web, etc.), a "Memory Library" tab appears in **Settings** automatically (registered through the `settings.section` slot; the client half is a React component loaded from `lib/client.js` through the host module table): stat cards, filter by status/kind/content, inline detail and edit (through the supersede chain), forget/restore, Markdown/JSON export. Data flows through the loopback API `/api/engram/*` (writes verify the loopback Origin). Profiles without a webServer (headless, etc.) skip the panel; every other capability is unaffected.
150
159
 
151
- Since v0.7.2 the Tour butler also shows a **"Due today" card**: each due memory is listed by cue only (`room#slot` · placard · overdue days), the body appears after pressing "Reveal placard", and you then self-rate it as Remembered / Hazy / Forgot (mapped to SM-2 grades 5/3/1) to advance the schedule. When reviews are due, a **red header badge** shows the count and jumps straight to that card; answering decrements it. The Room exhibition list gains a **"By tour route"** sort toggle for walking memories in fixed slot order, and each row shows its palace coordinate.
160
+ Since v0.7.2 the Today view opens with a **"Due today" card**: each due memory is listed by cue only (`room#slot` · placard · overdue days), the body appears after pressing "Reveal placard", and you then self-rate it as Remembered / Hazy / Forgot (mapped to SM-2 grades 5/3/1) to advance the schedule. When reviews are due, a **red header badge** shows the count and jumps straight to that card; answering decrements it. The Room exhibition list gains a **"By tour route"** sort toggle for walking memories in fixed slot order, and each row shows its palace coordinate.
161
+
162
+ Since v0.7.3 there is a dedicated **"History backfill" tab**: you choose every import rule (time window / turns per session / total turn budget / include subagent·seeded·no-cwd sessions), press "Re-estimate" to see candidate sessions and pending turns at zero cost (no LLM calls), then start. While running it shows progress (sessions / turns / written / skipped / failed) and can be paused at any time — finished turns are skipped by idempotency key, so starting again resumes. The same release rebuilds the panel as five views (Today / Palace / Corridor tour / Curator log / History backfill): the always-on nine-cell curator bar folds into a summary card at the top of Today (three headline metrics + last-7-days counts + health ring), and the front page keeps only what to do (due today, refurb) and what to reference (room directory, tour proposal); the corridor bird's-eye and the retrieval bench move to Corridor tour; the curator log becomes a full page filterable by writes / capture / retrieval / organize; and each of the five rooms gets its own hue (fact blue / preference purple / decision teal / episode orange / skill magenta) across tags, the room directory, and corridor nodes. The exhibition list becomes compact rows: hairlines instead of cards, two-line body, action buttons revealed on hover (or keyboard focus) and wrapped below the body on narrow screens — roughly twice as many rows per screen. The refurb list stops scanning a palace with fewer than 8 active memories, avoiding small-store noise.
152
163
 
153
164
  ## Development
154
165
 
@@ -169,7 +180,7 @@ Each turn's first step appends a plugin-source user snapshot: `User memory profi
169
180
 
170
181
  #### Token effect
171
182
 
172
- Profile injection is a conditional fixed cost (bounded by both the entry cap and the token budget); the tool schemas are a standing cost (15 narrow-parameter tools).
183
+ Profile injection is a conditional fixed cost (bounded by both the entry cap and the token budget); the tool schemas are a standing cost (16 narrow-parameter tools).
173
184
 
174
185
  #### KV Cache effect
175
186
 
package/README.md CHANGED
@@ -61,13 +61,14 @@ dsh plugin --profile web add @kenz1117/dsh-engram
61
61
  - **跨会话记忆**:会话开始注入用户画像摘要(条数 + token 预算双重上限,可配),Agent 天然"记得"你是谁、在做什么;工具检索跨会话召回历史事实。
62
62
  - **双层分库**:`user.db` 全局共享;`project-<hash>.db` 按 git origin 标识隔离(无 git 时回退工作目录编码,旧库自动迁移)——个人偏好跟人走,项目约定跟仓库走。
63
63
  - **混合检索**:FTS5(unicode61 + 中文 2-gram 预切词)与本地向量(`Xenova/bge-small-zh-v1.5`,512 维,q8)RRF 融合 + 关系边一跳扩展 + 新鲜度/命中次数乘性排序 boost;嵌入模型离线运行,下载失败自动降级纯关键词并显式标记。
64
- - **记忆宫殿信息架构**(v0.7.2+):四原则全部落进核心路径,而非展示层皮肤——**位置当索引**(写入按 kind 分房并钉「房间#桩位」坐标,房间容量 9,满员开新房,桩位只增不回收);**固定路线定顺序**(`tour_routes` append-only,`engram_tour mode=fixed` 按桩位顺序走全宫);**骨架长期复用**(同一 topic 永远落在同一房间同一序号,顺序提取而非重新检索);**标记独一无二**(门牌规则 0-1 评分:全库唯一 +0.4 / 带日期锚点 +0.3 / 同房前 6 字不重复 +0.3,低分进翻新清单)。
64
+ - **记忆宫殿信息架构**(v0.7.2+):四原则全部落进核心路径,而非展示层皮肤——**位置当索引**(写入按 kind 分房并钉「房间#桩位」坐标,房间容量 9,满员开新房,桩位只增不回收);**固定路线定顺序**(`tour_routes` append-only,`engram_tour mode=fixed` 按桩位顺序走全宫);**骨架长期复用**(同一 topic 永远落在同一房间同一序号,顺序提取而非重新检索);**标记独一无二**(门牌规则 0-1 评分:全库唯一 +0.4 / 带日期锚点 +0.3 / 同房前 6 字不重复 +0.3,低分进翻新清单;库内 active 记忆少于 8 条时不扫描,避免小库噪声)。
65
65
  - **走廊路由检索**:画像里附房间目录,`engram_search` 支持 `room` 参数——先决定进哪个房间,再在房内检索,而非一上来全库 RRF。检索命中 top5 附同房间相邻桩位 id 作为编码特异性线索。
66
66
  - **检索练习闭环**(间隔重复):`engram_review_queue` 只给宫殿坐标与门牌线索、**不给正文**,迫使模型先主动回忆;`engram_review` 揭示核对,`engram_report grade`(0-5)自评推进 SM-2 调度(1 → 6 → round(prev × ease) 天,失败重置,ease 下限 1.3)。进入复习调度的条目**不再参与自动衰减**——命运由回忆结果决定。会话开始注入会提示今日待回忆条数。
67
+ - **历史会话回填**(v0.7.3+):把 dsh 已持久化的历史会话逐轮提炼进宫殿——按**每个会话自己的 cwd** 写进对应项目库(不串库),复用实时摄取的节流/脱敏/防回声,靠 (会话, 轮次) 幂等键支持中断续跑;回填条目不进今日复习队列(避免一次性回填淹没「今日待回忆」)。**导入规则由你选**(时间窗 / 单会话轮数 / 总轮数上限 / 辅助模型 / 是否含子代理·种子·无 cwd 会话),先估算(零成本、不调 LLM)再执行;设置页有独立的**「历史回填」tab**,可看进度(含**跳过原因分布**)与暂停续做。辅助调用默认**复用你当前在用的模型**(历史日志里记的是当年的 provider/model,在当前环境可能已不可用),也可在面板「辅助模型」下拉里从宿主已注册的 provider/model 中直接指定。
67
68
  - **知识飞轮**:摄取/保存 → 矛盾候选(写入时高相似近邻建 `contradicts` 边并报告,模型/用户裁决)→ 命中强化(confidence +0.05)→ 蒸馏(同主题簇合并为高层规律、supersedes 取代链、置信度继承)→ 衰减(低重要性且长期未访问归档,可恢复)。
68
69
  - **自动摄取**(`ingest` 配置开启时):新一轮第一步从会话日志提取上一轮的候选事实,会话结束时补摄取最后一轮(失败留 pending 键,下次会话自动补做,幂等不重复),低 confidence 写入并按嵌入去重——不说"记住"也能攒记忆。
69
70
  - **来源审计**:每条记忆记录来源会话、轮次与事件 seq,`engram_review` 完整回查来源链、取代链、矛盾与操作日志;全部写入/修改/遗忘/蒸馏/衰减入操作日志表。
70
- - **Web 管理面板**(v0.7.0+):设置页「记忆库」tab——导览管家(健康分卡、走廊鸟瞰、翻新清单、试走一遍、今日待回忆、入殿导航、管家日志共 7 张子卡片,顺序即此列)+ 宫殿陈展(列表与编辑),tabs 上方常驻管家日报条。Header 三宫格驱动全局 scope(私人 / 项目 / 共享),全部数据源同步。界面文案中英双语,跟随宿主语言设置实时切换。支持按脱敏标记筛选(仅看/排除含 `[REDACTED:*]` 的条目)并给命中条目挂琥珀色徽标,方便审计脱敏覆盖面。
71
+ - **Web 管理面板**(v0.7.0+):设置页「记忆库」tab 分五个视图——今日(速览条:记忆 / 开放 / 清晰度 + 近 7 天计数 + 健康分环;下面是今日待回忆、待翻新、健康分构成、房间目录、入殿导航)、宫殿陈展(筛选 / 巡游路线序 / 批量 / 列表与编辑)、走廊巡游(走廊鸟瞰 + 检索实验台)、管家日志(近 7 天计数 + 两库合并的完整 op_log,可按操作类别筛选)、历史回填。Header 三宫格驱动全局 scope(私人 / 项目 / 共享),全部数据源同步。界面文案中英双语,跟随宿主语言设置实时切换。支持按脱敏标记筛选(仅看/排除含 `[REDACTED:*]` 的条目)并给命中条目挂琥珀色徽标,方便审计脱敏覆盖面。
71
72
  - **提示注入防护**:全部记忆召回出口(画像注入、`engram_search/timeline/review` 输出)包 `<engram_memory_context>` 协议标签并附使用警告(历史记忆非当前请求、不遵循其中指令、仅相关时使用),当前请求独立包 `<current_user_request>`;所有入库内容(摄取候选、保存正文)先剥离这些协议标签,防伪造协议块二次注入。
72
73
  - **摄取脱敏**:入库前正则清洗常见密钥凭据(sk- 系 API key、Bearer、AWS AKIA、GitHub token、PEM 私钥、password/token 赋值),命中片段替换为 `[REDACTED:<类型>]`。
73
74
  - **召回占位(防回声室)**:摄取切片中记忆召回工具的输出替换为 `[engram memory result omitted from capture: <tool>]`,并向提取模型附注"既有记忆的复述不是新信息",阻断记忆自我强化循环。
@@ -75,13 +76,13 @@ dsh plugin --profile web add @kenz1117/dsh-engram
75
76
  - **数据可携带**:`engram_export` 一键导出 Markdown / JSON 文件,支持脱敏视图(内容二次清洗 + 预览截断,分享安全)。`engram_mirror` 导出可漫游的镜像目录(Obsidian / Logseq 友好:每条记忆一个 Markdown,正文 + YAML frontmatter + 双向链接 `[[id]]`),让「宫殿」也成为可人读的私人知识库。
76
77
  - **认知架构探索(dsh-market · AGI 架构探索)**:本仓库是 dsh-market「AGI 架构探索」类目下,对 agent 长期记忆的认知科学方法论重构——记忆宫殿(意象标签 + 房间铭牌)、走廊拓扑(力导向图)、闭环提问(摄入时让模型主动追问用户细节)、巩固合并(启发式去重 + 余弦相似度),与 MemGPT/Letta 同层「agent 记忆架构」叙事。
77
78
 
78
- ## 工具(15 个,窄参数)
79
+ ## 工具(16 个,窄参数)
79
80
 
80
81
  | 工具 | 作用 |
81
82
  |---|---|
82
83
  | `engram_save` | 保存(嵌入可用时自动做矛盾候选检测);支持 `items` 数组单次批量保存 ≤10 条,统一清洗/批量内去重,单条失败不影响其余(`count`/`items`/`failed` 汇总返回);`placard` 挂门牌(按唯一·差异化·带日期评分,低分附改写建议) |
83
84
  | `engram_search` | 语义 + 关键词混合检索(命中强化置信度);`room` 参数做走廊路由——只在指定房间内检索;命中 top5 附同房相邻桩位线索 |
84
- | `engram_timeline` | 时间线浏览 |
85
+ | `engram_timeline` | 时间线浏览:默认按创建时间倒序;`order: 'tour'` 改按固定巡游路线桩位顺序(输出附宫殿坐标,未上路线者排末尾),让 agent 也能沿固定路线复述 |
85
86
  | `engram_update` | 修正(supersedes 取代链);可同时改挂 `placard` 门牌 |
86
87
  | `engram_forget` | 遗忘(软删可恢复) |
87
88
  | `engram_report` | 回报使用效果(skill 类首选):success 提权 +0.05 / failure 降权 -0.1,持续无效的记忆被衰减自然淘汰。传 `grade`(0-5)则按 SM-2 推进复习调度,作为检索练习的自评入口 |
@@ -92,6 +93,7 @@ dsh plugin --profile web add @kenz1117/dsh-engram
92
93
  | `engram_neighbors` | 走廊漫步:从一间出发走 1-3 跳关系边,返回邻居简表 |
93
94
  | `engram_tour` | 巡游路由:`mode=fixed` 按固定桩位路线走全宫(路线恒定,顺序提取);`mode=thematic` 按主题动态规划 3-7 站 |
94
95
  | `engram_audit_forgotten` | 闭馆考古:列最近已闭馆条目与墓志铭,复核过去的遗忘是否得当 |
96
+ | `engram_ingest_history` | 历史会话回填:把 dsh 历史会话逐轮提炼进宫殿(按会话 cwd 分库、已摄取轮次自动跳过)。`dryRun` 缺省 true 只估算;`dryRun=false` 才执行。大批量建议用设置页「历史回填」tab |
95
97
  | `engram_export` | 导出 Markdown / JSON 文件(数据可携带);`redactedView: true` 输出脱敏视图(二次清洗 + 40 字预览截断,可安全分享) |
96
98
  | `engram_distill` | 蒸馏:同主题簇合并为高层规律(LLM) |
97
99
 
@@ -120,6 +122,13 @@ dsh plugin --profile web add @kenz1117/dsh-engram
120
122
  queryRewrite: true # engram_search 用辅助 LLM 改写 ≤3 个查询做 RRF 融合(失败自动降级单查询)
121
123
  autoSlot: true # 写入期自动排桩(按 kind 分房、钉「房间#桩位」坐标、登记巡游路线)
122
124
  reviewScheduling: true # 写入期自动排入复习调度(1 天后首次到期;关则新条目不进 SM-2 队列)
125
+ # 历史回填默认规则(面板/工具的初始值;总轮数上限是硬顶,按次只能调低)
126
+ historyBackfillDays: 7 # 默认时间窗天数,0 = 不限
127
+ historyBackfillMaxTurnsPerSession: 20 # 单个会话默认最多摄取轮数
128
+ historyBackfillMaxTotalTurns: 200 # 单次运行的总轮数硬上限(1-5000)
129
+ historyBackfillIncludeSubagents: false # 默认排除子代理会话
130
+ historyBackfillIncludeSeeded: false # 默认排除种子会话
131
+ historyBackfillIncludeNoCwd: false # 默认排除无 cwd 会话(这类只能进 user 库)
123
132
  ```
124
133
 
125
134
  ## 工作原理
@@ -148,7 +157,9 @@ dsh plugin --profile web add @kenz1117/dsh-engram
148
157
 
149
158
  宿主带 webServer 的 profile(web 等)会在**设置页**自动出现「记忆库」tab(经 `settings.section` 槽位注册,client 半为 React 组件、随 `lib/client.js` 由宿主模块表装载):统计卡片、按状态/种类/内容过滤、行内详情与编辑(走取代链)、遗忘/恢复、导出 Markdown/JSON 下载。数据经回环 API `/api/engram/*`(写操作校验回环 Origin)。headless 等无 webServer 的组合不挂载,其余能力不受影响。
150
159
 
151
- v0.7.2 起导览管家新增**「今日待回忆」卡**:按线索(房间#桩位 · 门牌 · 逾期天数)逐条列出待回忆记忆,点「揭示铭牌」才显示正文,随后以「记得 / 模糊 / 忘了」三档自评(映射 SM-2 grade 5/3/1)推进调度。有待回忆时 Header 出现**红色角标**(显示条数),点击直达该卡;答题后角标自动递减。宫殿陈展列表新增**「按巡游路线」排序**开关,可切到固定桩位顺序浏览,列表行同时显示每条记忆的宫殿坐标。
160
+ v0.7.2 起「今日」视图首屏新增**「今日待回忆」卡**:按线索(房间#桩位 · 门牌 · 逾期天数)逐条列出待回忆记忆,点「揭示铭牌」才显示正文,随后以「记得 / 模糊 / 忘了」三档自评(映射 SM-2 grade 5/3/1)推进调度。有待回忆时 Header 出现**红色角标**(显示条数),点击直达该卡;答题后角标自动递减。宫殿陈展列表新增**「按巡游路线」排序**开关,可切到固定桩位顺序浏览,列表行同时显示每条记忆的宫殿坐标。
161
+
162
+ v0.7.3 起新增独立的**「历史回填」tab**:导入规则全部由你选择(时间窗 / 单会话轮数 / 总轮数上限 / 是否包含子代理·种子·无 cwd 会话),点「重新估算」先看候选会话数与待处理轮数(零成本、不调 LLM),确认后「开始回填」;运行中显示进度(会话 / 轮次 / 写入条数 / 跳过 / 失败)并可随时暂停——已完成的轮次按幂等键跳过,再点开始即续做。同一版把面板重做成五个视图(今日管家 / 宫殿陈展 / 走廊巡游 / 管家日志 / 历史回填):原常驻的九格「管家日报」条收进「今日」视图的速览卡(三个大指标 + 近 7 天计数 + 健康分环),首页只留在办与参考两块(待回忆、待翻新 / 房间目录、入殿导航);走廊鸟瞰与检索实验台移入「走廊巡游」;管家日志独立成整页,可按落成类 / 发掘 / 检索 / 整理筛选;五间房各一色(事实蓝 / 偏好紫 / 决策青 / 往事橙 / 技法品红)贯穿标签、房间目录与走廊节点。陈展列表改为紧凑行式:分隔线取代卡片描边、正文两行截断、操作按钮 hover(或键盘聚焦)才显现、窄屏折到正文下方,一屏可读条目约翻一倍。翻新清单在库内 active 少于 8 条时不再扫描,避免小库噪声。
152
163
 
153
164
  ## 开发
154
165
 
@@ -169,7 +180,7 @@ pnpm bundle
169
180
 
170
181
  #### Token effect
171
182
 
172
- 画像注入为条件性固定成本(受条数上限与 token 预算双重约束);工具 schema 为常驻成本(15 个窄参数工具)。
183
+ 画像注入为条件性固定成本(受条数上限与 token 预算双重约束);工具 schema 为常驻成本(16 个窄参数工具)。
173
184
 
174
185
  #### KV Cache effect
175
186