Memory Architecture
Design memory as a system, not a bucket.
Core stance
Optimize for:
- 1. truthful retrieval
- low token cost
- clear boundaries
- maintainable long-horizon continuity
- project isolation where needed
Do not default to "store more and search later." First decide what kind of memory something is.
The five-layer model
Use these layers consistently:
- 1. Hot canon
- Small, frequently loaded, cross-session truths.
- Identity, preferences, standing doctrine, current priorities, compact cross-project lessons.
- Keep it aggressively bounded.
- 2. Durable topic doctrine
- Stable architecture notes, decisions, playbooks, operating rules, and domain context.
- More detailed than hot canon, but still curated.
- 3. Project-scoped working memory
- Raw or evolving material tied to one initiative.
- Research notes, migration plans, transcripts, experiment outputs, snapshots.
- Promote only distilled lessons upward.
- 4. Episodic logs
- What happened today or in a specific work session.
- Events, observations, intermediate findings, next steps.
- Default landing zone for fresh information.
- 5. Generated live summaries
- Rebuildable operator read models for current state.
- Queue views, alerts, health snapshots, status summaries, compact log digests.
- Treat as derived state, not durable canon.
Memory classification rule
Before writing memory, classify the item:
- - Cross-cutting durable truth → hot canon
- Durable but detailed rule / doctrine / architecture → topic doc
- Project-bound raw or changing context → project memory
- Fresh event or observation → episodic log
- Current operational snapshot → generated summary only
If uncertain, bias downward:
- - daily/project first
- promote later
- avoid prematurely canonizing noise
Promotion / demotion flow
Use this ladder:
- - fresh event → episodic log or project artifact
- repeated / stable lesson → topic doc
- hottest compact cross-cutting truth → hot canon
- volatile state → generated summary
- stale bulky detail → keep in project/archive, not hot canon
Truthfulness rules
Never let memory blur these categories:
- - durable truth
- project-specific context
- current live status
- historical event log
- derived summary
Do not promote temporary red/yellow/green conditions, queue counts, disk snapshots, or stale alerts into canon unless they reveal a durable rule.
Retrieval policy
Retrieve in this order:
- 1. hot canon
- compact index/selector
- relevant topic docs
- project memory only if the task is project-specific
- generated summaries before raw logs for live-state questions
- raw logs only when summary is insufficient or needs verification
- episodic logs only when recent event history matters
The goal is not maximum recall. The goal is the right recall.
Comparison frame
When comparing layered memory against generic persistent-memory tools, use this lens:
Generic persistent-memory systems usually optimize for:
- - saving more facts
- retrieving facts later
- one-store convenience
- simple demo value
Layered memory systems optimize for:
- - memory boundaries
- retrieval trust
- token hygiene
- long-term maintainability
- project isolation
- separation of canon vs live state
Use this summary line:
- - "Persistent memory is a feature. Memory architecture is a system."
If needed, read references/scorecard.md for a compact comparison rubric.
Anti-patterns
Flag these quickly:
- - one giant memory blob with weak boundaries
- logs and durable truths mixed together
- live status stored as long-term canon
- duplicated facts across layers without summary/detail distinction
- always-append workflows with no dedupe or demotion
- semantic search over stale and current facts without authority separation
- project details contaminating global memory
Output patterns
For comparisons or teaching material, prefer one of these structures:
- - scorecard: category-by-category ratings and winners
- analogy: bucket/backpack vs compartments/ship
- thesis: "remember more" vs "remember the right things in the right places"
- migration plan: how to move from blob memory to layered memory
Use bundled references only when needed
- - Read
references/scorecard.md when preparing a digestible comparison, talk track, or publishable rubric. - Read
references/migration-pattern.md when helping someone convert an existing persistent-memory setup into a layered one. - Read
references/layout-template.md when the user wants a concrete starter structure for implementing layered memory in a workspace. - Read
references/audit-checklist.md when the user wants a repeatable audit of an existing memory setup instead of a high-level philosophy discussion. - Read
references/classifier-pattern.md when the user wants a lightweight routing rule for deciding where fresh information belongs. - Read
references/promotion-trigger-pattern.md when the user wants a safe promotion model for moving notes upward over time. - Read
references/summary-generator-pattern.md when the user wants live-state summaries that remain derived and rebuildable rather than polluting canon.
Reliability rules
- - Prefer the smallest useful memory change over a total rewrite.
- Do not invent hidden automation or magical persistence claims.
- Keep implementation recommendations explicit about which layer is authoritative.
- If offering migration advice, separate immediate low-risk fixes from optional later refinements.
- If the user wants operational memory, keep generated summaries distinct from canon.
- Treat lightweight automations as helpers that nominate or summarize, not as silent canon-writing authorities.
Keep the explanation compact unless the user explicitly wants a deep comparison.
内存架构
将内存设计为一个系统,而非一个桶。
核心立场
优化目标:
- 1. 真实检索
- 低令牌成本
- 清晰边界
- 可维护的长期连续性
- 必要时实现项目隔离
不要默认采用“先存储更多,之后再搜索”的策略。首先确定某信息属于何种内存类型。
五层模型
持续使用以下层级:
- 1. 热典
- 小型、频繁加载、跨会话的真理。
- 身份、偏好、既定原则、当前优先级、紧凑的跨项目经验教训。
- 严格限制其规模。
- 2. 持久主题原则
- 稳定的架构笔记、决策、行动手册、操作规则和领域上下文。
- 比热典更详细,但仍经过精炼。
- 3. 项目范围工作内存
- 与单个项目相关的原始或演进中的材料。
- 研究笔记、迁移计划、转录稿、实验输出、快照。
- 仅将提炼后的经验教训向上提升。
- 4. 事件日志
- 今天或特定工作会话中发生的事情。
- 事件、观察、中间发现、后续步骤。
- 新信息的默认着陆区。
- 5. 生成的实时摘要
- 针对当前状态的可重建操作者读取模型。
- 队列视图、告警、健康快照、状态摘要、紧凑的日志摘要。
- 视为派生状态,而非持久典藏。
内存分类规则
在写入内存前,对条目进行分类:
- - 跨领域的持久真理 → 热典
- 持久但详细的规则/原则/架构 → 主题文档
- 项目绑定的原始或变化中的上下文 → 项目内存
- 新事件或观察 → 事件日志
- 当前操作快照 → 仅生成摘要
如果不确定,优先向下归类:
- - 先归入日常/项目
- 后续再提升
- 避免过早将噪音典藏化
提升/降级流程
使用以下阶梯:
- - 新事件 → 事件日志或项目产物
- 重复/稳定的经验教训 → 主题文档
- 最热门的紧凑跨领域真理 → 热典
- 易变状态 → 生成摘要
- 过时的大篇幅细节 → 保留在项目/归档中,而非热典
真实性规则
绝不让内存模糊以下类别:
- - 持久真理
- 项目特定上下文
- 当前实时状态
- 历史事件日志
- 派生摘要
不要将临时的红/黄/绿状态、队列计数、磁盘快照或过时告警提升为典藏,除非它们揭示了一条持久规则。
检索策略
按以下顺序检索:
- 1. 热典
- 紧凑索引/选择器
- 相关主题文档
- 仅当任务为项目特定时才检索项目内存
- 针对实时状态问题,先检索生成摘要,再检索原始日志
- 仅当摘要不足或需要验证时才检索原始日志
- 仅当近期事件历史重要时才检索事件日志
目标不是最大召回。目标是正确的召回。
对比框架
在将分层内存与通用持久内存工具进行比较时,使用以下视角:
通用持久内存系统通常优化:
- - 保存更多事实
- 后续检索事实
- 单一存储的便利性
- 简单的演示价值
分层内存系统优化:
- - 内存边界
- 检索可信度
- 令牌卫生
- 长期可维护性
- 项目隔离
- 典藏与实时状态的分离
使用以下总结语:
如有需要,可阅读 references/scorecard.md 获取紧凑的对比评分标准。
反模式
快速标记以下情况:
- - 一个巨大的内存块,边界模糊
- 日志与持久真理混杂在一起
- 实时状态存储为长期典藏
- 各层之间事实重复,没有摘要/细节区分
- 始终追加的工作流,无去重或降级
- 对过时和当前事实进行语义搜索,无权威性分离
- 项目细节污染全局内存
输出模式
对于比较或教学材料,优先采用以下结构之一:
- - 评分卡:按类别逐项评分并给出胜出者
- 类比:桶/背包 vs 隔间/船舶
- 论点:“记住更多” vs “在正确的位置记住正确的事情”
- 迁移计划:如何从块状内存迁移到分层内存
仅在需要时使用捆绑参考
- - 当准备易于理解的比较、讲解内容或可发布的评分标准时,阅读 references/scorecard.md。
- 当帮助某人将现有持久内存设置转换为分层设置时,阅读 references/migration-pattern.md。
- 当用户想要一个在工作空间中实现分层内存的具体起始结构时,阅读 references/layout-template.md。
- 当用户希望对现有内存设置进行可重复的审计,而非进行高层哲学讨论时,阅读 references/audit-checklist.md。
- 当用户想要一个轻量级路由规则来决定新信息归属时,阅读 references/classifier-pattern.md。
- 当用户想要一个安全的提升模型来随时间推移向上移动笔记时,阅读 references/promotion-trigger-pattern.md。
- 当用户想要保持派生且可重建的实时状态摘要,而非污染典藏时,阅读 references/summary-generator-pattern.md。
可靠性规则
- - 优先选择最小有用的内存变更,而非完全重写。
- 不要编造隐藏的自动化或神奇持久性声明。
- 保持实现建议明确说明哪个层级具有权威性。
- 如果提供迁移建议,将立即的低风险修复与可选的后续优化分开。
- 如果用户想要操作内存,保持生成的摘要与典藏区分。
- 将轻量级自动化视为提名或总结的助手,而非静默的典藏写入权威。
除非用户明确想要深入比较,否则保持解释紧凑。