Loading...
Loading...
Compare original and translation side by side
undefinedundefined
| Root AGENTS.md? | Format | Action |
|-----------------|--------|--------|
| Yes | AGENTS.md-canonical | Update AGENTS.md files, create companion CLAUDE.md |
| No | CLAUDE.md-canonical | Update CLAUDE.md files directly |
**Key principle:** We use OUR format structure (Purpose, Contracts, Dependencies, Invariants, etc.) regardless of filename. AGENTS.md is just for cross-platform AI agent compatibility.
| 根目录存在AGENTS.md? | 格式 | 操作 |
|-----------------|--------|--------|
| 是 | AGENTS.md标准格式 | 更新AGENTS.md文件,创建配套的CLAUDE.md |
| 否 | CLAUDE.md标准格式 | 直接更新CLAUDE.md文件 |
**关键原则:** 无论文件名是什么,我们都使用自己的格式结构(Purpose、Contracts、Dependencies、Invariants等)。AGENTS.md仅用于跨平台AI Agent兼容性。Read @./AGENTS.md and treat its contents as if they were in CLAUDE.mdRead @./AGENTS.md and treat its contents as if they were in CLAUDE.md| Change Type | Update Required? | What to Update |
|---|---|---|
| New domain/module | Yes | Create domain context file |
| API/interface change | Yes | Contracts section |
| Architectural decision | Yes | Key Decisions section |
| Invariant change | Yes | Invariants section |
| Dependency change | Yes | Dependencies section |
| Bug fix (no contract change) | No | - |
| Refactor (same behavior) | No | - |
| Test additions | No | - |
| 变更类型 | 是否需要更新 | 更新内容 |
|---|---|---|
| 新增领域/模块 | 是 | 创建领域上下文文件 |
| API/接口变更 | 是 | Contracts部分 |
| 架构决策 | 是 | Key Decisions部分 |
| 不变量变更 | 是 | Invariants部分 |
| 依赖变更 | 是 | Dependencies部分 |
| 修复Bug(未变更契约) | 否 | - |
| 重构(行为不变) | 否 | - |
| 新增测试 | 否 | - |
undefinedundefined
Categorize changes:
- **Structural:** New directories, moved files
- **Contract:** Changed exports, interfaces, public APIs
- **Behavioral:** Changed invariants, guarantees
- **Internal:** Implementation details only
对变更进行分类:
- **结构性变更:** 新增目录、移动文件
- **契约变更:** 变更导出内容、接口、公共API
- **行为变更:** 变更不变量、保证条款
- **内部变更:** 仅实现细节变更| Change Location | Context File Location |
|---|---|
| Project-wide pattern | Root context file |
| New domain | |
| Existing domain contract | |
| Cross-domain dependency | Both affected domains |
AGENTS.mdCLAUDE.md| 变更位置 | 上下文文件位置 |
|---|---|
| 项目范围的模式 | 根目录上下文文件 |
| 新增领域 | |
| 现有领域契约变更 | |
| 跨领域依赖变更 | 两个受影响领域的上下文文件 |
AGENTS.mdCLAUDE.mdundefinedundefinedundefinedundefineddate +%Y-%m-%d<domain>/CLAUDE.md<domain>/AGENTS.md<domain>/CLAUDE.mdRead @./AGENTS.md and treat its contents as if they were in CLAUDE.mddate +%Y-%m-%d<domain>/CLAUDE.md<domain>/AGENTS.md<domain>/CLAUDE.mdRead @./AGENTS.md and treat its contents as if they were in CLAUDE.mdgit add <affected CLAUDE.md files>
git commit -m "docs: update project context for <branch-name>"git add <affected CLAUDE.md files>
git commit -m "docs: update project context for <branch-name>"Has code changed?
├─ No → Skip (nothing to update)
└─ Yes → Detect format first (AGENTS.md at root?)
│
└─ What changed?
├─ Only tests/internal details → Skip
└─ Contracts/APIs/structure → Continue
│
├─ New domain created?
│ ├─ AGENTS.md repo → Create AGENTS.md + companion CLAUDE.md
│ └─ CLAUDE.md repo → Create CLAUDE.md
│
├─ Existing domain changed?
│ └─ Update domain context file (read first!)
│
└─ Project-wide pattern changed?
└─ Update root context fileHas code changed?
├─ No → Skip (nothing to update)
└─ Yes → Detect format first (AGENTS.md at root?)
│
└─ What changed?
├─ Only tests/internal details → Skip
└─ Contracts/APIs/structure → Continue
│
├─ New domain created?
│ ├─ AGENTS.md repo → Create AGENTS.md + companion CLAUDE.md
│ └─ CLAUDE.md repo → Create CLAUDE.md
│
├─ Existing domain changed?
│ └─ Update domain context file (read first!)
│
└─ Project-wide pattern changed?
└─ Update root context file| Mistake | Fix |
|---|---|
| Updating for every change | Only update for contract changes |
| Forgetting freshness date | Always use |
| Documenting implementation | Document contracts and intent |
| Putting domain info in root | Use domain context files for domain contracts |
| Skipping verification | Read the code, confirm contracts hold |
| Skipping format detection | Always check for AGENTS.md first |
| Writing AGENTS.md without reading | Always read existing content before updating |
| Forgetting companion CLAUDE.md | AGENTS.md repos need both files |
| 错误 | 修复方案 |
|---|---|
| 每次变更都更新 | 仅在契约变更时更新 |
| 忘记更新新鲜度日期 | 始终使用 |
| 记录实现细节 | 记录契约和意图 |
| 把领域信息放在根目录文件 | 领域契约使用领域上下文文件 |
| 跳过验证步骤 | 阅读代码,确认契约有效 |
| 跳过格式检测 | 始终先检查是否存在AGENTS.md |
| 未阅读就更新AGENTS.md | 更新前务必先阅读现有内容 |
| 忘记创建配套CLAUDE.md | AGENTS.md仓库需要同时存在两个文件 |