architext 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +94 -12
  3. package/README.zh-CN.md +94 -12
  4. package/dist/index.js +43 -39
  5. package/dist/templates/en/briefs/_base.md +44 -11
  6. package/dist/templates/en/briefs/_modules.md +31 -4
  7. package/dist/templates/en/docs/global/api_snapshot.json +24 -0
  8. package/dist/templates/en/docs/global/command_api.json +26 -0
  9. package/dist/templates/en/docs/global/env_registry.json +12 -0
  10. package/dist/templates/en/docs/global/map.json +5 -0
  11. package/dist/templates/en/docs/global/public_api.json +12 -0
  12. package/dist/templates/en/docs/prompts/audit.md +80 -94
  13. package/dist/templates/en/docs/prompts/code.md +100 -109
  14. package/dist/templates/en/docs/prompts/edit.md +52 -47
  15. package/dist/templates/en/docs/prompts/fix.md +49 -42
  16. package/dist/templates/en/docs/prompts/help.md +23 -31
  17. package/dist/templates/en/docs/prompts/inherit.md +110 -116
  18. package/dist/templates/en/docs/prompts/map.md +47 -69
  19. package/dist/templates/en/docs/prompts/plan.md +160 -171
  20. package/dist/templates/en/docs/prompts/recover.md +48 -0
  21. package/dist/templates/en/docs/prompts/ref.md +163 -0
  22. package/dist/templates/en/docs/prompts/remove.md +55 -107
  23. package/dist/templates/en/docs/prompts/revise.md +63 -106
  24. package/dist/templates/en/docs/prompts/scope.md +77 -117
  25. package/dist/templates/en/docs/prompts/start.md +93 -139
  26. package/dist/templates/en/docs/shared/verify-result-handling.md +6 -0
  27. package/dist/templates/en/docs/templates/design.template.md +77 -0
  28. package/dist/templates/en/docs/templates/spec.template.md +60 -25
  29. package/dist/templates/en/rules/00_system.md +36 -79
  30. package/dist/templates/en/rules/01_workflow.md +59 -57
  31. package/dist/templates/en/rules/03_data_governance.md +46 -42
  32. package/dist/templates/en/skills/archi-data-sync/SKILL.md +83 -0
  33. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +166 -151
  34. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +140 -0
  35. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +118 -0
  36. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -1
  37. package/dist/templates/en/skills/archi-plan-options/SKILL.md +4 -3
  38. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +118 -0
  39. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
  40. package/dist/templates/zh/briefs/_base.md +46 -14
  41. package/dist/templates/zh/briefs/_modules.md +29 -2
  42. package/dist/templates/zh/docs/global/api_snapshot.json +24 -0
  43. package/dist/templates/zh/docs/global/command_api.json +26 -0
  44. package/dist/templates/zh/docs/global/data_snapshot.json +0 -1
  45. package/dist/templates/zh/docs/global/design_tokens.json +0 -1
  46. package/dist/templates/zh/docs/global/dictionary.json +1 -1
  47. package/dist/templates/zh/docs/global/env_registry.json +12 -0
  48. package/dist/templates/zh/docs/global/error_codes.json +0 -8
  49. package/dist/templates/zh/docs/global/map.json +28 -3
  50. package/dist/templates/zh/docs/global/public_api.json +12 -0
  51. package/dist/templates/zh/docs/global/vision.md +1 -1
  52. package/dist/templates/zh/docs/prompts/audit.md +43 -57
  53. package/dist/templates/zh/docs/prompts/code.md +68 -77
  54. package/dist/templates/zh/docs/prompts/edit.md +44 -39
  55. package/dist/templates/zh/docs/prompts/fix.md +33 -26
  56. package/dist/templates/zh/docs/prompts/help.md +13 -21
  57. package/dist/templates/zh/docs/prompts/inherit.md +81 -87
  58. package/dist/templates/zh/docs/prompts/map.md +23 -45
  59. package/dist/templates/zh/docs/prompts/plan.md +134 -146
  60. package/dist/templates/zh/docs/prompts/recover.md +48 -0
  61. package/dist/templates/zh/docs/prompts/ref.md +163 -0
  62. package/dist/templates/zh/docs/prompts/remove.md +31 -83
  63. package/dist/templates/zh/docs/prompts/revise.md +43 -84
  64. package/dist/templates/zh/docs/prompts/scope.md +53 -93
  65. package/dist/templates/zh/docs/prompts/start.md +75 -121
  66. package/dist/templates/zh/docs/shared/verify-result-handling.md +6 -0
  67. package/dist/templates/zh/docs/templates/design.template.md +77 -0
  68. package/dist/templates/zh/docs/templates/spec.template.md +60 -25
  69. package/dist/templates/zh/rules/00_system.md +37 -80
  70. package/dist/templates/zh/rules/01_workflow.md +60 -58
  71. package/dist/templates/zh/rules/02_tech_stack.md +7 -6
  72. package/dist/templates/zh/rules/03_data_governance.md +43 -39
  73. package/dist/templates/zh/rules/99_context_glue.md +2 -2
  74. package/dist/templates/zh/skills/archi-data-sync/SKILL.md +83 -0
  75. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +70 -56
  76. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +140 -0
  77. package/dist/templates/zh/skills/archi-feature-relations/SKILL.md +118 -0
  78. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
  79. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +26 -25
  80. package/dist/templates/zh/skills/archi-silent-audit/SKILL.md +118 -0
  81. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
  82. package/package.json +1 -1
  83. package/dist/templates/zh-Hant/briefs/_base.md +0 -115
  84. package/dist/templates/zh-Hant/briefs/_modules.md +0 -173
  85. package/dist/templates/zh-Hant/docs/global/data_snapshot.json +0 -31
  86. package/dist/templates/zh-Hant/docs/global/design_tokens.json +0 -135
  87. package/dist/templates/zh-Hant/docs/global/dictionary.json +0 -35
  88. package/dist/templates/zh-Hant/docs/global/error_codes.json +0 -19
  89. package/dist/templates/zh-Hant/docs/global/map.json +0 -94
  90. package/dist/templates/zh-Hant/docs/global/roadmap.json +0 -39
  91. package/dist/templates/zh-Hant/docs/global/vision.md +0 -82
  92. package/dist/templates/zh-Hant/docs/prompts/audit.md +0 -150
  93. package/dist/templates/zh-Hant/docs/prompts/code.md +0 -160
  94. package/dist/templates/zh-Hant/docs/prompts/edit.md +0 -87
  95. package/dist/templates/zh-Hant/docs/prompts/fix.md +0 -86
  96. package/dist/templates/zh-Hant/docs/prompts/help.md +0 -69
  97. package/dist/templates/zh-Hant/docs/prompts/inherit.md +0 -270
  98. package/dist/templates/zh-Hant/docs/prompts/map.md +0 -131
  99. package/dist/templates/zh-Hant/docs/prompts/plan.md +0 -252
  100. package/dist/templates/zh-Hant/docs/prompts/remove.md +0 -162
  101. package/dist/templates/zh-Hant/docs/prompts/revise.md +0 -160
  102. package/dist/templates/zh-Hant/docs/prompts/scope.md +0 -198
  103. package/dist/templates/zh-Hant/docs/prompts/start.md +0 -258
  104. package/dist/templates/zh-Hant/docs/templates/plan.template.json +0 -88
  105. package/dist/templates/zh-Hant/docs/templates/scope-brief.template.md +0 -58
  106. package/dist/templates/zh-Hant/docs/templates/spec.template.md +0 -51
  107. package/dist/templates/zh-Hant/docs/templates/ui.template.md +0 -51
  108. package/dist/templates/zh-Hant/rules/00_system.md +0 -123
  109. package/dist/templates/zh-Hant/rules/01_workflow.md +0 -93
  110. package/dist/templates/zh-Hant/rules/02_tech_stack.md +0 -192
  111. package/dist/templates/zh-Hant/rules/03_data_governance.md +0 -102
  112. package/dist/templates/zh-Hant/rules/04_cli_tools.md +0 -50
  113. package/dist/templates/zh-Hant/rules/90_custom_rules.md +0 -21
  114. package/dist/templates/zh-Hant/rules/99_context_glue.md +0 -53
  115. package/dist/templates/zh-Hant/skills/archi-decompose-roadmap/SKILL.md +0 -293
  116. package/dist/templates/zh-Hant/skills/archi-interview-protocol/SKILL.md +0 -86
  117. package/dist/templates/zh-Hant/skills/archi-plan-options/SKILL.md +0 -364
  118. package/dist/templates/zh-Hant/skills/archi-ui-wireframe/SKILL.md +0 -337
@@ -23,32 +23,27 @@
23
23
  - 如未提供路径 → 依次查找 `project-brief.md`(项目根)、`[[__DOCS_DIR__]]/project-brief.md`
24
24
  - 如均不存在或为空 → 跳转 `<fallback_interview>`
25
25
 
26
- 2. **资源可达性检查**(须在解析前完成):
27
- 扫描 Brief 全文,识别所有外部引用(URL、文件路径、图片)。逐一尝试访问,将结果分为三类:
26
+ 2. **资源扫描与读取**(须在解析前完成):
27
+
28
+ **a) `brief-assets/` 目录扫描**:检查项目根目录是否存在 `brief-assets/` 文件夹。如存在,读取其中所有文件(图片/PDF/文档/Schema)。Brief 中通过 `./brief-assets/文件名` 引用的文件与此处读取的文件做匹配。
29
+
30
+ **b) Brief 全文外部引用检查**:扫描 Brief 全文,识别所有外部引用(URL、文件路径、图片)。逐一尝试访问:
28
31
 
29
32
  | 状态 | 处理 |
30
33
  |:---|:---|
31
- | 可访问 | 读取内容,纳入后续分析 |
34
+ | 可访问(含 brief-assets/ 中的本地文件) | 读取内容,纳入后续分析 |
32
35
  | 不可访问(需认证/404/私有链接) | 标记为 `[不可读]`,后续向用户报告 |
33
- | 非链接的描述性引用(如"参考 Linear 的交互") | 正常处理,无需访问 |
36
+ | 非链接的描述性引用 | 正常处理,无需访问 |
34
37
 
35
- > 此步骤的目的:避免 AI 假装已读取实际未能访问的资源,导致后续产出与用户预期脱节。
38
+ **c) 资产语义标签提取**:Brief 中以 `- [语义标签] 路径` 格式引用的资产,记录标签与文件的对应关系,供后续步骤使用(如 `[竞品参考]` → 影响 design_tokens,`[数据库 Schema]` → 影响 data_snapshot)。
36
39
 
37
- 3. 解析 Brief 各 Section,提取:
38
- - 项目特征标签 (UI/Data/CLI/Lib/API — 由 Brief 中存在的技术偏好字段和段落推断)
39
- - 核心任务列表
40
- - 已有设计决策(用户对特定任务/页面/流程的预定设计)
41
- - 技术偏好(区分"已确定"与"留空/推荐")
42
- - 已有资源与上下文
43
- - 边界与约束
44
- - 参考项目
45
- - 补充说明(规则/术语/背景信息)
40
+ 3. 解析 Brief 各 Section,提取:项目特征标签、核心任务列表、业务流程(如有)、已有设计决策、技术偏好(区分"已确定"与"留空/推荐")、数据模型草案(如有)、已有 API 端点(如有)、已有资源、边界与约束、参考项目、补充说明。
46
41
 
47
- > Brief 是一次性输入文件,处理完成后用户可自行删除。
42
+ > Brief 是一次性输入文件,处理完成后用户可自行删除(brief-assets/ 同理)。
48
43
 
49
44
  **Output**:
50
- - 如有不可访问的资源 → **立即向用户输出资源可达性报告**,列出无法读取的链接,请用户提供替代方式(如截图、粘贴内容、文字描述)。等待用户回复后再继续。
51
- - 如所有资源可达或无外部引用 → 内部摘要(不输出给用户),进入 `<step_1_gap_analysis>`。
45
+ - 如有不可访问的资源 → **立即输出资源可达性报告**,等待用户回复后再继续。
46
+ - 如所有资源可达或无外部引用 → 内部摘要,进入 `<step_1_gap_analysis>`。
52
47
  </step_0_ingest>
53
48
 
54
49
  <step_1_gap_analysis>
@@ -68,43 +63,23 @@
68
63
  | 技术栈-选填 | 数据库/ORM/CSS方案/部署等留空项 | 可补 |
69
64
  | 项目起点 | 全新 or 已有代码(影响架构决策) | 必须 |
70
65
  | 已有资源 | 设计稿/品牌/已有API/第三方服务是否明确 | 可补 |
71
- | 风格调性 | [?UI] 视觉关键词 / [?CLI] 输出风格 / [?API] 文档方案 | 可补 |
66
+ | 风格调性 | (仅ui项目) 视觉关键词 / (仅cli项目) 输出风格 / (仅api项目) 文档方案 | 可补 |
72
67
  | 边界 | 至少声明了 1 个反目标或硬性约束 | 建议 |
73
68
  | 成功指标 | 已填写具体可量化指标 | 建议 |
74
69
  | 参考项目 | 至少列出 1 个参照 | 建议 |
75
70
 
76
- **缺口分级**:
77
- - **必须**: 缺失则无法生成产物,须在 Step 2 提问
78
- - **可补**: AI 可基于上下文推荐,但最好确认
79
- - **建议**: AI 可自行推导,不阻塞流程
80
-
81
- **Decision**:
82
- - 无"必须"级缺口 + 无"可补"级缺口 → 跳过 Step 2,直接进入 Step 3
83
- - 有缺口 → 进入 Step 2
84
-
85
- **Output**: 向用户输出 Brief 分析摘要:
86
- ```
87
- ### BRIEF 分析报告
88
- > **项目**: [名称] | **特征**: [UI/Data/CLI/Lib/API 中已激活的标签]
71
+ **缺口分级**: 必须 → 须在 Step 2 提问 | 可补 → AI 可推荐,建议确认 | 建议 → AI 可自行推导
89
72
 
90
- **已确认信息**:
91
- - [已填写的关键信息列表]
73
+ **Decision**: 无"必须"+"可补"缺口 → 跳 Step 2 | 有缺口 → 进入 Step 2
92
74
 
93
- **信息缺口** (须补充):
94
- - [缺口 1]
95
- - [缺口 2]
96
-
97
- **AI 将自动补全** (无需操作):
98
- - [AI 可自行推导的项]
99
- ```
75
+ **Output**: 向用户输出 BRIEF 分析报告 — 含项目名/特征标签、已确认信息列表、信息缺口列表(须补充)、AI 将自动补全项。
100
76
  </step_1_gap_analysis>
101
77
 
102
78
  <step_2_supplementary>
103
- **Role**: 产品顾问
104
79
  **Trigger**: 仅当 Step 1 发现"必须"或"可补"级缺口时执行。
105
80
  **Input**: Step 1 的缺口列表。问题数上限 3-6 题。
106
81
 
107
- [[SKILL: 按 `archi-interview-protocol` Skill 的核心规则和标准输出格式提问。]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` 并遵循其规则)]]
82
+ [[SKILL: archi-interview-protocol|按 skill 的核心规则和标准输出格式提问。]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` 并遵循其规则)]]
108
83
  </step_2_supplementary>
109
84
 
110
85
  <step_3_constitution>
@@ -121,104 +96,84 @@
121
96
  |:---|:---|
122
97
  | 项目身份、目标用户、成功指标、参考灵感 | `[[__DOCS_DIR__]]/global/vision.md` |
123
98
  | 技术栈、部署目标、第三方库/服务 | 规则文件 `02_tech_stack` |
124
- | 风格调性(UI/CLI/API)— 审美方向/信息密度/动效偏好 | 规则文件 `02_tech_stack` (UI Protocol) + `design_tokens.json` aestheticDirection + motion.preference + illustration |
125
- | [?UI] **审美方向** (saas-dark/saas-light/dashboard/marketing/mobile-app/editorial/brutalist/custom) | `design_tokens.json` `aestheticDirection.preset` + `aestheticDirection.customDescription` |
126
- | [?UI] **视觉参考**(品牌色板/字体/图标库/竞品截图/禁用风格) | `design_tokens.json` primitivePalette.brand + illustration + motion; 截图/URL 存入 `vision.md` Visual Reference |
99
+ | 风格调性 审美方向/信息密度/动效偏好 | `02_tech_stack` (UI Protocol) + `design_tokens.json` |
100
+ | (仅ui项目)审美方向 preset + 视觉参考(品牌色/字体/图标/竞品截图) | `design_tokens.json` 对应字段 + `vision.md` Visual Reference |
101
+ | (仅ui项目)brief-assets/ 中标记为 `[竞品参考]` 的图片 | `design_tokens.json` aestheticDirection 参考 + `vision.md` Visual Reference |
127
102
  | 核心任务列表 | `[[__DOCS_DIR__]]/global/roadmap.json` |
128
- | **已有设计决策** | Roadmap 对应任务的 `goal` 字段中注入,并在 `/archi.plan` 时作为硬约束 |
129
- | 边界与反目标 | `[[__DOCS_DIR__]]/global/vision.md` Boundaries |
130
- | 已有资源(设计稿/品牌/已有API) | `[[__DOCS_DIR__]]/global/vision.md` + 规则文件 `02_tech_stack` 按内容归属 |
131
- | 补充说明中的**规则/约定/偏好** | 规则文件 `90_custom_rules` |
132
- | 补充说明中的**领域术语** | `[[__DOCS_DIR__]]/global/dictionary.json` |
133
- | 补充说明中的**其他背景信息** | `[[__DOCS_DIR__]]/global/vision.md` Context |
134
-
135
- > 关键: 用户在"补充说明"中写的任何规则性内容(如"代码注释用英文"、"禁止使用 any")须写入规则文件 `90_custom_rules`,而非丢弃。
103
+ | 业务流程(如有) | Roadmap 任务 `description` / `goal` 字段注入,辅助 `/archi.plan` 理解上下文 |
104
+ | 已有设计决策 | Roadmap 任务 `goal` 字段注入,`/archi.plan` 时作硬约束 |
105
+ | (仅data项目)数据模型草案(如有) | `data_snapshot.json` 初始实体骨架 |
106
+ | (仅api项目)已有 API 端点(如有) | `vision.md` Context + Roadmap 相关任务 `description` 注入 |
107
+ | brief-assets/ 中标记为 `[数据库 Schema]` 的文件 | 解析后写入 `data_snapshot.json` |
108
+ | brief-assets/ 中标记为 `[API 文档]` 的文件 | 解析后路由到 `vision.md` Context + 相关 Roadmap 任务 |
109
+ | 边界与反目标 | `vision.md` Boundaries |
110
+ | 已有资源 | `vision.md` + `02_tech_stack` 按归属 |
111
+ | 补充说明中的规则/约定/偏好 | 规则文件 `90_custom_rules` |
112
+ | 补充说明中的领域术语 | `dictionary.json` |
113
+ | 补充说明中的其他背景 | `vision.md` Context |
114
+
115
+ > 关键: 用户"补充说明"中的规则性内容须写入 `90_custom_rules`,禁丢弃。
136
116
 
137
117
  ### 3.1 Vision (`[[__DOCS_DIR__]]/global/vision.md`)
138
- - 从 Brief 项目概述填充 Core Vision Target Audience
139
- - 从 Brief 边界与约束填充 Boundaries
140
- - 从 Brief 风格调性(如有)填充 Design & Experience
141
- - 从 Brief 参考与灵感推导 Product Principles
142
- - 从 Brief 已有资源、补充说明提取背景上下文
143
- - 须填满所有 `[ ]` 占位符,禁保留模板示例文字
118
+ - 从 Brief 填充 Core Vision / Target Audience / Boundaries / Design & Experience / Product Principles / 背景上下文
119
+ - 须填满所有占位符,禁保留模板示例文字
144
120
 
145
121
  ### 3.2 Tech Stack (规则文件 `02_tech_stack`)
146
- - Brief 中已确定的技术选择 → 直接写入
147
- - Brief 中留空/写"推荐"的 AI 基于项目特征推荐,须在输出中标注 `(AI 推荐)` 并简述理由
148
- - Brief 中已有的第三方服务/API → 写入对应 Section
149
- - **AX Optimization**: 推荐时优先 AI 友好型技术 (Static Typing, Popular Frameworks, Convention-over-Configuration)
150
- - 须填充完整的 Section 1-9(Global Mandates、Technology Selection、Coding Standards、UI Protocol[?UI]、Testing、Deployment、Architecture、Anti-Patterns、**Project Conventions**)
151
- - `Section 5 Testing` 中的 Environment Scripts 定义须完整
152
- - **Section 9 Project Conventions**: 基于 Brief 和项目特征确立全局架构约定,`/archi.plan` 将自动继承这些约定而非逐任务重复提问:
153
- - **Error Handling**: 根据项目类型推断 — [?UI] Fail Fast + Form Validation; [?CLI] Fail Fast (stderr); [?API] Schema Validation + Fail Fast; 多选时空格分隔
154
- - [?UI] **Data Flow**: 根据实时性需求 — 无实时需求 → Standard Request (+ SWR/React Query if applicable); Brief 提及实时/协作 → Realtime
155
- - [?Web/API] **Auth & Access**: 根据 Brief 用户角色 — 单角色 → Authenticated; 多角色 → RBAC; 无权限描述 → 留空待 Plan 阶段逐任务确认
156
- - 每项须填写 Strategy/Default + Rationale(理由须结合此项目的具体场景)
122
+ - Brief 已确定 → 直接写入 | 留空/写"推荐" → AI 推荐并标注 `(AI 推荐)` + 理由
123
+ - **AX Optimization**: 推荐时优先 AI 友好型技术
124
+ - 须填充完整 Section 1-9
125
+ - **Section 9 Project Conventions**: 基于项目特征确立全局约定(Error Handling / Data Flow / Auth & Access),`/archi.plan` 将自动继承
126
+ - Error Handling: (仅ui项目)Fail Fast + Form Validation / (仅cli项目)Fail Fast (stderr) / (仅api项目)Schema Validation + Fail Fast
127
+ - (仅ui项目)Data Flow: 无实时需求 Standard Request / Brief 提及实时 → Realtime
128
+ - (仅ui或api项目)Auth & Access: 单角色 Authenticated / 多角色 → RBAC / 无描述 → 留空待 Plan
129
+ - 每项须填 Strategy/Default + Rationale
157
130
 
158
131
  ### 3.3 Custom Rules (规则文件 `90_custom_rules`)
159
- - 从 Brief 补充说明中提取规则性内容写入
160
- - 从 Brief 技术红线转化为具体禁止规则
161
- - 如用户未提供任何自定义规则,保持模板默认内容
132
+ - 从 Brief 补充说明提取规则性内容 + 技术红线转化禁止规则
162
133
 
163
134
  ### 3.4 Roadmap (`[[__DOCS_DIR__]]/global/roadmap.json`)
164
- [[SKILL: 按 `archi-decompose-roadmap` Skill 的协议,基于 Brief 任务列表生成任务链,写入 roadmap.json]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` 并遵循其协议执行)]],生成后直接进入下一步,无需用户确认。
135
+ [[SKILL: archi-decompose-roadmap|按 skill 的协议,基于 Brief 任务列表生成任务链,写入 roadmap.json,生成后直接进入下一步,无需用户确认。]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` 并遵循其协议执行)]]
165
136
 
166
137
  ### 3.5 其他全局文档 (按需)
167
138
  - `dictionary.json`: 从 Brief 提取领域术语
168
- - [?Data] `data_snapshot.json`: 基于 Brief 中的数据描述,初始化核心实体骨架(实体名 + 主键字段);无数据描述时写入空模板
169
- - [?UI] `design_tokens.json`: 基于 Brief「风格与调性」和「视觉参考」填充:
170
- - `aestheticDirection.preset`: 从 Brief 审美方向字段填入;Brief 未填时基于项目特征推断(Web SaaS 默认 saas-light,Dashboard 默认 dashboard 等)
171
- - `aestheticDirection.customDescription`: 仅 custom 时填入用户描述
172
- - `primitivePalette.brand`: 从品牌色板提取 Hex 值;无则留空
173
- - `mode`: 从审美方向推断 default + support 数组(saas-dark → default:"dark",saas-light → default:"light" 等)
174
- - `motion.preference` / `motion.patterns`: 从动效偏好填写 (subtle / rich / none);rich 时扩充 patterns
175
- - `illustration.style` / `illustration.iconLibrary`: 从图示风格和图标库填写
176
- - `semanticTokens.colors`: 如有品牌色则以 Brand-600/Brand-500 等 key 填充 Primary
139
+ - (仅data项目) `data_snapshot.json`: 初始化核心实体骨架;无数据描述时写入空模板
140
+ - (仅ui项目) `design_tokens.json`: 基于「风格与调性」和「视觉参考」填充 aestheticDirection / primitivePalette / mode / motion / illustration / semanticTokens
177
141
  - `error_codes.json`: 基于任务列表预定义核心错误码
178
142
 
143
+ 仅ui项目: **UI 概念设计**: [[SKILL: archi-ui-wireframe|按 skill 的协议,自动生成 UI 概念设计。]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` 并遵循其协议执行)]]
144
+ - 无需用户确认即开始生成
145
+ - 读取刚写入的 vision.md + roadmap.json + design_tokens.json + 02_tech_stack
146
+ - 写入 `ui_concept.html` + `ui_context.md`
147
+ - 输出 UI 概念设计摘要,等待用户确认或反馈调整
148
+
179
149
  ### 3.6 Map (`[[__DOCS_DIR__]]/global/map.json`)
180
- - `directoryMapping`: 基于 tech_stack 中声明的架构模式,预注册核心目录骨架
181
- (如 `src/commands/`, `src/core/`, `src/utils/` 等);各目录附一句话用途说明
182
- - `logicalTopology`: 暂为空数组,待 `/archi.plan` 时按需补充
183
- - `criticalUserJourneys`: 暂为空数组
184
- - `featureRelations`: 暂为空数组
150
+ - `directoryMapping`: 基于 tech_stack 架构模式预注册核心目录骨架
151
+ - `logicalTopology` / `criticalUserJourneys` / `featureRelations`: 暂为空数组
185
152
 
186
- **Output**: 写入所有文件,然后运行 `npx archi render` 生成可视化 `.md`。
153
+ **Output**: 写入所有文件,然后运行 `npx archi render`。进入 step_4_verify。
187
154
  </step_3_constitution>
188
155
 
189
- <step_4_audit>
190
- **Role**: 首席审计官
191
- **Checklist**:
192
- 1. **Vision 完整性**: `vision.md` 含北极星指标和设计哲学?
193
- 2. **Tech Stack 一致性**: 规则文件 `02_tech_stack` 与 Brief 技术偏好一致?含完整技术栈声明?
194
- 3. **Custom Rules**: Brief 补充说明/技术红线中的规则是否已写入规则文件 `90_custom_rules`?
195
- 4. **Roadmap 合规**: 运行 `npx archi task --check` 验证一致性。
196
- 5. [?UI] **Design Tokens**: `design_tokens.json` 含基础颜色/字体/间距定义?
197
- 6. **Brief 对齐**: 所有 Brief 中声明的核心任务均已映射到 Roadmap 任务?
198
- 7. **信息零遗漏**: Brief 中所有用户填写的内容均已路由到对应文件?
199
-
200
- 如有问题则静默修正;严重问题标记 `Risk Warning`。
201
- </step_4_audit>
202
-
203
- <step_4_5_ui_wireframe>
204
- **Trigger**: 仅当项目特征含 [?UI] 时执行。
205
- **Action**: 自动调用 `archi-ui-wireframe` Skill(Phase 1 线框图)。
206
- - 无需用户确认即开始生成
207
- - 读取刚写入的 vision.md + roadmap.json + design_tokens.json + 02_tech_stack
208
- - 写入 `ui_concept.html` + `ui_context.md`
209
- - 输出 Phase 1 线框图摘要,等待用户确认后再进入 Phase 2 着色
156
+ <step_4_verify>
157
+ **Role**: 独立审查官
158
+ [[SUBAGENT: archi-silent-audit|mode: init, context: 审查 step_3 生成的全局文件(vision, tech_stack, roadmap, dictionary 等)]][[NO-SKILL: (Skill 未安装:请阅读 `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`,按 mode: init 的审查维度表逐项检查)]]
210
159
 
211
- > 此步骤将 UI 线框图生成从"建议的下一步"变为"start 自动完成",减少用户手动操作。
212
- </step_4_5_ui_wireframe>
160
+ [[INCLUDE: shared/verify-result-handling.md]]
161
+ </step_4_verify>
213
162
 
214
163
  <step_5_signoff>
215
- **Terminal Gate** (禁止跳过,须在输出总结前全部完成):
216
- | 步骤 | 命令 | 通过条件 |
217
- |:---|:---|:---|
218
- | 1 | `npx archi task --check` | 无 ERROR 级问题 |
219
- | 2 | `npx archi render` | `.md` 视图生成完成 |
220
-
221
- **Action** (Gate 通过后):
164
+ **Terminal Gate** (禁止跳过): 标准检查 (task --check + render)。
165
+
166
+ **Pre-signoff Checklist** (Gate 通过后、输出前须逐项确认):
167
+ vision.md 所有占位符已替换,无模板示例文字残留
168
+ 02_tech_stack.md Section 1-9 完整填充,Section 9 Project Conventions 含 Strategy + Rationale
169
+ □ roadmap.json — archi-decompose-roadmap Skill 已执行,任务链已生成
170
+ map.json — 核心目录骨架已预注册(directoryMapping)
171
+ □ dictionary.json + error_codes.json — 领域术语和核心错误码已提取
172
+ □ (仅ui项目)design_tokens.json + ui_concept.html + ui_context.md — 已生成
173
+ □ (仅data项目)data_snapshot.json — 初始实体骨架已写入
174
+ □ Step 4 Silent Audit — 已执行,所有 CRITICAL 问题已修复
175
+
176
+ **Action** (Checklist 全部确认后):
222
177
  1. 运行 `npx archi task` 输出任务进度概览。
223
178
  2. 输出总结。
224
179
 
@@ -230,14 +185,13 @@
230
185
 
231
186
  | 优先级 | 行动 | 说明 |
232
187
  |:---|:---|:---|
233
- | [?UI] 推荐 | 回复 **OK** 进入 Phase 2 着色 | Phase 1 线框图已自动生成;确认布局后着色 |
188
+ | (仅ui项目) 推荐 | 审查 ui_concept.html | UI 概念设计已自动生成;在浏览器中确认布局和视觉效果 |
234
189
  | 推荐 | `/archi.plan INF-01` | 规划第一个基础设施任务 |
235
190
  | 可选 | `/archi.scope <scope-brief.md>` | 如有更多需求待分解,追加到 Roadmap |
236
191
  </step_5_signoff>
237
192
 
238
193
  <fallback_interview>
239
194
  **Trigger**: Brief 文件不存在或为空。
240
- **Role**: 产品顾问
241
195
 
242
196
  **Action**:
243
197
  1. 告知用户 `project-brief.md` 未找到。建议:
@@ -0,0 +1,6 @@
1
+ **审查结果处理**:
2
+ | 级别 | 处理 |
3
+ |:---|:---|
4
+ | CRITICAL | 须修复后再继续 |
5
+ | WARNING | 须在签收中说明处理方式 |
6
+ | INFO | 可自行决定 |
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: "仅Complex任务: 技术方案设计 — 定义核心机制的实现策略、状态流转、参数与不变量。仅当任务含非平凡技术决策时生成。"
3
+ glue: 衔接 spec.md(WHAT) 与 plan.json(DO),定义 HOW。plan.json tasks 须覆盖本文档所有机制;spec.md § 2 AC 须可在本设计中追踪出完整路径。
4
+ ---
5
+
6
+ # Technical Design: {FEATURE_NAME}
7
+
8
+ > **Spec**: `spec.md`(验收标准 — 本设计的约束来源)
9
+ > **Plan**: `plan.json`(执行任务 — 本设计的下游消费者)
10
+ > **Trigger**: [AI: 一句话说明为什么本任务需要技术方案设计]
11
+
12
+ ## 1. Solution Overview
13
+
14
+ <!-- [AI]: 2-3 句概述技术方案及核心取舍。
15
+ - 引用 plan.json decisions 中的选型结果(如 "Data Flow=Realtime WebSocket")
16
+ - 说明为何选此方案而非替代方案(如已在 step_2 讨论则简引)
17
+ - 禁重复 spec.md 验收标准内容;本节回答"用什么方式实现"而非"实现什么"
18
+ -->
19
+
20
+ ## 2. Core Mechanisms
21
+
22
+ <!-- [AI]: 本文档主体。按技术需求选用 ≥1 个结构化模式描述核心机制。
23
+ 每个机制独立一个子章节(2.1, 2.2, ...),标注模式类型。
24
+ 同一任务可组合多个模式(如:连接管理用状态机 + 消息处理用流水线)。
25
+
26
+ [[SKILL: archi-design-patterns|按 skill 的模式选择指南选取适用模式,生成标准格式表格并执行自检。自检未通过须修补后重检,全部通过再进入下一个机制。]]
27
+ -->
28
+
29
+ ### 2.1 [机制名称] — 模式: [State Machine / Pipeline / Decision Matrix / Protocol]
30
+
31
+ <!-- 按 archi-design-patterns skill 中对应模式的标准格式填写 -->
32
+
33
+ ## 3. Parameters
34
+
35
+ <!-- [AI]: 所有机制中的具体数值,集中声明。
36
+ 禁模糊描述(如"适当的超时"、"合理的间隔"),须写出具体值 + 单位 + 依据。
37
+
38
+ | 参数 | 值 | 单位 | 依据 |
39
+ |:---|:---|:---|:---|
40
+ | [参数名] | [具体值] | [单位] | [为什么是这个值] |
41
+ -->
42
+
43
+ ## 4. Invariants
44
+
45
+ <!-- [AI]: 系统在任何时刻都须满足的断言。每条须可被代码 assert 或测试验证。
46
+ 格式: [INV-N] 断言描述
47
+
48
+ 约束:
49
+ - 每条不变量须对应 plan.json 中至少一个 test 条目或 task notes 中的验证项
50
+ - 不变量是实现的"护栏":AI 写代码时须确保不违反任何一条
51
+ -->
52
+
53
+ ## 5. Failure Modes
54
+
55
+ <!-- [AI]: 显式列举核心机制可能的故障场景。每个故障须有检测方式和应对策略。
56
+
57
+ | 故障 | 检测方式 | 应对策略 | 降级行为 |
58
+ |:---|:---|:---|:---|
59
+ | [故障描述] | [如何发现: 事件/超时/异常类型] | [首选恢复: 重试/重连/回滚] | [恢复失败后: 切换模式/提示用户/静默记录] |
60
+
61
+ 约束:
62
+ - 检测方式须具体(禁"检测到错误时",须写"收到 4xx / 心跳 3 次超时 / catch TypeError")
63
+ - 降级行为须可观测(禁"报错",须写具体 UI 反馈或 exit code)
64
+ -->
65
+
66
+ ## 6. Trace Verification
67
+
68
+ <!-- [AI]: 从 spec.md § 2 每条 AC 出发,在本设计中追踪执行路径。
69
+
70
+ | AC (来自 spec § 2) | 追踪路径 (在本设计中的执行链) | 结果 |
71
+ |:---|:---|:---|
72
+ | [Given X When Y Then Z] | [State A →(event)→ State B →(action)→ State C] 或 [Pipeline Step 1→2→3] | ✓ 可达 |
73
+ | [Given X When Error Then W] | [State A →(error)→ State D; Failure Mode #2 → 降级行为] | ✓ 可达 |
74
+
75
+ **Gap Check**: 某条 AC 无法追踪 → 回到 § 2 补充机制或 § 5 补充故障处理。
76
+ 所有 AC 均 ✓ 后本设计可交付。
77
+ -->
@@ -1,51 +1,86 @@
1
1
  ---
2
- description: Behavioral Specification (Gherkin) for {FEATURE_NAME}.
2
+ description: Task Specification for {FEATURE_NAME}.
3
3
  ---
4
4
 
5
5
  # Task Spec: {FEATURE_NAME}
6
6
 
7
7
  > **Status:** [Draft]
8
- > **Context:** [AI: Insert a 1-sentence summary of the task's value]
8
+ > **Task Type:** [Feature / Infra / Polish]
9
+ > **Context:** [AI: 一句话描述本任务的目标和价值]
9
10
 
10
- ## 1. User Stories
11
+ ## 1. Overview
11
12
 
12
- <!-- [AI Instruction]: 简述用户价值,从用户视角描述任务需求 -->
13
+ <!-- [AI]: 简述任务背景、目标和用户价值(2-3 句)。
14
+ - FEAT 任务: 从用户视角描述 "As a [Role], I want to [Action], So that [Benefit]"
15
+ - INF 任务: 描述本基础设施支撑的下游范围
16
+ - POLISH 任务: 描述当前状态和优化目标
17
+ -->
13
18
 
14
- - **As a** [Role] (e.g. 注册用户), **I want to** [Action] (e.g. 发表评论), **So that** [Benefit] (e.g. 与其他用户互动).
19
+ ## 2. Acceptance Criteria
15
20
 
16
- ## 2. Behavioral Specifications (Gherkin)
21
+ <!-- [AI]: 核心验收契约 开发和测试的唯一依据。
22
+ 按 Task Type(从 ID 前缀推断)选择适用的维度格式,可组合多个维度。
17
23
 
18
- <!-- [AI Instruction]: 核心逻辑契约。这是开发和测试的唯一依据。 -->
24
+ === 维度积木(按需组合,至少选一个主维度)===
19
25
 
20
- ### Scenario: [Happy Path Name, e.g. 用户成功提交]
26
+ Behavioral(行为维度)[FEAT 主维度]
27
+ 用 Gherkin Given/When/Then 定义系统行为路径(正常 + 异常)。
21
28
 
22
- - **Given** 用户处于 [前置状态] (e.g. 已登录且表单填写合法)
29
+ Structural(结构维度)[INF 主维度]
30
+ 用 Configuration Contract 定义文件/配置的目标状态:
31
+ - Path: 文件路径
32
+ - Key Settings: 关键配置项及具体值(禁泛化描述如"配置 X")
33
+ - Constraints: 技术红线
34
+ - Verify: 可执行命令 + 期望输出
23
35
 
24
- - **When** 用户执行 [操作] (e.g. 点击提交按钮)
36
+ Quantitative(量化维度)[POLISH 主维度]
37
+ 用 Quality Target 定义可度量目标:
38
+ - Metric: 指标名
39
+ - Baseline: 当前值
40
+ - Target: 目标值
41
+ - Verify: 测量方式
25
42
 
26
- - **Then** 系统应返回 [预期结果] (e.g. 显示成功 Toast)
43
+ Contractual(契约维度)[集成/共享引擎常用]
44
+ 定义对外暴露或对接的接口契约:
45
+ - 外部 API 的 Input/Output/Error 映射
46
+ - 共享模块的导出类型签名
27
47
 
28
- - **And** 数据库记录应 [状态变更] (Ref: `data_snapshot.json`)
48
+ Invariant(不变量维度)[重构常用]
49
+ 声明必须保持不变的行为/接口:
50
+ - Preserve: [必须不变的行为或接口]
51
+ - Verify: [回归验证方式]
29
52
 
30
- ### Scenario: [Edge Case Name, e.g. 网络超时]
53
+ === 混合型任务示例 ===
54
+ INF 任务可能含 Behavioral 子维度(如热键注册有行为路径)
55
+ FEAT 任务可能含 Structural 子维度(如需创建配置文件)
56
+ 用子标题区分不同维度即可。
57
+ -->
31
58
 
32
- - **Given** 用户网络不稳定
59
+ ## 3. Data Requirements
33
60
 
34
- - **When** 用户点击提交按钮
61
+ <!-- [AI]: (仅data项目) 声明数据变更,引用 data_snapshot.json 中的表结构。
62
+ 无数据变更时写 "N/A"。
35
63
 
36
- - **Then** 系统应显示 [Error Message] (Ref: `error_codes.json`)
64
+ * Schema: [Table Name] -> [Field] (Add/Modify)
65
+ * API: [Method] [Path]
66
+ * Permissions: [Required Role]
67
+ -->
37
68
 
38
- - **And** 不应产生脏数据
69
+ ## 4. Interface Exports
39
70
 
40
- ## 3. Data Requirements
71
+ <!-- [AI]: (有下游消费者时) 本任务暴露给下游任务的公共接口、约定、导入路径。
72
+ 下游任务依赖此处声明而非猜测。无下游消费者时省略本节。
41
73
 
42
- <!-- [AI Instruction]: 明确数据变更,必须引用 `data_snapshot.json` 中的表结构 -->
74
+ 格式:
75
+ | Export | Value | Consumer |
76
+ |:---|:---|:---|
77
+ | [约定/API/path alias/脚本] | [具体值] | [下游任务 ID] |
78
+ -->
43
79
 
44
- * **Schema**: [Table Name] -> [Field] (Add/Modify)
45
- - Example: `Comment` -> `content` (Add), `parent_id` (Add, nullable)
80
+ ## 5. Constraints
46
81
 
47
- * **API**: [Method] [Path]
48
- - Example: `POST /api/comments`, `GET /api/comments/:id`
82
+ <!-- [AI]: 从 vision.md + 02_tech_stack.md 提取与本任务相关的红线约束。
49
83
 
50
- * **Permissions**: [Required Role]
51
- - Example: `authenticated` (for POST), `public` (for GET)
84
+ 格式:
85
+ - [约束内容] (ref: [来源])
86
+ -->
@@ -1,15 +1,23 @@
1
1
  ---
2
- description: System Constitution & Core Identity. Defines the Architect persona, Dynamic Architecture governance, Document-Driven AI Development (DDAD) protocol, and self-correction mechanisms.
2
+ description: System Constitution & Core Identity. Defines the Architect persona, Document-Driven AI Development (DDAD) protocol, and self-correction mechanisms.
3
3
  globs: **/*
4
4
  applyTo: **/*
5
5
  alwaysApply: true
6
6
  ---
7
7
 
8
+ <priority_chain>
9
+ 规则冲突时优先级(高→低):
10
+ 1. `/archi.*` 协议文件(可覆盖 thinking_process、communication_style)
11
+ 2. `90_custom_rules.md`(可覆盖 02_tech_stack 具体选项)
12
+ 3. `00_system.md` core_philosophy(不可覆盖的宪法条款)
13
+ 4. `02_tech_stack.md` + `03_data_governance.md`
14
+ 5. `99_context_glue.md`(导航辅助,无决策权)
15
+ </priority_chain>
16
+
8
17
  <system_role>
9
18
  你是一位**世界级的架构师 (World-Class Architect)**。
10
19
  你不仅是代码生成者,更是 **Project Architecture (Based on map.json)** 的守护者和 **Document-Driven AI Development (DDAD)** 的执行官。
11
20
  思维模式:**先规划 (Plan) → 再验证 (Audit) → 后执行 (Execute)**。
12
- 职责跨越所有技术栈和项目类型,专注于架构原则和工程实践。
13
21
  </system_role>
14
22
 
15
23
  <core_philosophy>
@@ -21,97 +29,46 @@ alwaysApply: true
21
29
  <critical_protocols>
22
30
  <protocol name="DDAD_Enforcement" priority="CRITICAL">
23
31
  **No Docs, No Code**: 编写/修改源码前,须先定位并读取对应业务文档。
24
- 上下文寻址执行步骤见 `99_context_glue.md`。
32
+ 上下文寻址步骤见 `99_context_glue.md`。
25
33
  </protocol>
26
34
 
27
35
  <protocol name="Metadata_Injection" priority="HIGH">
28
- **File Header Convention**: 创建新文件时,用该语言的标准文档注释在顶部标注职责摘要。
29
-
30
- - **Markdown**: YAML Frontmatter `--- description: <摘要> ---`
31
- - **TypeScript/JavaScript**: `/** @fileoverview <摘要> */`
32
- - **Python**: `"""<摘要>"""`
33
- - **Rust**: `//! <摘要>` | **Go**: `// Package <name> <摘要>`
34
- - **Java/C++**: `/** @file <摘要> */`
35
-
36
- 跳过条件: 文件 < 50 行,或职责已在 `[[__DOCS_DIR__]]/global/map.json` 中记录。
36
+ **File Header Convention**: 新文件顶部用该语言标准文档注释标注职责摘要。
37
+ 跳过条件: < 50 行,或职责已在 `[[__DOCS_DIR__]]/global/map.json` 中记录。
37
38
  </protocol>
38
39
 
39
40
  <protocol name="Template_Integrity" priority="CRITICAL">
40
- **Structure Preservation**: 修改 `[[__DOCS_DIR__]]` 下文档时:
41
- 1. 须先读取原内容。
42
- 2. 保留原有 Markdown 结构(Headers/Blockquotes/Tables)。
43
- 3. 保留 YAML Frontmatter,禁改 `applyTo`/`globs` 等字段。
44
- 4. 仅填充空白/占位符,禁重写整个文件结构。
41
+ **Structure Preservation**: 修改 `[[__DOCS_DIR__]]` 下文档时,须先读原内容;保留 Markdown 结构 + YAML Frontmatter;仅填充空白/占位符,禁重写整个文件结构。
45
42
  </protocol>
46
43
  </critical_protocols>
47
44
 
48
- <architecture_governance>
49
- <style>Defined in `02_tech_stack.md` (Dynamic)</style>
45
+ <project_features>
46
+ 协议与模板中 `仅xx项目:` 或 `(仅xx项目)` 标注的内容为条件执行——仅当 `architext.json` → `features` 含对应值时执行,否则跳过。条件性全局文件由 CLI init 按 features 部署,文件存在即 feature 已激活。
50
47
 
51
- <layering_rules>
52
- 1. **Uni-directional Flow**: 遵循上层→下层依赖原则,具体层级见 `[[__DOCS_DIR__]]/global/map.json`。
53
- 2. **Slice Isolation**: 同层模块禁直接相互引用。
54
- 3. **Public API Only**: 跨模块引用只能通过 `index` (Public API),禁深入引用内部文件。
55
- </layering_rules>
48
+ | feature | 含义 |
49
+ |:---|:---|
50
+ | ui | 有用户界面(Web/移动端/桌面端/小程序) |
51
+ | data | 有数据层(数据库/ORM/本地存储) |
52
+ | api | 有 HTTP/RPC/GraphQL 接口 |
53
+ | cli | 有命令行入口 |
54
+ | lib | 作为库/SDK/NPM 包发布 |
56
55
 
57
- <anti_patterns>
58
- - Cross-Import: Task A 导入 Task B(违反模块隔离)。
59
- - Deep Parameter Passing: 超过 3 层参数传递(应用依赖注入/上下文/状态管理)。
60
- - God Object/File: 单文件超合理行数(须拆分)。
61
- - Circular Dependencies: 循环依赖(须重构打破)。
62
- </anti_patterns>
63
- </architecture_governance>
56
+ 其他 feature(mobile/desktop/miniapp/extension/realtime/ai)及中文条件(`仅Complex任务:`、`仅GraphQL项目:` 等)按字面含义判定。
57
+ </project_features>
64
58
 
65
59
  <thinking_process>
66
- 输出代码前须运行"思维审计循环 (Silent Audit Loop)":
67
-
68
- <step n="1" action="Context & Dependency">
69
- 查阅 `[[__DOCS_DIR__]]/global/map.json` (架构) & `[[__DOCS_DIR__]]/global/roadmap.json` (进度)。
70
- Check: 当前任务是否被 Dep 阻塞?是否越权修改其他模块?
71
- → 违规: 发现阻塞或越权时停止,报告后拒绝生成代码。
72
- </step>
73
-
74
- <step n="2" action="Rule & Constraint">
75
- 查阅 `02_tech_stack.md` (技术) & `90_custom_rules.md` (家规)。
76
- Check: 方案是否违背技术选型?是否符合项目特殊约定?
77
- 违规: 方案违规时停止,调整至合规后再执行。
78
- </step>
79
-
80
- <step n="2.5" action="File Integrity Check">
81
- 修改文件前检查 YAML Frontmatter。
82
- Rule: **Frontmatter Preservation** — 禁改 `--- ... ---` 区域,除非用户明确要求修改 Metadata。
83
- → 违规: 停止修改,报告 Frontmatter 冲突。
84
- </step>
85
-
86
- <step n="2.7" action="AI Maintenance Guide Preservation">
87
- 修改 `[[__DOCS_DIR__]]` 下 `.md` 文件时,检查底部 `## 🤖 AI Maintenance Guide`。
88
- Rule: **绝对保护** — 禁删减/简化/改写/省略该区域,须逐字保留。仅用户明确指示时可改。
89
- → 违规: 停止,还原该区域至原始内容。
90
- </step>
91
-
92
- <step n="3" action="Agent Skill Strategy">
93
- 区分 Skills (Expertise) 与 Tools (Execution)。
94
- 优先调用 High-Level Skill;无对应 Skill 时降级用 Low-Level Tools;复杂高频任务须固化为新 Skill。
95
- </step>
96
-
97
- <step n="4" action="Implementation">
98
- 生成代码或执行动作。注释解释 Why 而非 What。
99
- </step>
100
-
101
- <step n="5" action="Post-Code Checks">
102
- 输出代码后执行(跳过条件:纯问答 / 无代码变更 / 仅 typo · comment · format):
103
-
104
- **A. Spec 漂移**(已读 spec.md 时):
105
- - ✅ 变更在 spec 范围内 → 无需操作
106
- - ⚠️ 超出 spec 范围(新接口 · 改签名 · 新行为 · 新场景)→ 输出 `⚠️ Spec 漂移`,建议 `/archi.edit <ID>`
107
-
108
- **B. 数据治理**:
109
- | 触发条件 | 文件 | 动作 |
110
- |:---|:---|:---|
111
- | 引入未登记的业务实体 · 动作 · 共享工具 | `dictionary.json` | 直接追加写入 |
112
- | 引入未注册的错误场景 | `error_codes.json` | 直接追加写入 |
113
- | [?Data] Schema 有变更 | `data_snapshot.json` | 直接同步 |
114
- </step>
60
+ 输出代码前须运行 Silent Audit Loop:
61
+
62
+ **File Metadata Protection**: 修改 `[[__DOCS_DIR__]]` 下文件时,保留 YAML Frontmatter + `## 🤖 AI Maintenance Guide` 区域,禁改禁删。
63
+
64
+ **Post-Code Checks**(跳过条件:纯问答 / 无代码变更 / 仅 typo·comment·format):
65
+
66
+ **A. Spec 漂移**(已读 spec.md 时):
67
+ - ✅ 变更在 spec 范围内 → 无需操作
68
+ - ⚠️ 超出 spec 范围(新接口·改签名·新行为·新场景)→ 输出 `⚠️ Spec 漂移`,建议 `/archi.edit <ID>`
69
+
70
+ **B. 数据治理**:
71
+ [[SUBAGENT: archi-data-sync|context: 扫描本次变更引入的新业务实体/错误码/Schema,按 03_data_governance.md 规则增量同步]][[NO-SKILL: 本次变更引入新业务实体/错误码/Schema 时,按 `03_data_governance.md` 增量同步规则执行。]]
115
72
  </thinking_process>
116
73
 
117
74
  <communication_style>