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,7 +1,7 @@
1
1
  <protocol_kickoff>
2
2
  **Trigger**: `/archi.start [file_path]`
3
3
  **Phase**: Strategic Initialization
4
- **Goal**: Establish Project Constitution (Vision/Tech/Roadmap) from Project Brief.
4
+ **Goal**: Establish project constitution (Vision/Tech/Roadmap) from Project Brief.
5
5
 
6
6
  <meta>
7
7
  <style>Strict, Professional, CLI-Like</style>
@@ -20,42 +20,37 @@
20
20
  **Action**:
21
21
  1. Parse `[file_path]` from trigger:
22
22
  - If path provided → read that file
23
- - If not → search `project-brief.md` (project root), then `[[__DOCS_DIR__]]/project-brief.md`
23
+ - If not provided → search `project-brief.md` (project root), then `[[__DOCS_DIR__]]/project-brief.md`
24
24
  - If neither exists or empty → goto `<fallback_interview>`
25
25
 
26
- 2. **Resource Accessibility Check** (must complete before parsing):
27
- Scan Brief for all external references (URLs, file paths, images). Try to access each; classify:
26
+ 2. **Resource scan and read** (must complete before parsing):
27
+
28
+ **a) `brief-assets/` directory scan**: Check if `brief-assets/` exists at project root. If so, read all files (images/PDFs/docs/Schema). Match files referenced in Brief via `./brief-assets/filename` with files read here.
29
+
30
+ **b) Brief full-text external reference check**: Scan Brief for all external references (URLs, file paths, images). Try to access each:
28
31
 
29
32
  | Status | Handling |
30
33
  |:---|:---|
31
- | Accessible | Read content, include in analysis |
34
+ | Accessible (incl. local files in brief-assets/) | Read content, include in analysis |
32
35
  | Inaccessible (auth required/404/private) | Mark `[unreadable]`, report to user later |
33
- | Non-link references (e.g. "reference Linear's interaction") | Process normally, no fetch |
36
+ | Non-link descriptive references | Process normally, no fetch |
34
37
 
35
- > Purpose: Avoid AI pretending it read resources it cannot access, leading to mismatched output.
38
+ **c) Asset semantic tag extraction**: For assets referenced in Brief as `- [semantic label] path`, record tag-to-file mapping for later steps (e.g. `[competitor reference]` → affects design_tokens, `[database Schema]` → affects data_snapshot).
36
39
 
37
- 3. Parse Brief sections, extract:
38
- - Project feature tags (UI/Data/CLI/Lib/API — inferred from tech fields and paragraphs)
39
- - Core feature list
40
- - Pre-defined design decisions (user's preset design for specific features/pages/flows)
41
- - Tech preferences (distinguish "confirmed" vs "blank/recommend")
42
- - Existing resources and context
43
- - Boundaries and constraints
44
- - Reference projects
45
- - Supplementary notes (rules/terminology/background)
40
+ 3. Parse Brief sections, extract: project feature tags, core task list, business process (if any), pre-defined design decisions, tech preferences (distinguish "confirmed" vs "blank/recommend"), data model draft (if any), existing API endpoints (if any), existing resources, boundaries and constraints, reference projects, supplementary notes.
46
41
 
47
- > Brief is a one-time input file; user may delete after processing.
42
+ > Brief is a one-time input file; user may delete after processing (brief-assets/ likewise).
48
43
 
49
44
  **Output**:
50
- - If any resources inaccessible → **Immediately output Resource Accessibility Report** to user, list unreadable links, ask for alternatives (screenshot, paste content, text description). Wait for user reply before continuing.
51
- - If all accessible or no external refs → Internal summary (no user output), proceed to `<step_1_gap_analysis>`.
45
+ - If any resources inaccessible → **Immediately output Resource Accessibility Report**, wait for user reply before continuing.
46
+ - If all accessible or no external refs → Internal summary, proceed to `<step_1_gap_analysis>`.
52
47
  </step_0_ingest>
53
48
 
54
49
  <step_1_gap_analysis>
55
- **Role**: Chief Product Officer (CPO)
50
+ **Role**: Chief Product Strategist (CPO)
56
51
  **Input**: Step 0 parsing result.
57
52
 
58
- **Action**: Check Brief completeness, identify information gaps.
53
+ **Action**: Check Brief completeness item by item, identify information gaps.
59
54
 
60
55
  **Checklist**:
61
56
 
@@ -63,196 +58,155 @@
63
58
  |:---|:---|:---|
64
59
  | Project identity | Name + one-line description + problem statement all filled | Required |
65
60
  | Target users | At least core user role described | Required |
66
- | Core features | At least 2 concrete features, each with description | Required |
61
+ | Core tasks | At least 2 concrete tasks listed, each with description | Required |
67
62
  | Tech stack – core | Language/runtime + core framework filled (non-empty) | Required |
68
63
  | Tech stack – optional | DB/ORM/CSS/deploy etc. blanks | Can supplement |
69
- | Project starting point | New project or existing codebase (affects architecture) | Required |
64
+ | Project starting point | New or existing codebase (affects architecture) | Required |
70
65
  | Existing resources | Design/brand/existing API/3rd-party services explicit? | Can supplement |
71
- | Style/tone | [?UI] Visual keywords / [?CLI] Output style / [?API] Doc approach | Can supplement |
66
+ | Style/tone | (UI projects only) Visual keywords / (CLI projects only) Output style / (API projects only) Doc approach | Can supplement |
72
67
  | Boundaries | At least 1 anti-goal or hard constraint declared | Suggested |
73
68
  | Success metrics | Concrete quantifiable metrics filled | Suggested |
74
69
  | Reference projects | At least 1 reference listed | Suggested |
75
70
 
76
- **Gap levels**:
77
- - **Required**: Must ask in Step 2
78
- - **Can supplement**: AI can recommend but better to confirm
79
- - **Suggested**: AI can infer, does not block flow
80
-
81
- **Decision**:
82
- - No "Required" gaps + no "Can supplement" gaps → skip Step 2, go to Step 3
83
- - Otherwise → go to Step 2
84
-
85
- **Output**: Brief analysis summary:
86
- ```
87
- ### BRIEF Analysis Report
88
- > **Project**: [name] | **Features**: [activated UI/Data/CLI/Lib/API tags]
71
+ **Gap levels**: Required → must ask in Step 2 | Can supplement → AI can recommend, suggest confirm | Suggested → AI can infer
89
72
 
90
- **Confirmed**:
91
- - [list of filled items]
73
+ **Decision**: No "Required" + "Can supplement" gaps → skip Step 2 | Has gaps → proceed to Step 2
92
74
 
93
- **Gaps (require supplement)**:
94
- - [gap 1]
95
- - [gap 2]
96
-
97
- **AI will auto-complete** (no action):
98
- - [items AI can infer]
99
- ```
75
+ **Output**: Output BRIEF analysis report to user — include project name/feature tags, confirmed items list, information gap list (require supplement), AI auto-complete items.
100
76
  </step_1_gap_analysis>
101
77
 
102
78
  <step_2_supplementary>
103
- **Role**: Product Advisor
104
79
  **Trigger**: Only when Step 1 finds "Required" or "Can supplement" gaps.
105
80
  **Input**: Step 1 gap list. Max 3–6 questions.
106
81
 
107
- [[SKILL: Follow `archi-interview-protocol` Skill's core rules and standard output format.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` and follow its rules)]]
82
+ [[SKILL: archi-interview-protocol|Follow the skill's core rules and standard output format for questioning.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-interview-protocol/SKILL.md` and follow its rules)]]
108
83
  </step_2_supplementary>
109
84
 
110
85
  <step_3_constitution>
111
86
  **Role**: Chief Architect
112
- **Input**: Full Brief text + Step 2 answers (if any).
87
+ **Input**: Full Brief + Step 2 supplement answers (if any).
113
88
 
114
89
  **Action**: Generate project constitution files in one pass. All Brief content must be consumed and routed; nothing omitted.
115
90
 
116
91
  ### Information Routing Rules
117
92
 
118
- > Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by the IDE — the AI knows their paths; write directly.
93
+ > Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by IDE; AI knows their paths, write directly.
119
94
 
120
95
  | Brief content | Target file |
121
96
  |:---|:---|
122
97
  | Project identity, target users, success metrics, references | `[[__DOCS_DIR__]]/global/vision.md` |
123
98
  | Tech stack, deploy target, 3rd-party libs/services | rule file `02_tech_stack` |
124
- | Style/tone (UI/CLI/API) — aesthetic direction / density / motion | rule file `02_tech_stack` (UI Protocol) + `design_tokens.json` aestheticDirection + motion.preference + illustration |
125
- | [?UI] **Aesthetic direction** (saas-dark/saas-light/dashboard/marketing/mobile-app/editorial/brutalist/custom) | `design_tokens.json` `aestheticDirection.preset` + `aestheticDirection.customDescription` |
126
- | [?UI] **Visual Reference** (brand palette / font / icon library / competitor screenshots / forbidden styles) | `design_tokens.json` primitivePalette.brand + illustration + motion; screenshots/URLs → `vision.md` Visual Reference |
127
- | Core feature list | `[[__DOCS_DIR__]]/global/roadmap.json` |
128
- | **Pre-defined design decisions** | Inject into related tasks' `goal` in Roadmap; treat as hard constraint in `/archi.plan` |
129
- | Boundaries and anti-goals | `[[__DOCS_DIR__]]/global/vision.md` Boundaries |
130
- | Existing resources (design/brand/existing API) | `[[__DOCS_DIR__]]/global/vision.md` + rule file `02_tech_stack` by content |
131
- | **Rules/conventions/preferences** from supplementary notes | rule file `90_custom_rules` |
132
- | **Domain terminology** from supplementary notes | `[[__DOCS_DIR__]]/global/dictionary.json` |
133
- | **Other background info** from supplementary notes | `[[__DOCS_DIR__]]/global/vision.md` Context |
134
-
135
- > Key: Any rule-like content (e.g. "comments in English", "no any") in supplementary notes must go to rule file `90_custom_rules`, not discarded.
99
+ | Style/tone — aesthetic direction / density / motion preference | `02_tech_stack` (UI Protocol) + `design_tokens.json` |
100
+ | (UI projects only) Aesthetic preset + visual reference (brand palette / font / icon / competitor screenshots) | `design_tokens.json` corresponding fields + `vision.md` Visual Reference |
101
+ | (UI projects only) Images in brief-assets/ tagged `[competitor reference]` | `design_tokens.json` aestheticDirection reference + `vision.md` Visual Reference |
102
+ | Core task list | `[[__DOCS_DIR__]]/global/roadmap.json` |
103
+ | Business process (if any) | Inject into Roadmap task `description` / `goal`; aids `/archi.plan` context |
104
+ | Pre-defined design decisions | Inject into Roadmap task `goal`; hard constraint in `/archi.plan` |
105
+ | (Data projects only) Data model draft (if any) | `data_snapshot.json` initial entity skeleton |
106
+ | (API projects only) Existing API endpoints (if any) | `vision.md` Context + Roadmap task `description` injection |
107
+ | Files in brief-assets/ tagged `[database Schema]` | Parse and write to `data_snapshot.json` |
108
+ | Files in brief-assets/ tagged `[API docs]` | Parse and route to `vision.md` Context + related Roadmap tasks |
109
+ | Boundaries and anti-goals | `vision.md` Boundaries |
110
+ | Existing resources | `vision.md` + `02_tech_stack` by content |
111
+ | Rules/conventions/preferences from supplementary notes | rule file `90_custom_rules` |
112
+ | Domain terminology from supplementary notes | `dictionary.json` |
113
+ | Other background from supplementary notes | `vision.md` Context |
114
+
115
+ > Key: Rule-like content in supplementary notes must go to `90_custom_rules`; do not discard.
136
116
 
137
117
  ### 3.1 Vision (`[[__DOCS_DIR__]]/global/vision.md`)
138
- - Fill from Brief project overview: Core Vision, Target Audience
139
- - Fill from Brief boundaries: Boundaries
140
- - Fill from Brief style/tone (if any): Design & Experience
141
- - Derive Product Principles from Brief references
142
- - Extract background context from Brief existing resources + supplementary notes
143
- - Fill all `[ ]` placeholders; do not retain template example text
118
+ - Fill from Brief: Core Vision / Target Audience / Boundaries / Design & Experience / Product Principles / background context
119
+ - Fill all placeholders; do not retain template example text
144
120
 
145
121
  ### 3.2 Tech Stack (rule file `02_tech_stack`)
146
- - Confirmed tech in Briefwrite directly
147
- - Blank/"recommend" in Brief AI recommends by project features; mark `(AI Recommended)` and brief rationale
148
- - Brief 3rd-party services/API → write in corresponding Section
149
- - **AX Optimization**: Prefer AI-friendly tech (Static Typing, Popular Frameworks, Convention-over-Configuration)
150
- - Fill all 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 must be complete
152
- - **Section 9 Project Conventions**: Establish global architecture conventions based on Brief and project features. `/archi.plan` will auto-inherit these instead of re-asking per feature:
153
- - **Error Handling**: Infer from project type — [?UI] Fail Fast + Form Validation; [?CLI] Fail Fast (stderr); [?API] Schema Validation + Fail Fast; space-separated for multi-select
154
- - [?UI] **Data Flow**: Based on realtime needs — no realtime → Standard Request (+ SWR/React Query if applicable); Brief mentions realtime/collab → Realtime
155
- - [?Web/API] **Auth & Access**: Based on Brief user roles — single role → Authenticated; multi-role → RBAC; no auth mentioned → leave empty for per-feature decision in Plan
156
- - Each item must have Strategy/Default + Rationale (rationale must be specific to this project)
122
+ - Brief confirmed write directly | Blank/"recommend" AI recommends and mark `(AI Recommended)` + rationale
123
+ - **AX Optimization**: Prefer AI-friendly tech when recommending
124
+ - Fill complete Section 1-9
125
+ - **Section 9 Project Conventions**: Establish global conventions by project features (Error Handling / Data Flow / Auth & Access); `/archi.plan` will auto-inherit
126
+ - Error Handling: (UI projects only) Fail Fast + Form Validation / (CLI projects only) Fail Fast (stderr) / (API projects only) Schema Validation + Fail Fast
127
+ - (UI projects only) Data Flow: No realtime need Standard Request / Brief mentions realtime → Realtime
128
+ - (UI or API projects only) Auth & Access: Single role Authenticated / Multi-role RBAC / No description leave empty for Plan
129
+ - Each item must have Strategy/Default + Rationale
157
130
 
158
131
  ### 3.3 Custom Rules (rule file `90_custom_rules`)
159
- - Extract rule-like content from Brief supplementary notes
160
- - Convert Brief tech red lines into concrete prohibitions
161
- - If user provided nothing, keep template default
132
+ - Extract rule-like content from Brief supplementary notes + convert tech red lines to prohibitions
162
133
 
163
134
  ### 3.4 Roadmap (`[[__DOCS_DIR__]]/global/roadmap.json`)
164
- [[SKILL: Follow the `archi-decompose-roadmap` Skill protocol to generate the task chain from the Brief feature list and write to roadmap.json]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` and follow its protocol)]], then proceed to the next step immediately without user confirmation.
135
+ [[SKILL: archi-decompose-roadmap|Follow the skill protocol to generate task chain from Brief task list, write to roadmap.json; proceed to next step immediately without user confirmation.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` and follow its protocol)]]
165
136
 
166
137
  ### 3.5 Other global docs (as needed)
167
138
  - `dictionary.json`: Extract domain terms from Brief
168
- - [?Data] `data_snapshot.json`: Initialize core entity skeleton (entity names + primary key fields) from Brief data descriptions; write empty template if no data descriptions provided
169
- - [?UI] `design_tokens.json`: Populate from Brief "Style & Tone" and "Visual Reference":
170
- - `aestheticDirection.preset`: From Brief aesthetic direction field; if blank, infer from project features (Web SaaS → saas-light, Dashboard → dashboard, etc.)
171
- - `aestheticDirection.customDescription`: Only fill when preset is "custom"
172
- - `primitivePalette.brand`: Extract Hex values from brand palette; leave empty if none
173
- - `mode`: Infer default + support array from aesthetic direction (saas-dark → default:"dark", saas-light → default:"light", etc.)
174
- - `motion.preference` / `motion.patterns`: Set from motion preference (subtle / rich / none); expand patterns for rich
175
- - `illustration.style` / `illustration.iconLibrary`: Set from illustration style and icon library fields
176
- - `semanticTokens.colors`: If brand color present, fill Primary using Brand-600/Brand-500 keys
177
- - `error_codes.json`: Predefine core error codes from feature list
139
+ - (Data projects only) `data_snapshot.json`: Initialize core entity skeleton; write empty template if no data description
140
+ - (UI projects only) `design_tokens.json`: Fill aestheticDirection / primitivePalette / mode / motion / illustration / semanticTokens from "Style & Tone" and "Visual Reference"
141
+ - `error_codes.json`: Predefine core error codes from task list
178
142
 
179
143
  ### 3.6 Map (`[[__DOCS_DIR__]]/global/map.json`)
180
- - `directoryMapping`: Pre-register core directory skeleton based on architecture pattern declared in tech_stack
181
- (e.g. `src/commands/`, `src/core/`, `src/utils/`); each directory with a one-line purpose description
182
- - `logicalTopology`: Empty array for now; populate during `/archi.plan`
183
- - `criticalUserJourneys`: Empty array
184
- - `featureRelations`: Empty array
185
-
186
- **Output**: Write all files, then run `npx archi render` to generate visual `.md`.
187
- </step_3_constitution>
144
+ - `directoryMapping`: Pre-register core directory skeleton from tech_stack architecture pattern
145
+ - `logicalTopology` / `criticalUserJourneys` / `featureRelations`: Empty array for now
188
146
 
189
- <step_4_audit>
190
- **Role**: Chief Auditor
191
- **Checklist**:
192
- 1. **Vision completeness**: Does `vision.md` include North Star metric and design philosophy?
193
- 2. **Tech Stack consistency**: Is rule file `02_tech_stack` aligned with Brief preferences? Contains full stack?
194
- 3. **Custom Rules**: Did Brief supplementary notes/tech red lines get written to rule file `90_custom_rules`?
195
- 4. **Roadmap compliance**: Run `npx archi task --check` to verify.
196
- 5. [?UI] **Design Tokens**: Does `design_tokens.json` have base color/font/spacing definitions?
197
- 6. **Brief alignment**: All Brief core features mapped to Roadmap tasks?
198
- 7. **Zero omission**: All user-provided content routed to correct files?
199
-
200
- Silently fix issues; mark critical ones with `Risk Warning`.
201
- </step_4_audit>
202
-
203
- <step_4_5_ui_wireframe>
204
- **Trigger**: Only when project features include [?UI].
205
- **Action**: Auto-invoke `archi-ui-wireframe` Skill (Phase 1 wireframe).
147
+ UI projects only: **UI concept design**: [[SKILL: archi-ui-wireframe|Follow the skill protocol to auto-generate UI concept design.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]]
206
148
  - Start generation without user confirmation
207
149
  - Read the just-written vision.md + roadmap.json + design_tokens.json + 02_tech_stack
208
150
  - Write `ui_concept.html` + `ui_context.md`
209
- - Output Phase 1 wireframe summary; await user confirmation before entering Phase 2 styling
151
+ - Output UI concept design summary; await user confirmation or feedback for adjustments
210
152
 
211
- > This step promotes UI wireframe generation from "recommended next step" to "auto-completed by start", reducing manual user actions.
212
- </step_4_5_ui_wireframe>
153
+ **Output**: Write all files, then run `npx archi render`. Enter step_4_verify.
154
+ </step_3_constitution>
213
155
 
214
- <step_5_signoff>
215
- **Terminal Gate** (Do not skip; must complete before output summary):
216
- | Step | Command | Pass Condition |
217
- |:---|:---|:---|
218
- | 1 | `npx archi task --check` | No ERROR-level issues |
219
- | 2 | `npx archi render` | `.md` views generated |
156
+ <step_4_verify>
157
+ **Role**: Independent Reviewer
158
+ [[SUBAGENT: archi-silent-audit|mode: init, context: Review step_3 generated global files (vision, tech_stack, roadmap, dictionary, etc.)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: init review dimension table item by item)]]
159
+
160
+ [[INCLUDE: shared/verify-result-handling.md]]
161
+ </step_4_verify>
220
162
 
221
- **Action** (After Gate passes):
222
- 1. Run `npx archi task` to output task progress.
163
+ <step_5_signoff>
164
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
165
+
166
+ **Pre-signoff Checklist** (confirm each item after Gate passes, before Output):
167
+ □ vision.md — all placeholders replaced, no template example text remaining
168
+ □ 02_tech_stack.md — Sections 1-9 fully filled, Section 9 Project Conventions includes Strategy + Rationale
169
+ □ roadmap.json — archi-decompose-roadmap Skill executed, task chain generated
170
+ □ map.json — core directory skeleton pre-registered (directoryMapping)
171
+ □ dictionary.json + error_codes.json — domain terms and core error codes extracted
172
+ □ (UI projects only) design_tokens.json + ui_concept.html + ui_context.md — generated
173
+ □ (Data projects only) data_snapshot.json — initial entity skeleton written
174
+ □ Step 4 Silent Audit — executed, all CRITICAL issues resolved
175
+
176
+ **Action** (after Checklist confirmed):
177
+ 1. Run `npx archi task` to output task progress overview.
223
178
  2. Output summary.
224
179
 
225
- **Output**: Project init summary including:
226
- - **Brief adoption**: Key decisions adopted from Brief
180
+ **Output**: Project init summary, including:
181
+ - **Brief source confirmation**: Key decisions adopted from Brief
227
182
  - **AI completions**: Tech/decisions AI recommended and rationale
228
183
  - **Roadmap overview**: Task count and phase distribution
229
184
  - **Next Steps table**:
230
185
 
231
186
  | Priority | Action | Notes |
232
187
  |:---|:---|:---|
233
- | [?UI] Recommended | Reply **OK** to enter Phase 2 styling | Phase 1 wireframe auto-generated; confirm layout then style |
188
+ | (UI projects only) Recommended | Review ui_concept.html | UI concept design auto-generated; confirm layout and visuals in browser |
234
189
  | Recommended | `/archi.plan INF-01` | Plan the first infrastructure task |
235
- | Optional | `/archi.scope <scope-brief.md>` | Append more requirements to Roadmap if needed |
190
+ | Optional | `/archi.scope <scope-brief.md>` | If more requirements to decompose, append to Roadmap |
236
191
  </step_5_signoff>
237
192
 
238
193
  <fallback_interview>
239
194
  **Trigger**: Brief file not found or empty.
240
- **Role**: Product Advisor
241
195
 
242
196
  **Action**:
243
- 1. Tell user `project-brief.md` not found. Suggest:
197
+ 1. Inform user `project-brief.md` not found. Suggest:
244
198
  - Check project root for the file (should have been generated by `npx archi init`)
245
199
  - If lost, re-run `npx archi init` to regenerate
246
200
  - Or continue conversation and provide info via interview
247
- 2. If user continues via conversation, guide in this order:
201
+ 2. If user chooses to continue conversation, guide in this order:
248
202
  a. What is the project? (name, one-line description, problem solved)
249
203
  b. Who is it for? (target users)
250
- c. Core features? (at least 2–3)
204
+ c. What are the core tasks? (at least 2–3)
251
205
  d. Tech stack? (language/framework, confirmed parts)
252
- e. Constraints? (anti-goals, timeline, compatibility)
206
+ e. What constraints? (anti-goals, timeline, compatibility)
253
207
  3. After collection, write to `project-brief.md` (project root), then goto `<step_1_gap_analysis>`.
254
208
 
255
- > Fallback for backward compatibility; Brief remains the primary flow.
209
+ > This mode is for backward compatibility; core flow remains Brief-driven.
256
210
  </fallback_interview>
257
211
 
258
212
  </protocol_kickoff>
@@ -0,0 +1,6 @@
1
+ **Review result handling**:
2
+ | Level | Handling |
3
+ |:---|:---|
4
+ | CRITICAL | Must fix before continuing |
5
+ | WARNING | Must explain handling in signoff |
6
+ | INFO | May decide at discretion |
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: "[?Complex] Technical Design — Defines implementation strategy, state flow, parameters and invariants for core mechanisms. Generated only when the task involves non-trivial technical decisions."
3
+ glue: Bridges spec.md (WHAT) and plan.json (DO), defining HOW. plan.json tasks must cover all mechanisms in this doc; spec.md § 2 AC must be traceable to complete paths in this design.
4
+ ---
5
+
6
+ # Technical Design: {FEATURE_NAME}
7
+
8
+ > **Spec**: `spec.md` (Acceptance Criteria — constraint source for this design)
9
+ > **Plan**: `plan.json` (Execution tasks — downstream consumer of this design)
10
+ > **Trigger**: [AI: One sentence explaining why this task needs technical design]
11
+
12
+ ## 1. Solution Overview
13
+
14
+ <!-- [AI]: 2-3 sentences summarizing the technical approach and key trade-offs.
15
+ - Reference plan.json decisions (e.g. "Data Flow=Realtime WebSocket")
16
+ - Explain why this approach over alternatives (brief ref if discussed in step_2)
17
+ - Do not repeat spec.md acceptance criteria; this section answers "how to implement" not "what to implement"
18
+ -->
19
+
20
+ ## 2. Core Mechanisms
21
+
22
+ <!-- [AI]: Main body of this doc. Select ≥1 structured pattern per technical need.
23
+ Each mechanism in its own subsection (2.1, 2.2, ...), labeled with pattern type.
24
+ Same task may combine patterns (e.g. State Machine for connection mgmt + Pipeline for message handling).
25
+
26
+ [[SKILL: archi-design-patterns|Follow the skill's pattern selection guide, generate standard-format tables and run self-checks. If any check fails, fix and re-check before proceeding to next mechanism.]]
27
+ -->
28
+
29
+ ### 2.1 [Mechanism Name] — Pattern: [State Machine / Pipeline / Decision Matrix / Protocol]
30
+
31
+ <!-- Fill per archi-design-patterns skill's standard format for the chosen pattern -->
32
+
33
+ ## 3. Parameters
34
+
35
+ <!-- [AI]: All concrete numeric values used across mechanisms, centralized.
36
+ Prohibit vague descriptions (e.g. "appropriate timeout", "reasonable interval"); must state concrete value + unit + rationale.
37
+
38
+ | Parameter | Value | Unit | Rationale |
39
+ |:---|:---|:---|:---|
40
+ | [name] | [value] | [unit] | [why this value] |
41
+ -->
42
+
43
+ ## 4. Invariants
44
+
45
+ <!-- [AI]: Assertions that must hold at any time. Each must be assertable or testable.
46
+ Format: [INV-N] assertion description
47
+
48
+ Constraints:
49
+ - Each invariant must map to at least one plan.json test entry or task notes verification
50
+ - Invariants are implementation "guardrails": AI must ensure no violation when writing code
51
+ -->
52
+
53
+ ## 5. Failure Modes
54
+
55
+ <!-- [AI]: Explicitly list possible failure scenarios for core mechanisms. Each must have detection and response.
56
+
57
+ | Failure | Detection | Response | Fallback |
58
+ |:---|:---|:---|:---|
59
+ | [description] | [how to detect: event/timeout/exception type] | [primary recovery: retry/reconnect/rollback] | [if recovery fails: switch mode/prompt user/silent log] |
60
+
61
+ Constraints:
62
+ - Detection must be concrete (no "on error"; write "4xx response / 3 heartbeat timeouts / catch TypeError")
63
+ - Fallback must be observable (no "report error"; write specific UI feedback or exit code)
64
+ -->
65
+
66
+ ## 6. Trace Verification
67
+
68
+ <!-- [AI]: From each spec.md § 2 AC, trace the execution path through this design.
69
+
70
+ | AC (from spec § 2) | Trace Path (execution chain in this design) | Result |
71
+ |:---|:---|:---|
72
+ | [Given X When Y Then Z] | [State A →(event)→ State B →(action)→ State C] or [Pipeline Step 1→2→3] | ✓ Reachable |
73
+ | [Given X When Error Then W] | [State A →(error)→ State D; Failure Mode #2 → fallback] | ✓ Reachable |
74
+
75
+ **Gap Check**: If an AC cannot be traced → design has a gap; return to § 2 to add mechanism or § 5 to add failure handling.
76
+ Design is deliverable only when all ACs are ✓.
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: One-sentence summary of this task's goal and value]
9
10
 
10
- ## 1. User Stories
11
+ ## 1. Overview
11
12
 
12
- <!-- [AI Instruction]: Brief user value, describe task requirements from user perspective -->
13
+ <!-- [AI]: Brief task background, goal, and user value (2-3 sentences).
14
+ - FEAT task: From user perspective describe "As a [Role], I want to [Action], So that [Benefit]"
15
+ - INF task: Describe the downstream scope this infrastructure supports
16
+ - POLISH task: Describe current state and optimization target
17
+ -->
13
18
 
14
- - **As a** [Role] (e.g. Registered User), **I want to** [Action] (e.g. Post a comment), **So that** [Benefit] (e.g. Interact with other users).
19
+ ## 2. Acceptance Criteria
15
20
 
16
- ## 2. Behavioral Specifications (Gherkin)
21
+ <!-- [AI]: Core acceptance contract — sole basis for development and testing.
22
+ Select applicable dimension format by Task Type (inferred from ID prefix); may combine multiple dimensions.
17
23
 
18
- <!-- [AI Instruction]: Core logic contract. The sole basis for development and testing. -->
24
+ === Dimension Building Blocks (select at least one primary dimension) ===
19
25
 
20
- ### Scenario: [Happy Path Name, e.g. User submits successfully]
26
+ Behavioral [FEAT primary]
27
+ Use Gherkin Given/When/Then to define system behavior paths (happy + exception).
21
28
 
22
- - **Given** User is in [Pre-state] (e.g. Logged in and form is valid)
29
+ Structural [INF primary]
30
+ Use Configuration Contract to define target state of files/config:
31
+ - Path: file path
32
+ - Key Settings: key config items and concrete values (no generic descriptions like "configure X")
33
+ - Constraints: technical red lines
34
+ - Verify: executable command + expected output
23
35
 
24
- - **When** User performs [Action] (e.g. Clicks submit button)
36
+ Quantitative [POLISH primary]
37
+ Use Quality Target to define measurable goals:
38
+ - Metric: metric name
39
+ - Baseline: current value
40
+ - Target: target value
41
+ - Verify: measurement method
25
42
 
26
- - **Then** System should return [Expected Result] (e.g. Show success Toast)
43
+ Contractual [integration / shared engine]
44
+ Define interface contracts for external exposure or integration:
45
+ - External API Input/Output/Error mapping
46
+ - Shared module export type signatures
27
47
 
28
- - **And** Database record should [State Change] (Ref: `data_snapshot.json`)
48
+ Invariant [refactoring]
49
+ Declare behavior/interface that must remain unchanged:
50
+ - Preserve: [behavior or interface that must not change]
51
+ - Verify: [regression verification method]
29
52
 
30
- ### Scenario: [Edge Case Name, e.g. Network timeout]
53
+ === Mixed task example ===
54
+ INF task may include Behavioral sub-dimension (e.g. hotkey registration has behavior path)
55
+ FEAT task may include Structural sub-dimension (e.g. config file creation)
56
+ Use sub-headings to distinguish dimensions.
57
+ -->
31
58
 
32
- - **Given** User network is unstable
59
+ ## 3. Data Requirements
33
60
 
34
- - **When** User clicks submit button
61
+ <!-- [AI]: [?Data] Declare data changes, reference table structure in data_snapshot.json.
62
+ Write "N/A" when no data changes.
35
63
 
36
- - **Then** System should show [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** Should not produce dirty data
69
+ ## 4. Interface Exports
39
70
 
40
- ## 3. Data Requirements
71
+ <!-- [AI]: [?Upstream] Public interfaces, conventions, import paths this task exposes to downstream tasks.
72
+ Downstream tasks depend on this declaration rather than guessing. Omit when no downstream consumers.
41
73
 
42
- <!-- [AI Instruction]: Explicit data changes, must reference table structure in `data_snapshot.json` -->
74
+ Format:
75
+ | Export | Value | Consumer |
76
+ |:---|:---|:---|
77
+ | [convention/API/path alias/script] | [concrete value] | [downstream task 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]: Extract red-line constraints relevant to this task from vision.md + 02_tech_stack.md.
49
83
 
50
- * **Permissions**: [Required Role]
51
- - Example: `authenticated` (for POST), `public` (for GET)
84
+ Format:
85
+ - [constraint content] (ref: [source])
86
+ -->