mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-19 21:07:28 +08:00
docs: make English the default docs language and fix link paths
This commit is contained in:
@@ -1,94 +1,90 @@
|
||||
---
|
||||
title: 梦境蒸馏
|
||||
description: Deep Dream — 从对话到永久记忆的自动蒸馏机制
|
||||
title: Deep Dream
|
||||
description: Deep Dream — automatic distillation from conversations to permanent memory
|
||||
---
|
||||
|
||||
梦境蒸馏(Deep Dream)是 CowAgent 记忆系统的核心整理机制,负责将分散的天级记忆蒸馏为精炼的长期记忆,并生成梦境日记。
|
||||
Deep Dream is the core consolidation mechanism of CowAgent's memory system, responsible for distilling scattered daily memories into refined long-term memory and generating dream diaries.
|
||||
|
||||
## 记忆流转
|
||||
## Memory Flow
|
||||
|
||||
CowAgent 的记忆从短期到长期经历三个阶段:
|
||||
CowAgent's memory progresses through three stages from short-term to long-term:
|
||||
|
||||
```
|
||||
对话上下文(短期)→ 天级记忆(中期)→ MEMORY.md(长期)
|
||||
Conversation context (short-term) → Daily memory (mid-term) → MEMORY.md (long-term)
|
||||
```
|
||||
|
||||
### 1. 对话 → 天级记忆
|
||||
### 1. Conversation → Daily Memory
|
||||
|
||||
当对话上下文被裁剪或每日定时总结时,系统使用 LLM 将对话内容摘要为关键事件,写入当天的天级记忆文件 `memory/YYYY-MM-DD.md`。
|
||||
When conversation context is trimmed or during the daily scheduled summary, the system uses LLM to summarize conversation content into key events, writing them to the daily memory file `memory/YYYY-MM-DD.md`.
|
||||
|
||||
触发时机:
|
||||
- **上下文裁剪** — 轮次或 token 超限时,裁剪的内容被总结写入
|
||||
- **每日定时** — 23:55 自动触发全量总结
|
||||
- **API 溢出** — 紧急保存当前对话摘要
|
||||
Triggers:
|
||||
- **Context trimming** — Trimmed content is summarized when turn or token limits are exceeded
|
||||
- **Daily schedule** — Automatically triggered at 23:55
|
||||
- **API overflow** — Emergency save of current conversation summary
|
||||
|
||||
### 2. 天级记忆 → MEMORY.md(蒸馏)
|
||||
### 2. Daily Memory → MEMORY.md (Distillation)
|
||||
|
||||
每日总结完成后,Deep Dream 自动执行蒸馏:
|
||||
After the daily summary completes, Deep Dream automatically runs distillation:
|
||||
|
||||
1. **读取材料** — 当前 `MEMORY.md` + 当天的天级记忆
|
||||
2. **LLM 蒸馏** — 去重、合并、修剪、提取新信息
|
||||
3. **覆写 MEMORY.md** — 输出精炼后的长期记忆
|
||||
4. **生成梦境日记** — 记录整理过程的发现和洞察
|
||||
1. **Read materials** — Current `MEMORY.md` + today's daily memory
|
||||
2. **LLM distillation** — Deduplicate, merge, prune, extract new information
|
||||
3. **Overwrite MEMORY.md** — Output the refined long-term memory
|
||||
4. **Generate dream diary** — Record discoveries and insights from the consolidation
|
||||
|
||||
### 3. MEMORY.md 的作用
|
||||
### 3. Role of MEMORY.md
|
||||
|
||||
`MEMORY.md` 会被注入到每次对话的系统提示词中,让 Agent 始终了解用户的偏好、决策和关键事实。因此它必须保持精炼——Deep Dream 会控制在约 30 条以内。
|
||||
`MEMORY.md` is injected into the system prompt for every conversation, keeping the Agent aware of user preferences, decisions, and key facts. Therefore it must stay concise — Deep Dream targets approximately 30 entries or fewer.
|
||||
|
||||
## 蒸馏规则
|
||||
## Distillation Rules
|
||||
|
||||
Deep Dream 遵循以下整理规则:
|
||||
Deep Dream follows these consolidation rules:
|
||||
|
||||
| 操作 | 说明 |
|
||||
| Operation | Description |
|
||||
| --- | --- |
|
||||
| **合并提炼** | 含义相近的多条合并为一条高密度表述 |
|
||||
| **新增萃取** | 从天级记忆中提取偏好、决策、人物、经验等 |
|
||||
| **冲突更新** | 新信息与旧条目矛盾时,以新信息为准 |
|
||||
| **清理无效** | 删除临时性记录、空白条目、格式残留 |
|
||||
| **删除冗余** | 已被更精炼表述涵盖的旧条目删除 |
|
||||
| **Merge & refine** | Combine similar entries into single high-density statements |
|
||||
| **Extract new** | Pull preferences, decisions, people, experiences from daily memory |
|
||||
| **Conflict update** | When new info contradicts old entries, newer info takes precedence |
|
||||
| **Clean invalid** | Remove temporary records, blank entries, formatting artifacts |
|
||||
| **Remove redundancy** | Delete old entries already covered by more refined statements |
|
||||
|
||||
## 梦境日记
|
||||
## Dream Diary
|
||||
|
||||
每次蒸馏会生成一篇梦境日记,保存在 `memory/dreams/YYYY-MM-DD.md`,用叙事风格记录:
|
||||
Each distillation generates a dream diary saved at `memory/dreams/YYYY-MM-DD.md`, written in a narrative style recording:
|
||||
|
||||
- 发现了哪些重复或矛盾
|
||||
- 从天级记忆中提取了什么新洞察
|
||||
- 做了哪些清理和优化
|
||||
- 整体感受和观察
|
||||
- Duplications or contradictions found
|
||||
- New insights extracted from daily memory
|
||||
- Cleanups and optimizations performed
|
||||
- Overall observations
|
||||
|
||||
梦境日记可在 Web 控制台的「记忆管理 → 梦境日记」tab 中查看。
|
||||
Dream diaries can be viewed in the Web console under "Memory → Dream Diary" tab.
|
||||
|
||||
<Frame>
|
||||
<img src="https://cdn.link-ai.tech/doc/20260414110032.png" width="800" />
|
||||
</Frame>
|
||||
|
||||
## 手动触发
|
||||
## Manual Trigger
|
||||
|
||||
除了每日自动执行外,也可以在对话中手动触发:
|
||||
In addition to the automatic daily run, you can manually trigger distillation in chat:
|
||||
|
||||
```text
|
||||
/memory dream [N]
|
||||
```
|
||||
|
||||
- `N`:整理近 N 天的记忆(默认 3 天,最大 30 天)
|
||||
- 蒸馏在后台异步执行,完成后在对话中通知结果
|
||||
- Web 端通知包含可点击链接,直接跳转查看 MEMORY.md 和梦境日记
|
||||
- 无需 Agent 初始化,首次对话前即可使用
|
||||
|
||||
<Frame>
|
||||
<img src="https://cdn.link-ai.tech/doc/20260414120158.png" width="800" />
|
||||
</Frame>
|
||||
- `N`: Consolidate the last N days of memory (default 3, max 30)
|
||||
- Runs asynchronously in the background; you'll be notified in chat when complete
|
||||
- Web notifications include clickable links to view MEMORY.md and dream diary
|
||||
- Works without Agent initialization — can be used before the first conversation
|
||||
|
||||
<Tip>
|
||||
首次部署后可以手动执行一次 `/memory dream 30`,将历史天级记忆全量蒸馏到 MEMORY.md。
|
||||
After first deployment, it's recommended to run `/memory dream 30` once to distill all historical daily memories into MEMORY.md.
|
||||
</Tip>
|
||||
|
||||
## 安全机制
|
||||
## Safety Mechanisms
|
||||
|
||||
| 机制 | 说明 |
|
||||
| Mechanism | Description |
|
||||
| --- | --- |
|
||||
| **无新内容跳过** | 没有天级记忆时不执行蒸馏,避免空覆写 |
|
||||
| **输入去重** | 定时任务中,输入材料未变化时自动跳过 |
|
||||
| **异步执行** | 蒸馏在后台线程运行,不阻塞对话 |
|
||||
| **顺序保证** | 定时任务中,天级 flush 全部完成后才启动蒸馏 |
|
||||
| **禁止编造** | 提示词明确约束只能基于已有材料整理,不得推测或添加 |
|
||||
| **Skip on no content** | Distillation skipped when no daily memory exists, avoiding empty overwrites |
|
||||
| **Input dedup** | In scheduled tasks, automatically skipped when input materials haven't changed |
|
||||
| **Async execution** | Distillation runs in a background thread, never blocking conversation |
|
||||
| **Sequential guarantee** | In scheduled tasks, daily flush completes before distillation starts |
|
||||
| **No fabrication** | Prompt explicitly constrains consolidation to existing materials only |
|
||||
|
||||
Reference in New Issue
Block a user