Session Memory (MANDATORY)
会话内存(强制要求)
EVERY WORKFLOW MUST:
1. LOAD memory at START (and before key decisions)
2. UPDATE memory at END (and after learnings/decisions)
Brevity Rule: Memory is an index, not a document. Be brief—one line per item.
EVERY WORKFLOW MUST:
1. LOAD memory at START (and before key decisions)
2. UPDATE memory at END (and after learnings/decisions)
简洁原则: 内存是索引,而非文档。内容需简洁——每项仅用一行。
What “Memory” Actually Is (The Guts)
“内存”的实际定义(核心内容)
CC10x memory is a small, stable, permission-free Markdown database used for:
- Continuity: survive compaction/session resets
- Consistency: avoid contradicting prior decisions
- Compounding: promote learnings into reusable patterns
- Resumability: recover where a workflow stopped
CC10x内存是一个小型、稳定、无需权限的Markdown数据库,用于:
- 连续性: 在会话压缩/重置后仍能保留上下文
- 一致性: 避免与之前的决策产生冲突
- 复合性: 将经验转化为可复用的模式
- 可恢复性: 从工作流中断处继续推进
Memory Surfaces (Types)
内存层面(类型)
- Index / Working Memory:
.claude/cc10x/activeContext.md
- “What matters right now”: focus, next steps, active decisions, learnings
- Links to durable artifacts (plans/research)
- Long-Term Project Memory:
.claude/cc10x/patterns.md
- Conventions, architecture decisions, common gotchas, reusable solutions
- Progress + Evidence Memory:
.claude/cc10x/progress.md
- What’s done/remaining + verification evidence (commands + exit codes)
- Artifact Memory (Durable): ,
- The details. Memory files are the index.
- Tasks (Execution State): Claude Code Tasks
- Great for orchestration, but not guaranteed to be the only durable source.
- Mirror key task subjects/status into for backup/resume.
- 索引/工作内存:
.claude/cc10x/activeContext.md
- “当前重要事项”:工作重点、下一步计划、当前决策、经验总结
- 链接到持久化工件(计划/研究文档)
- 长期项目内存:
.claude/cc10x/patterns.md
- 进度与证据内存:
.claude/cc10x/progress.md
- 已完成/剩余工作 + 验证证据(命令 + 退出码)
- 工件内存(持久化):,
- 任务(执行状态):Claude Code Tasks
- 非常适合编排,但不保证是唯一的持久化来源。
- 将关键任务主题/状态镜像到中,用于备份/恢复。
Promotion Ladder (“Rises To”)
晋升阶梯(“升级至”)
Information “graduates” to more durable layers:
- One-off observation → (Learnings / Recent Changes)
- Repeated or reusable → (Pattern / Gotcha)
- Needs detail → or + link from
- Proven → (Verification Evidence)
信息会“升级”到更持久的层级:
- 一次性观察结果 → (经验总结 / 近期变更)
- 可重复或可复用内容 → (模式 / 陷阱)
- 需要详细记录的内容 → 或 + 从添加链接
- 已验证内容 → (验证证据)
READ Side (Equally Important)
读取侧(同样重要)
If memory is not loaded: You work blind, repeat mistakes, lose context.
If decisions made without checking memory: You contradict prior choices, waste effort.
如果未加载内存: 你将在无上下文的情况下工作,重复犯错,丢失关键信息。
如果未检查内存就做出决策: 你将与之前的选择冲突,浪费精力。
If memory is not updated: Next session loses everything learned.
If learnings not recorded: Same mistakes will be repeated.
BOTH SIDES ARE NON-NEGOTIABLE.
如果未更新内存: 下一次会话将丢失所有已学习的内容。
如果未记录经验: 会重复犯同样的错误。
两侧操作均为强制要求,无例外。
Permission-Free Operations (CRITICAL)
无需权限的操作(关键)
ALL memory operations are PERMISSION-FREE using the correct tools.
| Operation | Tool | Permission |
|---|
| Create memory directory | Bash(command="mkdir -p .claude/cc10x")
| FREE |
| Read memory files | Read(file_path=".claude/cc10x/activeContext.md")
| FREE |
| Create NEW memory file | Write(file_path="...", content="...")
| FREE (file doesn't exist) |
| Update EXISTING memory | Edit(file_path="...", old_string="...", new_string="...")
| FREE |
| Save plan/design files | Write(file_path="docs/plans/...", content="...")
| FREE |
使用正确工具时,所有内存操作均无需权限。
| 操作 | 工具 | 权限要求 |
|---|
| 创建内存目录 | Bash(command="mkdir -p .claude/cc10x")
| 无需权限 |
| 读取内存文件 | Read(file_path=".claude/cc10x/activeContext.md")
| 无需权限 |
| 创建新内存文件 | Write(file_path="...", content="...")
| 无需权限(文件不存在时) |
| 更新已有内存 | Edit(file_path="...", old_string="...", new_string="...")
| 无需权限 |
| 保存计划/设计文件 | Write(file_path="docs/plans/...", content="...")
| 无需权限 |
CRITICAL: Write vs Edit
关键:Write与Edit的区别
| Tool | Use For | Asks Permission? |
|---|
| Write | Creating NEW files | NO (if file doesn't exist) |
| Write | Overwriting existing files | YES - asks "Do you want to overwrite?" |
| Edit | Updating existing files | NO - always permission-free |
RULE: Use Write for NEW files, Edit for UPDATES.
| 工具 | 使用场景 | 是否需要申请权限? |
|---|
| Write | 创建新文件 | 否(文件不存在时) |
| Write | 覆盖已有文件 | 是 - 会询问“是否要覆盖?” |
| Edit | 更新已有文件 | 否 - 始终无需权限 |
规则:使用Write创建新文件,使用Edit更新已有文件。
CRITICAL: Use Read Tool, NOT Bash(cat)
关键:使用Read工具,而非Bash(cat)
NEVER use Bash compound commands (
) - they ASK PERMISSION.
ALWAYS use Read tool for reading files - it's PERMISSION-FREE.
切勿使用Bash复合命令(
)- 这些命令会申请权限。
始终使用Read工具读取文件 - 无需权限。
WRONG (asks permission - compound Bash command)
错误示例(会申请权限 - 复合Bash命令)
mkdir -p .claude/cc10x && cat .claude/cc10x/activeContext.md
mkdir -p .claude/cc10x && cat .claude/cc10x/activeContext.md
RIGHT (permission-free - separate tools)
正确示例(无需权限 - 单独使用工具)
Bash(command="mkdir -p .claude/cc10x")
Read(file_path=".claude/cc10x/activeContext.md")
**NEVER use heredoc writes** (`cat > file << 'EOF'`) - they ASK PERMISSION.
**Use Write for NEW files, Edit for EXISTING files.**
Bash(command="mkdir -p .claude/cc10x")
Read(file_path=".claude/cc10x/activeContext.md")
**切勿使用here-doc写入**(`cat > file << 'EOF'`)- 这些命令会申请权限。
**使用Write创建新文件,使用Edit更新已有文件。**
WRONG (asks permission - heredoc)
错误示例(会申请权限 - here-doc)
cat > .claude/cc10x/activeContext.md << 'EOF'
content here
EOF
cat > .claude/cc10x/activeContext.md << 'EOF'
content here
EOF
RIGHT for NEW files (permission-free)
正确创建新文件方式(无需权限)
Write(file_path=".claude/cc10x/activeContext.md", content="content here")
Write(file_path=".claude/cc10x/activeContext.md", content="content here")
RIGHT for EXISTING files (permission-free)
正确更新已有文件方式(无需权限)
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="# Active Context",
new_string="# Active Context\n\n[new content]")
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="# Active Context",
new_string="# Active Context\n\n[new content]")
"My memory resets between sessions. The Memory Bank is my ONLY link to previous work."
Without memory persistence:
- Context lost on conversation compaction
- Patterns relearned from scratch
- Decisions forgotten and remade differently
- Progress tracking lost
- Same mistakes repeated
Memory is the difference between an expert who learns and a novice who forgets.
“我的内存在会话之间会重置。内存库是我与之前工作的唯一连接。”
没有内存持久化:
- 会话压缩后丢失上下文
- 模式需要从头重新学习
- 决策被遗忘并重新做出不同的选择
- 进度跟踪丢失
- 重复犯同样的错误
内存是会学习的专家和会遗忘的新手之间的区别。
.claude/
└── cc10x/
├── activeContext.md # Current focus + learnings + decisions (MOST IMPORTANT)
├── patterns.md # Project patterns, conventions, gotchas
└── progress.md # What works, what's left, verification evidence
.claude/
└── cc10x/
├── activeContext.md # 当前重点 + 经验总结 + 决策(最重要)
├── patterns.md # 项目模式、约定规范、常见陷阱
└── progress.md # 已完成工作、剩余工作、验证证据
Who Reads/Writes Memory (Ownership)
谁读取/写入内存(所有权)
- Router (always): loads all 3 files before workflow selection and before resuming Tasks.
- WRITE agents (component-builder, bug-investigator, planner): load memory files at task start via this skill.
- READ-ONLY agents (code-reviewer, silent-failure-hunter, integration-verifier): receive memory summary in prompt, do NOT load this skill.
- Router(始终): 在选择工作流和恢复任务前加载所有3个文件。
- 写入型Agent(组件构建器、错误调查员、规划师):通过本技能在任务开始时加载内存文件。
- 只读型Agent(代码审查员、静默故障排查员、集成验证员):在提示中接收内存摘要,无需加载本技能。
- WRITE agents: update memory directly at task end using + verify pattern.
- READ-ONLY agents: output
### Memory Notes (For Workflow-Final Persistence)
section. The task-enforced "CC10X Memory Update" task ensures these are persisted.
- 写入型Agent: 在任务结束时直接使用 + 验证模式来更新内存。
- 只读型Agent: 输出
### Memory Notes (For Workflow-Final Persistence)
部分。任务强制执行的“CC10X Memory Update”任务会确保这些内容被持久化。
Concurrency Rule (Parallel Phases)
并发规则(并行阶段)
BUILD runs
code-reviewer ∥ silent-failure-hunter
in parallel. To avoid conflicting edits:
- Prefer no memory edits during parallel phases.
- If you must persist something mid-parallel, only the main assistant should do it, and only after both parallel tasks complete.
BUILD阶段会并行运行
code-reviewer ∥ silent-failure-hunter
。为避免冲突编辑:
- 并行阶段优先不编辑内存。
- 如果必须在并行过程中持久化某些内容,仅由主助理执行,且仅在两个并行任务完成后进行。
Pre-Compaction Memory Safety
压缩前的内存安全
Update memory IMMEDIATELY when you notice:
- Extended debugging (5+ cycles)
- Long planning discussions
- Multi-file refactoring
- 30+ tool calls in session
Checkpoint Pattern:
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Current Focus",
new_string="## Current Focus\n\n[Updated focus + key decisions]")
Read(file_path=".claude/cc10x/activeContext.md") # Verify
Rule: When in doubt, update memory NOW. Better duplicate entries than lost context.
当你注意到以下情况时,立即更新内存:
- 长时间调试(5个循环以上)
- 长时间规划讨论
- 多文件重构
- 会话中工具调用超过30次
检查点模式:
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Current Focus",
new_string="## Current Focus\n\n[Updated focus + key decisions]")
Read(file_path=".claude/cc10x/activeContext.md") # 验证
规则: 如有疑问,立即更新内存。重复条目总比丢失上下文好。
Use these purposes to decide where information belongs:
- activeContext.md: current state + pointers (what we’re doing, why, what’s next)
- patterns.md: reusable knowledge (conventions, architecture, gotchas, “do it this way here”)
- progress.md: execution tracking + hard evidence (tests/build/run commands, exit codes, scenario tables)
根据以下用途决定信息的存放位置:
- activeContext.md: 当前状态 + 指针(我们正在做什么、原因、下一步计划)
- patterns.md: 可复用知识(约定规范、架构、常见陷阱、“此处应这样做”)
- progress.md: 执行跟踪 + 确凿证据(测试/构建/运行命令、退出码、场景表)
Memory File Contract (Never Break)
内存文件契约(切勿违反)
CC10x memory files are not "notes" - they are contracts used as Edit anchors.
Hard rules:
- Do not rename the top-level headers (, , ).
- Do not rename section headers (e.g., , ).
- Only add content inside existing sections (append lists/rows).
- If a canonical section from this template is missing (e.g., , , ), add it by inserting it just above .
- After every , Read back the file and confirm the intended change exists.
If an Edit does not apply cleanly:
- STOP (do not guess).
- Re-read the file and re-apply using a correct, exact anchor.
CC10x内存文件不是“笔记”——它们是契约,用作Edit的锚点。
严格规则:
- 请勿重命名顶级标题(、、)。
- 请勿重命名章节标题(例如、)。
- 仅在现有章节内添加内容(追加列表/行)。
- 如果本模板中的标准章节缺失(例如、、),请将其插入到上方。
- 每次执行后,重新读取文件并确认预期的更改已存在。
如果Edit无法正常应用:
- 停止操作(不要猜测)。
- 重新读取文件,使用正确、精确的锚点重新应用。
activeContext.md (Read/Write EVERY session)
activeContext.md(每次会话都要读取/写入)
Current state of work - ALWAYS check this first:
Active Context
Active Context
<!-- CC10X: Do not rename headings. Used as Edit anchors. -->
<!-- CC10X: Do not rename headings. Used as Edit anchors. -->
Current Focus
Current Focus
Recent Changes
Recent Changes
- [Change] - [file:line]
- [DEBUG-N]: {what was tried} → {result} <!-- Use for debug workflow -->
- [Change] - [file:line]
- [DEBUG-N]: {what was tried} → {result} <!-- Use for debug workflow -->
- [Decision]: [Choice] - [Why]
- [Decision]: [Choice] - [Why]
- Plan: (or N/A)
- Design: (or N/A)
- Research: → [insight]
- Plan: (or N/A)
- Design: (or N/A)
- Research: → [insight]
[timestamp]
**Merged sections:**
- `## Active Decisions` + `## Learnings This Session` → `## Decisions` + `## Learnings`
- `## Plan Reference` + `## Design Reference` + `## Research References` → `## References`
- Removed: `## User Preferences Discovered` (goes in Learnings)
[timestamp]
**合并的章节:**
- `## Active Decisions` + `## Learnings This Session` → `## Decisions` + `## Learnings`
- `## Plan Reference` + `## Design Reference` + `## Research References` → `## References`
- 移除:`## User Preferences Discovered`(归入Learnings)
patterns.md (Accumulates over time)
patterns.md(随时间积累)
Project-specific knowledge that persists:
Project Patterns
Project Patterns
<!-- CC10X MEMORY CONTRACT: Do not rename headings. Used as Edit anchors. -->
<!-- CC10X MEMORY CONTRACT: Do not rename headings. Used as Edit anchors. -->
Architecture Patterns
Architecture Patterns
- [Pattern]: [How this project implements it]
- [Pattern]: [How this project implements it]
Code Conventions
Code Conventions
File Structure
File Structure
- [File type]: [Where it goes, naming convention]
- [File type]: [Where it goes, naming convention]
Testing Patterns
Testing Patterns
- [Test type]: [How to write, where to put]
- [Test type]: [How to write, where to put]
Common Gotchas
Common Gotchas
- [Gotcha]: [How to avoid / solution]
- [Gotcha]: [How to avoid / solution]
- [Endpoint pattern]: [Convention used]
- [Endpoint pattern]: [Convention used]
Error Handling
Error Handling
- [Error type]: [How project handles it]
- [Error type]: [How project handles it]
- [Dependency]: [Why used, how configured]
- [Dependency]: [Why used, how configured]
progress.md (Tracks completion)
progress.md(跟踪完成情况)
Progress Tracking
Progress Tracking
<!-- CC10X: Do not rename headings. Used as Edit anchors. -->
<!-- CC10X: Do not rename headings. Used as Edit anchors. -->
Current Workflow
Current Workflow
[PLAN | BUILD | REVIEW | DEBUG]
[PLAN | BUILD | REVIEW | DEBUG]
[timestamp]
**Merged sections:**
- `## Active Workflow Tasks` + `## In Progress` + `## Remaining` → `## Tasks`
- `## Verification Evidence` table → `## Verification` bullets
- Removed: `## Known Issues`, `## Evolution of Decisions`, `## Implementation Results` (rarely used, clutters template)
[timestamp]
**合并的章节:**
- `## Active Workflow Tasks` + `## In Progress` + `## Remaining` → `## Tasks`
- `## Verification Evidence`表格 → `## Verification`项目符号
- 移除:`## Known Issues`、`## Evolution of Decisions`、`## Implementation Results`(很少使用,会使模板杂乱)
Stable Anchors (ONLY use these)
稳定锚点(仅使用这些)
| Anchor | File | Stability |
|---|
| activeContext | GUARANTEED |
| activeContext | GUARANTEED |
| activeContext | GUARANTEED |
| all files | GUARANTEED (fallback) |
| patterns | GUARANTEED |
| progress | GUARANTEED |
| progress | GUARANTEED |
NEVER use as anchors:
- Table headers ()
- Checkbox text ()
- Optional sections that may not exist
| 锚点 | 文件 | 稳定性 |
|---|
| activeContext | 保证存在 |
| activeContext | 保证存在 |
| activeContext | 保证存在 |
| 所有文件 | 保证存在( fallback) |
| patterns | 保证存在 |
| progress | 保证存在 |
| progress | 保证存在 |
切勿使用以下内容作为锚点:
- 表格标题()
- 复选框文本()
- 可能不存在的可选章节
Read-Edit-Verify (MANDATORY)
读取-编辑-验证(强制要求)
Every memory edit MUST follow this exact sequence:
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/activeContext.md")
Step 2: VERIFY ANCHOR
步骤2:验证锚点
Check if intended anchor exists in the content you just read
检查你刚刚读取的内容中是否存在预期的锚点
If "## References" not found → use "## Last Updated" as fallback
如果未找到"## References" → 使用"## Last Updated"作为 fallback
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Recent Changes",
new_string="## Recent Changes\n- [New entry]\n")
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Recent Changes",
new_string="## Recent Changes\n- [New entry]\n")
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/activeContext.md")
Confirm your change appears. If not → STOP and retry.
确认你的更改已出现。如果没有 → 停止并重试。
**Why this works:**
- Step 1 shows you what's actually there
- Step 2 prevents "anchor not found" errors
- Step 3 uses verified anchor
- Step 4 catches silent failures
---
**为什么这有效:**
- 步骤1显示实际存在的内容
- 步骤2防止“锚点未找到”错误
- 步骤3使用已验证的锚点
- 步骤4捕获静默失败
---
READ Triggers - When to Load Memory
读取触发条件 - 何时加载内存
ALWAYS Read (Non-Negotiable)
始终读取(不可协商)
| Trigger | Action | Why |
|---|
| Session start | Load ALL 3 files | Fresh context needed |
| Workflow start | Load ALL 3 files | Before BUILD/REVIEW/DEBUG/PLAN |
| Continuation session | Load ALL 3 files | Resume from where we left |
| User says "continue" | Load activeContext.md | Get current state |
| 触发条件 | 操作 | 原因 |
|---|
| 会话开始 | 加载所有3个文件 | 需要全新上下文 |
| 工作流开始 | 加载所有3个文件 | 在BUILD/REVIEW/DEBUG/PLAN之前 |
| 续开会话 | 加载所有3个文件 | 从上次中断处继续 |
| 用户说“继续” | 加载activeContext.md | 获取当前状态 |
Read BEFORE These Actions
以下操作前必须读取
| Before This Action | Read This File | Why |
|---|
| Making architectural decision | patterns.md | Check existing patterns |
| Choosing implementation approach | patterns.md + activeContext.md | Align with conventions + prior decisions |
| Starting to build something | progress.md | Check if already done |
| Debugging an error | activeContext.md + patterns.md | May have seen before + known gotchas |
| Planning next steps | progress.md | Know what's remaining |
| Reviewing code | patterns.md | Apply project conventions |
| Making any decision | activeContext.md (Decisions) | Check prior decisions |
| 操作前 | 读取文件 | 原因 |
|---|
| 做出架构决策 | patterns.md | 检查现有模式 |
| 选择实现方案 | patterns.md + activeContext.md | 与约定规范 + 之前的决策保持一致 |
| 开始构建内容 | progress.md | 检查是否已完成 |
| 调试错误 | activeContext.md + patterns.md | 可能之前遇到过 + 已知陷阱 |
| 规划下一步 | progress.md | 了解剩余工作 |
| 审查代码 | patterns.md | 应用项目约定规范 |
| 做出任何决策 | activeContext.md(Decisions章节) | 检查之前的决策 |
Read WHEN You Notice
当你注意到以下情况时读取
| Situation | Action | Why |
|---|
| User references "what we did" | Load activeContext.md | Get history |
| You're about to repeat work | Load progress.md | Check if done |
| You're unsure of convention | Load patterns.md | Project standards |
| Error seems familiar | Load patterns.md (Common Gotchas) | Known issues |
| Decision feels arbitrary | Load activeContext.md | Prior reasoning |
| 情况 | 操作 | 原因 |
|---|
| 用户提及“我们之前做的工作” | 加载activeContext.md | 获取历史记录 |
| 你即将重复工作 | 加载progress.md | 检查是否已完成 |
| 你不确定约定规范 | 加载patterns.md | 项目标准 |
| 错误看起来很熟悉 | 加载patterns.md(Common Gotchas章节) | 已知问题 |
| 决策感觉随意 | 加载activeContext.md | 之前的推理 |
File Selection Matrix
文件选择矩阵
What do I need? → Which file?
─────────────────────────────────────────
Current state / focus → activeContext.md
Prior decisions + reasoning → activeContext.md (Decisions)
What we learned → activeContext.md (Learnings)
Project conventions → patterns.md
How to structure code → patterns.md
Common gotchas to avoid → patterns.md
What's done / remaining → progress.md
Verification evidence → progress.md
Prior research on topic → activeContext.md (References) → docs/research/
我需要什么? → 哪个文件?
─────────────────────────────────────────
当前状态 / 工作重点 → activeContext.md
之前的决策 + 推理过程 → activeContext.md(Decisions章节)
我们学到的内容 → activeContext.md(Learnings章节)
项目约定规范 → patterns.md
如何组织代码结构 → patterns.md
需要避免的常见陷阱 → patterns.md
已完成 / 剩余工作 → progress.md
验证证据 → progress.md
关于主题的之前研究 → activeContext.md(References章节) → docs/research/
Before ANY decision, ask:
- Did we decide this before? → Check activeContext.md Decisions section
- Is there a project pattern? → Check patterns.md
- Did we learn something relevant? → Check activeContext.md Learnings
If memory has relevant info:
- Follow prior decision (or document why changing)
- Apply project pattern
- Use learned insight
If memory is empty/irrelevant:
- Make decision
- RECORD it in activeContext.md for next time
做出任何决策前,询问自己:
- 我们之前是否做过这个决策? → 检查activeContext.md的Decisions章节
- 是否有项目模式? → 检查patterns.md
- 我们是否学到过相关内容? → 检查activeContext.md的Learnings章节
如果内存中有相关信息:
- 遵循之前的决策(或记录更改原因)
- 应用项目模式
- 使用已学到的见解
如果内存为空/无关:
- 做出决策
- 将其记录在activeContext.md中,供下次使用
At Workflow START (REQUIRED)
工作流开始时(必须)
Use separate tool calls (PERMISSION-FREE):
Step 1: Create directory (single Bash command - permission-free)
步骤1:创建目录(单个Bash命令 - 无需权限)
Bash(command="mkdir -p .claude/cc10x")
Bash(command="mkdir -p .claude/cc10x")
Step 2: Load ALL 3 memory files using Read tool (permission-free)
步骤2:使用Read工具加载所有3个内存文件(无需权限)
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/patterns.md")
Read(file_path=".claude/cc10x/progress.md")
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/patterns.md")
Read(file_path=".claude/cc10x/progress.md")
Step 3: Git Context - Understand project state (RECOMMENDED)
步骤3:Git上下文 - 了解项目状态(推荐)
Bash(command="git status") # Current working state
Bash(command="git ls-files | head -50") # Project file structure
Bash(command="git log --oneline -10") # Recent commits
**NEVER use this (asks permission):**
```bash
Bash(command="git status") # 当前工作状态
Bash(command="git ls-files | head -50") # 项目文件结构
Bash(command="git log --oneline -10") # 最近提交记录
**切勿使用以下方式(会申请权限):**
```bash
WRONG - compound command asks permission
错误 - 复合命令会申请权限
mkdir -p .claude/cc10x && cat .claude/cc10x/activeContext.md
**If file doesn't exist:** Read tool returns an error - that's fine, means starting fresh.
mkdir -p .claude/cc10x && cat .claude/cc10x/activeContext.md
**如果文件不存在:** Read工具会返回错误 - 没关系,意味着从头开始。
At Workflow END (REQUIRED)
工作流结束时(必须)
MUST update before completing ANY workflow. Use Edit tool (NO permission prompt).
完成任何工作流前必须更新。使用Edit工具(无权限提示)。
First, read existing content
首先,读取现有内容
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/activeContext.md")
Prefer small, targeted edits. Avoid rewriting whole files.
优先进行小的、有针对性的编辑。避免重写整个文件。
Example A: Add a bullet to Recent Changes (prepend)
示例A:向Recent Changes添加一个项目(前置)
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Recent Changes",
new_string="## Recent Changes\n- [YYYY-MM-DD] [What changed] - [file:line]\n")
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Recent Changes",
new_string="## Recent Changes\n- [YYYY-MM-DD] [更改内容] - [file:line]\n")
Example B: Add a decision (stable anchor)
示例B:添加一个决策(稳定锚点)
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Decisions",
new_string="## Decisions\n- [Decision]: [Choice] - [Why]")
Edit(file_path=".claude/cc10x/activeContext.md",
old_string="## Decisions",
new_string="## Decisions\n- [决策内容]: [选择] - [原因]")
Example C: Add verification evidence to progress.md (stable anchor)
示例C:向progress.md添加验证证据(稳定锚点)
Read(file_path=".claude/cc10x/progress.md")
Edit(file_path=".claude/cc10x/progress.md",
old_string="## Verification",
new_string="## Verification\n-
→ exit 0 (X/X)")
Read(file_path=".claude/cc10x/progress.md")
Edit(file_path=".claude/cc10x/progress.md",
old_string="## Verification",
new_string="## Verification\n-
→ exit 0 (X/X)")
VERIFY (do not skip)
验证(不可跳过)
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/progress.md")
**WHY Edit not Write?** Write asks "Do you want to overwrite?" for existing files. Edit is always permission-free.
Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/progress.md")
**为什么用Edit而不是Write?** Write在覆盖现有文件时会询问“是否要覆盖?”。Edit始终无需权限。
When Learning Patterns (APPEND)
记录学习到的模式(追加)
Read existing patterns.md, then append using Edit:
读取现有的patterns.md,然后使用Edit追加内容:
Read existing content
读取现有内容
Read(file_path=".claude/cc10x/patterns.md")
Read(file_path=".claude/cc10x/patterns.md")
Append under an existing section header (preferred: stable anchor)
在现有章节标题下追加内容(首选:稳定锚点)
Edit(file_path=".claude/cc10x/patterns.md",
old_string="## Common Gotchas",
new_string="## Common Gotchas\n- [Gotcha]: [Solution / how to avoid]\n")
Edit(file_path=".claude/cc10x/patterns.md",
old_string="## Common Gotchas",
new_string="## Common Gotchas\n- [陷阱]: [解决方案 / 避免方法]\n")
When Completing Tasks (UPDATE)
完成任务时(更新)
Read progress.md, then record completion with evidence
读取progress.md,然后记录完成情况及证据
Read(file_path=".claude/cc10x/progress.md")
Read(file_path=".claude/cc10x/progress.md")
Option A (preferred): append a completed line under "## Completed"
选项A(首选):在"## Completed"下追加已完成条目
Edit(file_path=".claude/cc10x/progress.md",
old_string="## Completed",
new_string="## Completed\n- [x] [What was completed] - [evidence: command → exit 0]\n")
Edit(file_path=".claude/cc10x/progress.md",
old_string="## Completed",
new_string="## Completed\n- [x] [已完成内容] - [证据: 命令 → exit 0]\n")
Option B: flip an existing checkbox if one exists (more brittle)
选项B:如果存在现有复选框,将其勾选(更脆弱)
Edit(file_path=".claude/cc10x/progress.md",
old_string="- [ ] [Task being completed]",
new_string="- [x] [Task being completed] - [verification evidence]")
Edit(file_path=".claude/cc10x/progress.md",
old_string="- [ ] [正在完成的任务]",
new_string="- [x] [正在完成的任务] - [验证证据]")
Integration with Agents
与Agent的集成
ALL agents MUST:
- START: Load memory files before any work
- DURING: Note learnings and decisions
- END: Update memory files with new context
If an agent cannot safely update memory (e.g., no
tool available):
- Include "memory-worthy" notes in the agent output (decisions, learnings, verification evidence).
- The main assistant (router) must persist those notes into using + Read-back verification.
Failure to update memory = incomplete work.
所有Agent必须:
- 开始时: 在任何工作前加载内存文件
- 过程中: 记录经验总结和决策
- 结束时: 使用新上下文更新内存文件
如果Agent无法安全更新内存(例如,没有
工具可用):
- 在Agent输出中包含“值得存入内存”的笔记(决策、经验总结、验证证据)。
- 主助理(router)必须使用 + 回读验证将这些笔记持久化到中。
未更新内存 = 工作未完成。
Red Flags - STOP IMMEDIATELY
危险信号 - 立即停止
If you catch yourself:
- Starting work WITHOUT loading memory
- Making decisions WITHOUT checking Decisions section
- Completing work WITHOUT updating memory
- Saying "I'll remember" instead of writing to memory
STOP. Load/update memory FIRST.
如果你发现自己:
- 未加载内存就开始工作
- 未检查Decisions章节就做出新决策
- 完成工作后未更新内存
- 说“我会记住的”而不是写入内存
停止。先加载/更新内存。
Rationalization Prevention
防止合理化借口
| Excuse | Reality |
|---|
| "I know what we decided" | Check the Decisions section. |
| "Small task, no need" | Small tasks have context too. Always update. |
| "I'll remember" | You won't. Conversation compacts. Write it down. |
| "Memory is optional" | Memory is MANDATORY. No exceptions. |
| 借口 | 现实 |
|---|
| “我知道我们之前的决策” | 检查Decisions章节。 |
| “任务很小,不需要” | 小任务也有上下文。始终更新。 |
| “我会记住的” | 你不会。会话会被压缩。写下来。 |
| “内存是可选的” | 内存是强制要求的。无例外。 |
Verification Checklist
验证清单
Cannot check all boxes? Memory cycle incomplete.