Quick Start
When the user says "record to the memory system" or a similar expression, execute the following process:
- Extract key information - Extract events, decisions, preferences, and emotions from the current session
- Determine the recording level - Determine which level it should be recorded to based on the content type
- Detect repeated patterns - Check whether it is a recurring pattern (3+ times)
- Update files - Update the corresponding memory files
- Suggest distillation - If a repeated pattern is detected, suggest distilling it to a higher level
Workflow
Step 1: Extract key information
Extract from the current session:
- Events: What happened? When did it happen?
- Decisions: What decision was made? What factors were considered?
- Preferences: What likes or dislikes were expressed?
- Emotions: What emotional reactions were there?
- Follow-up actions: What next actions were mentioned?
Step 2: Determine the recording level
Determine the level based on the content type:
L1_Situational Layer(daily records):
- Daily events, conversations
- Important decisions, task completion
- Emotional expression
L2_Behavioral Layer(habits and preferences):
- Preference expressions that appear 3+ times
- Habitual behavior patterns
- Tool usage preferences
L3_Cognitive Layer(thinking patterns):
- Multiple behaviors point to the same principle
- Decision frameworks
- Thinking models
L4_Core Layer(⚠️ can only be modified manually):
- Expression of values
- Life beliefs
- Identity
For detailed judgment rules, see protocol.md
Step 3: Detect repeated patterns
Use Grep to search for keywords:
Grep "关键词" AI_MEMORY/L1_情境层/
Count the number of occurrences. If >= 3 times, suggest distilling to the L2 behavioral layer.
Example:
用户说:"我喜欢用图表而不是大段文字"
执行:Grep "图表" AI_MEMORY/L1_情境层/
结果:发现这是第3次出现
操作:建议记录到 L2_行为层/工作习惯.md
Step 4: Update files
Update the L1_Situational Layer
- Read the current month's file (e.g.,
AI_MEMORY/L1_情境层/2025-12.md) - Add a new entry in the "Record by Date" section
Format:
### {日期}(周X)
#### {事件类型}
- **内容**:{提取的内容}
- **情绪**:{情绪(如有)}
- **后续行动**:{行动(如有)}
- **标签**:`#{标签1} #{标签2}`
Update the L2_Behavioral Layer
If a repeated pattern is detected (3+ times), update the corresponding L2 file:
- Check whether a related file exists (e.g.,
L2_行为层/工作习惯.md) - If it does not exist, create a new file
- Add or update the behavior pattern
Step 5: Suggest distillation
Show the user:
✅ 已记录到 L1_情境层/2025-12.md
💡 检测到这是第{N}次出现"{偏好/行为}",
是否记录到 L2_行为层/{相关文件}.md?
If it involves the L4 core layer (values):
⚠️ 这次对话涉及核心价值观,
建议手动更新 L4_核心层/核心价值观.md
要不要我生成建议内容供你审核?
L4 Core Layer Protection Principles
The L4_Core Layer can only be modified manually by the user
Claude can:
- ✅ Suggest updates
- ✅ Generate suggested content
- ✅ Show current content
Claude must absolutely not:
- ❌ Directly write L4 files
- ❌ Automatically infer values
File structure
See the complete file structure at structure.md
Important paths:
- L1 Context Layer:
AI_MEMORY/L1_情境层/{年}-{月}.md - L2 Behavior Layer:
AI_MEMORY/L2_行为层/ - L3 Cognition Layer:
AI_MEMORY/L3_认知层/ - L4 Core Layer:
AI_MEMORY/L4_核心层/(⚠️ read-only)
Helper scripts
Using scripts/update_memory.py you can:
- Get the current month's file path
- Format L1 entries
- Generate mode check prompts
Examples
Example 1: Recording a decision
用户:"今天我决定采用Claude Code方案来搭建AI记忆系统,
因为它不需要向量数据库,基于现有工具"
执行:
1. 提炼:决策(采用Claude Code)、考虑因素(无需向量DB)、情绪(未表达)
2. 判断:这是重要决策,记录到L1
3. 检查:首次提到此决策
4. 更新:L1_情境层/2025-12.md
5. 输出:✅ 已记录到L1情境层
Example 2: Recording a preference (repeated pattern detected)
用户:"我更喜欢用图表而不是大段文字来解释概念"
执行:
1. 提炼:偏好(图表 > 文字)
2. 判断:偏好表达
3. 检查:Grep "图表" L1_情境层/
4. 结果:发现这是第3次出现
5. 输出:✅ 已记录到L1
💡 这是第3次提到"图表偏好",是否记录到L2?
Example 3: Involving values
用户:"对我来说,成长比赚钱更重要"
执行:
1. 提炼:价值观(成长优先)
2. 判断:涉及L4核心层
3. 输出:⚠️ 这涉及核心价值观
建议手动更新 L4_核心层/核心价值观.md
要不要我生成建议内容?
Frequently asked questions
Q: How do I determine which layer to record to?
A: Refer to the judgment rules in protocol.md .
Q: How do I detect repeated patterns?
A: Use Grep to search for keywords and count the number of occurrences.
Q: Can the L4 Core Layer be updated automatically?
A: No. The L4 Core Layer can only be modified manually by the user; Claude can only make suggestions.