Loading...
Loading...
Compare original and translation side by side
1. Detect state
scripts/detect_state.sh /path/to/project
→ Returns: none | partial | complete
2. Route
none/partial → Initial setup (steps 3-5)
complete → Maintenance (step 6)
3. Measure [gate - show table first]
scripts/analyze_structure.sh /path/to/project
scripts/estimate_tokens.sh /path/to/each/source/dir
4. Decide
No root file → Ask: CLAUDE.md or AGENTS.md?
Has root file → Add Intent Layer section + child nodes if needed
5. Execute
Use references/templates.md for structure
Use references/node-examples.md for real-world patterns
Validate: one root, READ-FIRST directive, <4k tokens per node
6. Maintenance mode (when state=complete)
Ask user:
a) Audit nodes → Use references/capture-protocol.md for SME questions
b) Find candidates → Re-measure tokens, suggest new nodes
c) Both1. 检测状态
scripts/detect_state.sh /path/to/project
→ 返回结果:none | partial | complete
2. 路由
none/partial → 初始设置(步骤3-5)
complete → 维护(步骤6)
3. 评估 [关卡 - 先展示表格]
scripts/analyze_structure.sh /path/to/project
scripts/estimate_tokens.sh /path/to/each/source/dir
4. 决策
无根文件 → 询问:创建CLAUDE.md还是AGENTS.md?
已有根文件 → 添加意图层章节 + 必要的子节点
5. 执行
使用references/templates.md中的结构模板
使用references/node-examples.md中的真实场景模式
验证:仅一个根文件、包含READ-FIRST指令、每个节点的token数<4k
6. 维护模式(当状态=complete时)
询问用户:
a) 审核节点 → 使用references/capture-protocol.md中的专家访谈问题
b) 寻找候选节点 → 重新评估token数,建议新节点
c) 同时进行a和b| Signal | Action |
|---|---|
| >20k tokens in directory | Create AGENTS.md |
| Responsibility shift | Create AGENTS.md |
| Hidden contracts/invariants | Document in nearest ancestor |
| Cross-cutting concern | Place at LCA |
| 信号 | 操作 |
|---|---|
| 目录中token数>20k | 创建AGENTS.md |
| 职责转移 | 创建AGENTS.md |
| 存在隐藏约定/不变量 | 在最近的父节点中记录 |
| 跨领域关注点 | 放置在最近公共祖先(LCA)节点 |
scripts/detect_state.shscripts/analyze_structure.shscripts/estimate_tokens.shreferences/templates.mdreferences/node-examples.mdreferences/capture-protocol.mdscripts/detect_state.shscripts/analyze_structure.shscripts/estimate_tokens.shreferences/templates.mdreferences/node-examples.mdreferences/capture-protocol.md