Files
HomeAgent/internal/plugins/skillmgr/builtin/kernel-memory/SKILL.md
JianFeeeee b850feaef2 feat: 段页式记忆流转、coldcontext 重命名与安全治理
记忆层:
- MemoryBlock 承载 FrameTS/PageSeq/PageKind/BlockRole/CallID
- coldcontext 归档与回填按完整页传递,工具调用参数和配对键不丢失
- 召回先估算总 token,超预算时按全局页相似度标记 inactive
- inactive 仅是 context 渲染期状态,不落盘、不进入 coldcontext,Prune 后重置
- Peek/确认/Remove 两阶段召回,失败保留冷上下文副本
- stablemem 记录 last_recalled_at,删块连带清理边

命名:
- internal/memory/document → internal/memory/coldcontext
- Doc/DocEvent/DocHit → ColdDoc/ColdEvent/ColdHit
- ContextToColdContext/RecentColdContexts/FindColdContexts
- 保留既有 JSON 标签、doc_ 文件前缀与 doc_count 状态键,兼容存量数据

安全治理:
- 工具策略门禁、安全配置、事件总线发布者身份与入站脱敏
- 声明式 SecurityAPI 与 QQ owner/guest profile
- 日志保留策略与相关 e2e/回归判据

验证:go build ./...、go vet ./...、go test ./...(62 包);
生产副本 e2e:7013 块迁移后 ID/向量/指纹 0 变化、0 缺失。
2026-10-29 23:53:48 +08:00

38 lines
1.3 KiB
Markdown

---
name: kernel-memory
description: Where past turns and facts live; read before recalling old context.
version: 1.0.0
---
# Memory layers
Four stores, one rule each:
- **Conversation timeline (L1)** - recent turns. Already in your context; just read it.
- **History (L2)** - older turns that left the window. Their full text still exists.
- **Graph memory (L3)** - facts and relations: who is what, the current value of something.
- **Knowledge** - written, reusable documents.
## Retrieving
| Need | Tool |
|---|---|
| A past episode in full | `coldcontext_query` |
| A fact or relation | `stablemem_recall` |
| Written reference material | `knowledge_search` |
### `coldcontext_query` semantics (read this before using it)
It does **not** return a summary you can reason from directly. It **re-inserts the matched
events into your conversation timeline at their original timestamps**. After the call,
read that section of the timeline; the return value only lists time / source / opening line.
Retrieval is **consuming**: a document served from L2 is removed from L2. If you need it
again later, it lives on in the timeline until pruning moves it back.
## Writing
- Facts worth keeping: `stablemem_commit` (triples).
- Written knowledge: `knowledge_write`.
- Do not commit transient chatter, tool output, or your own status lines.