architext 0.0.4 → 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 (56) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README.md +84 -7
  3. package/README.zh-CN.md +84 -7
  4. package/dist/index.js +38 -38
  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/prompts/audit.md +80 -94
  8. package/dist/templates/en/docs/prompts/code.md +87 -89
  9. package/dist/templates/en/docs/prompts/edit.md +47 -51
  10. package/dist/templates/en/docs/prompts/fix.md +49 -42
  11. package/dist/templates/en/docs/prompts/help.md +23 -31
  12. package/dist/templates/en/docs/prompts/inherit.md +91 -116
  13. package/dist/templates/en/docs/prompts/map.md +47 -69
  14. package/dist/templates/en/docs/prompts/plan.md +134 -239
  15. package/dist/templates/en/docs/prompts/recover.md +19 -34
  16. package/dist/templates/en/docs/prompts/ref.md +43 -138
  17. package/dist/templates/en/docs/prompts/remove.md +55 -107
  18. package/dist/templates/en/docs/prompts/revise.md +63 -106
  19. package/dist/templates/en/docs/prompts/scope.md +77 -117
  20. package/dist/templates/en/docs/prompts/start.md +89 -129
  21. package/dist/templates/en/rules/00_system.md +36 -79
  22. package/dist/templates/en/rules/01_workflow.md +59 -57
  23. package/dist/templates/en/rules/03_data_governance.md +46 -42
  24. package/dist/templates/en/skills/archi-data-sync/SKILL.md +12 -12
  25. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +3 -34
  26. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +1 -0
  27. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +4 -4
  28. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -1
  29. package/dist/templates/en/skills/archi-plan-options/SKILL.md +4 -3
  30. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +20 -20
  31. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
  32. package/dist/templates/zh/briefs/_base.md +44 -12
  33. package/dist/templates/zh/briefs/_modules.md +27 -0
  34. package/dist/templates/zh/docs/prompts/audit.md +42 -56
  35. package/dist/templates/zh/docs/prompts/code.md +47 -49
  36. package/dist/templates/zh/docs/prompts/edit.md +38 -42
  37. package/dist/templates/zh/docs/prompts/fix.md +30 -29
  38. package/dist/templates/zh/docs/prompts/help.md +13 -21
  39. package/dist/templates/zh/docs/prompts/inherit.md +59 -83
  40. package/dist/templates/zh/docs/prompts/map.md +24 -47
  41. package/dist/templates/zh/docs/prompts/plan.md +92 -197
  42. package/dist/templates/zh/docs/prompts/recover.md +9 -24
  43. package/dist/templates/zh/docs/prompts/ref.md +11 -106
  44. package/dist/templates/zh/docs/prompts/remove.md +31 -71
  45. package/dist/templates/zh/docs/prompts/revise.md +37 -86
  46. package/dist/templates/zh/docs/prompts/scope.md +51 -91
  47. package/dist/templates/zh/docs/prompts/start.md +67 -106
  48. package/dist/templates/zh/rules/00_system.md +18 -91
  49. package/dist/templates/zh/rules/01_workflow.md +60 -59
  50. package/dist/templates/zh/rules/03_data_governance.md +41 -68
  51. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +2 -33
  52. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +1 -0
  53. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
  54. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +1 -0
  55. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
  56. package/package.json +1 -1
@@ -1,346 +1,241 @@
1
1
  <protocol_plan>
2
- **Trigger**: `/archi.plan <ID> [context]`
3
- **Goal**: Define Task Spec/UI/Plan through deep architecture interview.
2
+ **Trigger**: `/archi.plan <ID> [context]` | Auto-loaded by Workflow Dispatch on natural language trigger
3
+ **Goal**: Define task Spec/UI/Plan through deep architecture interview.
4
4
  **Input**:
5
- - `<ID>` (required): An existing task ID from the Roadmap. Tasks must be created first via `/archi.scope` or `/archi.inherit`.
6
- - `[context]` (optional): Known context for the task (e.g., requirement descriptions, references, constraints). When provided, serves as pre-loaded input for step_2 interview, reducing questions.
5
+ - `<ID>` (required): Existing task ID in Roadmap. Must create via `/archi.scope` or `/archi.inherit` first.
6
+ - `[context]` (optional): Known context for the task (e.g. requirement descriptions, references, constraints). When provided, serves as pre-input for step_2 interview, reducing questions.
7
7
 
8
8
  <constraints_cursor>
9
- **Mode Lock**: This protocol MUST execute in **Agent Mode (Normal Mode)**. Prohibited from switching to Plan Mode or any read-only mode.
9
+ **Mode Lock**: This protocol must run in **Agent Mode (Normal Mode)**. Do not switch to Plan Mode or other read-only modes.
10
10
  </constraints_cursor>
11
11
 
12
12
  <meta>
13
13
  <style>Architectural, Exhaustive, Strict, Technology-Agnostic</style>
14
14
  <language>English</language>
15
15
  <principles>
16
- 1. **Global First**: The birth of local tasks must be accompanied by updates to global indices (Map/Data/Dict).
17
- 2. **AI-Native Perspective**: All option Pros/Cons written from AI Agent perspective. Focus: Context Locality, Type Safety, Boilerplate, Ambiguity.
16
+ 1. **Global First**: Local task birth must accompany global index (Map/Data/Dict) updates.
17
+ 2. **AI-Native Perspective**: All option Pros/Cons from AI Agent perspective. Focus: Context Locality, Type Safety, Boilerplate, Ambiguity.
18
18
  3. **Flexible Interaction**: Options are heuristic suggestions; support multi-select, hybrid, or custom.
19
19
  4. **Audit-Gated**: Only audited docs can be delivered.
20
+ 5. **IDE-Native First**: Leverage IDE native capabilities to drive execution rhythm; this protocol defines quality standards and checkpoints, not fight IDE planning/execution mechanisms.
20
21
  </principles>
21
22
  </meta>
22
23
 
23
24
  <step_1_load>
24
- **Role**: System Analyst
25
25
  **Action**:
26
- 1. **Read Roadmap**: Read `[[__DOCS_DIR__]]/global/roadmap.json`.
27
- - **Pre-flight**: Read only the `<ID>` task entry and its direct deps' `id/title/status`; check whether deps are completed, reject Plan if not (unless user forces). No need to load other task data.
28
- 2. **Read Vision**: Read `[[__DOCS_DIR__]]/global/vision.md` extract North Star Metric and Design Philosophy sections only; skip remaining chapters.
29
- 3. **Read Tech Stack**: `02_tech_stack.md` (technical red lines + **Section 9 Project Conventions**).
30
- - Extract global architecture conventions from Section 9 (Error Handling / Data Flow / Auth & Access) for convention inheritance in step_2.
31
- 4. [?UI] **Read Design Tokens**: `[[__DOCS_DIR__]]/global/design_tokens.json`.
32
- 4.5 [?UI] **Read UI Context**: `[[__DOCS_DIR__]]/global/ui_context.md` (if it exists).
33
- - Look up the screen inventory to locate the screen IDs (e.g. S-03) for this task and their state coverage.
34
- - Lock the screen scope to fill in `ui.md §1` in step_4; do not invent new screen IDs.
35
- - If `ui_context.md` does not exist → skip; write `ui.md` in full ITP format.
36
- 5. [?Data] **Read Data Model**: `[[__DOCS_DIR__]]/global/data_snapshot.json`.
37
- 6. **Read Dependency Context** (if dependent tasks exist):
38
- - Read only the Interface/Type definitions section of the dep's `spec.md` (`## Interface` or `## Types` chapter); skip Scenarios and other content.
39
- - Execute only when a `ref: tasks/<dep_id>/spec.md#X` reference appears in the current spec/plan; skip if no reference found.
40
- - **Stub Compatibility**: If a dependency's Spec-Status is Stub, extract source files from the stub's "Associated Files", read entry files to extract public interfaces/exported types as upstream interface reference.
41
- - Avoid re-defining upstream interfaces; ensure integration points are precisely aligned.
42
- 7. **Read Refs** (if any): Read `[[__DOCS_DIR__]]/refs/index.json` (if exists).
43
- - Match relevant ref entries by tags and current task description semantics.
44
- - Load only matched ref files (`[[__DOCS_DIR__]]/refs/{id}.{ext}`); skip unrelated entries.
45
- - If `refs/index.json` does not exist or refs is empty → skip.
46
-
47
- **Output**: Present a **Task Context Brief** to the user:
48
- ```
49
- ### Task Context: [Task Name] ([ID])
50
-
51
- **Task Type**: [Inferred from ID prefix: Infrastructure / Feature / Quality / Edit]
52
- **Goal**: [roadmap task's goal; highlight any [User Presets] if present]
53
- **Upstream Dependencies**: [completed dependency tasks and their key interfaces/types, or "None"]
54
- **Project Features**: [activated UI/Data/CLI/Lib/API tags]
55
- **Technical Constraints**: [key red lines from 02_tech_stack.md]
56
- **Design Philosophy**: [North Star Metric and design principles from vision.md]
57
- **Project Conventions**: [from 02_tech_stack.md §9 — Error Handling: X | Data Flow: X | Auth: X, or "Not set" if absent]
58
- **External knowledge refs**: [matched ref ids, e.g. `wechat-pay`, `company-sdk`; or "None"]
59
- ```
60
- Retain full context materials internally, proceed to step_2.
26
+ 1. **Pre-flight**: Read roadmap.json; read only `<ID>` entry and direct deps' `id/title/status`; reject if deps incomplete (unless user forces).
27
+ 2. **Load**: vision.md (North Star + design philosophy only), 02_tech_stack.md (red lines + §9 project conventions; extract Error Handling/Data Flow/Auth inheritance), (UI projects only) design_tokens.json + ui_context.md (locate screen IDs, lock scope for step_4; do not invent new IDs; skip if absent), (Data projects only) data_snapshot.json.
28
+ 3. **Dependency Context** (when deps exist): Read only dep task spec.md Interface/Type section; skip if no ref. Stub dep extract public interfaces from associated files.
29
+ 4. **Refs** (if any): Read refs/index.json; match by tag semantics; load only matched ref files; skip if absent.
30
+
31
+ **Output**: Output **Task Context Brief** to user — include task type (from ID prefix), goal (highlight [User Preset]), upstream deps and key interfaces, project feature tags, tech constraints, design philosophy, project conventions (§9 values, or "not set"), external ref ids (matched). Retain full context internally; enter step_2_complexity.
61
32
  </step_1_load>
62
33
 
63
- <step_1_5_complexity>
64
- **Role**: Product Consultant
34
+ <step_2_complexity>
65
35
  **Action**: Detect task type, assess complexity, decide flow path.
66
36
 
67
- **⓪ Task Type detection (execute first)**:
68
-
69
- Infer task type from `<ID>` prefix; applies to all subsequent steps:
70
-
71
- | ID Prefix | Task Type | spec § 2 Primary Dimension | spec § 4 Interface Exports |
72
- |:---|:---|:---|:---|
73
- | `INF-` | Infrastructure | Structural (config contracts) | **Required** (downstream infrastructure) |
74
- | `FEAT-` | Feature | Behavioral (behavior scenarios) | Required when has downstream deps |
75
- | `POLISH-` | Quality | Quantitative (quality targets) | Usually omit |
76
- | `EDIT-` | Edit | Inherit from original task | Inherit |
37
+ **⓪ Task Type + granularity red lines**:
77
38
 
78
- > Mixed tasks (e.g. INF task with behavior aspect) may combine dimensions in § 2; use sub-headings to distinguish.
39
+ | ID Prefix | Task Type | spec § 2 Primary Dimension | § 4 Interface | AC Cap | Phase Cap |
40
+ |:---|:---|:---|:---|:---|:---|
41
+ | `INF-` | Infrastructure | Structural (config contracts) | **Required** | ≤ 8 Contracts | ≤ 5 |
42
+ | `FEAT-` | Feature | Behavioral (scenarios) | Required when has downstream deps | ≤ 6 Scenarios | ≤ 4 |
43
+ | `POLISH-` | Quality | Quantitative (targets) | Usually omit | ≤ 4 Targets | ≤ 3 |
44
+ | `EDIT-` | Edit | Inherit from original | Inherit | Inherit | Inherit |
79
45
 
80
- **① Granularity hard-limit check (by Task Type)**:
81
-
82
- | Task Type | Acceptance Criteria item cap | plan.json Phase cap |
83
- |:---|:---|:---|
84
- | Feature | ≤ 6 Scenarios | ≤ 4 |
85
- | Infrastructure | ≤ 8 Contracts | ≤ 5 |
86
- | Quality | ≤ 4 Targets | ≤ 3 |
46
+ > Mixed tasks may combine dimensions in § 2 with sub-headings. Trigger split when estimate exceeds cap.
87
47
 
88
- > Estimation method: based on roadmap task goal and dependency context from step_1, quickly enumerate core paths. Trigger if over limit — no precise calculation needed.
89
-
90
- **② Complexity verdict (after granularity passes)**:
48
+ **① Complexity verdict**:
91
49
 
92
50
  | Signal | Verdict | Flow |
93
51
  |:---|:---|:---|
94
- | No deps + no new entities + no architecture decisions + estimated ≤3 tasks | **Simple** | Skip step_2 interview; generate spec + plan directly |
95
- | Has deps OR new entities OR architecture decisions needed | **Standard** | Execute step_2 Unified Proposal normally |
96
-
97
- **Simple Mode**:
98
- - Skip 5-dimension architecture recommendations and User Confirm Gate
99
- - spec condensed to 1-2 Acceptance Criteria items (format by Task Type)
100
- - plan condensed to a single Phase
101
- - Confirm at signoff (replacing step_2 Gate)
52
+ | No deps + no new entities + no arch decision + estimated ≤3 tasks | **Simple** | Skip step_2; generate spec + plan directly (condensed single Phase; confirm at signoff) |
53
+ | Has deps OR new entities OR arch decision needed | **Standard** | Execute step_2 Unified Proposal normally |
102
54
 
103
- **③ Design signal detection (after Standard verdict)**:
104
-
105
- For Standard tasks, detect whether to generate `design.md` (technical design):
55
+ **② Design signal detection** (after Standard):
106
56
 
107
57
  | Signal | Verdict |
108
58
  |:---|:---|
109
- | Architecture option's AI- contains complexity warning (e.g. "extremely hard to implement correctly", "state management complex", "connection leak") | **Standard + Design** |
110
- | Involves custom state machine, non-trivial algorithm, multi-component coordination protocol, retry/recovery strategy | **Standard + Design** |
111
- | Standard CRUD / config / simple integration | **Standard** (no design.md) |
112
-
113
- > When Standard + Design: step_2 must output mechanism preview (Part 1.5); step_4 must additionally generate `design.md`.
114
- </step_1_5_complexity>
59
+ | AI- contains complexity warning OR involves custom state machine / non-trivial algorithm / multi-component coordination / retry recovery | **Standard + Design** (step_2 output mechanism preview; step_4 add design.md) |
60
+ | Standard CRUD / config / simple integration | **Standard** |
61
+ </step_2_complexity>
115
62
 
116
- <step_2_interview>
63
+ <step_3_interview>
117
64
  **Role**: Architect
118
65
 
119
66
  ---
120
67
 
121
- ### Unified Proposal
68
+ ### Unified Proposal (one-shot)
122
69
 
123
- **Core principle**: Merge task design and architecture decisions into **one single output**; user confirms or overrides in one round.
70
+ **Core principle**: Merge task design and architecture decisions into **one output**; user confirms or overrides in one round.
124
71
 
125
72
  **Action**:
126
73
 
127
74
  #### Part 1: Task Design
128
75
 
129
- AI **selects which modules to output** based on the task's nature, from the following material library:
76
+ AI **decides which modules to output** by task nature; select from:
130
77
 
131
78
  | Material | When applicable |
132
79
  |:---|:---|
133
80
  | Flow description (user journey / system flow / command flow) | Multi-step interaction or processing chain |
134
- | Core entities & data | New or modified entities involved; existing entities use `→ ref: data_snapshot.json#EntityName` |
135
- | Touchpoints (pages / commands / endpoints / methods) | User-facing or external interfaces exist |
136
- | Pre-defined decisions | When goal contains `[User Preset]` → highlight and enforce strictly |
81
+ | Core entities and data | New or modified entities; existing use `→ ref: data_snapshot.json#EntityName` |
82
+ | Touchpoints (page / command / endpoint / method) | User-facing or external surface |
83
+ | Pre-defined decisions | When goal has `[User Preset]` → highlight and enforce strictly |
137
84
 
138
85
  **Reference rules**:
139
- - Entities/types already in global → `ref: data_snapshot.json#X`, only describe what this task **adds or modifies**
140
- - Design philosophy/principles → `ref: vision.md#PrincipleName`, no need to restate
86
+ - Entities/types in global → `ref: data_snapshot.json#X`; only describe **additions or changes** for this task
87
+ - Design philosophy/principles → `ref: vision.md#PrincipleName`; no restatement
141
88
  - Upstream interfaces → `ref: tasks/<dep_ID>/spec.md#InterfaceName`
142
89
  - Existing design tokens/components → `ref: design_tokens.json#preset` / `ref: dictionary.json#component`
143
90
 
144
- **Universal requirement**: Use this task's specific entity names and operation names; no generic descriptions
145
-
91
+ **Universal requirement**: Use this task's concrete entity names and operation names; no generics
146
92
 
147
93
  #### Part 2: Architecture Recommendations
148
94
 
149
- [[SKILL: archi-plan-options|Follow the skill's three-step selection logic (Convention Inheritance -> Tag Routing -> Recommend vs. Expand) to generate architecture recommendations across five dimensions.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-plan-options/SKILL.md` and follow its three-step logic)]]
150
-
151
- When expanding a Q-table, follow the format in [[SKILL: archi-interview-protocol|the skill's standard output format]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` and follow its rules)]].
95
+ [[SKILL: archi-plan-options|Follow the skill's three-step selection (convention inheritance tag routing recommend vs expand) to generate arch recommendations from five dimensions.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-plan-options/SKILL.md` and follow its three-step logic)]]
152
96
 
153
- #### Part 1.5: Mechanism Preview [?Complex]
97
+ When expanding Q-table, follow [[SKILL: archi-interview-protocol|skill's standard output format]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` and follow its rules)]].
154
98
 
155
- Output only when step_1_5 verdict is **Standard + Design**. List core mechanisms needing technical design and intended pattern:
156
-
157
- ```
158
- ### Mechanism Preview (will generate design.md)
159
- | Mechanism | Pattern | Brief |
160
- |:---|:---|:---|
161
- | [name] | [State Machine / Pipeline / Decision Matrix / Protocol] | [one-sentence description] |
162
- ```
99
+ #### Part 1.5: Mechanism Preview (Complex tasks only)
163
100
 
164
- > User may add/remove mechanisms or change pattern selection here.
101
+ Output only when step_1_5 verdict is **Standard + Design**. List core mechanisms needing design and intended pattern (Mechanism / Pattern / Brief table). User may add/remove mechanisms or change pattern.
165
102
 
166
103
  #### Output Format
167
104
 
168
- ```
169
- ## Task Proposal: [Task Name] ([ID])
170
-
171
- ### Task Design
172
- [Output per complexity level, see Part 1 above]
173
-
174
- ### Architecture Recommendations
175
- | Dimension | Recommended | Source | Rationale |
176
- |:---|:---|:---|:---|
177
- | Core Structure | [Recommended option] | Task | [1-2 sentences specific to this task] |
178
- | Interaction Pattern | [Recommended option] | Task | [Rationale] |
179
- | Error Handling | [Convention value] | Project Convention | ref: 02_tech_stack.md §9 |
180
- | ... | ... | ... | ... |
181
-
182
- [Only when Standard + Design]:
183
- ### Mechanism Preview (will generate design.md)
184
- | Mechanism | Pattern | Brief |
185
- |:---|:---|:---|
186
- | ... | ... | ... |
105
+ Output **Task Proposal** including: task design (per Part 1), architecture table (dimension/recommendation/source/rationale), (Standard+Design only) mechanism preview table, (dimensions needing user decision only) expanded Q-table (ID/option/description/AI+/AI-, A recommended, Z custom). End with confirmation: OK to accept all; or annotate changes (design fix / dimension override / answer / mechanism change).
187
106
 
188
- [Only expand option table for dimensions requiring user decision]:
189
- **[Q<n>] Question title**
190
- > Why user decision is needed (one sentence)
107
+ **Goal**: Lock `spec`, `ui` (if applicable), `data_snapshot.json` (if applicable).
191
108
 
192
- | ID | Option | Description | AI+ | AI- |
193
- |:---|:---|:---|:---|:---|
194
- | A [Recommended] | ... | Concrete behavior (2-3 sentences) | Full sentence | Full sentence |
195
- | B | ... | ... | ... | ... |
196
- | Z | Custom | (Describe) | - | - |
109
+ **⌨️ INPUT**: Reply **OK** to accept all (→ enter step_4_global_sync); or free-text changes (→ enter step_3_5_refinement). No fixed format.
110
+ </step_3_interview>
197
111
 
198
- ---
199
- > Reply **OK** to accept all recommendations; or annotate what to change, e.g.:
200
- > - Design correction: "Registration doesn't need email verification step"
201
- > - Dimension override: "Core Structure=C, Error Handling=B D"
202
- > - Question answer: "Q1=B"
203
- > - Mechanism change: "Remove Pipeline, reconnection doesn't need that complexity"
204
- ```
205
-
206
- **⌨️ INPUT**: Reply **OK** to accept all; or free-text annotations for changes. No fixed format required.
207
- </step_2_interview>
208
-
209
- <step_2_5_refinement>
210
- **Role**: Consultant
112
+ <step_3_5_refinement>
211
113
  **Trigger**: User reply is not OK — contains corrections, questions, overrides, or logic conflicts.
212
- **Action**: Do NOT generate docs. Incorporate user feedback, refresh Unified Proposal and re-output. Wait for confirmation.
114
+ **Action**: Do not generate docs. Incorporate feedback, refresh Unified Proposal and re-output; await re-confirmation.
213
115
  - If task design question → Compare alternatives, re-propose design
214
- - If architecture dimension question → Explain differences in this task's context, update recommendation
116
+ - If architecture dimension question → Explain differences in this task context, update recommendation
215
117
  - If dimension override → Replace recommendation directly and adjust related design
216
- </step_2_5_refinement>
217
118
 
218
- <step_3_global_sync>
219
- **Role**: System Admin
220
- **Constraint**: MUST update the following global files **BEFORE** generating Task docs.
119
+ User replies OK → enter step_4_global_sync.
120
+ </step_3_5_refinement>
121
+
122
+ <step_4_global_sync>
123
+ **Constraint**: Must update the following global files **before** generating Task docs.
221
124
 
222
- **Boundary**: Only register **project business domain** content. Architext framework concepts (scripts, scaffold, roadmap, plan, etc.) and framework infrastructure errors are prohibited from registration in global files.
125
+ **Boundary**: Only register **project business domain** content. Architext framework concepts (scripts, scaffold, roadmap, plan, etc.) and framework infra errors must not be registered.
223
126
 
224
127
  **Action Checklist**:
225
128
  1. **`map.json`**: Register `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>` in `directoryMapping`; define module responsibility and dependencies in `logicalTopology`.
226
- 2. **Data governance sync** (`dictionary.json` / `error_codes.json` / `data_snapshot.json` etc.): Per `03_data_governance.md` rules, incrementally sync new business terms, error codes, Schema from the proposal to corresponding global files.
227
- 3. **`map.json` featureRelations**: [[SUBAGENT: archi-feature-relations|mode: register, context: Determine if this Task is aggregator; if yes, register featureRelations entry]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: register logic)]]
129
+ 2. **Data governance sync** (`dictionary.json` / `error_codes.json` / `data_snapshot.json` etc.): Per `03_data_governance.md`, incrementally sync new business terms, error codes, Schema to corresponding global files.
130
+ 3. **`map.json` featureRelations**: [[SUBAGENT: archi-feature-relations|mode: register, context: Determine if this Task is aggregator; if yes register featureRelations entry]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: register logic)]]
228
131
 
229
- **Output**: Change diffs of above files (brief).
230
- </step_3_global_sync>
132
+ **Output**: Diff summary of above files. Enter step_5_generate.
133
+ </step_4_global_sync>
231
134
 
232
- <step_4_generate>
233
- **Role**: Doc Engineer
234
- **Input**: Confirmed Unified Proposal (task design + architecture recommendations) + updated global context + Task Type from step_1_5.
135
+ <step_5_generate>
136
+ **Input**: Confirmed Unified Proposal (task design + arch recommendations) + updated global context + step_1_5 Task Type.
235
137
  **Action**: Generate standard docs under `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>/`.
236
138
 
237
- **1. `spec.md`** (Mandatory):
139
+ **1. `spec.md`** (required):
238
140
  - Template: `templates/spec.template.md`.
239
141
 
240
- **spec § 2 dimension format by Task Type**:
142
+ **spec § 2 format by Task Type**:
241
143
 
242
144
  | Task Type | § 2 Primary Dimension | Format requirement |
243
145
  |:---|:---|:---|
244
- | Feature | Behavioral | Gherkin (Given/When/Then); each Scenario maps to concrete flow step or exception path from task design |
245
- | Infrastructure | Structural | Configuration Contract per config file/service (Path + Key Settings + Constraints + Verify). Key Settings **must state concrete values**; no generic descriptions (e.g. "configure X") |
246
- | Quality | Quantitative | Quality Target; each optimization goal has Metric + Baseline + Target + Verify |
146
+ | Feature | Behavioral | Gherkin (Given/When/Then); each Scenario maps to concrete flow step or exception path in task design |
147
+ | Infrastructure | Structural | Configuration Contract; one per config file/service (Path + Key Settings + Constraints + Verify). Key Settings **must state concrete values**; no generic descriptions |
148
+ | Quality | Quantitative | Quality Target; each goal has Metric + Baseline + Target + Verify |
247
149
  | Edit | Inherit from original | Same as original task type |
248
150
 
249
- > Mixed tasks use sub-headings in § 2 to distinguish dimensions (e.g. INF task with Behavioral subsection for hotkey behavior).
151
+ > Mixed tasks use sub-headings in § 2 to distinguish dimensions.
250
152
 
251
- **spec § 4 Interface Exports**: INF tasks **required** (downstream infrastructure must declare exports); FEAT tasks required when has downstream deps.
153
+ **spec § 4 Interface Exports**: INF **required**; FEAT required when has downstream deps.
252
154
  **spec § 5 Constraints**: **Required** — extract relevant red lines from vision.md + 02_tech_stack.md.
253
155
 
254
156
  **General rules**:
255
- - Do not invent Acceptance Criteria; each must correspond to concrete content in task design.
157
+ - Do not invent AC items; each must map to concrete content in task design.
256
158
  - If upstream task, must include explicit Interface/Type definitions in § 4.
257
159
 
258
- **2. `ui.md`** [?UI]:
160
+ **2. `ui.md`** (when this task involves UI):
259
161
  - Template: `templates/ui.template.md`.
260
162
  - **With `ui_context.md` (primary path)**:
261
- 1. **UI Divergence Check** (required before writing `ui.md`): Compare the confirmed task design from step_2 against the screen inventory in `ui_context.md`. [[SKILL: archi-ui-wireframe|Follow the skill protocol to handle UI divergence.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]]. Criteria and action:
163
+ 1. **UI divergence check** (required before writing `ui.md`): Compare task design with screen index; identify divergence. [[SKILL: archi-ui-wireframe|Follow skill protocol to handle UI divergence]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]].
262
164
 
263
- | Divergence type | Criteria | Action |
165
+ | Divergence Type | Criteria | Handling |
264
166
  |:---|:---|:---|
265
- | No divergence | Screen index matches design | Write `ui.md` directly, reference screen ID |
266
- | Minor addition | New state / modal / local area, overall layout unchanged | Call skill (Plan refinement mode) to update `ui_concept.html` + `ui_context.md`; note `MODIFIED: S-XX` in `ui.md` |
267
- | Structural divergence | Layout restructure, new standalone screen, flow path change | **Pause** — present divergence summary to user, wait for **OK**, then call skill to update `ui_concept.html` + `ui_context.md`, then write `ui.md` |
268
-
269
- 2. After resolving divergence, fill in screen scope and delta components per `ui.template.md`.
270
- - **Without `ui_context.md` (fallback path)**: Write full ITP v3.0 component tree, referencing `design_tokens.json` token definitions.
271
-
272
- **3. `design.md`** [?Complex]:
273
- - Template: `templates/design.template.md`.
274
- - Generate only when step_1_5 verdict is **Standard + Design**.
275
- - § 2 Core Mechanisms: Per step_2 confirmed mechanism preview, call [[SKILL: archi-design-patterns|skill's pattern selection guide and standard format to generate mechanism descriptions and run self-checks]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-design-patterns/SKILL.md` and follow its pattern formats and self-check lists)]].
276
- - § 3 Parameters: All mechanism numeric values must be concrete; no vague descriptions.
277
- - § 4 Invariants: Each must be testable; must map to plan.json test entries.
278
- - § 5 Failure Modes: Each failure must have detection + fallback behavior.
279
- - § 6 Trace Verification: Trace design path from each spec § 2 AC; fix gaps by returning to § 2 or § 5.
280
-
281
- **4. `plan.json`** (Mandatory):
282
- - Template: `templates/plan.template.json`.
283
- - Dynamically adjust Phases by project type; ensure each Task's context is self-contained.
284
- - Task descriptions explicitly state "Additive Only" + "Respect Unknowns".
285
-
286
- **WBS decomposition three principles (must follow when generating plan.json)**:
287
-
288
- **Principle 1 — Deliverable-oriented**: Each task `title` describes **deliverable** not activity.
289
- > ✅ Good: `apps/web/tsconfig.json — strict + path aliases`
290
- > ❌ Bad: `Configure TypeScript`
291
-
292
- **Principle 2 — 100% coverage**: After generation, verify coverage:
293
- | Check | Rule |
294
- |:---|:---|
295
- | Each spec § 2 Acceptance Criteria item | Must have ≥1 task covering it |
296
- | Each spec § 4 Interface Export | Must have task responsible for creating/exposing it |
297
- | Each spec § 5 Constraint | Must be referenced in some task's notes |
298
- Add tasks until 100% covered.
167
+ | No divergence | Screen index matches design | Write `ui.md` directly; reference screen ID |
168
+ | Minor addition | New state/popup/local area; overall layout unchanged | Call skill to update `ui_concept.html` + `ui_context.md`; note `MODIFIED: S-XX` |
169
+ | Structural divergence | Layout refactor, new standalone screen, flow path change | **Pause** — output divergence summary to user; wait for **OK**; then call skill to update; then write `ui.md` |
170
+
171
+ 2. After resolving divergence, fill screen scope and delta components per `ui.template.md`.
172
+ - **Without `ui_context.md` (fallback)**: Describe full ITP v3.0 component tree; reference `design_tokens.json` token definitions.
173
+
174
+ **3. Complex tasks only: `design.md`**:
175
+ - Template: `templates/design.template.md`. Generate only when **Standard + Design**.
176
+ - § 2 Core Mechanisms: Per confirmed mechanism preview, call [[SKILL: archi-design-patterns|skill pattern selection guide and standard format to generate mechanism description and run self-check]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-design-patterns/SKILL.md` and follow its pattern format and self-check list)]].
177
+ - § 3 Parameters: Values must be concrete; no vagueness. § 4 Invariants: Must be testable; map to plan.json test entries. § 5 Failure Modes: Must have detection + fallback. § 6 Trace Verification: Trace from each spec § 2 AC to design path; fix gaps.
178
+
179
+ **4. `plan.json`** (required):
180
+ - Template: `templates/plan.template.json`. Adjust Phases by project type; each Task context self-contained.
181
+ - Each Phase must include a `rationale` field recording key design decision rationale (user choice / AI recommendation reason).
182
+
183
+ **WBS decomposition three principles**:
184
+
185
+ **Principle 1 Deliverable-oriented**: Each task `title` describes **deliverable**, not activity.
186
+ > Red Flag: `Configure TypeScript` should be `apps/web/tsconfig.json — strict + path aliases`
187
+
188
+ **Principle 2 100% coverage**: Each spec § 2 AC → ≥1 task covers; each § 4 Interface → task creates; each § 5 Constraint → task notes references. Add if missing.
299
189
 
300
190
  **Principle 3 — Granularity and mutual exclusion**:
301
191
  | Signal | Verdict |
302
192
  |:---|:---|
303
- | Task involves ≥3 unrelated files | Too coarse — split |
304
- | Task title cannot map to concrete output file | Too abstract — concretize |
305
- | Two tasks modify same file same region | Violates mutual exclusion — merge or redraw boundary |
306
- | Task notes single sentence with no verification | Insufficient info — supplement |
307
-
308
- **`decisions` quality standard**:
309
- - `rationale` **must include implementation guidance**; not only "why choose" but "how to configure after choosing".
310
- > ✅ Good: `pnpm workspace manages apps/ + packages/; Turborepo pipeline: build→lint→type-check three-level cache; root scripts unified entry`
311
- > Bad: `Brief explicitly requires` zero implementation guidance
312
-
313
- **`notes` quality standard**:
314
- - Format: `[output file path or operation target] · [spec ref] · [key constraints] · Verify: [executable command + expected result]`
315
- - Used by `/archi.code` step_4 to locate and run e2e; do not leave empty.
316
- > ✅ Good: `Create apps/web/next.config.ts · spec §2.2 · transpilePackages: ['@repo/ui'], output: 'standalone' · no CSS-in-JS · Verify: pnpm --filter web build succeeds (exit 0)`
317
- > ❌ Bad: `Configure Next.js · spec §2.2` ← no concrete content, constraints, or verification
318
- > ❌ Bad: `Create file · spec §2.1 · Verify: check file exists` ← "check file exists" not executable
319
- > **Red Flag**: notes degenerate to title synonym. Each notes must contain information **not present** in title.
320
-
321
- - Run `npx archi render` after generation to produce readable `.md` view.
322
- </step_4_generate>
323
-
324
- <step_5_verify>
325
- **Role**: Independent Reviewer
193
+ | Task touches ≥3 unrelated files | Too coarse — split |
194
+ | Title cannot map to concrete output file | Too abstract — concretize |
195
+ | Two tasks modify same file same region | Violates mutual exclusion — merge or redraw |
196
+ | Notes single sentence with no verification | Insufficient — supplement |
197
+
198
+ **`decisions` quality**: `rationale` must include implementation guidance; not just "why choose" but "how to configure".
199
+ > Red Flag: `Brief explicitly requires` zero implementation guidance
200
+
201
+ **`notes` quality**: Format `[output file path] · [spec ref] · [key constraints] · Verify: [executable command + expected result]`. Do not leave empty.
202
+ > Red Flag: notes degenerate to title synonym. Each notes must contain information **not in** title.
203
+
204
+ - Run `npx archi render` after generation to produce readable `.md` views. Enter step_6_verify.
205
+ </step_5_generate>
326
206
 
327
- [[SUBAGENT: archi-silent-audit|mode: plan-docs, context: Review step_4 generated docs (spec.md, ui.md, plan.json, design.md)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: plan-docs review dimension table item by item)]]
207
+ <step_6_verify>
208
+ **Role**: Independent Reviewer
209
+ [[SUBAGENT: archi-silent-audit|mode: plan-docs, context: Review step_4 generated docs (spec.md, ui.md, plan.json, design.md)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: plan-docs review dimension table)]]
328
210
 
329
211
  [[INCLUDE: shared/verify-result-handling.md]]
330
- </step_5_verify>
212
+ </step_6_verify>
331
213
 
332
- <step_6_signoff>
333
- **Terminal Gate** (Do not skip; must complete before output summary):
214
+ <step_7_signoff>
215
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
334
216
  | Step | Command | Pass Condition |
335
217
  |:---|:---|:---|
336
- | 1 | `npx archi task --check` | No ERROR-level issues |
337
- | 2 | `npx archi render` | `.md` views generated |
338
- | 3 | `npx archi task <ID> --status active` | Task marked as in-progress |
339
-
340
- **Action** (After Gate passes):
218
+ | 1 | `npx archi task <ID> --status active` | Task marked as in-progress |
219
+
220
+ **Pre-signoff Checklist** (confirm each item after Gate passes, before Output):
221
+ □ spec.md § 2 — ACs/scenarios/contracts map to specific design content (no fabrication)
222
+ spec.md § 4 Interface — filled (required for INF tasks / tasks with downstream deps)
223
+ □ spec.md § 5 Constraints — extracted from vision + tech_stack (not empty)
224
+ □ plan.json — every AC in spec § 2 → ≥1 task covering it (100% coverage rule)
225
+ □ plan.json — every task notes includes verification field (not empty, not title paraphrase)
226
+ □ map.json — tasks/<ID>_<Slug> registered in directoryMapping
227
+ □ Global files — new terms/error codes/schemas synced (dictionary/error_codes/data_snapshot)
228
+ □ Step 6 Silent Audit — executed, all CRITICAL issues resolved
229
+
230
+ **Action** (after Checklist confirmed):
341
231
  1. Output summary.
342
232
 
343
- **Output**: Task definition summary with Architecture Confirmation table (each dimension's final choice and rationale) and Next Steps table.
233
+ **Output**: Task definition summary with architecture confirmation table (each dimension final choice and rationale) and Next Steps:
234
+
235
+ | Priority | Action | Notes |
236
+ |:---|:---|:---|
237
+ | 1 | `/archi.code <ID>` | Spec and Plan are ready; start implementation (requires user confirmation) |
238
+ | Optional | Review spec.md / plan.json | Double-check docs before coding |
344
239
  </step_6_signoff>
345
240
 
346
241
  </protocol_plan>
@@ -1,63 +1,48 @@
1
1
  <protocol_recover>
2
2
  **Trigger**: `/archi.recover <pack-file>`
3
- **Goal**: Read the pack file and write all user data (docs, tasks, custom rules) to their corresponding paths in the current project, completing data restore after a framework upgrade.
3
+ **Goal**: Read pack file; write all user data (docs, tasks, custom rules) to corresponding paths in current project; complete data restore after framework upgrade.
4
4
 
5
5
  <meta>
6
6
  <style>Precise, Efficient, Non-interactive</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **User Data Only**: The pack file contains only user data (`global/`, `tasks/`, `scripts/`, custom rules) no framework files. Write all entries without filtering.
10
- 2. **Overwrite Always**: If the target file already exists, overwrite it directly without prompting (in an upgrade scenario, existing files are empty templates and safe to replace).
11
- 3. **Delta Notation**: Label each written file as `ADDED` or `MODIFIED` in the output.
12
- 4. **No Partial Write**: If any file write fails, stop immediately and report. Already-written files are not rolled back (idempotent safe to re-run).
9
+ 1. **User Data Only**: Pack file contains only user data (`global/`, `tasks/`, `scripts/`, `refs/`, custom rules); write all; no filtering.
10
+ 2. **Overwrite Always**: When target path exists, overwrite directly (in upgrade scenario old data is empty template; safe to replace).
11
+ 3. **Delta Notation**: Output must label each written file as `ADDED` / `MODIFIED`.
12
+ 4. **No Partial Write**: If any file write fails, stop immediately and report; already-written files are not rolled back (idempotent; safe to re-run).
13
13
  </principles>
14
14
  </meta>
15
15
 
16
16
  <step_1_ingest>
17
17
  **Role**: Intelligence Analyst
18
18
  **Action**:
19
- 1. Read the file at the `<pack-file>` path.
20
- 2. Parse the XML; extract the `path` attribute and CDATA content of each `<file>` element under `<files>`.
19
+ 1. Read file at `<pack-file>` path.
20
+ 2. Parse XML; extract `path` attribute and CDATA content of each `<file>` element under `<files>`.
21
21
 
22
- | Condition | Action |
22
+ | Condition | Handling |
23
23
  |:---|:---|
24
- | File not found or unreadable | Stop — ask user to verify path; suggest running `archi pack` to regenerate |
25
- | XML malformed | Stop — note file may be corrupted; suggest re-running `archi pack` |
26
- | `<files>` is empty | Stop — inform user the pack is empty |
24
+ | File not found or unreadable | Stop — ask user to check path; suggest running `archi pack` to generate |
25
+ | XML malformed | Stop — suggest file may be corrupted; re-run `archi pack` |
26
+ | `<files>` empty | Stop — inform pack is empty |
27
27
 
28
- **Output**: Internal file list (path + content). Do not output to user.
28
+ **Output**: Internal file list (path + content); not shown to user.
29
29
  </step_1_ingest>
30
30
 
31
31
  <step_2_apply>
32
- **Role**: Senior Engineer
33
32
  **Action**:
34
- 1. For each `<file>` entry:
35
- - Use the `path` attribute (relative to project root) as the write target.
36
- - If the target file exists → overwrite (mark as `MODIFIED`).
37
- - If the target file does not exist create (mark as `ADDED`).
38
- - Write the full CDATA content, preserving original line endings and encoding.
39
- 2. Note: paths in the pack may contain nested subdirectories (e.g. `tasks/FEAT-001_auth/spec.md`); ensure parent directories exist before writing.
40
-
41
- **Output**:
42
- ```
43
- ADDED .architext/global/vision.md
44
- ADDED .architext/global/roadmap.json
45
- ADDED .architext/tasks/FEAT-001_auth/spec.md
46
- MODIFIED .cursor/rules/90_custom_rules.mdc
47
- ...
48
- ```
33
+ 1. For each `<file>` entry: use `path` (relative to project root) as write target; exists → overwrite (`MODIFIED`), not exists → create (`ADDED`). Write full CDATA content; preserve original line endings and encoding.
34
+ 2. Paths in pack may have nested subdirs; ensure parent dirs exist.
35
+
36
+ **Output**: Each file's `ADDED` / `MODIFIED` status list.
49
37
  </step_2_apply>
50
38
 
51
39
  <step_3_signoff>
52
- **Action**:
53
- 1. Output restore summary:
54
- - Total files written (ADDED and MODIFIED counted separately)
55
- 2. Next Steps:
40
+ **Output**: Restore summary — total files written (ADDED / MODIFIED counted separately) + Next Steps:
56
41
 
57
42
  | Step | Notes |
58
43
  |:---|:---|
59
- | Verify framework state | Run `/archi.help` to check project status and recommended next actions |
60
- | Clean up pack file | You may delete `<pack-file>` — it is no longer needed |
44
+ | Verify framework state | Run `/archi.help` to check project state and suggested next actions |
45
+ | Clean up pack file | May delete `<pack-file>`; no longer needed |
61
46
  </step_3_signoff>
62
47
 
63
48
  </protocol_recover>