architecture-decision

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
When this skill is invoked:
调用此技能时:

0. Parse Arguments — Detect Retrofit Mode

0. 解析参数——检测改造模式

Resolve the review mode (once, store for all gate spawns this run):
  1. If
    --review [full|lean|solo]
    was passed → use that
  2. Else read
    production/review-mode.txt
    → use that value
  3. Else → default to
    lean
See
.claude/docs/director-gates.md
for the full check pattern.
If the argument starts with
retrofit
followed by a file path
(e.g.,
/architecture-decision retrofit docs/architecture/adr-0001-event-system.md
):
Enter retrofit mode:
  1. Read the existing ADR file completely.
  2. Identify which template sections are present by scanning headings:
    • ## Status
      BLOCKING if missing:
      /story-readiness
      cannot check ADR acceptance
    • ## ADR Dependencies
      — HIGH if missing: dependency ordering breaks
    • ## Engine Compatibility
      — HIGH if missing: post-cutoff risk unknown
    • ## GDD Requirements Addressed
      — MEDIUM if missing: traceability lost
  3. Present to the user:
    ## Retrofit: [ADR title]
    File: [path]
    
    Sections already present (will not be touched):
    ✓ Status: [current value, or "MISSING — will add"]
    ✓ [section]
    
    Missing sections to add:
    ✗ Status — BLOCKING (stories cannot validate ADR acceptance without this)
    ✗ ADR Dependencies — HIGH
    ✗ Engine Compatibility — HIGH
  4. Ask: "Shall I add the [N] missing sections? I will not modify any existing content."
  5. If yes:
    • For Status: ask the user — "What is the current status of this decision?" Options: "Proposed", "Accepted", "Deprecated", "Superseded by ADR-XXXX"
    • For ADR Dependencies: ask — "Does this decision depend on any other ADR? Does it enable or block any other ADR or epic?" Accept "None" for each field.
    • For Engine Compatibility: read the engine reference docs (same as Step 1 below) and ask the user to confirm the domain. Then generate the table with verified data.
    • For GDD Requirements Addressed: ask — "Which GDD systems motivated this decision? What specific requirement in each GDD does this ADR address?"
    • Append each missing section to the ADR file using the Edit tool.
    • Never modify any existing section. Only append or fill absent sections.
  6. After adding all missing sections, update the ADR's
    ## Date
    field if it is absent.
  7. Suggest: "Run
    /architecture-review
    to re-validate coverage now that this ADR has its Status and Dependencies fields."
If NOT in retrofit mode, proceed to Step 1 below (normal ADR authoring).
No-argument guard: If no argument was provided (title is empty), ask before running Phase 0:
"What technical decision are you documenting? Please provide a short title (e.g.,
event-system-architecture
,
physics-engine-choice
)."
Use the user's response as the title, then proceed to Step 1.

确定评审模式(仅执行一次,本次运行中所有 gate 实例均使用该模式):
  1. 如果传入了
    --review [full|lean|solo]
    参数 → 使用该参数指定的模式
  2. 否则读取
    production/review-mode.txt
    文件 → 使用文件中的值
  3. 若无上述两种情况 → 默认使用
    lean
    模式
完整检查规则请参见
.claude/docs/director-gates.md
如果参数以
retrofit
开头并后跟文件路径
(例如:
/architecture-decision retrofit docs/architecture/adr-0001-event-system.md
):
进入改造模式
  1. 完整读取现有的ADR文件。
  2. 通过扫描标题识别已存在的模板章节:
    • ## Status
      — 缺失则阻塞
      /story-readiness
      无法检查ADR是否可接受
    • ## ADR Dependencies
      — 缺失则优先级高:依赖顺序会被破坏
    • ## Engine Compatibility
      — 缺失则优先级高:无法知晓 cutoff 后的风险
    • ## GDD Requirements Addressed
      — 缺失则优先级中等:会丢失可追溯性
  3. 向用户展示:
    ## 改造:[ADR标题]
    文件:[路径]
    
    已存在的章节(不会修改):
    ✓ Status: [当前值,或“缺失——将添加”]
    ✓ [章节名称]
    
    需要添加的缺失章节:
    ✗ Status — 阻塞(无此章节则故事无法验证ADR是否可接受)
    ✗ ADR Dependencies — 高优先级
    ✗ Engine Compatibility — 高优先级
  4. 询问:“是否需要我添加这[N]个缺失章节?我不会修改任何现有内容。”
  5. 如果用户同意:
    • 对于Status:询问用户——“此决策当前的状态是什么?” 选项:“Proposed”(提议)、“Accepted”(已接受)、“Deprecated”(已弃用)、“Superseded by ADR-XXXX”(被ADR-XXXX取代)
    • 对于ADR Dependencies:询问——“此决策是否依赖其他ADR? 它是否启用或阻塞其他ADR或史诗任务?”每个字段可接受“None”(无)作为回答。
    • 对于Engine Compatibility:读取引擎参考文档(与下方步骤1相同) 并请用户确认领域。然后生成包含验证数据的表格。
    • 对于GDD Requirements Addressed:询问——“哪些GDD系统促成了此决策? 此ADR满足每个GDD中的哪些具体需求?”
    • 使用编辑工具将每个缺失章节追加到ADR文件中。
    • 绝不修改任何现有章节,仅追加或补充缺失章节。
  6. 添加完所有缺失章节后,如果ADR的
    ## Date
    字段缺失,则更新该字段。
  7. 建议:“现在此ADR已具备Status和Dependencies字段,请运行
    /architecture-review
    重新验证覆盖范围。”
若未处于改造模式,则继续执行下方步骤1(常规ADR编写流程)。
无参数防护:如果未提供任何参数(标题为空),在执行第0阶段前询问用户:
“您要记录的技术决策是什么?请提供一个简短标题 (例如:
event-system-architecture
physics-engine-choice
)。”
将用户的回复作为标题,然后继续执行步骤1。

1. Load Engine Context (ALWAYS FIRST)

1. 加载引擎上下文(始终第一步)

Before doing anything else, establish the engine environment:
  1. Read
    docs/engine-reference/[engine]/VERSION.md
    to get:
    • Engine name and version
    • LLM knowledge cutoff date
    • Post-cutoff version risk levels (LOW / MEDIUM / HIGH)
  2. Identify the domain of this architecture decision from the title or user description. Common domains: Physics, Rendering, UI, Audio, Navigation, Animation, Networking, Core, Input, Scripting.
  3. Read the corresponding module reference if it exists:
    docs/engine-reference/[engine]/modules/[domain].md
  4. Read
    docs/engine-reference/[engine]/breaking-changes.md
    — flag any changes in the relevant domain that post-date the LLM's training cutoff.
  5. Read
    docs/engine-reference/[engine]/deprecated-apis.md
    — flag any APIs in the relevant domain that should not be used.
  6. Display a knowledge gap warning before proceeding if the domain carries MEDIUM or HIGH risk:
    ⚠️  ENGINE KNOWLEDGE GAP WARNING
    Engine: [name + version]
    Domain: [domain]
    Risk Level: HIGH — This version is post-LLM-cutoff.
    
    Key changes verified from engine-reference docs:
    - [Change 1 relevant to this domain]
    - [Change 2]
    
    This ADR will be cross-referenced against the engine reference library.
    Proceed with verified information only — do NOT rely solely on training data.
    If no engine has been configured yet, prompt: "No engine is configured. Run
    /setup-engine
    first, or tell me which engine you are using."

在执行任何操作之前,先确定引擎环境:
  1. 读取
    docs/engine-reference/[engine]/VERSION.md
    以获取:
    • 引擎名称和版本
    • LLM知识 cutoff 日期
    • Cutoff后版本的风险等级(LOW / MEDIUM / HIGH)
  2. 根据标题或用户描述确定此架构决策的领域。常见领域:Physics(物理)、Rendering(渲染)、UI(用户界面)、Audio(音频)、Navigation(导航)、Animation(动画)、Networking(网络)、Core(核心)、Input(输入)、Scripting(脚本)。
  3. 如果对应模块参考文档存在,则读取:
    docs/engine-reference/[engine]/modules/[domain].md
  4. 读取
    docs/engine-reference/[engine]/breaking-changes.md
    ——标记相关领域中所有晚于LLM训练 cutoff 日期的变更。
  5. 读取
    docs/engine-reference/[engine]/deprecated-apis.md
    ——标记相关领域中不应再使用的API。
  6. 如果该领域存在MEDIUM或HIGH风险,在继续执行前显示知识缺口警告
    ⚠️ 引擎知识缺口警告
    引擎:[名称 + 版本]
    领域:[领域名称]
    风险等级:HIGH —— 该版本晚于LLM cutoff日期。
    
    从引擎参考文档中验证的关键变更:
    - [与该领域相关的变更1]
    - [变更2]
    
    此ADR将与引擎参考库进行交叉引用。
    仅基于已验证的信息进行操作——请勿仅依赖训练数据。
    如果尚未配置引擎,则提示:“未配置引擎。 请先运行
    /setup-engine
    ,或告知您正在使用的引擎。”

2. Determine the next ADR number

2. 确定下一个ADR编号

Scan
docs/architecture/
for existing ADRs to find the next number.

扫描
docs/architecture/
目录中的现有ADR,找到下一个可用编号。

3. Gather context

3. 收集上下文信息

Read related code, existing ADRs, and relevant GDDs from
design/gdd/
.
读取相关代码、现有ADR以及
design/gdd/
目录中的相关GDD文档。

3a: Architecture Registry Check (BLOCKING gate)

3a: 架构注册表检查(阻塞 gate)

Read
docs/registry/architecture.yaml
. Extract entries relevant to this ADR's domain and decision (grep by system name, domain keyword, or state being touched).
Present any relevant stances to the user before the collaborative design begins, as locked constraints:
undefined
读取
docs/registry/architecture.yaml
。提取与本ADR领域和决策相关的条目(按系统名称、领域关键字或涉及的状态进行筛选)。
在协作设计开始前,向用户展示所有相关的既定规则,作为不可违反的约束:
undefined

Existing Architectural Stances (must not contradict)

现有架构规则(不得违反)

State Ownership: player_health → owned by health-system (ADR-0001) Interface: HealthComponent.current_health (read-only float) → If this ADR reads or writes player health, it must use this interface.
Interface Contracts: damage_delivery → signal pattern (ADR-0003) Signal: damage_dealt(amount, target, is_crit) → If this ADR delivers or receives damage events, it must use this signal.
Forbidden Patterns: ✗ autoload_singleton_coupling (ADR-0001) ✗ direct_cross_system_state_write (ADR-0000) → The proposed approach must not use these patterns.

If the user's proposed decision would contradict any registered stance, surface
the conflict immediately:

> "⚠️ Conflict: This ADR proposes [X], but ADR-[NNNN] established that [Y] is
> the accepted pattern for this purpose. Proceeding without resolving this will
> produce contradictory ADRs and inconsistent stories.
> Options: (1) Align with the existing stance, (2) Supersede ADR-[NNNN] with
> an explicit replacement, (3) Explain why this case is an exception."

Do not proceed to Step 4 (collaborative design) until any conflict is resolved
or explicitly accepted as an intentional exception.

---
状态所有权: player_health → 归health-system所有(ADR-0001) 接口:HealthComponent.current_health(只读浮点数) → 如果本ADR需要读取或写入玩家生命值,必须使用此接口。
接口契约: damage_delivery → 信号模式(ADR-0003) 信号:damage_dealt(amount, target, is_crit) → 如果本ADR需要传递或接收伤害事件,必须使用此信号。
禁止模式: ✗ autoload_singleton_coupling(ADR-0001) ✗ direct_cross_system_state_write(ADR-0000) → 提议的方案不得使用这些模式。

如果用户提议的决策与任何已注册规则冲突,立即指出冲突:

> “⚠️ 冲突:本ADR提议[X],但ADR-[NNNN]已确立[Y]是此类场景的公认模式。
> 不解决此冲突将产生矛盾的ADR和不一致的故事。
> 选项:(1) 与现有规则保持一致,(2) 明确替换ADR-[NNNN],(3) 解释为何此案例是例外。”

在冲突解决或用户明确接受作为故意例外之前,不得继续执行步骤4(协作设计)。

---

4. Guide the decision collaboratively

4. 协作引导决策

Before asking anything, derive the skill's best guesses from the context already gathered (GDDs read, engine reference loaded, existing ADRs scanned). Then present a confirm/adjust prompt using
AskUserQuestion
— not open-ended questions.
Derive assumptions first:
  • Problem: Infer from the title + GDD context what decision needs to be made
  • Alternatives: Propose 2-3 concrete options from engine reference + GDD requirements
  • Dependencies: Scan existing ADRs for upstream dependencies; assume None if unclear
  • GDD linkage: Extract which GDD systems the title directly relates to
  • Status: Always
    Proposed
    for new ADRs — never ask the user what the status is
Scope of assumptions tab: Assumptions cover only: problem framing, alternative approaches, upstream dependencies, GDD linkage, and status. Schema design questions (e.g., "How should spawn timing work?", "Should data be inline or external?") are NOT assumptions — they are design decisions belonging to a separate step after the assumptions are confirmed. Do not include schema design questions in the assumptions AskUserQuestion widget.
After assumptions are confirmed, if the ADR involves schema or data design choices, use a separate multi-tab
AskUserQuestion
to ask each design question independently before drafting.
Present assumptions with
AskUserQuestion
:
Here's what I'm assuming before drafting:

Problem: [one-sentence problem statement derived from context]
Alternatives I'll consider:
  A) [option derived from engine reference]
  B) [option derived from GDD requirements]
  C) [option from common patterns]
GDD systems driving this: [list derived from context]
Dependencies: [upstream ADRs if any, otherwise "None"]
Status: Proposed

[A] Proceed — draft with these assumptions
[B] Change the alternatives list
[C] Adjust the GDD linkage
[D] Add a performance budget constraint
[E] Something else needs changing first
Do not generate the ADR until the user confirms assumptions or provides corrections.
After engine specialist and TD reviews return (Step 5.5/5.6), if unresolved decisions remain, present each one as a separate
AskUserQuestion
with the proposed options as choices plus a free-text escape:
Decision: [specific unresolved point]
[A] [option from specialist review]
[B] [alternative option]
[C] Different approach — I'll describe it
ADR Dependencies — derive from existing ADRs, then confirm:
  • Does this decision depend on any other ADR not yet Accepted?
  • Does it unlock or unblock any other ADR or epic?
  • Does it block any specific epic from starting?
Record answers in the ADR Dependencies section. Write "None" for each field if no constraints apply.

在提问之前,先从已收集的上下文(已读取的GDD、已加载的引擎参考、已扫描的现有ADR)中得出技能的最佳猜测。然后使用
AskUserQuestion
展示确认/调整提示——而非开放式问题。
先推导假设:
  • 问题:从标题和GDD上下文推断需要做出什么决策
  • 备选方案:根据引擎参考和GDD需求提出2-3个具体选项
  • 依赖关系:扫描现有ADR寻找上游依赖;若不明确则假设为None
  • GDD关联:提取与标题直接相关的GDD系统
  • 状态:新ADR的状态始终为
    Proposed
    ——无需询问用户
假设范围:假设仅涵盖问题框架、备选方案、上游依赖、GDD关联和状态。架构设计问题(例如:“生成时机应如何工作?”、“数据应内嵌还是外置?”)不属于假设范畴——它们是假设确认后单独步骤中的设计决策。请勿将架构设计问题包含在
AskUserQuestion
的假设部分中。
假设确认后,如果ADR涉及架构或数据设计选择,使用单独的多标签
AskUserQuestion
在起草前逐个询问每个设计问题。
使用
AskUserQuestion
展示假设:
以下是我起草前的假设:

问题:[从上下文推导的一句话问题陈述]
我将考虑的备选方案:
  A) [从引擎参考推导的选项]
  B) [从GDD需求推导的选项]
  C) [常见模式中的选项]
驱动此决策的GDD系统:[从上下文推导的列表]
依赖关系:[上游ADR(如有),否则为“None”]
状态:Proposed

[A] 继续——基于这些假设起草
[B] 修改备选方案列表
[C] 调整GDD关联
[D] 添加性能预算约束
[E] 先修改其他内容
在用户确认假设或提供修正之前,不得生成ADR。
在引擎专家和技术总监评审返回后(步骤5.5/5.6),若仍有未解决的决策点,将每个决策点作为单独的
AskUserQuestion
展示,提供提议选项和自由文本输入选项:
决策点:[具体未解决的问题]
[A] [专家评审提出的选项]
[B] [备选选项]
[C] 其他方案——我将描述它
ADR依赖关系——从现有ADR推导,然后确认:
  • 此决策是否依赖任何尚未被Accept的ADR?
  • 它是否解锁或解除对其他ADR或史诗任务的阻塞?
  • 它是否阻塞任何特定史诗任务的启动?
将答案记录在ADR Dependencies章节中。如果无约束适用,每个字段填写“None”。

5. Generate the ADR

5. 生成ADR

Following this format:
markdown
undefined
遵循以下格式:
markdown
undefined

ADR-[NNNN]: [Title]

ADR-[NNNN]: [标题]

Status

Status

[Proposed | Accepted | Deprecated | Superseded by ADR-XXXX]
[Proposed | Accepted | Deprecated | Superseded by ADR-XXXX]

Date

Date

[Date of decision]
[决策日期]

Engine Compatibility

Engine Compatibility

FieldValue
Engine[e.g. Godot 4.6]
Domain[Physics / Rendering / UI / Audio / Navigation / Animation / Networking / Core / Input]
Knowledge Risk[LOW / MEDIUM / HIGH — from VERSION.md]
References Consulted[List engine-reference docs read, e.g.
docs/engine-reference/godot/modules/physics.md
]
Post-Cutoff APIs Used[Any APIs from post-LLM-cutoff versions this decision depends on, or "None"]
Verification Required[Specific behaviours to test before shipping, or "None"]
字段
Engine[例如 Godot 4.6]
Domain[Physics / Rendering / UI / Audio / Navigation / Animation / Networking / Core / Input]
Knowledge Risk[LOW / MEDIUM / HIGH — 来自VERSION.md]
References Consulted[读取的引擎参考文档列表,例如
docs/engine-reference/godot/modules/physics.md
]
Post-Cutoff APIs Used[此决策依赖的任何LLM cutoff后版本的API,或“None”]
Verification Required[发布前需要测试的特定行为,或“None”]

ADR Dependencies

ADR Dependencies

FieldValue
Depends On[ADR-NNNN (must be Accepted before this can be implemented), or "None"]
Enables[ADR-NNNN (this ADR unlocks that decision), or "None"]
Blocks[Epic/Story name — cannot start until this ADR is Accepted, or "None"]
Ordering Note[Any sequencing constraint that isn't captured above]
字段
Depends On[ADR-NNNN(必须先被Accept才能实现此ADR),或“None”]
Enables[ADR-NNNN(此ADR解锁该决策),或“None”]
Blocks[史诗/故事名称——必须等此ADR被Accept才能启动,或“None”]
Ordering Note[未被上述字段涵盖的任何顺序约束]

Context

Context

Problem Statement

Problem Statement

[What problem are we solving? Why does this decision need to be made now?]
[我们要解决什么问题?为什么现在需要做出此决策?]

Constraints

Constraints

  • [Technical constraints]
  • [Timeline constraints]
  • [Resource constraints]
  • [Compatibility requirements]
  • [技术约束]
  • [时间线约束]
  • [资源约束]
  • [兼容性要求]

Requirements

Requirements

  • [Must support X]
  • [Must perform within Y budget]
  • [Must integrate with Z]
  • [必须支持X]
  • [必须在Y预算内运行]
  • [必须与Z集成]

Decision

Decision

[The specific technical decision made, described in enough detail for someone to implement it.]
[做出的具体技术决策,描述需足够详细以便他人实现。]

Architecture Diagram

Architecture Diagram

[ASCII diagram or description of the system architecture this creates]
[此决策创建的系统架构的ASCII图或描述]

Key Interfaces

Key Interfaces

[API contracts or interface definitions this decision creates]
[此决策定义的API契约或接口定义]

Alternatives Considered

Alternatives Considered

Alternative 1: [Name]

Alternative 1: [名称]

  • Description: [How this would work]
  • Pros: [Advantages]
  • Cons: [Disadvantages]
  • Rejection Reason: [Why this was not chosen]
  • Description: [此方案的工作方式]
  • Pros: [优势]
  • Cons: [劣势]
  • Rejection Reason: [未选择此方案的原因]

Alternative 2: [Name]

Alternative 2: [名称]

  • Description: [How this would work]
  • Pros: [Advantages]
  • Cons: [Disadvantages]
  • Rejection Reason: [Why this was not chosen]
  • Description: [此方案的工作方式]
  • Pros: [优势]
  • Cons: [劣势]
  • Rejection Reason: [未选择此方案的原因]

Consequences

Consequences

Positive

Positive

  • [Good outcomes of this decision]
  • [此决策带来的良好结果]

Negative

Negative

  • [Trade-offs and costs accepted]
  • [接受的权衡和成本]

Risks

Risks

  • [Things that could go wrong]
  • [Mitigation for each risk]
  • [可能出现的问题]
  • [每个风险的缓解措施]

GDD Requirements Addressed

GDD Requirements Addressed

GDD SystemRequirementHow This ADR Addresses It
[system-name].md[specific rule, formula, or performance constraint from that GDD][how this decision satisfies it]
GDD SystemRequirement此ADR如何满足需求
[system-name].md[来自该GDD的具体规则、公式或性能约束][此决策如何满足该需求]

Performance Implications

Performance Implications

  • CPU: [Expected impact]
  • Memory: [Expected impact]
  • Load Time: [Expected impact]
  • Network: [Expected impact, if applicable]
  • CPU: [预期影响]
  • Memory: [预期影响]
  • Load Time: [预期影响]
  • Network: [预期影响(如适用)]

Migration Plan

Migration Plan

[If this changes existing code, how do we get from here to there?]
[如果此决策修改现有代码,如何从当前状态过渡到目标状态?]

Validation Criteria

Validation Criteria

[How will we know this decision was correct? What metrics or tests?]
[我们如何知道此决策是正确的?使用什么指标或测试?]

Related Decisions

Related Decisions

  • [Links to related ADRs]
  • [Links to related design documents]

5.5. **Engine Specialist Validation** — Before saving, spawn the **primary engine specialist** via Task to validate the drafted ADR:
   - Read `.claude/docs/technical-preferences.md` `Engine Specialists` section to get the primary specialist
   - If no engine is configured (`[TO BE CONFIGURED]`), skip this step
   - Spawn `subagent_type: [primary specialist]` with: the ADR's Engine Compatibility section, Decision section, Key Interfaces, and the engine reference docs path. Ask them to:
     1. Confirm the proposed approach is idiomatic for the pinned engine version
     2. Flag any APIs or patterns that are deprecated or changed post-training-cutoff
     3. Identify engine-specific risks or gotchas not captured in the current ADR draft
   - If the specialist identifies a **blocking issue** (wrong API, deprecated approach, engine version incompatibility): revise the Decision and Engine Compatibility sections accordingly, then confirm the changes with the user before proceeding
   - If the specialist finds **minor notes** only: incorporate them into the ADR's Risks subsection

**Review mode check** — apply before spawning TD-ADR:
- `solo` → skip. Note: "TD-ADR skipped — Solo mode." Proceed to Step 5.7 (GDD sync check).
- `lean` → skip (not a PHASE-GATE). Note: "TD-ADR skipped — Lean mode." Proceed to Step 5.7 (GDD sync check).
- `full` → spawn as normal.

5.6. **Technical Director Strategic Review** — After the engine specialist validation, spawn `technical-director` via Task using gate **TD-ADR** (`.claude/docs/director-gates.md`):
   - Pass: the ADR file path (or draft content), engine version, domain, any existing ADRs in the same domain
   - The TD validates architectural coherence (is this decision consistent with the whole system?) — distinct from the engine specialist's API-level check
   - If CONCERNS or REJECT: revise the Decision or Alternatives sections accordingly before proceeding

5.7. **GDD Sync Check** — Before presenting the write approval, scan all GDDs
referenced in the "GDD Requirements Addressed" section for naming inconsistencies
with the ADR's Key Interfaces and Decision sections (renamed signals, API methods,
or data types). If any are found, surface them as a **prominent warning block**
immediately before the write approval — not as a footnote:
⚠️ GDD SYNC REQUIRED [gdd-filename].md uses names this ADR has renamed: [old_name] → [new_name_from_adr] [old_name_2] → [new_name_2_from_adr] The GDD must be updated before or alongside writing this ADR to prevent developers reading the GDD from implementing the wrong interface.

If no inconsistencies: skip this block silently.

5. **Write approval** — Use `AskUserQuestion`:

If GDD sync issues were found:
- "ADR draft is complete. How would you like to proceed?"
  - [A] Write ADR + update GDD in the same pass
  - [B] Write ADR only — I'll update the GDD manually
  - [C] Not yet — I need to review further

If no GDD sync issues:
- "ADR draft is complete. May I write it?"
  - [A] Write ADR to `docs/architecture/adr-[NNNN]-[slug].md`
  - [B] Not yet — I need to review further

If yes to any write option, write the file, creating the directory if needed.
For option [A] with GDD update: also update the GDD file(s) to use the new names.

6. **Update Architecture Registry**

Scan the written ADR for new architectural stances that should be registered:
- State it claims ownership of
- Interface contracts it defines (signal signatures, method APIs)
- Performance budget it claims
- API choices it makes explicitly
- Patterns it bans (Consequences → Negative or explicit "do not use X")

Present candidates:
Registry candidates from this ADR: NEW state ownership: player_stamina → stamina-system NEW interface contract: stamina_depleted signal NEW performance budget: stamina-system: 0.5ms/frame NEW forbidden pattern: polling stamina each frame (use signal instead) EXISTING (referenced_by update only): player_health → already registered ✅

**Registry append logic**: When writing to `docs/registry/architecture.yaml`, do NOT assume sections are empty. The file may already have entries from previous ADRs written in this session. Before each Edit call:
1. Read the current state of `docs/registry/architecture.yaml`
2. Find the correct section (state_ownership, interfaces, forbidden_patterns, api_decisions)
3. Append the new entry AFTER the last existing entry in that section — do not try to replace a `[]` placeholder that may no longer exist
4. If the section has entries already, use the closing content of the last entry as the `old_string` anchor, and append the new entry after it

**BLOCKING — do not write to `docs/registry/architecture.yaml` without explicit user approval.**

Ask using `AskUserQuestion`:
- "May I update `docs/registry/architecture.yaml` with these [N] new stances?"
  - Options: "Yes — update the registry", "Not yet — I want to review the candidates", "Skip registry update"

Only proceed if the user selects yes. If yes: append new entries. Never modify existing entries — if a stance is
changing, set the old entry to `status: superseded_by: ADR-[NNNN]` and add the new entry.

---
  • [相关ADR的链接]
  • [相关设计文档的链接]

5.5. **引擎专家验证** —— 在保存前,通过Task生成**主引擎专家**来验证起草的ADR:
   - 读取`.claude/docs/technical-preferences.md`的`Engine Specialists`部分以获取主专家信息
   - 如果未配置引擎(显示`[TO BE CONFIGURED]`),跳过此步骤
   - 生成`subagent_type: [primary specialist]`,并提供:ADR的Engine Compatibility章节、Decision章节、Key Interfaces,以及引擎参考文档路径。要求他们:
     1. 确认提议的方法对于固定引擎版本是否符合惯用做法
     2. 标记任何已弃用或在训练cutoff后变更的API或模式
     3. 识别当前ADR草稿中未涵盖的引擎特定风险或陷阱
   - 如果专家发现**阻塞问题**(错误API、已弃用方法、引擎版本不兼容):相应修改Decision和Engine Compatibility章节,然后在继续前请用户确认变更
   - 如果专家仅提出**次要建议**:将其整合到ADR的Risks子章节中

**评审模式检查** —— 在生成TD-ADR前应用:
- `solo` → 跳过。备注:“TD-ADR已跳过——Solo模式。”继续执行步骤5.7(GDD同步检查)。
- `lean` → 跳过(非PHASE-GATE)。备注:“TD-ADR已跳过——Lean模式。”继续执行步骤5.7(GDD同步检查)。
- `full` → 正常生成。

5.6. **技术总监战略评审** —— 引擎专家验证完成后,通过Task使用gate **TD-ADR**(`.claude/docs/director-gates.md`)生成`technical-director`:
   - 提供:ADR文件路径(或草稿内容)、引擎版本、领域、同一领域的所有现有ADR
   - 技术总监验证架构一致性(此决策是否与整个系统一致?)——与引擎专家的API级检查不同
   - 如果提出担忧或拒绝:相应修改Decision或Alternatives章节后再继续

5.7. **GDD同步检查** —— 在请求写入批准前,扫描“GDD Requirements Addressed”章节中引用的所有GDD,检查ADR的Key Interfaces和Decision章节中的命名是否存在不一致(重命名的信号、API方法或数据类型)。如果发现不一致,在写入批准前立即以**显眼警告块**形式展示——而非脚注:
⚠️ 需要同步GDD [gdd-filename].md使用的名称与此ADR中的重命名不一致: [旧名称] → [ADR中的新名称] [旧名称2] → [ADR中的新名称2] 在写入此ADR之前或同时必须更新GDD,以防止阅读GDD的开发者实现错误的接口。

如果无不一致:静默跳过此块。

5. **写入批准** —— 使用`AskUserQuestion`:

如果发现GDD同步问题:
- “ADR草稿已完成。您希望如何处理?”
  - [A] 写入ADR并同步更新GDD
  - [B] 仅写入ADR——我将手动更新GDD
  - [C] 暂不处理——我需要进一步评审

如果无GDD同步问题:
- “ADR草稿已完成。是否可以写入?”
  - [A] 将ADR写入`docs/architecture/adr-[NNNN]-[slug].md`
  - [B] 暂不处理——我需要进一步评审

如果用户同意任何写入选项,则写入文件,必要时创建目录。
对于选项[A]且需要更新GDD的情况:同时更新GDD文件以使用新名称。

6. **更新架构注册表**

扫描已写入的ADR,找出应注册的新架构规则:
- 它声明拥有所有权的状态
- 它定义的接口契约(信号签名、方法API)
- 它声明的性能预算
- 它明确做出的API选择
- 它禁止的模式(Consequences → Negative或明确的“不得使用X”)

展示候选条目:
此ADR中的注册表候选条目: 新状态所有权: player_stamina → stamina-system 新接口契约: stamina_depleted信号 新性能预算: stamina-system: 0.5ms/帧 新禁止模式: 每帧轮询耐力(改用信号) 已存在(仅更新引用):player_health → 已注册 ✅

**注册表追加逻辑**:写入`docs/registry/architecture.yaml`时,请勿假设章节为空。该文件可能已包含本次会话中之前写入的ADR条目。每次调用Edit前:
1. 读取`docs/registry/architecture.yaml`的当前状态
2. 找到正确的章节(state_ownership、interfaces、forbidden_patterns、api_decisions)
3. 将新条目追加到该章节的最后一个现有条目之后——不要尝试替换可能已不存在的`[]`占位符
4. 如果章节已有条目,使用最后一个条目的结尾内容作为`old_string`锚点,将新条目追加到其后

**阻塞规则——未经用户明确批准,不得写入`docs/registry/architecture.yaml`。**

使用`AskUserQuestion`询问:
- “是否可以将这[N]个新规则更新到`docs/registry/architecture.yaml`中?”
  - 选项:“是——更新注册表”、“暂不——我要先评审候选条目”、“跳过注册表更新”

仅当用户选择“是”时才继续。如果同意:追加新条目。绝不修改现有条目——如果规则变更,将旧条目设置为`status: superseded_by: ADR-[NNNN]`并添加新条目。

---

6. Closing Next Steps

6. 结束与后续步骤

After the ADR is written (and registry optionally updated), close with
AskUserQuestion
.
Before generating the widget:
  1. Read
    docs/registry/architecture.yaml
    — check if any priority ADRs are still unwritten (look for ADRs flagged in technical-preferences.md or systems-index.md as prerequisites)
  2. Check if all prerequisite ADRs are now written. If yes, include a "Start writing GDDs" option.
  3. List ALL remaining priority ADRs as individual options — not just the next one or two.
Widget format:
ADR-[NNNN] written and registry updated. What would you like to do next?
[1] Write [next-priority-adr-name] — [brief description from prerequisites list]
[2] Write [another-priority-adr] — [brief description]  (include ALL remaining ones)
[N] Start writing GDDs — run `/design-system [first-undesigned-system]` (only show if all prerequisite ADRs are written)
[N+1] Stop here for this session
If there are no remaining priority ADRs and no undesigned GDD systems, offer only "Stop here" and suggest running
/architecture-review
in a fresh session.
Always include this fixed notice in the closing output (do NOT omit it):
To validate ADR coverage against your GDDs, open a fresh Claude Code session and run
/architecture-review
.
Never run
/architecture-review
in the same session as
/architecture-decision
.
The reviewing agent must be independent of the authoring context to give an unbiased assessment. Running it here would invalidate the review.
Update any stories that were
Status: Blocked
pending this ADR to
Status: Ready
.
ADR写入完成(并可选更新注册表)后,使用
AskUserQuestion
结束会话。
生成组件前:
  1. 读取
    docs/registry/architecture.yaml
    ——检查是否仍有未写入的优先级ADR(查找technical-preferences.md或systems-index.md中标记为前置条件的ADR)
  2. 检查所有前置ADR是否已写入。如果是,添加“开始编写GDD”选项。
  3. 将所有剩余的优先级ADR列为单独选项——而非仅列出下一个或两个。
组件格式:
ADR-[NNNN]已写入且注册表已更新。接下来您想做什么?
[1] 编写[下一个优先级ADR名称] —— [前置条件列表中的简要描述]
[2] 编写[另一个优先级ADR] —— [简要描述] (包含所有剩余ADR)
[N] 开始编写GDD —— 运行`/design-system [首个未设计系统]`(仅当所有前置ADR已写入时显示)
[N+1] 本次会话到此结束
如果没有剩余优先级ADR且没有未设计的GDD系统,仅提供“到此结束”选项,并建议在新会话中运行
/architecture-review
始终在结束输出中包含此固定提示(不得省略):
要验证ADR对GDD的覆盖范围,请打开一个全新的Claude Code会话 并运行
/architecture-review
切勿在与
/architecture-decision
相同的会话中运行
/architecture-review
评审代理必须独立于编写上下文才能给出无偏见的评估。在此处运行会使评审无效。
将所有因等待此ADR而处于
Status: Blocked
状态的故事更新为
Status: Ready