Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.1.0-beta.5

- Refactor: build reset/new reflection handoff note in `runMemoryReflection`.
- Refactor: `<open-loops>` now comes from the fresh reflection run, while `<derived-focus>` comes from historical scored itemized derived rows.
- Breaking: stop writing and stop reading legacy combined reflection rows (`type=memory-reflection`).
- Docs: refresh README / README_CN for the new handoff-note behavior and remove old legacy combined guidance.

---

## 1.1.0

- Feat: add integrated self-improvement governance flow (`agent:bootstrap`, `command:new/reset`, governance tools, and `.learnings` file bootstrap).
Expand Down
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ Filters out low-quality content at both auto-capture and tool-store stages:
- Hooks: `agent:bootstrap`, `command:new`, `command:reset`.
- `agent:bootstrap`: injects `SELF_IMPROVEMENT_REMINDER.md` into bootstrap context.
- `command:new` / `command:reset`: appends a short `/note self-improvement ...` reminder before reset.
- Under `sessionStrategy="memoryReflection"`, the final reset/new note is assembled in `runMemoryReflection`.
- In `memoryReflection.injectMode="inheritance+derived"` mode, the note can include:
- `<open-loops>` from the **fresh** reflection text of the current `/new` or `/reset`.
- `<derived-focus>` from **historical** LanceDB derived rows after dedupe+decay scoring, filtered to final score `> 0.3`.
- File ensure/create path: ensures `.learnings/LEARNINGS.md` and `.learnings/ERRORS.md` exist.
- This flow is separate from `memoryReflection`: seeing self-improvement notes or `.learnings/*` activity does not by itself mean reflection storage is enabled.
- Append paths are intentionally distinct:
Expand All @@ -183,6 +187,7 @@ Filters out low-quality content at both auto-capture and tool-store stages:
- Requires `sessionStrategy="memoryReflection"`.
- Triggers on `command:new` / `command:reset`.
- Skips generation when session context is incomplete (for example missing config, session file, or readable conversation content).
- Edge case: issuing `/new` immediately after a previous `/new` can land in a fresh empty session without a readable prior `sessionFile`; in that case reflection skips and logs `missing session file after recovery`. This is expected behavior.
- Runner chain:
- First try embedded runner (`runEmbeddedPiAgent`).
- If the embedded path fails, fall back to `openclaw agent --local --json`.
Expand All @@ -201,7 +206,6 @@ Filters out low-quality content at both auto-capture and tool-store stages:
- Writes one event row (`type=memory-reflection-event`) plus item rows (`type=memory-reflection-item`) for each `Invariants` / `Derived` bullet.
- Event rows keep lightweight provenance/audit metadata only (`eventId`, `sessionKey`, `usedFallback`, `errorSignals`, source path).
- Item rows carry per-item decay metadata (`decayModel`, `decayMidpointDays`, `decayK`, `baseWeight`, `quality`) plus ordinal/group metadata.
- Compatibility mode: `memoryReflection.writeLegacyCombined=true` (default) also writes legacy combined rows (`type=memory-reflection`) during migration.
- Reflection rows display as `reflection:<scope>`.
- Reflection-derived durable memory mapping:
- Available memory categories in the plugin are `preference`, `fact`, `decision`, `entity`, `reflection`, `other`.
Expand Down Expand Up @@ -229,6 +233,12 @@ Filters out low-quality content at both auto-capture and tool-store stages:
- If the configured agent id is not present in `cfg.agents.list`, the plugin warns and falls back to the runtime agent id.
- Error loop:
- `after_tool_call` captures and deduplicates tool error signatures for reminder/reflection context.
- Injection placement by hook (`memoryReflection.injectMode`):
- `before_agent_start`: injects `<inherited-rules>` via Reflection-Recall.
- `memoryReflection.recall.mode="fixed"` (default): compatibility path; fixed inheritance remains active even when generic Auto-Recall is disabled.
- `memoryReflection.recall.mode="dynamic"`: prompt-gated dynamic Reflection-Recall with independent top-k/session suppression budget from generic Auto-Recall.
- `command:new` / `command:reset`: `runMemoryReflection` builds the self-improvement note (`<open-loops>` from fresh reflection; `<derived-focus>` from historical scored rows when mode is `inheritance+derived`).
- `before_prompt_build`: injects `<error-detected>` only (no `<derived-focus>`).

### 10. Markdown Mirror (`mdMirror`)

Expand Down Expand Up @@ -274,7 +284,11 @@ When embedding calls fail, the plugin provides **actionable error messages** ins

- **Auto-Capture** (`agent_end` hook): Extracts preference/fact/decision/entity from conversations, deduplicates, stores up to 3 per turn
- Skips memory-management prompts (e.g. delete/forget/cleanup memory entries) to reduce noise
- **Auto-Recall** (`before_agent_start` hook): Injects `<relevant-memories>` context (up to 3 entries)
- **Auto-Recall** (`before_agent_start` hook): Injects `<relevant-memories>` context
- Default top-k: `autoRecallTopK=3`
- Default category allowlist: `preference`, `fact`, `decision`, `entity`, `other`
- `autoRecallExcludeReflection=true` by default, so `<relevant-memories>` stays separate from `<inherited-rules>`
- Supports age window (`autoRecallMaxAgeDays`) and recent-per-key cap (`autoRecallMaxEntriesPerKey`)

### Prevent memories from showing up in replies

Expand Down Expand Up @@ -309,7 +323,7 @@ Add a line to your agent system prompt, e.g.:

## Installation

> **🧪 Beta available: v1.1.0-beta.3**
> **🧪 Beta available: v1.1.0-beta.5**
>
> A beta release is available with major new features: **Self-Improvement governance**, **memoryReflection session strategy**, **Markdown Mirror**, and improved embedding error diagnostics. The stable `latest` remains at v1.0.32.
>
Expand All @@ -321,7 +335,7 @@ Add a line to your agent system prompt, e.g.:
> npm install memory-lancedb-pro
> ```
>
> See [Release Notes](https://github.com/win4r/memory-lancedb-pro/releases/tag/v1.1.0-beta.3) for details. Feedback welcome via [GitHub Issues](https://github.com/win4r/memory-lancedb-pro/issues).
> See [Release Notes](https://github.com/win4r/memory-lancedb-pro/releases/tag/v1.1.0-beta.5) for details. Feedback welcome via [GitHub Issues](https://github.com/win4r/memory-lancedb-pro/issues).

### AI-safe install notes (anti-hallucination)

Expand Down Expand Up @@ -470,6 +484,11 @@ openclaw config get plugins.slots.memory
"autoCapture": true,
"autoRecall": false,
"autoRecallMinLength": 8,
"autoRecallTopK": 3,
"autoRecallCategories": ["preference", "fact", "decision", "entity", "other"],
"autoRecallExcludeReflection": true,
"autoRecallMaxAgeDays": 30,
"autoRecallMaxEntriesPerKey": 10,
"retrieval": {
"mode": "hybrid",
"vectorWeight": 0.7,
Expand Down Expand Up @@ -510,15 +529,24 @@ openclaw config get plugins.slots.memory
},
"memoryReflection": {
"storeToLanceDB": true,
"writeLegacyCombined": true,
"injectMode": "inheritance+derived",
"agentId": "memory-distiller",
"messageCount": 120,
"maxInputChars": 24000,
"timeoutMs": 20000,
"thinkLevel": "medium",
"errorReminderMaxEntries": 3,
"dedupeErrorSignals": true
"dedupeErrorSignals": true,
"recall": {
"mode": "fixed",
"topK": 6,
"includeKinds": ["invariant"],
"maxAgeDays": 45,
"maxEntriesPerKey": 10,
"minRepeated": 2,
"minScore": 0.18,
"minPromptLength": 8
}
},
"mdMirror": {
"enabled": false,
Expand Down Expand Up @@ -547,6 +575,7 @@ A practical starting point for Chinese chat workloads:
"autoCapture": true,
"autoRecall": true,
"autoRecallMinLength": 8,
"autoRecallExcludeReflection": true,
"retrieval": {
"candidatePoolSize": 20,
"minScore": 0.45,
Expand Down
38 changes: 32 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Query → BM25 FTS ─────┘
- 需要 `sessionStrategy="memoryReflection"`。
- 触发于 `command:new` / `command:reset`。
- 若会话上下文不完整(例如缺少配置、session 文件、或可读对话内容),则跳过生成。
- 边界场景:在刚 `/new` 后立即再次 `/new`,可能进入一个没有可读上一轮 `sessionFile` 的新空会话;此时 reflection 会跳过并记录 `missing session file after recovery`。这属于预期行为。
- 执行链:
- 先尝试 embedded runner(`runEmbeddedPiAgent`)。
- 若 embedded 路径失败,则回退到 `openclaw agent --local --json`。
Expand All @@ -201,7 +202,7 @@ Query → BM25 FTS ─────┘
- 每次反思会写入 1 条 event row(`type=memory-reflection-event`)以及多条 item row(`type=memory-reflection-item`,对应每个 `Invariants` / `Derived` bullet)。
- event row 仅保留轻量 provenance / audit 元数据(`eventId`、`sessionKey`、`usedFallback`、`errorSignals`、source path)。
- item row 携带逐条衰减元数据(`decayModel`、`decayMidpointDays`、`decayK`、`baseWeight`、`quality`)以及 `ordinal/groupSize`。
- 兼容模式:`memoryReflection.writeLegacyCombined=true`(默认)时,迁移期仍会额外写入旧版 combined row(`type=memory-reflection`)。
- 仅使用 itemized reflection rows;旧版 combined row(`type=memory-reflection`)已不再写入,也不再参与读取
- reflection 行展示标签为 `reflection:<scope>`。
- Reflection 派生 durable memory 映射:
- 插件支持的 memory categories 包括 `preference`、`fact`、`decision`、`entity`、`reflection`、`other`。
Expand Down Expand Up @@ -229,6 +230,12 @@ Query → BM25 FTS ─────┘
- 若配置的 agent id 不在 `cfg.agents.list` 中,插件会告警并回退到 runtime agent id。
- 错误闭环:
- `after_tool_call` 捕获并去重工具错误签名,用于提醒 / reflection 上下文。
- Hook 注入位置(`memoryReflection.injectMode`):
- `before_agent_start`:通过 Reflection-Recall 注入 `<inherited-rules>`。
- `memoryReflection.recall.mode="fixed"`(默认):兼容路径;即使关闭 generic Auto-Recall,固定继承仍会注入。
- `memoryReflection.recall.mode="dynamic"`:按 prompt 动态检索反思规则,且与 generic Auto-Recall 使用独立 top-k / session 去重预算。
- `command:new` / `command:reset`:`runMemoryReflection` 生成 self-improvement note(`<open-loops>` 来自本次新反思;`<derived-focus>` 来自历史打分行,模式为 `inheritance+derived` 时启用)。
- `before_prompt_build`:仅注入 `<error-detected>`(不会注入 `<derived-focus>`)。

### 10. Markdown 镜像(`mdMirror`)

Expand Down Expand Up @@ -274,7 +281,11 @@ Query → BM25 FTS ─────┘

- **Auto-Capture**(`agent_end` hook): 从对话中提取 preference/fact/decision/entity,去重后存储(每次最多 3 条)
- 触发词支持 **简体中文 + 繁體中文**(例如:记住/記住、偏好/喜好/喜歡、决定/決定 等)
- **Auto-Recall**(`before_agent_start` hook): 注入 `<relevant-memories>` 上下文(最多 3 条)
- **Auto-Recall**(`before_agent_start` hook): 注入 `<relevant-memories>` 上下文
- 默认 top-k:`autoRecallTopK=3`
- 默认类别白名单:`preference`、`fact`、`decision`、`entity`、`other`
- 默认 `autoRecallExcludeReflection=true`,让 `<relevant-memories>` 与 `<inherited-rules>` 分离
- 支持时间窗(`autoRecallMaxAgeDays`)和按归一化 key 的最近 N 条限制(`autoRecallMaxEntriesPerKey`)

### 不想在对话中“显示长期记忆”?

Expand Down Expand Up @@ -309,7 +320,7 @@ Query → BM25 FTS ─────┘

## 安装

> **🧪 Beta 版本可用:v1.1.0-beta.3**
> **🧪 Beta 版本可用:v1.1.0-beta.5**
>
> Beta 版包含多项重大新特性:**Self-Improvement 治理流**、**memoryReflection 会话策略**、**Markdown 镜像双写**、以及改进的 Embedding 错误诊断。稳定版 `latest` 仍为 v1.0.32。
>
Expand All @@ -321,7 +332,7 @@ Query → BM25 FTS ─────┘
> npm install memory-lancedb-pro
> ```
>
> 详见 [Release Notes](https://github.com/win4r/memory-lancedb-pro/releases/tag/v1.1.0-beta.3)。欢迎通过 [GitHub Issues](https://github.com/win4r/memory-lancedb-pro/issues) 反馈问题。
> 详见 [Release Notes](https://github.com/win4r/memory-lancedb-pro/releases/tag/v1.1.0-beta.5)。欢迎通过 [GitHub Issues](https://github.com/win4r/memory-lancedb-pro/issues) 反馈问题。

### AI 安装指引(防幻觉版)

Expand Down Expand Up @@ -470,6 +481,11 @@ openclaw config get plugins.slots.memory
"autoCapture": true,
"autoRecall": false,
"autoRecallMinLength": 8,
"autoRecallTopK": 3,
"autoRecallCategories": ["preference", "fact", "decision", "entity", "other"],
"autoRecallExcludeReflection": true,
"autoRecallMaxAgeDays": 30,
"autoRecallMaxEntriesPerKey": 10,
"retrieval": {
"mode": "hybrid",
"vectorWeight": 0.7,
Expand Down Expand Up @@ -510,15 +526,24 @@ openclaw config get plugins.slots.memory
},
"memoryReflection": {
"storeToLanceDB": true,
"writeLegacyCombined": true,
"injectMode": "inheritance+derived",
"agentId": "memory-distiller",
"messageCount": 120,
"maxInputChars": 24000,
"timeoutMs": 20000,
"thinkLevel": "medium",
"errorReminderMaxEntries": 3,
"dedupeErrorSignals": true
"dedupeErrorSignals": true,
"recall": {
"mode": "fixed",
"topK": 6,
"includeKinds": ["invariant"],
"maxAgeDays": 45,
"maxEntriesPerKey": 10,
"minRepeated": 2,
"minScore": 0.18,
"minPromptLength": 8
}
},
"mdMirror": {
"enabled": false,
Expand Down Expand Up @@ -547,6 +572,7 @@ openclaw config get plugins.slots.memory
"autoCapture": true,
"autoRecall": true,
"autoRecallMinLength": 8,
"autoRecallExcludeReflection": true,
"retrieval": {
"candidatePoolSize": 20,
"minScore": 0.45,
Expand Down
Loading