Files
2026-06-06 10:40:48 +08:00

102 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 记忆系统审计 Playbook
> 可复用操作手册。当需要全量检查记忆系统健康状态时按此流程执行。
## 触发条件
- 每 2 周例行审计
- 记忆搜索异常时
- 发现 git 未推送时
- MEMORY.md 或 vault.md 超过阈值时
## Phase 1: 数据收集 (Collect)
### 1.1 文件系统
```bash
find memory -type f -name '*.md' | sort
du -sh memory/
find memory -type f -name '*.md' -exec ls -lt {} + | head -15
```
### 1.2 Git 状态
```bash
git remote -v
git status --short
git log --oneline -5
```
### 1.3 远程同步
```bash
curl -s --max-time 5 http://111.229.145.18/api/v2/stats
bash scripts/memory-sync.sh check
```
### 1.4 自动化
```bash
# 检查 cron 列表 (通过 cron tool)
# 验证 dream-cycle 上次运行
cat memory/.dream-cycle-last-run
```
## Phase 2: 诊断 (Diagnose)
### 2.1 版本控制
- [ ] git remote 是否存在?
- [ ] .gitignore 是否存在?
- [ ] 最后一次 push 是否在 24h 内?
### 2.2 索引时效
- [ ] `grep -c '^- ' memory/index.md` vs 实际文件数
- [ ] index.md 是否遗漏 project/daily
### 2.3 文件健康
- [ ] MEMORY.md 是否 < 200 行?
- [ ] vault.md 是否 < 200 行?
- [ ] daily/ 是否有连续空缺 > 1 天?
### 2.4 寄存器健康
- [ ] _index.md 引用与实际文件一致?
- [ ] 是否有被引用但未创建的文件?
### 2.5 去重检查
```python
# 交叉分析 vault.md 决策 vs registers/ 内容
keywords = ['工具','服务','配置','偏好','规则']
# 同一条信息不应同时出现在两个寄存器中
```
## Phase 3: 修复 (Fix)
### 分级策略
| 级别 | 标准 | 示例 |
|------|------|------|
| P0 🔴 | 数据可能丢失、自动化断链 | 无 git remote、cron 缺失 |
| P1 🟡 | 影响效率、信息不一致 | 索引过时、vault 超限 |
| P2 🟢 | 预防性改进 | 去重检查、演化目录充实 |
### 修复后验证
```bash
bash scripts/memory-sync.sh check
bash scripts/memory-sync.sh index
git push origin main
```
## Phase 4: 沉淀 (Internalize)
1. 写 reflection → `reflections/YYYY-MM-DD-memory-audit.md`
2. 更新本 playbook(如有新发现)
3. 更新 companion-log(如有伙伴参与)
4. 记录到今天的 daily/
## 快速健康评分公式
```
f = 最近 daily 日期距离今天的天数
c = registers/ 更新率 (30天内更新数/总数)
e = vault.md 行数 (>200行扣分)
r = git push 24h内? (是=100, 否=0)
s = 远程服务器在线? (是=100, 否=0)
health = f*25 + c*25 + e*20 + r*15 + s*15
```