Files
16gagent/reflections/2026-06-04-memory-audit.md
T
2026-06-06 10:40:48 +08:00

65 lines
2.6 KiB
Markdown
Raw 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.
# Reflection: Memory System Full Audit
> Date: 2026-06-04 | Severity: P0/P1/P2 mixed | Recurrence: 1
## Context
记忆系统全量审计 + 全链路修复。6 维度扫描(文件/远程/版本/自动化/索引/寄存器),P0(5)→P1(5)→P2(4)。
## Pattern Class: Infrastructure Drift
**Root Cause**: 脚本存在 ≠ 脚本在运行。Dream Cycle cron 从未配置,index.md 从未自动更新(15→75 条差距)。
**Fix**: 添加 3 个 cron jobsDream Cycle + Git push + Health check),session-compact.sh 加 pre-compact hook。
**Future Trigger**: any automated maintenance system, any cron-scheduled task, any script that "should run automatically"
**Checklist**:
- [ ] 新脚本添加后立即验证 cron/trigger 是否配置
- [ ] 定期检查 index/registers 的 freshness
- [ ] 引用即承诺——引用未创建的文件要么创建要么删引用
## 成功经验 ✅
### 1. 全量审计方法论
- **先收集后判断**: 不要边查边改。先扫描全部 6 个维度(文件/远程/版本/自动化/索引/寄存器)再排优先级
- **分级修复**: P0(立即)/P1(本周)/P2(长期) 三层划分,避免一锅粥
- **交叉验证**: vault.md vs registers/ 去重分析,用 Python 脚本做交叉检查
### 2. Git 版本控制从零到一
- 先建 .gitignore(排除 175M+14M+19M 大目录)再 git add
- 用 Gitea API 创建仓库(免去 Web UI 操作)
- 单个基线提交覆盖 79 文件,保持 history clean
### 3. vault.md 拆分策略
- 不是"移走",是"精简引用 + 交叉链接"
- 保留决策时间线(WHEN),配置详情移到 registers/WHAT
- 父文件从 206→143 行,回退阈值以下
## 失败教训 ⚠️
### 1. 索引长期不更新
- index.md 从 15→75 条,说明 memory-sync.sh index 从未被 cron 触发过
- **根因**: Dream Cycle cron 未配置,脚本是手动的
- **教训**: 脚本存在 ≠ 自动运行,必须验证 cron 列表
### 2. 注册文件被引用但未创建
- people.md 在 _index.md 引用为"按需创建",但从未被创建
- 引用即承诺,要么创建要么删引用
## 新能力
- `session-compact.sh pre-compact` — 上下文压缩前自动安全检查 + 同步
- 远程服务器健康监控 cron(每 2h,连续 3 次失败告警)
- 记忆审计 playbook(可复用)
## 度量
| 指标 | 修复前 | 修复后 |
|------|--------|--------|
| Git commits | 2 (未推送) | 7 (已推送 Gitea) |
| Cron jobs | 0 | 3 (Dream Cycle + Git push + Health) |
| Index entries | 15 | 75 |
| Registers | 4 | 7 |
| vault.md 行数 | 206 | 146 |
| Daily 覆盖 | 5篇 (缺今日) | 6篇 |