session-memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Session Memory (MANDATORY)

会话内存(强制要求)

The Iron Law

铁律

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)

内存层面(类型)

  1. Index / Working Memory:
    .claude/cc10x/activeContext.md
    • “What matters right now”: focus, next steps, active decisions, learnings
    • Links to durable artifacts (plans/research)
  2. Long-Term Project Memory:
    .claude/cc10x/patterns.md
    • Conventions, architecture decisions, common gotchas, reusable solutions
  3. Progress + Evidence Memory:
    .claude/cc10x/progress.md
    • What’s done/remaining + verification evidence (commands + exit codes)
  4. Artifact Memory (Durable):
    docs/plans/*
    ,
    docs/research/*
    • The details. Memory files are the index.
  5. Tasks (Execution State): Claude Code Tasks
    • Great for orchestration, but not guaranteed to be the only durable source.
    • Mirror key task subjects/status into
      progress.md
      for backup/resume.
  1. 索引/工作内存
    .claude/cc10x/activeContext.md
    • “当前重要事项”:工作重点、下一步计划、当前决策、经验总结
    • 链接到持久化工件(计划/研究文档)
  2. 长期项目内存
    .claude/cc10x/patterns.md
    • 约定规范、架构决策、常见陷阱、可复用解决方案
  3. 进度与证据内存
    .claude/cc10x/progress.md
    • 已完成/剩余工作 + 验证证据(命令 + 退出码)
  4. 工件内存(持久化)
    docs/plans/*
    ,
    docs/research/*
    • 详细内容。内存文件是其索引。
  5. 任务(执行状态):Claude Code Tasks
    • 非常适合编排,但不保证是唯一的持久化来源。
    • 将关键任务主题/状态镜像到
      progress.md
      中,用于备份/恢复。

Promotion Ladder (“Rises To”)

晋升阶梯(“升级至”)

Information “graduates” to more durable layers:
  • One-off observation
    activeContext.md
    (Learnings / Recent Changes)
  • Repeated or reusable
    patterns.md
    (Pattern / Gotcha)
  • Needs detail
    docs/research/*
    or
    docs/plans/*
    + link from
    activeContext.md
  • Proven
    progress.md
    (Verification Evidence)
信息会“升级”到更持久的层级:
  • 一次性观察结果
    activeContext.md
    (经验总结 / 近期变更)
  • 可重复或可复用内容
    patterns.md
    (模式 / 陷阱)
  • 需要详细记录的内容
    docs/research/*
    docs/plans/*
    + 从
    activeContext.md
    添加链接
  • 已验证内容
    progress.md
    (验证证据)

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.
如果未加载内存: 你将在无上下文的情况下工作,重复犯错,丢失关键信息。 如果未检查内存就做出决策: 你将与之前的选择冲突,浪费精力。

WRITE Side

写入侧

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.
OperationToolPermission
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的区别

ToolUse ForAsks Permission?
WriteCreating NEW filesNO (if file doesn't exist)
WriteOverwriting existing filesYES - asks "Do you want to overwrite?"
EditUpdating existing filesNO - 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 (
mkdir && cat
) - they ASK PERMISSION. ALWAYS use Read tool for reading files - it's PERMISSION-FREE.
undefined
切勿使用Bash复合命令
mkdir && cat
)- 这些命令会申请权限。 始终使用Read工具读取文件 - 无需权限。
undefined

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]")
undefined
Edit(file_path=".claude/cc10x/activeContext.md", old_string="# Active Context", new_string="# Active Context\n\n[new content]")
undefined

Why This Matters

为什么这很重要

"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.
“我的内存在会话之间会重置。内存库是我与之前工作的唯一连接。”
没有内存持久化:
  • 会话压缩后丢失上下文
  • 模式需要从头重新学习
  • 决策被遗忘并重新做出不同的选择
  • 进度跟踪丢失
  • 重复犯同样的错误
内存是会学习的专家和会遗忘的新手之间的区别。

Memory Structure

内存结构

.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)

谁读取/写入内存(所有权)

Read

读取

  • 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

写入

  • WRITE agents: update memory directly at task end using
    Edit(...)
    +
    Read(...)
    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: 在任务结束时直接使用
    Edit(...)
    +
    Read(...)
    验证模式来更新内存。
  • 只读型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")  # 验证
规则: 如有疑问,立即更新内存。重复条目总比丢失上下文好。

File Purposes

文件用途

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 (
    # Active Context
    ,
    # Project Patterns
    ,
    # Progress Tracking
    ).
  • Do not rename section headers (e.g.,
    ## Current Focus
    ,
    ## Last Updated
    ).
  • Only add content inside existing sections (append lists/rows).
    • If a canonical section from this template is missing (e.g.,
      ## References
      ,
      ## Decisions
      ,
      ## Learnings
      ), add it by inserting it just above
      ## Last Updated
      .
  • After every
    Edit(...)
    , 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
    old_string
    anchor.
CC10x内存文件不是“笔记”——它们是契约,用作Edit的锚点。
严格规则:
  • 请勿重命名顶级标题(
    # Active Context
    # Project Patterns
    # Progress Tracking
    )。
  • 请勿重命名章节标题(例如
    ## Current Focus
    ## Last Updated
    )。
  • 仅在现有章节内添加内容(追加列表/行)。
    • 如果本模板中的标准章节缺失(例如
      ## References
      ## Decisions
      ## Learnings
      ),请将其插入到
      ## Last Updated
      上方。
  • 每次执行
    Edit(...)
    后,重新读取文件并确认预期的更改已存在。
如果Edit无法正常应用:
  • 停止操作(不要猜测)。
  • 重新读取文件,使用正确、精确的
    old_string
    锚点重新应用。

activeContext.md (Read/Write EVERY session)

activeContext.md(每次会话都要读取/写入)

Current state of work - ALWAYS check this first:
markdown
undefined
当前工作状态 - 始终先检查此文件:
markdown
undefined

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

[Active work]
[Active work]

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 -->

Next Steps

Next Steps

  1. [Step]
  1. [Step]

Decisions

Decisions

  • [Decision]: [Choice] - [Why]
  • [Decision]: [Choice] - [Why]

Learnings

Learnings

  • [Insight]
  • [Insight]

References

References

  • Plan:
    docs/plans/...
    (or N/A)
  • Design:
    docs/plans/...
    (or N/A)
  • Research:
    docs/research/...
    → [insight]
  • Plan:
    docs/plans/...
    (or N/A)
  • Design:
    docs/plans/...
    (or N/A)
  • Research:
    docs/research/...
    → [insight]

Blockers

Blockers

  • [None]
  • [None]

Last Updated

Last Updated

[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:
markdown
undefined
项目特定的持久化知识:
markdown
undefined

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]

API Patterns

API Patterns

  • [Endpoint pattern]: [Convention used]
  • [Endpoint pattern]: [Convention used]

Error Handling

Error Handling

  • [Error type]: [How project handles it]
  • [Error type]: [How project handles it]

Dependencies

Dependencies

  • [Dependency]: [Why used, how configured]
undefined
  • [Dependency]: [Why used, how configured]
undefined

progress.md (Tracks completion)

progress.md(跟踪完成情况)

What's done, what's not:
markdown
undefined
已完成/未完成工作:
markdown
undefined

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]

Tasks

Tasks

  • Task 1
  • Task 2 - evidence
  • Task 1
  • Task 2 - evidence

Completed

Completed

  • Item - evidence
  • Item - evidence

Verification

Verification

  • command
    → exit 0 (X/X)
  • command
    → exit 0 (X/X)

Last Updated

Last Updated

[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)

稳定锚点(仅使用这些)

AnchorFileStability
## Recent Changes
activeContextGUARANTEED
## Learnings
activeContextGUARANTEED
## References
activeContextGUARANTEED
## Last Updated
all filesGUARANTEED (fallback)
## Common Gotchas
patternsGUARANTEED
## Completed
progressGUARANTEED
## Verification
progressGUARANTEED
NEVER use as anchors:
  • Table headers (
    | Col | Col |
    )
  • Checkbox text (
    - [ ] specific text
    )
  • Optional sections that may not exist

锚点文件稳定性
## Recent Changes
activeContext保证存在
## Learnings
activeContext保证存在
## References
activeContext保证存在
## Last Updated
所有文件保证存在( fallback)
## Common Gotchas
patterns保证存在
## Completed
progress保证存在
## Verification
progress保证存在
切勿使用以下内容作为锚点:
  • 表格标题(
    | Col | Col |
  • 复选框文本(
    - [ ] specific text
  • 可能不存在的可选章节

Read-Edit-Verify (MANDATORY)

读取-编辑-验证(强制要求)

Every memory edit MUST follow this exact sequence:
每次内存编辑必须遵循以下精确顺序:

Step 1: READ

步骤1:读取

Read(file_path=".claude/cc10x/activeContext.md")
Read(file_path=".claude/cc10x/activeContext.md")

Step 2: VERIFY ANCHOR

步骤2:验证锚点

undefined
undefined

Check if intended anchor exists in the content you just read

检查你刚刚读取的内容中是否存在预期的锚点

If "## References" not found → use "## Last Updated" as fallback

如果未找到"## References" → 使用"## Last Updated"作为 fallback

undefined
undefined

Step 3: EDIT

步骤3:编辑

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")

Step 4: VERIFY

步骤4:验证

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)

始终读取(不可协商)

TriggerActionWhy
Session startLoad ALL 3 filesFresh context needed
Workflow startLoad ALL 3 filesBefore BUILD/REVIEW/DEBUG/PLAN
Continuation sessionLoad ALL 3 filesResume from where we left
User says "continue"Load activeContext.mdGet current state
触发条件操作原因
会话开始加载所有3个文件需要全新上下文
工作流开始加载所有3个文件在BUILD/REVIEW/DEBUG/PLAN之前
续开会话加载所有3个文件从上次中断处继续
用户说“继续”加载activeContext.md获取当前状态

Read BEFORE These Actions

以下操作前必须读取

Before This ActionRead This FileWhy
Making architectural decisionpatterns.mdCheck existing patterns
Choosing implementation approachpatterns.md + activeContext.mdAlign with conventions + prior decisions
Starting to build somethingprogress.mdCheck if already done
Debugging an erroractiveContext.md + patterns.mdMay have seen before + known gotchas
Planning next stepsprogress.mdKnow what's remaining
Reviewing codepatterns.mdApply project conventions
Making any decisionactiveContext.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

当你注意到以下情况时读取

SituationActionWhy
User references "what we did"Load activeContext.mdGet history
You're about to repeat workLoad progress.mdCheck if done
You're unsure of conventionLoad patterns.mdProject standards
Error seems familiarLoad patterns.md (Common Gotchas)Known issues
Decision feels arbitraryLoad activeContext.mdPrior 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/

Decision Integration

决策集成

Before ANY decision, ask:
  1. Did we decide this before? → Check activeContext.md Decisions section
  2. Is there a project pattern? → Check patterns.md
  3. 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

做出任何决策前,询问自己:
  1. 我们之前是否做过这个决策? → 检查activeContext.md的Decisions章节
  2. 是否有项目模式? → 检查patterns.md
  3. 我们是否学到过相关内容? → 检查activeContext.md的Learnings章节
如果内存中有相关信息:
  • 遵循之前的决策(或记录更改原因)
  • 应用项目模式
  • 使用已学到的见解
如果内存为空/无关:
  • 做出决策
  • 将其记录在activeContext.md中,供下次使用

Mandatory Operations

强制操作

At Workflow START (REQUIRED)

工作流开始时(必须)

Use separate tool calls (PERMISSION-FREE):
undefined
使用单独的工具调用(无需权限):
undefined

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).
undefined
完成任何工作流前必须更新。使用Edit工具(无权限提示)。
undefined

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-
[cmd]
→ 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-
[cmd]
→ 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:
undefined
读取现有的patterns.md,然后使用Edit追加内容:
undefined

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")
undefined
Edit(file_path=".claude/cc10x/patterns.md", old_string="## Common Gotchas", new_string="## Common Gotchas\n- [陷阱]: [解决方案 / 避免方法]\n")
undefined

When Completing Tasks (UPDATE)

完成任务时(更新)

undefined
undefined

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]")
undefined
Edit(file_path=".claude/cc10x/progress.md", old_string="- [ ] [正在完成的任务]", new_string="- [x] [正在完成的任务] - [验证证据]")
undefined

Integration with Agents

与Agent的集成

ALL agents MUST:
  1. START: Load memory files before any work
  2. DURING: Note learnings and decisions
  3. END: Update memory files with new context
If an agent cannot safely update memory (e.g., no
Edit
tool available):
  • Include "memory-worthy" notes in the agent output (decisions, learnings, verification evidence).
  • The main assistant (router) must persist those notes into
    .claude/cc10x/*.md
    using
    Edit(...)
    + Read-back verification.
Failure to update memory = incomplete work.
所有Agent必须:
  1. 开始时: 在任何工作前加载内存文件
  2. 过程中: 记录经验总结和决策
  3. 结束时: 使用新上下文更新内存文件
如果Agent无法安全更新内存(例如,没有
Edit
工具可用):
  • 在Agent输出中包含“值得存入内存”的笔记(决策、经验总结、验证证据)。
  • 主助理(router)必须使用
    Edit(...)
    + 回读验证将这些笔记持久化到
    .claude/cc10x/*.md
    中。
未更新内存 = 工作未完成。

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

防止合理化借口

ExcuseReality
"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

验证清单

  • Memory loaded at workflow start
  • Decisions checked before making new ones
  • Learnings documented in activeContext.md
  • Progress updated in progress.md
Cannot check all boxes? Memory cycle incomplete.
  • 工作流开始时已加载内存
  • 做出新决策前已检查之前的决策
  • 经验总结已记录在activeContext.md中
  • 进度已更新在progress.md中
无法勾选所有框?内存周期未完成。