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
@@ -1,252 +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
-
43
- **Output**: Present a **Task Context Brief** to the user:
44
- ```
45
- ### Task Context: [Task Name] ([ID])
46
-
47
- **Goal**: [roadmap task's goal; highlight any [User Presets] if present]
48
- **Upstream Dependencies**: [completed dependency tasks and their key interfaces/types, or "None"]
49
- **Project Features**: [activated UI/Data/CLI/Lib/API tags]
50
- **Technical Constraints**: [key red lines from 02_tech_stack.md]
51
- **Design Philosophy**: [North Star Metric and design principles from vision.md]
52
- **Project Conventions**: [from 02_tech_stack.md §9 — Error Handling: X | Data Flow: X | Auth: X, or "Not set" if absent]
53
- ```
54
- 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.
55
32
  </step_1_load>
56
33
 
57
- <step_1_5_complexity>
58
- **Role**: Product Consultant
59
- **Action**: Assess task complexity to decide whether to run the full step_2 flow:
34
+ <step_2_complexity>
35
+ **Action**: Detect task type, assess complexity, decide flow path.
60
36
 
61
- **① Granularity hard-limit check (before complexity verdict)**:
37
+ **⓪ Task Type + granularity red lines**:
62
38
 
63
- | Metric | Limit |
64
- |:---|:---|
65
- | Estimated spec.md Scenario count | ≤ 6 |
66
- | Estimated plan.json Phase count | ≤ 4 |
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 |
67
45
 
68
- > Estimation method: based on the roadmap task goal and dependency context loaded in step_1, quickly enumerate the core behavior paths. Trigger if over the limit — no need for precise calculation.
46
+ > Mixed tasks may combine dimensions in § 2 with sub-headings. Trigger split when estimate exceeds cap.
69
47
 
70
- **② Complexity verdict (only after granularity passes)**:
48
+ **① Complexity verdict**:
71
49
 
72
50
  | Signal | Verdict | Flow |
73
51
  |:---|:---|:---|
74
- | No deps + no new entities + no architecture decisions + estimated ≤3 tasks | **Simple** | Skip step_2 interview; generate spec + plan directly |
75
- | Has deps OR new entities OR architecture decisions needed | **Standard** | Execute step_2 Unified Proposal normally |
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 |
76
54
 
77
- **Simple Mode**:
78
- - Skip 5-dimension architecture recommendations and User Confirm Gate
79
- - spec condensed to 1-2 Gherkin scenarios
80
- - plan condensed to a single Phase
81
- - Confirm at signoff (replacing step_2 Gate)
82
- </step_1_5_complexity>
55
+ **② Design signal detection** (after Standard):
83
56
 
84
- <step_2_interview>
57
+ | Signal | Verdict |
58
+ |:---|:---|
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>
62
+
63
+ <step_3_interview>
85
64
  **Role**: Architect
86
65
 
87
66
  ---
88
67
 
89
- ### Unified Proposal
68
+ ### Unified Proposal (one-shot)
90
69
 
91
- **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.
92
71
 
93
72
  **Action**:
94
73
 
95
74
  #### Part 1: Task Design
96
75
 
97
- 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:
98
77
 
99
78
  | Material | When applicable |
100
79
  |:---|:---|
101
80
  | Flow description (user journey / system flow / command flow) | Multi-step interaction or processing chain |
102
- | Core entities & data | New or modified entities involved; existing entities use `→ ref: data_snapshot.json#EntityName` |
103
- | Touchpoints (pages / commands / endpoints / methods) | User-facing or external interfaces exist |
104
- | 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 |
105
84
 
106
85
  **Reference rules**:
107
- - Entities/types already in global → `ref: data_snapshot.json#X`, only describe what this task **adds or modifies**
108
- - 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
109
88
  - Upstream interfaces → `ref: tasks/<dep_ID>/spec.md#InterfaceName`
110
89
  - Existing design tokens/components → `ref: design_tokens.json#preset` / `ref: dictionary.json#component`
111
90
 
112
- **Universal requirement**: Use this task's specific entity names and operation names; no generic descriptions
113
-
91
+ **Universal requirement**: Use this task's concrete entity names and operation names; no generics
114
92
 
115
93
  #### Part 2: Architecture Recommendations
116
94
 
117
- [[SKILL: Follow `archi-plan-options` 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)]]
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)]]
118
96
 
119
- When expanding a Q-table, follow the format in [[SKILL: `archi-interview-protocol` Skill's standard output format]][[NO-SKILL: `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md`]].
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)]].
120
98
 
121
- #### Output Format
122
-
123
- ```
124
- ## Task Proposal: [Task Name] ([ID])
99
+ #### Part 1.5: Mechanism Preview (Complex tasks only)
125
100
 
126
- ### Task Design
127
- [Output per complexity level, see Part 1 above]
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.
128
102
 
129
- ### Architecture Recommendations
130
- | Dimension | Recommended | Source | Rationale |
131
- |:---|:---|:---|:---|
132
- | Core Structure | [Recommended option] | Task | [1-2 sentences specific to this task] |
133
- | Interaction Pattern | [Recommended option] | Task | [Rationale] |
134
- | Error Handling | [Convention value] | Project Convention | ref: 02_tech_stack.md §9 |
135
- | ... | ... | ... | ... |
136
-
137
- [Only expand option table for dimensions requiring user decision]:
138
- **[Q<n>] Question title**
139
- > Why user decision is needed (one sentence)
103
+ #### Output Format
140
104
 
141
- | ID | Option | Description | AI+ | AI- |
142
- |:---|:---|:---|:---|:---|
143
- | A [Recommended] | ... | Concrete behavior (2-3 sentences) | Full sentence | Full sentence |
144
- | B | ... | ... | ... | ... |
145
- | Z | Custom | (Describe) | - | - |
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).
146
106
 
147
- ---
148
- > Reply **OK** to accept all recommendations; or annotate what to change, e.g.:
149
- > - Design correction: "Registration doesn't need email verification step"
150
- > - Dimension override: "Core Structure=C, Error Handling=B D"
151
- > - Question answer: "Q1=B"
152
- ```
107
+ **Goal**: Lock `spec`, `ui` (if applicable), `data_snapshot.json` (if applicable).
153
108
 
154
- **⌨️ INPUT**: Reply **OK** to accept all; or free-text annotations for changes. No fixed format required.
155
- </step_2_interview>
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>
156
111
 
157
- <step_2_5_refinement>
158
- **Role**: Consultant
112
+ <step_3_5_refinement>
159
113
  **Trigger**: User reply is not OK — contains corrections, questions, overrides, or logic conflicts.
160
- **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.
161
115
  - If task design question → Compare alternatives, re-propose design
162
- - 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
163
117
  - If dimension override → Replace recommendation directly and adjust related design
164
- </step_2_5_refinement>
165
118
 
166
- <step_3_global_sync>
167
- **Role**: System Admin
168
- **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.
169
124
 
170
- **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.
171
126
 
172
127
  **Action Checklist**:
173
128
  1. **`map.json`**: Register `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>` in `directoryMapping`; define module responsibility and dependencies in `logicalTopology`.
174
- 2. **`dictionary.json`**: Extract **project business** new terms from the proposal to fill `entities`/`verbs`; register new shared tools to `utilities`; register new public components to `components`.
175
- 3. [?Data] **`data_snapshot.json`**: Add/modify Schema based on Core Structure recommendation. Prohibited from writing "TBD"; must write field names and types.
176
- 4. **`error_codes.json`**: Register new **business** error codes based on Error Handling recommendation. Framework script errors are handled by exit code + stderr; prohibited from registration.
177
- 5. **`map.json` featureRelations**: Determine if this task is an "aggregator" — i.e., its core responsibility is to **list, summarize, or dynamically reflect** a class of other tasks (e.g., "list all commands", "aggregate all page entries", "register all routes"). If yes, append one record to `featureRelations`:
178
- ```json
179
- {
180
- "aggregator": "<this task ID or file path>",
181
- "sources": "<one-sentence description of what is aggregated, e.g. 'all CLI command tasks'>",
182
- "evidence": "<basis, e.g. 'spec.md §X states this task dynamically lists all Y-type tasks'>",
183
- "checkNote": "When tasks of this type are added or removed, check whether <aggregator> needs to be updated"
184
- }
185
- ```
186
- If not an aggregator, skip this step.
187
-
188
- **Output**: Change diffs of above files (brief).
189
- </step_3_global_sync>
190
-
191
- <step_4_generate>
192
- **Role**: Doc Engineer
193
- **Input**: Confirmed Unified Proposal (task design + architecture recommendations) + updated global context.
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)]]
131
+
132
+ **Output**: Diff summary of above files. Enter step_5_generate.
133
+ </step_4_global_sync>
134
+
135
+ <step_5_generate>
136
+ **Input**: Confirmed Unified Proposal (task design + arch recommendations) + updated global context + step_1_5 Task Type.
194
137
  **Action**: Generate standard docs under `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>/`.
195
138
 
196
- **1. `spec.md`** (Mandatory):
139
+ **1. `spec.md`** (required):
197
140
  - Template: `templates/spec.template.md`.
198
- - Convert confirmed task design and architecture recommendations to Gherkin Scenarios.
199
- - Each Scenario must map to a concrete flow step or exception path from the task design; do not invent scenarios.
200
- - If upstream task, must include explicit Interface/Type definitions.
201
141
 
202
- **2. `ui.md`** [?UI]:
142
+ **spec § 2 format by Task Type**:
143
+
144
+ | Task Type | § 2 Primary Dimension | Format requirement |
145
+ |:---|:---|:---|
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 |
149
+ | Edit | Inherit from original | Same as original task type |
150
+
151
+ > Mixed tasks use sub-headings in § 2 to distinguish dimensions.
152
+
153
+ **spec § 4 Interface Exports**: INF **required**; FEAT required when has downstream deps.
154
+ **spec § 5 Constraints**: **Required** — extract relevant red lines from vision.md + 02_tech_stack.md.
155
+
156
+ **General rules**:
157
+ - Do not invent AC items; each must map to concrete content in task design.
158
+ - If upstream task, must include explicit Interface/Type definitions in § 4.
159
+
160
+ **2. `ui.md`** (when this task involves UI):
203
161
  - Template: `templates/ui.template.md`.
204
162
  - **With `ui_context.md` (primary path)**:
205
- 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`:
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)]].
206
164
 
207
- | Divergence type | Criteria | Action |
165
+ | Divergence Type | Criteria | Handling |
208
166
  |:---|:---|:---|
209
- | No divergence | Screen index matches design | Write `ui.md` directly, reference screen ID |
210
- | Minor addition | New state / modal / local area, overall layout unchanged | Call `archi-ui-wireframe` Skill (Plan refinement mode) to update `ui_concept.html` + `ui_context.md`; note `MODIFIED: S-XX` in `ui.md` |
211
- | 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` |
212
-
213
- 2. After resolving divergence, fill in screen scope and delta components per `ui.template.md`.
214
- - **Without `ui_context.md` (fallback path)**: Write full ITP v3.0 component tree, referencing `design_tokens.json` token definitions.
215
-
216
- **3. `plan.json`** (Mandatory):
217
- - Template: `templates/plan.template.json`.
218
- - Dynamically adjust Phases by project type; ensure each Task's context is self-contained.
219
- - Task descriptions explicitly state "Additive Only" + "Respect Unknowns".
220
- - **`decisions`**: Fill per dimension; `choice` supports multi-select (e.g. `A B`, space-separated), custom (`Z: …`); `rationale` must explain reasoning for code phase; do not leave empty.
221
- - **`notes`**: Fill each task's `notes` with: `[scope] · [spec ref] · [key constraints] · Verify: [concrete operation]`; used by `/archi.code` step_4 to locate context and run e2e; do not leave empty.
222
- > Example: `Implement POST /auth/login · spec §3.1 · JWT must not contain password · Verify: curl POST /auth/login returns 200 + token field`
223
- - Run `npx archi render` after generation to produce readable `.md` view.
224
- </step_4_generate>
225
-
226
- <step_5_audit>
227
- **Role**: Chief Auditor
228
- **Checklist**:
229
- 1. **Design Fidelity**: Do Scenarios fully cover confirmed task design (flow steps and exception paths)?
230
- 2. **Tech Consistency**: Any undeclared tech used?
231
- 3. **Data Integrity**: Do Scenario entities match confirmed core entities?
232
- 4. **Error Handling**: Is Error Handling recommendation covered?
233
- 5. **AX Compliance**: Are Anti-Clobbering and Interface Stability rules followed?
234
-
235
- Silently fix issues; mark critical issues with `⚠️ Risk Warning`.
236
- </step_5_audit>
237
-
238
- <step_6_signoff>
239
- **Terminal Gate** (Do not skip; must complete before output summary):
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.
189
+
190
+ **Principle 3 Granularity and mutual exclusion**:
191
+ | Signal | Verdict |
192
+ |:---|:---|
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>
206
+
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)]]
210
+
211
+ [[INCLUDE: shared/verify-result-handling.md]]
212
+ </step_6_verify>
213
+
214
+ <step_7_signoff>
215
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
240
216
  | Step | Command | Pass Condition |
241
217
  |:---|:---|:---|
242
- | 1 | `npx archi task --check` | No ERROR-level issues |
243
- | 2 | `npx archi task <ID> --status active` | Task marked as in-progress |
244
- | 3 | `npx archi render` | `.md` views generated |
245
-
246
- **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):
247
231
  1. Output summary.
248
232
 
249
- **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 |
250
239
  </step_6_signoff>
251
240
 
252
241
  </protocol_plan>
@@ -0,0 +1,48 @@
1
+ <protocol_recover>
2
+ **Trigger**: `/archi.recover <pack-file>`
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
+
5
+ <meta>
6
+ <style>Precise, Efficient, Non-interactive</style>
7
+ <language>English</language>
8
+ <principles>
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
+ </principles>
14
+ </meta>
15
+
16
+ <step_1_ingest>
17
+ **Role**: Intelligence Analyst
18
+ **Action**:
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
+
22
+ | Condition | Handling |
23
+ |:---|:---|
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
+
28
+ **Output**: Internal file list (path + content); not shown to user.
29
+ </step_1_ingest>
30
+
31
+ <step_2_apply>
32
+ **Action**:
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.
37
+ </step_2_apply>
38
+
39
+ <step_3_signoff>
40
+ **Output**: Restore summary — total files written (ADDED / MODIFIED counted separately) + Next Steps:
41
+
42
+ | Step | Notes |
43
+ |:---|:---|
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 |
46
+ </step_3_signoff>
47
+
48
+ </protocol_recover>