context-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext Manager
上下文管理器
Purpose
目的
Permanent external memory system that compensates for SDAM (no episodic memory). Saves and recalls:
- DECISION: Architectural choices, tech stack selections, design decisions
- BLOCKER: Active obstacles preventing progress
- CONTEXT: Project background, requirements, constraints
- PREFERENCE: User preferences, coding style, patterns
- PROCEDURE: How-to guides, workflows, processes
- NOTE: General information, observations, reminders
For SDAM users: Complete external memory - never forget decisions or context.
For ADHD users: Eliminates decision fatigue - past choices automatically recalled.
For dyschronometria: All memories time-anchored with explicit timestamps.
用于补偿SDAM(无情景记忆)的永久外部记忆系统。可保存并召回以下内容:
- DECISION(决策):架构选择、技术栈选型、设计决策
- BLOCKER(障碍):阻碍进展的当前障碍
- CONTEXT(上下文):项目背景、需求、约束条件
- PREFERENCE(偏好):用户偏好、编码风格、模式
- PROCEDURE(流程):操作指南、工作流、流程步骤
- NOTE(笔记):通用信息、观察结果、提醒事项
针对SDAM用户:完整的外部记忆——再也不会忘记决策或上下文信息。
针对ADHD用户:消除决策疲劳——自动召回过往选择。
针对时间感知障碍用户:所有记忆都带有明确时间戳进行时间锚定。
Activation Triggers
触发条件
- User says: "remember", "save this", "don't forget"
- User asks: "what did we decide", "recall", "search for"
- User mentions: "decision", "blocker", "preference"
- Making important architectural decision (proactive save)
- Encountering obstacle (proactive blocker tracking)
- 用户说出:“记住”、“保存这个”、“别忘了”
- 用户询问:“我们之前决定了什么”、“回忆一下”、“搜索一下”
- 用户提及:“决策”、“障碍”、“偏好”
- 做出重要架构决策时(主动保存)
- 遇到障碍时(主动追踪障碍)
Core Workflow
核心工作流
1. Save Memory
1. 保存记忆
When user says "remember [something]":
Step 1: Classify memory type
DECISION: "remember we're using PostgreSQL"
BLOCKER: "remember I can't access the API yet"
CONTEXT: "remember this is for BOOSTBOX project"
PREFERENCE: "remember I prefer functional components"
PROCEDURE: "remember how to deploy: npm run build then rsync"
NOTE: "remember to update docs after this feature"Step 2: Extract metadata
- Content: The actual memory
- Tags: Auto-generate from keywords (e.g., "PostgreSQL" → ["database", "postgresql", "backend"])
- Project: Infer from current directory or explicit mention
- Timestamp: ISO 8601 format
Step 3: Read current index
bash
undefined当用户说“记住[内容]”时:
步骤1:分类记忆类型
DECISION: "记住我们使用PostgreSQL"
BLOCKER: "记住我还无法访问API"
CONTEXT: "记住这是BOOSTBOX项目的内容"
PREFERENCE: "记住我偏好函数式组件"
PROCEDURE: "记住部署步骤:先运行npm run build再执行rsync"
NOTE: "记住完成这个功能后更新文档"步骤2:提取元数据
- 内容:实际记忆内容
- 标签:从关键词自动生成(例如“PostgreSQL” → ["database", "postgresql", "backend"])
- 项目:从当前目录或明确提及的内容推断
- 时间戳:ISO 8601格式
步骤3:读取当前索引
bash
undefinedCross-platform: Use $HOME (Linux/macOS) or %USERPROFILE% (Windows)
跨平台:Linux/macOS使用$HOME,Windows使用%USERPROFILE%
cat ~/.claude-memories/index.json
cat ~/.claude-memories/index.json
Windows PowerShell alternative:
Windows PowerShell替代命令:
Get-Content "$env:USERPROFILE.claude-memories\index.json"
Get-Content "$env:USERPROFILE.claude-memories\index.json"
**Step 4**: Add to index
```json
{
"version": "1.0.0",
"created": "2025-10-17T17:45:00Z",
"last_updated": "{current_timestamp}",
"total_memories": N + 1,
"memories_by_type": {
"DECISION": X + 1,
...
},
"memories": [
{
"id": "{uuid}",
"type": "DECISION",
"content": "Using PostgreSQL as primary database",
"timestamp": "{current_timestamp}",
"tags": ["database", "postgresql", "backend"],
"project": "boostbox",
"context": {
"file": "{current_file_if_relevant}",
"conversation_id": "{if_available}"
}
},
...existing memories
],
"tags_index": {
"database": ["{uuid1}", "{uuid2}"],
"postgresql": ["{uuid}"]
},
"project_index": {
"boostbox": ["{uuid1}", "{uuid2}"],
"toolhub": ["{uuid3}"]
}
}Step 5: Create detailed memory file
bash
undefined
**步骤4**:添加到索引
```json
{
"version": "1.0.0",
"created": "2025-10-17T17:45:00Z",
"last_updated": "{current_timestamp}",
"total_memories": N + 1,
"memories_by_type": {
"DECISION": X + 1,
...
},
"memories": [
{
"id": "{uuid}",
"type": "DECISION",
"content": "Using PostgreSQL as primary database",
"timestamp": "{current_timestamp}",
"tags": ["database", "postgresql", "backend"],
"project": "boostbox",
"context": {
"file": "{current_file_if_relevant}",
"conversation_id": "{if_available}"
}
},
...existing memories
],
"tags_index": {
"database": ["{uuid1}", "{uuid2}"],
"postgresql": ["{uuid}"]
},
"project_index": {
"boostbox": ["{uuid1}", "{uuid2}"],
"toolhub": ["{uuid3}"]
}
}步骤5:创建详细记忆文件
bash
undefinedSave to category-specific directory
保存到对应类型的目录
Linux/macOS: ~/.claude-memories/decisions/{uuid}.md
Linux/macOS: ~/.claude-memories/decisions/{uuid}.md
Windows: %USERPROFILE%.claude-memories\decisions{uuid}.md
Windows: %USERPROFILE%.claude-memories\decisions{uuid}.md
~/.claude-memories/decisions/{uuid}.md
```markdown~/.claude-memories/decisions/{uuid}.md
```markdownDECISION: Using PostgreSQL
DECISION: Using PostgreSQL
Date: 2025-10-17T17:45:00Z (2 hours ago)
Project: BOOSTBOX
Tags: database, postgresql, backend
日期: 2025-10-17T17:45:00Z (2小时前)
项目: BOOSTBOX
标签: database, postgresql, backend
Decision
决策内容
Using PostgreSQL as primary database instead of MongoDB.
使用PostgreSQL作为主数据库,替代MongoDB。
Rationale
决策依据
{if provided by user or inferred from conversation}
{如果用户提供或从对话中推断}
Context
上下文
{surrounding conversation context}
{对话的相关上下文}
Related Memories
相关记忆
{if any related memories found by tag/project match}
{如果通过标签/项目匹配找到相关记忆}
Last Updated
最后更新时间
2025-10-17T17:45:00Z
**Step 6**: Confirm to user✅ Remembered: Using PostgreSQL as primary database
📁 Saved to: decisions/{uuid}.md
🏷️ Tags: database, postgresql, backend
📊 Total memories: {N+1}
undefined2025-10-17T17:45:00Z
**步骤6**:向用户确认✅ 已记住:使用PostgreSQL作为主数据库
📁 保存至:decisions/{uuid}.md
🏷️ 标签:database, postgresql, backend
📊 总记忆数:{N+1}
undefined2. Recall Memory
2. 召回记忆
When user asks "what did we decide about [topic]":
Step 1: Parse query
- Extract keywords: "decide" → search DECISION type
- Extract topic: "database" → search tags/content
Step 2: Search index
javascript
// Priority order:
1. Exact tag match in requested project
2. Exact tag match in any project
3. Partial content match in requested project
4. Partial content match in any project
// Sort by:
1. Relevance (exact match > partial)
2. Recency (newer > older)
3. Type priority (BLOCKER > DECISION > others)Step 3: Load detailed memory files
bash
undefined当用户询问“我们关于[主题]的决策是什么”时:
步骤1:解析查询
- 提取关键词:“decide” → 搜索DECISION类型
- 提取主题:“database” → 搜索标签/内容
步骤2:搜索索引
javascript
// 优先级顺序:
1. 指定项目中的精确标签匹配
2. 任意项目中的精确标签匹配
3. 指定项目中的部分内容匹配
4. 任意项目中的部分内容匹配
// 排序规则:
1. 相关性(精确匹配 > 部分匹配)
2. 时间远近(最新 > 较旧)
3. 类型优先级(BLOCKER > DECISION > 其他类型)步骤3:加载详细记忆文件
bash
undefinedFor each matching UUID
针对每个匹配的UUID
cat ~/.claude-memories/decisions/{uuid}.md
cat ~/.claude-memories/decisions/{uuid}.md
Windows PowerShell:
Windows PowerShell:
Get-Content "$env:USERPROFILE.claude-memories\decisions{uuid}.md"
Get-Content "$env:USERPROFILE.claude-memories\decisions{uuid}.md"
**Step 4**: Present results🔍 Found 3 memories about "database":
-
DECISION: Using PostgreSQL (2 days ago) 📁 Project: BOOSTBOX 💡 Using PostgreSQL as primary database instead of MongoDB 🔗 decisions/abc-123.md
-
DECISION: Database schema design (5 days ago) 📁 Project: BOOSTBOX 💡 User table with UUID primary keys 🔗 decisions/def-456.md
-
PREFERENCE: Prefer migrations over raw SQL (1 week ago) 📁 All projects 💡 Always use migration files, never direct SQL schema changes 🔗 preferences/ghi-789.md
Would you like details on any of these?
undefined
**步骤4**:展示结果🔍 找到3条关于“database”的记忆:
-
DECISION: Using PostgreSQL(2天前) 📁 项目: BOOSTBOX 💡 使用PostgreSQL作为主数据库替代MongoDB 🔗 decisions/abc-123.md
-
DECISION: Database schema design(5天前) 📁 项目: BOOSTBOX 💡 用户表使用UUID作为主键 🔗 decisions/def-456.md
-
PREFERENCE: Prefer migrations over raw SQL(1周前) 📁 所有项目 💡 始终使用迁移文件,绝不直接修改SQL schema 🔗 preferences/ghi-789.md
需要查看其中任意条目的详细内容吗?
undefined3. Track Blockers
3. 追踪障碍
Auto-detect blockers:
- User says: "I can't", "it won't work", "stuck on"
- Error messages that can't be immediately fixed
- Missing credentials/access
- External dependencies not ready
Proactive save:
🚧 Detected blocker: API credentials not available
Saving as BLOCKER for tracking.
When this is resolved, say "blocker resolved: [brief description]"Blocker resolution:
User: "blocker resolved: got API credentials"
✅ Blocker resolved: API credentials not available
📝 Updated memory with resolution timestamp
⏱️ Blocked for: 2 days 4 hours自动检测障碍:
- 用户说:“我无法”、“这行不通”、“卡在”
- 无法立即修复的错误信息
- 缺少凭证/权限
- 外部依赖未就绪
主动保存:
🚧 检测到障碍:API凭证不可用
将保存为BLOCKER进行追踪。
问题解决后,请说“障碍已解决:[简要描述]”障碍解决:
用户: "障碍已解决:获取到API凭证"
✅ 障碍已解决:API凭证不可用
📝 已更新记忆并添加解决时间戳
⏱️ 持续阻塞时长:2天4小时4. Search Memories
4. 搜索记忆
Support rich queries:
- "search memories for auth" → Full-text search
- "show all blockers" → Filter by type
- "what did we decide this week" → Time-filtered DECISION
- "boostbox decisions" → Project + type filter
- "show preferences" → Type filter
Search syntax:
Basic: "search [topic]"
Type filter: "search decisions about [topic]"
Project filter: "search boostbox [topic]"
Time filter: "search [topic] this week|month|today"
Combined: "search boostbox decisions about database this week"支持丰富的查询方式:
- "search memories for auth" → 全文搜索
- "show all blockers" → 按类型筛选
- "what did we decide this week" → 按时间筛选DECISION
- "boostbox decisions" → 项目+类型筛选
- "show preferences" → 类型筛选
搜索语法:
基础搜索: "search [主题]"
类型筛选: "search decisions about [主题]"
项目筛选: "search boostbox [主题]"
时间筛选: "search [主题] this week|month|today"
组合筛选: "search boostbox decisions about database this week"Memory Types Deep Dive
记忆类型深入解析
DECISION
DECISION(决策)
When to save:
- Tech stack choices ("using React", "chose PostgreSQL")
- Architecture decisions ("microservices vs monolith")
- Design patterns ("using repository pattern")
- Library selections ("using Tailwind CSS")
Structure:
markdown
undefined保存时机:
- 技术栈选择(“使用React”、“选择PostgreSQL”)
- 架构决策(“微服务vs单体架构”)
- 设计模式(“使用仓库模式”)
- 库选型(“使用Tailwind CSS”)
结构:
markdown
undefinedDECISION: {title}
DECISION: {标题}
What we decided
决策内容
{the decision}
{具体决策}
Why
决策原因
{rationale - infer from conversation}
{决策依据——从对话中推断}
Alternatives considered
备选方案
{if discussed}
{如果有讨论过}
Impact
影响范围
{affected areas}
undefined{受影响的领域}
undefinedBLOCKER
BLOCKER(障碍)
When to save:
- Can't access resource (API, database, server)
- Missing dependencies (libraries, services)
- External blockers (waiting on someone)
- Technical issues (bug preventing progress)
Structure:
markdown
undefined保存时机:
- 无法访问资源(API、数据库、服务器)
- 缺少依赖(库、服务)
- 外部障碍(等待他人配合)
- 技术问题(阻碍进展的bug)
结构:
markdown
undefinedBLOCKER: {title}
BLOCKER: {标题}
Issue
问题描述
{what's blocking}
{具体阻塞内容}
Impact
影响
{what can't be done}
{无法进行的工作}
Workarounds tried
已尝试的解决方法
{if any}
{如果有}
Status
状态
Active | Resolved | Bypassed
活跃 | 已解决 | 已绕过
Resolution (when resolved)
解决情况(问题解决后填写)
{how it was fixed}
{timestamp of resolution}
undefined{解决方式}
{解决时间戳}
undefinedCONTEXT
CONTEXT(上下文)
When to save:
- Project background ("this is for BOOSTBOX")
- Requirements ("must support offline mode")
- Constraints ("can't use paid services")
- Business rules ("users can't delete posts")
保存时机:
- 项目背景(“这是BOOSTBOX项目的内容”)
- 需求(“必须支持离线模式”)
- 约束条件(“不能使用付费服务”)
- 业务规则(“用户无法删除帖子”)
PREFERENCE
PREFERENCE(偏好)
When to save:
- Coding style ("prefer const over let")
- File organization ("components in src/components/")
- Testing approach ("always unit test utilities")
- Documentation style ("JSDoc for all public functions")
保存时机:
- 编码风格(“偏好const而非let”)
- 文件组织(“组件放在src/components/目录下”)
- 测试方式(“始终为工具类编写单元测试”)
- 文档风格(“所有公共函数使用JSDoc”)
PROCEDURE
PROCEDURE(流程)
When to save:
- Deployment process
- Build commands
- Testing workflows
- Release checklists
Structure:
markdown
undefined保存时机:
- 部署流程
- 构建命令
- 测试工作流
- 发布检查清单
结构:
markdown
undefinedPROCEDURE: {title}
PROCEDURE: {标题}
When to use
使用场景
{triggering condition}
{触发条件}
Steps
步骤
- {step 1}
- {step 2}
- {step 3}
- {步骤1}
- {步骤2}
- {步骤3}
Expected outcome
预期结果
{what success looks like}
{成功的标志}
Troubleshooting
故障排除
{common issues}
undefined{常见问题}
undefinedNOTE
NOTE(笔记)
When to save:
- General observations
- Reminders
- Ideas for later
- Links to resources
保存时机:
- 通用观察结果
- 提醒事项
- 后续想法
- 资源链接
Time Anchoring (for Dyschronometria)
时间锚定(针对时间感知障碍用户)
Always provide:
- Absolute timestamp: ISO 8601 format
- Relative time: "2 hours ago", "3 days ago", "last Tuesday"
- Context anchor: "Before we added authentication", "After the redesign"
Time utilities:
javascript
function relativeTime(timestamp) {
const now = Date.now();
const then = new Date(timestamp).getTime();
const diff = now - then;
const minutes = Math.floor(diff / 60000);
const hours = Math.floor(diff / 3600000);
const days = Math.floor(diff / 86400000);
if (minutes < 60) return `${minutes} minutes ago`;
if (hours < 24) return `${hours} hours ago`;
if (days < 7) return `${days} days ago`;
if (days < 30) return `${Math.floor(days/7)} weeks ago`;
return `${Math.floor(days/30)} months ago`;
}始终提供:
- 绝对时间戳:ISO 8601格式
- 相对时间:“2小时前”、“3天前”、“上周二”
- 上下文锚点:“在我们添加认证之前”、“重新设计之后”
时间工具函数:
javascript
function relativeTime(timestamp) {
const now = Date.now();
const then = new Date(timestamp).getTime();
const diff = now - then;
const minutes = Math.floor(diff / 60000);
const hours = Math.floor(diff / 3600000);
const days = Math.floor(diff / 86400000);
if (minutes < 60) return `${minutes} minutes ago`;
if (hours < 24) return `${hours} hours ago`;
if (days < 7) return `${days} days ago`;
if (days < 30) return `${Math.floor(days/7)} weeks ago`;
return `${Math.floor(days/30)} months ago`;
}Memory Index Structure
记忆索引结构
Core Index File
核心索引文件
~/.claude-memories/index.json%USERPROFILE%\.claude-memories\index.jsonjson
{
"version": "1.0.0",
"created": "ISO8601",
"last_updated": "ISO8601",
"total_memories": 0,
"memories_by_type": {
"DECISION": 0,
"BLOCKER": 0,
"CONTEXT": 0,
"PREFERENCE": 0,
"PROCEDURE": 0,
"NOTE": 0
},
"memories": [
{
"id": "uuid",
"type": "DECISION|BLOCKER|CONTEXT|PREFERENCE|PROCEDURE|NOTE",
"content": "brief summary",
"timestamp": "ISO8601",
"tags": ["tag1", "tag2"],
"project": "project-name",
"status": "active|resolved|archived",
"context": {
"file": "optional-file-path",
"line": "optional-line-number"
}
}
],
"tags_index": {
"tag-name": ["uuid1", "uuid2"]
},
"project_index": {
"project-name": ["uuid1", "uuid2"]
},
"session_index": {
"session-id": ["uuid1", "uuid2"]
}
}~/.claude-memories/index.json%USERPROFILE%\.claude-memories\index.jsonjson
{
"version": "1.0.0",
"created": "ISO8601",
"last_updated": "ISO8601",
"total_memories": 0,
"memories_by_type": {
"DECISION": 0,
"BLOCKER": 0,
"CONTEXT": 0,
"PREFERENCE": 0,
"PROCEDURE": 0,
"NOTE": 0
},
"memories": [
{
"id": "uuid",
"type": "DECISION|BLOCKER|CONTEXT|PREFERENCE|PROCEDURE|NOTE",
"content": "brief summary",
"timestamp": "ISO8601",
"tags": ["tag1", "tag2"],
"project": "project-name",
"status": "active|resolved|archived",
"context": {
"file": "optional-file-path",
"line": "optional-line-number"
}
}
],
"tags_index": {
"tag-name": ["uuid1", "uuid2"]
},
"project_index": {
"project-name": ["uuid1", "uuid2"]
},
"session_index": {
"session-id": ["uuid1", "uuid2"]
}
}Directory Structure
目录结构
~/.claude-memories/ (Linux/macOS) or %USERPROFILE%\.claude-memories\ (Windows)
├── index.json # Master index
├── decisions/ # Architecture decisions
│ ├── {uuid1}.md
│ └── {uuid2}.md
├── blockers/ # Active/resolved blockers
│ ├── {uuid3}.md
│ └── {uuid4}.md
├── context/ # Project context
│ ├── {uuid5}.md
│ └── {uuid6}.md
├── preferences/ # User preferences
│ ├── {uuid7}.md
│ └── {uuid8}.md
├── procedures/ # How-to procedures
│ ├── {uuid9}.md
│ └── {uuid10}.md
├── notes/ # General notes
│ ├── {uuid11}.md
│ └── {uuid12}.md
├── sessions/ # Session summaries
│ ├── 2025-10-17.md
│ └── 2025-10-16.md
└── backups/ # Daily backups
├── index-2025-10-17.json
└── index-2025-10-16.json~/.claude-memories/ (Linux/macOS) 或 %USERPROFILE%\.claude-memories\ (Windows)
├── index.json # 主索引
├── decisions/ # 架构决策
│ ├── {uuid1}.md
│ └── {uuid2}.md
├── blockers/ # 活跃/已解决的障碍
│ ├── {uuid3}.md
│ └── {uuid4}.md
├── context/ # 项目上下文
│ ├── {uuid5}.md
│ └── {uuid6}.md
├── preferences/ # 用户偏好
│ ├── {uuid7}.md
│ └── {uuid8}.md
├── procedures/ # 操作流程
│ ├── {uuid9}.md
│ └── {uuid10}.md
├── notes/ # 通用笔记
│ ├── {uuid11}.md
│ └── {uuid12}.md
├── sessions/ # 会话摘要
│ ├── 2025-10-17.md
│ └── 2025-10-16.md
└── backups/ # 每日备份
├── index-2025-10-17.json
└── index-2025-10-16.jsonIntegration with Other Skills
与其他技能的集成
Session Launcher
会话启动器
Provides memories for session restoration:
- Recent decisions (last 7 days)
- Active blockers
- Project context
- Session summaries
为会话恢复提供记忆内容:
- 近期决策(过去7天)
- 活跃障碍
- 项目上下文
- 会话摘要
Error Debugger
错误调试器
Searches memories for:
- Similar past errors
- Solutions that worked
- Known blockers
- Relevant procedures
在记忆中搜索:
- 类似的过往错误
- 有效的解决方案
- 已知障碍
- 相关流程
Testing Builder
测试构建器
Recalls preferences:
- Testing style (unit/integration/E2E)
- Coverage requirements
- Test framework choices
- Mocking preferences
召回偏好设置:
- 测试类型(单元/集成/E2E)
- 覆盖率要求
- 测试框架选择
- 模拟偏好
Deployment Orchestrator
部署编排器
Loads procedures:
- Deployment workflows
- Environment configurations
- Rollback procedures
- Checklist items
加载流程内容:
- 部署工作流
- 环境配置
- 回滚流程
- 检查清单项
Proactive Memory Saving
主动保存记忆
Auto-save memories in these situations:
During architecture discussions:
User: "Let's use React for the frontend"
→ Auto-save as DECISION: Using React for frontendWhen encountering blockers:
User: "Can't connect to the API"
→ Auto-save as BLOCKER: API connection failingWhen establishing preferences:
User: "I prefer TypeScript over JavaScript"
→ Auto-save as PREFERENCE: Prefer TypeScriptWhen creating procedures:
User: "To deploy: run npm build then copy to server"
→ Auto-save as PROCEDURE: Deployment processAlways confirm:
💾 Saved as DECISION: Using React for frontend
(say "undo" within 30 seconds to cancel)在以下场景自动保存记忆:
架构讨论期间:
用户: "我们前端用React吧"
→ 自动保存为DECISION: 前端使用React遇到障碍时:
用户: "无法连接到API"
→ 自动保存为BLOCKER: API连接失败设置偏好时:
用户: "我偏好TypeScript而非JavaScript"
→ 自动保存为PREFERENCE: 偏好TypeScript创建流程时:
用户: "部署步骤:先运行npm build再复制到服务器"
→ 自动保存为PROCEDURE: 部署流程始终进行确认:
💾 已保存为DECISION: 前端使用React
(30秒内说“撤销”可取消保存)Backup Strategy
备份策略
Daily backups:
bash
undefined每日备份:
bash
undefinedEvery 24 hours, create backup
每24小时创建一次备份
Linux/macOS:
Linux/macOS:
cp ~/.claude-memories/index.json
~/.claude-memories/backups/index-$(date +%Y-%m-%d).json
~/.claude-memories/backups/index-$(date +%Y-%m-%d).json
cp ~/.claude-memories/index.json
~/.claude-memories/backups/index-$(date +%Y-%m-%d).json
~/.claude-memories/backups/index-$(date +%Y-%m-%d).json
Windows PowerShell:
Windows PowerShell:
Copy-Item "$env:USERPROFILE.claude-memories\index.json" `
Copy-Item "$env:USERPROFILE.claude-memories\index.json" `
"$env:USERPROFILE.claude-memories\backups\index-$(Get-Date -Format 'yyyy-MM-dd').json"
"$env:USERPROFILE.claude-memories\backups\index-$(Get-Date -Format 'yyyy-MM-dd').json"
Keep last 30 days (Linux/macOS):
保留最近30天的备份(Linux/macOS):
find ~/.claude-memories/backups/ -name "index-*.json" -mtime +30 -delete
find ~/.claude-memories/backups/ -name "index-*.json" -mtime +30 -delete
Windows PowerShell:
Windows PowerShell:
Get-ChildItem "$env:USERPROFILE.claude-memories\backups\index-*.json" |
Get-ChildItem "$env:USERPROFILE.claude-memories\backups\index-*.json" |
Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item
Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item
**Corruption recovery**:
```bash
**损坏恢复**:
```bashIf index.json corrupted, restore from backup
如果index.json损坏,从备份恢复
Linux/macOS:
Linux/macOS:
cp ~/.claude-memories/backups/index-$(date -d yesterday +%Y-%m-%d).json
~/.claude-memories/index.json
~/.claude-memories/index.json
cp ~/.claude-memories/backups/index-$(date -d yesterday +%Y-%m-%d).json
~/.claude-memories/index.json
~/.claude-memories/index.json
Windows PowerShell:
Windows PowerShell:
Copy-Item "$env:USERPROFILE.claude-memories\backups\index-$(Get-Date (Get-Date).AddDays(-1) -Format 'yyyy-MM-dd').json" `
Copy-Item "$env:USERPROFILE.claude-memories\backups\index-$(Get-Date (Get-Date).AddDays(-1) -Format 'yyyy-MM-dd').json" `
"$env:USERPROFILE.claude-memories\index.json"
"$env:USERPROFILE.claude-memories\index.json"
undefinedundefinedQuick Reference
快速参考
Common Commands
常用指令
| User Says | Action |
|---|---|
| "remember we're using PostgreSQL" | Save as DECISION |
| "what did we decide about the database" | Search DECISIONs for "database" |
| "show all blockers" | List active BLOCKERs |
| "any blockers?" | Quick blocker check |
| "remember I prefer functional components" | Save as PREFERENCE |
| "search memories for authentication" | Full-text search |
| "blocker resolved: got API key" | Mark blocker as resolved |
| 用户指令 | 操作 |
|---|---|
| "记住我们使用PostgreSQL" | 保存为DECISION |
| "我们关于数据库的决策是什么" | 搜索与“database”相关的DECISION |
| "显示所有障碍" | 列出活跃的BLOCKER |
| "有障碍吗?" | 快速检查障碍 |
| "记住我偏好函数式组件" | 保存为PREFERENCE |
| "搜索记忆中的认证相关内容" | 全文搜索 |
| "障碍已解决:获取到API密钥" | 将障碍标记为已解决 |
File Paths
文件路径
- Index: (Linux/macOS) or
~/.claude-memories/index.json(Windows)%USERPROFILE%\.claude-memories\index.json - Decisions: or
~/.claude-memories/decisions/{uuid}.md%USERPROFILE%\.claude-memories\decisions\{uuid}.md - Blockers: or
~/.claude-memories/blockers/{uuid}.md%USERPROFILE%\.claude-memories\blockers\{uuid}.md - Backups: or
~/.claude-memories/backups/%USERPROFILE%\.claude-memories\backups\
- 索引文件: (Linux/macOS)或
~/.claude-memories/index.json(Windows)%USERPROFILE%\.claude-memories\index.json - 决策文件: 或
~/.claude-memories/decisions/{uuid}.md%USERPROFILE%\.claude-memories\decisions\{uuid}.md - 障碍文件: 或
~/.claude-memories/blockers/{uuid}.md%USERPROFILE%\.claude-memories\blockers\{uuid}.md - 备份目录: 或
~/.claude-memories/backups/%USERPROFILE%\.claude-memories\backups\
Memory Lifecycle
记忆生命周期
- Create: User says "remember" or auto-detected
- Store: Added to index + detailed file created
- Recall: Searched by keywords/tags/type/project
- Update: Can be edited if context changes
- Archive: Old memories archived but never deleted
- 创建: 用户说“记住”或系统自动检测
- 存储: 添加到索引并创建详细文件
- 召回: 通过关键词/标签/类型/项目搜索
- 更新: 上下文变化时可编辑
- 归档: 旧记忆会归档但永不删除
Success Criteria
成功标准
✅ User never has to remember decisions
✅ "What did we decide?" is always answerable
✅ Blockers are tracked automatically
✅ All context is time-anchored
✅ Memory search returns relevant results in <1 second
✅ Zero reliance on user's biological memory
✅ 用户无需再记住决策内容
✅ “我们之前决定了什么?”总能得到答案
✅ 障碍被自动追踪
✅ 所有上下文都带有时间锚定
✅ 记忆搜索在1秒内返回相关结果
✅ 完全不依赖用户的生理记忆