architext 0.0.4 → 0.0.6

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 (84) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/README.md +93 -14
  3. package/README.zh-CN.md +92 -14
  4. package/dist/index.js +53 -39
  5. package/dist/templates/en/briefs/_base.md +53 -13
  6. package/dist/templates/en/briefs/_modules.md +31 -4
  7. package/dist/templates/en/docs/global/error_memory.json +40 -0
  8. package/dist/templates/en/docs/global/map.json +46 -90
  9. package/dist/templates/en/{rules/04_cli_tools.md → docs/global/references/cli_reference.md} +6 -13
  10. package/dist/templates/en/{rules/02_tech_stack.md → docs/global/tech_stack.md} +7 -18
  11. package/dist/templates/en/docs/global/vision.md +1 -1
  12. package/dist/templates/en/docs/prompts/audit.md +80 -94
  13. package/dist/templates/en/docs/prompts/code.md +99 -89
  14. package/dist/templates/en/docs/prompts/edit.md +61 -51
  15. package/dist/templates/en/docs/prompts/fix.md +59 -43
  16. package/dist/templates/en/docs/prompts/help.md +23 -31
  17. package/dist/templates/en/docs/prompts/inherit.md +97 -117
  18. package/dist/templates/en/docs/prompts/map.md +48 -69
  19. package/dist/templates/en/docs/prompts/plan.md +141 -240
  20. package/dist/templates/en/docs/prompts/recover.md +19 -34
  21. package/dist/templates/en/docs/prompts/ref.md +43 -138
  22. package/dist/templates/en/docs/prompts/remove.md +63 -110
  23. package/dist/templates/en/docs/prompts/revise.md +71 -106
  24. package/dist/templates/en/docs/prompts/scope.md +78 -117
  25. package/dist/templates/en/docs/prompts/script.md +102 -0
  26. package/dist/templates/en/docs/prompts/start.md +98 -132
  27. package/dist/templates/en/docs/prompts/ui.md +113 -0
  28. package/dist/templates/en/docs/shared/ui-redlines.md +7 -0
  29. package/dist/templates/en/docs/templates/spec.template.md +1 -1
  30. package/dist/templates/en/docs/templates/ui.template.md +8 -8
  31. package/dist/templates/en/rules/00_system.md +268 -117
  32. package/dist/templates/en/rules/90_custom_rules.md +3 -1
  33. package/dist/templates/en/skills/archi-data-sync/SKILL.md +37 -23
  34. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +138 -240
  35. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +6 -1
  36. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +10 -6
  37. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -2
  38. package/dist/templates/en/skills/archi-plan-options/SKILL.md +77 -301
  39. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +24 -25
  40. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +175 -305
  41. package/dist/templates/icon.svg +16 -0
  42. package/dist/templates/zh/briefs/_base.md +56 -17
  43. package/dist/templates/zh/briefs/_modules.md +28 -1
  44. package/dist/templates/zh/docs/global/error_memory.json +40 -0
  45. package/dist/templates/zh/docs/global/map.json +39 -109
  46. package/dist/templates/zh/{rules/04_cli_tools.md → docs/global/references/cli_reference.md} +0 -7
  47. package/dist/templates/zh/{rules/02_tech_stack.md → docs/global/tech_stack.md} +9 -20
  48. package/dist/templates/zh/docs/global/vision.md +1 -1
  49. package/dist/templates/zh/docs/prompts/audit.md +43 -57
  50. package/dist/templates/zh/docs/prompts/code.md +66 -56
  51. package/dist/templates/zh/docs/prompts/edit.md +52 -42
  52. package/dist/templates/zh/docs/prompts/fix.md +39 -29
  53. package/dist/templates/zh/docs/prompts/help.md +13 -21
  54. package/dist/templates/zh/docs/prompts/inherit.md +67 -86
  55. package/dist/templates/zh/docs/prompts/map.md +28 -50
  56. package/dist/templates/zh/docs/prompts/plan.md +100 -199
  57. package/dist/templates/zh/docs/prompts/recover.md +9 -24
  58. package/dist/templates/zh/docs/prompts/ref.md +11 -106
  59. package/dist/templates/zh/docs/prompts/remove.md +39 -74
  60. package/dist/templates/zh/docs/prompts/revise.md +47 -88
  61. package/dist/templates/zh/docs/prompts/scope.md +52 -91
  62. package/dist/templates/zh/docs/prompts/script.md +102 -0
  63. package/dist/templates/zh/docs/prompts/start.md +75 -110
  64. package/dist/templates/zh/docs/prompts/ui.md +113 -0
  65. package/dist/templates/zh/docs/shared/ui-redlines.md +7 -0
  66. package/dist/templates/zh/docs/templates/spec.template.md +1 -1
  67. package/dist/templates/zh/docs/templates/ui.template.md +8 -8
  68. package/dist/templates/zh/rules/00_system.md +252 -131
  69. package/dist/templates/zh/rules/90_custom_rules.md +2 -1
  70. package/dist/templates/zh/skills/archi-data-sync/SKILL.md +27 -13
  71. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +133 -235
  72. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +6 -1
  73. package/dist/templates/zh/skills/archi-feature-relations/SKILL.md +6 -2
  74. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -2
  75. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +77 -301
  76. package/dist/templates/zh/skills/archi-silent-audit/SKILL.md +4 -5
  77. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +174 -301
  78. package/package.json +3 -1
  79. package/dist/templates/en/rules/01_workflow.md +0 -93
  80. package/dist/templates/en/rules/03_data_governance.md +0 -102
  81. package/dist/templates/en/rules/99_context_glue.md +0 -53
  82. package/dist/templates/zh/rules/01_workflow.md +0 -94
  83. package/dist/templates/zh/rules/03_data_governance.md +0 -133
  84. package/dist/templates/zh/rules/99_context_glue.md +0 -53
@@ -1,160 +1,125 @@
1
1
  <protocol_revise>
2
2
  **Trigger**: `/archi.revise [context]`
3
- **Goal**: Execute project-wide global changes (tech stack, architecture, vision, etc.), analyze impact scope, modify global assets after user confirmation, and cascade updates to affected Task documents.
3
+ **Goal**: Execute project-wide global changes (tech stack, architecture, vision, etc.); analyze impact scope; modify global assets after user confirmation and cascade update affected Task docs.
4
4
 
5
5
  <constraints_cursor>
6
- **Mode Lock**: This protocol must run in **Agent Mode (Normal Mode)**. Prohibited from switching to Plan Mode or other read-only modes.
6
+ **Mode Lock**: This protocol must run in **Agent Mode (Normal Mode)**. Do not switch to Plan Mode or other read-only modes.
7
7
  </constraints_cursor>
8
8
 
9
9
  <meta>
10
10
  <style>Strategic, Analytical, Cautious, Traceable</style>
11
11
  <language>English</language>
12
12
  <principles>
13
- 1. **User Gate**: Global changes require item-by-item user confirmation before execution. Prohibited from modifying without approval.
14
- 2. **Impact First**: Output complete impact analysis before making any changes.
15
- 3. **Doc Cascade**: After global asset changes, must update affected Task docs following edit protocol standards.
13
+ 1. **User Gate**: Global changes require item-by-item user confirmation before execution. Do not modify without approval.
14
+ 2. **Impact First**: Output complete impact analysis before making changes.
15
+ 3. **Doc Cascade**: After global asset changes, must sync affected Task docs per edit standards.
16
16
  4. **Traceability**: Every change must be traceable — state rationale and impact scope.
17
17
  </principles>
18
18
  </meta>
19
19
 
20
20
  <step_1_load>
21
- **Role**: Systems Analyst
22
21
  **Action**:
23
- 1. **Read Global Assets**:
24
- - `[[__DOCS_DIR__]]/global/vision.md`
25
- - `[[__DOCS_DIR__]]/global/roadmap.json`
26
- - `[[__DOCS_DIR__]]/global/map.json`
27
- - `[[__DOCS_DIR__]]/global/dictionary.json`
28
- - `[[__DOCS_DIR__]]/global/error_codes.json`
29
- - `02_tech_stack.md`
30
- - [?UI] `[[__DOCS_DIR__]]/global/design_tokens.json`
31
- - [?Data] `[[__DOCS_DIR__]]/global/data_snapshot.json`
32
- 2. **Scan Task Index**: Scan `[[__DOCS_DIR__]]/tasks/` directory, build Task index (ID, name, status).
33
- 3. **Intent Analysis**: Based on user `[context]`, identify which global asset categories are affected.
34
-
35
- **Output**: Change intent summary — list of initially identified global files. Proceed to step_2.
22
+ 1. **Load**: All global assets (vision/roadmap/map/dictionary/error_codes/tech_stack + conditional: design_tokens/data_snapshot).
23
+ 2. **Scan Task Index**: Scan tasks/ directory; build Task index (ID, name, status).
24
+ 3. **Intent Analysis**: From `[context]`, identify affected global asset categories.
25
+
26
+ **Output**: Change intent summary — list initially identified global files; proceed to step_2.
36
27
  </step_1_load>
37
28
 
38
29
  <step_2_interview>
39
30
  **Role**: Chief Architect
40
31
  **Action**:
41
- Clarify change boundaries based on user description and loaded context:
32
+ Clarify change boundaries from user description and loaded context:
42
33
 
43
34
  | Dimension | Description |
44
35
  |:---|:---|
45
- | Change Scope | Precisely identify which global files and rules are affected |
46
- | Change Motivation | Why this change is needed, what outcome is expected |
47
- | Exclusion List | Any Tasks that should not be affected |
36
+ | Change scope | Precisely identify which global files and rules are affected |
37
+ | Change motivation | Why this change; expected outcome |
38
+ | Exclusion list | Any Tasks that should not be affected |
48
39
 
49
- - Context is clear enough → merge into step_3 and output impact analysis directly.
50
- - Ambiguity or multiple viable directions → ask user to confirm (A/B/C/D options).
40
+ - When context is clear enough → merge into step_3 and output impact analysis directly.
41
+ - When ambiguity or multiple viable directions → ask user to confirm (A/B/C/D options).
51
42
  </step_2_interview>
52
43
 
53
44
  <step_3_impact>
54
- **Role**: Impact Analyst
55
- **Constraint**: **Output only, prohibited from modifying any files**. This step produces the "Change Impact Assessment".
56
-
57
- **Output Format**:
58
- ```
59
- ## Change Impact Assessment: [Change Topic]
60
-
61
- ### 1. Global Asset Change List
62
- | File | Change Content | Type |
63
- |:---|:---|:---|
64
- | vision.md | [what specifically changes, or "no change needed"] | modify/no change |
65
- | 02_tech_stack.md | [...] | ... |
66
- | roadmap.json | [...] | ... |
67
- | map.json | [...] | ... |
68
- | dictionary.json | [...] | ... |
69
- | data_snapshot.json | [...] | ... |
70
- | design_tokens.json | [...] | ... |
71
- | error_codes.json | [...] | ... |
72
-
73
- ### 2. Affected Tasks List
74
- | Task ID | Name | Impact Points | Severity |
75
- |:---|:---|:---|:---|
76
- | INF-001 | [name] | [which parts of spec/ui/plan are affected] | High/Med/Low |
77
-
78
- ### 3. Items Requiring User Decision (if any)
79
- - [?] [uncertain item description + options]
80
- - [?] ...
81
-
82
- ---
83
- > Reply **OK** to confirm all; or annotate items that need adjustment.
84
- ```
85
-
86
- **Gate**: Wait for user confirmation. Prohibited from entering step_4 without confirmation.
45
+ **Constraint**: **Output only; do not modify any files**. This step produces the "Change Impact Assessment".
46
+
47
+ **Output**: Change impact assessment — global asset change list table (file/change content/type), affected Task list table (ID/name/impact points/severity), user decision items (if any). End with confirmation: OK to confirm all; or annotate adjustments.
48
+
49
+ **Gate**: Wait for user confirmation. Do not enter step_4 without confirmation.
87
50
  </step_3_impact>
88
51
 
89
52
  <step_3_5_refinement>
90
- **Role**: Consultant
91
- **Trigger**: User replies non-OK, contains corrections, rejections, or additional input.
92
- **Action**: Do not execute changes. Incorporate user feedback, refresh and re-output the impact assessment. Wait for re-confirmation.
53
+ **Trigger**: User reply is not OK — contains corrections, rejections, or additional input.
54
+ **Action**: Do not execute changes. Incorporate feedback, refresh impact assessment and re-output; await re-confirmation.
93
55
  </step_3_5_refinement>
94
56
 
95
57
  <step_4_execute>
96
- **Role**: Execution Engineer
97
58
  **Action**:
98
59
 
99
- **Safety Checkpoint** (required before execution):
60
+ **Safety Checkpoint** (must complete before execution):
100
61
  1. Check Git working directory status (run `git status`).
101
- 2. If uncommitted changes exist → prompt user to commit or stash first, then continue.
102
- 3. Once working directory is clean, inform user: to roll back, run `git checkout -- .` to restore pre-change state.
62
+ 2. If uncommitted changes exist → prompt user to commit or stash first.
63
+ 3. Once working directory clean, inform user: to rollback, run `git checkout -- .`.
103
64
 
104
- **Phase 1 — Modify Global Assets**:
105
- Modify global files per the user-confirmed list. Output change summary for each file.
65
+ **Phase 1 — Modify global assets**:
66
+ Modify global files per user-confirmed list. Output change summary for each file.
106
67
 
107
- **[?UI] Phase 1.5 — Design System Change Check**:
108
- If `design_tokens.json` has any of the following changes, notify the user after Phase 2:
68
+ **(UI projects only) Phase 1.5 — Design system change check**:
69
+ If `design_tokens.json` has the following changes, notify user to re-run `archi-ui-wireframe` to regenerate:
109
70
 
110
- | Change scope | Impact | Action |
111
- |:---|:---|:---|
112
- | `primitivePalette.brand` / `semanticTokens.colors` | Brand/semantic color change | Notify user: re-run `archi-ui-wireframe` Phase 2 (full re-coloring) |
113
- | `semanticTokens.typography` | Font change | Notify user: re-run Phase 2 |
114
- | `motion.preference` / `motion.patterns` | Motion change | Notify user: re-run Phase 2 |
115
- | `illustration.iconLibrary` | Icon library change | Notify user: re-run Phase 2 |
116
- | `layout` (radius/spacing/shadow) | Component size/radius change | Notify user: re-run Phase 2 |
71
+ | Change scope | Impact |
72
+ |:---|:---|
73
+ | `primitivePalette.brand` / `semanticTokens.colors` | Brand/semantic color change |
74
+ | `semanticTokens.typography` | Font change |
75
+ | `motion.preference` / `motion.patterns` | Motion change |
76
+ | `illustration.iconLibrary` | Icon library change |
77
+ | `layout` (radius/spacing/shadow) | Component size/radius change |
117
78
 
118
- > If none of the above fields changed (e.g., only `mode.default` changed), Phase 2 re-run is not needed.
79
+ > If above fields unchanged (e.g. only `mode.default` changed), no need to re-run.
119
80
 
120
- **Phase 2 — Cascade Update Task Docs**:
81
+ **Phase 2 — Cascade update Task docs**:
121
82
  For each affected Task, follow `/archi.edit` standards:
122
- 1. Update `spec.md` (logic/rules that need adjustment due to global changes).
123
- 2. [?UI] Update `ui.md` (scope/interaction adjustments due to global changes); if screen structure is affected, [[SKILL: archi-ui-wireframe|run skill (incremental update mode) to sync both `ui_concept.html` + `ui_context.md`]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]].
124
- 3. Append new Phase to `plan.json` `phases`: `Phase X: Global Revision — [Change Topic] (<Date>)`, listing implementation tasks.
83
+ 1. Update `spec.md`.
84
+ 2. (UI projects only) Update `ui.md`; if screen structure affected, [[SKILL: archi-ui-wireframe|run skill (local update mode) to sync]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]].
85
+ 3. Append new Phase to `plan.json`: `Phase X: Global Revision — [Change Topic] (<Date>)`.
125
86
 
126
- **Output**: Change summary for each file (global + Task).
87
+ **Output**: Change summary for each file (global + Task). Enter step_5_verify.
127
88
  </step_4_execute>
128
89
 
129
- <step_5_summary>
130
- **Role**: Auditor
131
- **Checklist**:
132
- 1. Cross-consistency between global assets (vision ↔ tech_stack ↔ roadmap ↔ map).
133
- 2. Task docs aligned with updated global assets.
134
- 3. No orphaned references (stale terms/paths in dictionary/map cleaned up).
90
+ <step_5_verify>
91
+ **Role**: Independent Reviewer
135
92
 
136
- **Terminal Gate** (Do not skip; must complete before output summary):
137
- | Step | Command | Pass Condition |
138
- |:---|:---|:---|
139
- | 1 | `npx archi task --check` | No ERROR-level issues |
140
- | 2 | `npx archi render` | `.md` views generated |
93
+ [[SUBAGENT: archi-silent-audit|mode: plan-docs, context: Review step_4 Phase 2 cascade-updated Task docs for alignment with modified global assets]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: plan-docs review dimension table)]]
141
94
 
142
- **Action** (After Gate passes):
143
- 1. Output change summary.
95
+ [[INCLUDE: shared/verify-result-handling.md]]
96
+ </step_5_verify>
97
+
98
+ <step_6_summary>
99
+ **Role**: Chief Auditor
144
100
 
145
- **Output**:
146
- ```
147
- ## Global Revision Summary: [Change Topic]
101
+ **Pre-signoff Checklist** (confirm each item after Gate passes, before Output):
102
+ □ step_4 Safety Checkpoint — Git workspace confirmed (no uncommitted changes or user informed)
103
+ Phase 1 all confirmed global assets modified, change summary output per file
104
+ □ Phase 1 — Global files check:
105
+ - roadmap.json + vision.md + tech_stack.md + map.json — required
106
+ - dictionary.json + error_codes.json + env_registry.json — required
107
+ - (UI projects only) design_tokens.json + ui_context.md
108
+ - (Data projects only) data_snapshot.json
109
+ - (API projects only) api_snapshot.json
110
+ - (CLI projects only) command_api.json
111
+ - (Lib projects only) public_api.json
112
+ □ (UI projects only, design system changed) User notified to re-run `/archi.ui`
113
+ □ Phase 2 — each affected Task: spec.md updated + plan.json appended Revision Phase
114
+ □ Step 5 Silent Audit — executed, all CRITICAL issues resolved
115
+ □ Consistency confirmed: vision ↔ tech_stack ↔ roadmap ↔ map, no orphan refs (stale terms/paths cleaned)
148
116
 
149
- **Global Assets Modified**: [list of modified files]
150
- **Tasks Updated**: [list of updated Tasks + impact summary each]
151
- **Audit Result**: [pass/risk items]
117
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
118
+
119
+ **Action** (after Gate passes):
120
+ 1. Output change summary.
152
121
 
153
- ### Next Steps
154
- | Priority | Action | Description |
155
- |:---|:---|:---|
156
- | ... | ... | ... |
157
- ```
122
+ **Output**: Global Revision Summary — global asset changed files list, Task update list and impact summary, audit result, Next Steps table.
158
123
  </step_5_summary>
159
124
 
160
125
  </protocol_revise>
@@ -1,117 +1,78 @@
1
1
  <protocol_scope>
2
- **Trigger**: `/archi.scope [file_path]`
2
+ **Trigger**: `/archi.scope [file_path]` | Auto-loaded by Workflow Dispatch on natural language trigger
3
3
  **Phase**: Requirement Decomposition
4
- **Goal**: Read Scope Brief, decompose large requirements into multiple Roadmap tasks with dependency relationships.
4
+ **Goal**: Read Scope Brief, decompose large requirements into Roadmap tasks with dependencies.
5
5
 
6
6
  <meta>
7
7
  <style>Strategic, Analytical, Structured</style>
8
8
  <language>English</language>
9
9
  <principles>
10
- 1. **Brief-Driven**: Use user-provided Scope Brief as primary input; never brainstorm tasks from scratch.
11
- 2. **Incremental**: Append to existing Roadmap; never rewrite existing tasks.
12
- 3. **User Agency First**: Adopt user-specified choices from Brief as-is; never question or replace.
13
- 4. **Minimal Questions**: Only ask about information gaps; skip questioning if Brief is sufficient.
14
- 5. **Option Z Everywhere**: All supplementary questions must include `[Z] Custom`.
10
+ 1. **Brief-Driven**: User-provided Scope Brief is the core input; no task brainstorming from thin air.
11
+ 2. **Incremental**: Append to existing Roadmap; do not rewrite existing tasks.
12
+ 3. **User Agency First**: User-filled choices in Brief must be adopted directly; do not question or replace.
13
+ 4. **Minimal Questions**: Ask only for information gaps; skip when Brief is sufficient.
14
+ 5. **Option Z Everywhere**: Supplementary questions must include `[Z] Custom`.
15
+ 6. **IDE-Native First**: Leverage IDE native capabilities to drive execution rhythm; this protocol defines quality standards and checkpoints, not fight IDE planning/execution mechanisms.
15
16
  </principles>
16
17
  </meta>
17
18
 
18
19
  <step_0_ingest>
19
20
  **Role**: Intelligence Analyst
20
21
  **Action**:
21
- 1. Parse `[file_path]` from trigger command:
22
+ 1. Parse `[file_path]` from trigger:
22
23
  - If path provided → read that file
23
- - If no pathlook for `scope-brief.md` (project root), then `[[__DOCS_DIR__]]/scope-brief.md`
24
- - If none found or emptyjump to `<fallback_interview>`
24
+ - If not providedsearch `scope-brief.md` (project root), then `[[__DOCS_DIR__]]/scope-brief.md`
25
+ - If user entered via natural language description (no file_path param) and above files not found goto `<fallback_interview>`
26
+ - If neither exists or empty → goto `<fallback_interview>`
25
27
 
26
- 2. Parse Brief sections and extract:
27
- - Initiative name and description
28
- - Task list
29
- - Existing design decisions
30
- - Boundaries & constraints (out of scope, timeline, dependencies, technical limits)
31
- - Affected existing tasks
32
- - References
28
+ 2. Parse Brief sections, extract: initiative name and description, task list, pre-defined design decisions, boundaries and constraints, affected existing tasks, references.
33
29
 
34
- > Brief is a one-time input file; user may delete it after processing.
30
+ > Brief is a one-time input file; user may delete after processing.
35
31
 
36
32
  **Output**: Internal summary (not shown to user), proceed to `<step_1_load>`.
37
33
  </step_0_ingest>
38
34
 
39
35
  <step_1_load>
40
- **Role**: System Analyst
41
36
  **Action**:
42
- 1. **Read Vision**: `[[__DOCS_DIR__]]/global/vision.md` — read North Star Metric and Boundaries sections only; skip remaining chapters.
43
- 2. **Read Roadmap**: `[[__DOCS_DIR__]]/global/roadmap.json`extract only `id/title/status/deps/tag` fields per task (skip `goal/notes`; requirement decomposition does not need these); read current max ID watermark for new task numbering.
44
- 3. **Read Tech Stack**: `02_tech_stack.md` — technical constraints.
45
- 4. **Read Map**: `[[__DOCS_DIR__]]/global/map.json` — read `directoryMapping` and `featureRelations` only; skip `logicalTopology` and `criticalUserJourneys`.
46
- 5. **Scan Tasks**: Scan `[[__DOCS_DIR__]]/tasks/` directory — understand existing task summaries (title + key flows, no full read needed).
37
+ 1. **Load**: vision.md (North Star + Boundaries only), roadmap.json (id/title/status/deps/tag + max ID watermark only), tech_stack.md, map.json (directoryMapping + featureRelations only).
38
+ 2. **Scan Tasks**: Scan tasks/ — understand existing task summaries (title + key flows; full read not needed).
47
39
 
48
40
  **Output**: Internal context summary, proceed to `<step_2_analysis>`.
49
41
  </step_1_load>
50
42
 
51
43
  <step_2_analysis>
52
44
  **Role**: Chief Product Strategist (CPO)
53
- **Input**: Step 0 Brief parsing result + Step 1 project context.
45
+ **Input**: Step 0 Brief parse result + Step 1 project context.
54
46
 
55
47
  **Action**:
56
48
 
57
- 1. **Vision Alignment Check**: Does the Brief align with vision.md north star metrics? If deviation → flag `[Vision Deviation Warning]`.
58
- 2. **Task List Completeness**: Does the task list sufficiently support the initiative goal?
59
- 3. **Impact Assessment**: Brief "Affected Existing Tasks" → verify against roadmap/tasks for existence and status.
60
- 4. **Gap Identification**: Check Brief for critical missing information.
61
- 5. **Linkage Check**: Read `map.json.featureRelations`; semantically compare the new task's description against each `sources` field to determine if it falls within any aggregator's coverage. Surface a linkage reminder in the summary if matched.
49
+ 1. **Vision alignment check**: Does Brief align with vision.md North Star? If deviation → mark `[Vision Deviation Warning]`.
50
+ 2. **Task list completeness**: Sufficient to support initiative goal?
51
+ 3. **Impact assessment**: Brief "affected existing tasks" → verify against roadmap/tasks.
52
+ 4. **Gap identification**: Key info missing in Brief?
53
+ 5. **Linkage check**: [[SUBAGENT: archi-feature-relations|mode: check, context: Compare new task descriptions with featureRelations sources; output linkage reminder if matched]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: check logic)]]
62
54
 
63
- **Gap Levels**:
64
- - **Required**: Missing prevents reasonable decomposition (e.g., empty task list)
65
- - **Recommended**: AI can infer but should confirm (e.g., unclear dependencies)
66
- - **Optional**: AI can decide autonomously (e.g., task grouping approach)
55
+ **Gap levels**: Required → cannot decompose | Can supplement → AI can derive, suggest confirm | Suggested → AI decides
67
56
 
68
- **Decision**:
69
- - No "Required" or "Recommended" gaps → skip Step 2.5, proceed to Step 3
70
- - Has gaps → proceed to Step 2.5
57
+ **Decision**: No "Required" + "Can supplement" gaps → skip Step 3 | Has gaps → enter Step 3
71
58
 
72
- **Output**: Display Brief analysis summary to user:
73
- ```
74
- ### SCOPE BRIEF Analysis Report
75
- > **Initiative**: [Name] | **Scale**: Estimated [N] tasks
76
-
77
- **Vision Alignment**: [Aligned / ⚠️ Deviation — reason]
78
-
79
- **Confirmed Information**:
80
- - [list]
81
-
82
- **Affected Existing Tasks**:
83
- | Task | Status | Estimated Impact |
84
- |:---|:---|:---|
85
- | [ID: Name] | [done/active/stub] | [needs modification/extension/no impact] |
86
-
87
- **[?matched] Linkage Reminder**:
88
- | Aggregator | checkNote |
89
- |:---|:---|
90
- | [aggregator ID/path] | [checkNote content] |
91
-
92
- **Information Gaps** (to be addressed):
93
- - [gap list]
94
-
95
- **AI Will Auto-Decide** (no action needed):
96
- - [list]
97
- ```
59
+ **Output**: Output SCOPE BRIEF analysis report to user — include initiative name/estimated scale, Vision alignment, confirmed info, affected existing tasks table (task/status/estimated impact), (if matched) linkage reminder table, information gaps, AI auto-decide items. Enter step_3_supplementary (has gaps) or step_4_decompose (no gaps).
98
60
  </step_2_analysis>
99
61
 
100
- <step_2_5_supplementary>
101
- **Role**: Product Consultant
102
- **Trigger**: Only when Step 2 identifies "Required" or "Recommended" gaps.
62
+ <step_3_supplementary>
63
+ **Trigger**: Only when Step 2 finds "Required" or "Can supplement" gaps.
103
64
  **Input**: Step 2 gap list. Max 3 questions.
104
65
 
105
- [[SKILL: archi-interview-protocol|Follow the 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)]]
106
- </step_2_5_supplementary>
66
+ [[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)]]
67
+ </step_3_supplementary>
107
68
 
108
- <step_3_decompose>
69
+ <step_4_decompose>
109
70
  **Role**: Chief Architect
110
- **Input**: Full Brief + project context + supplementary answers (if any).
71
+ **Input**: Full Brief + project context + supplement answers (if any).
111
72
 
112
- **Action**: [[SKILL: archi-decompose-roadmap|Follow the skill protocol to generate incremental task data from the Scope Brief task list.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` and follow its protocol)]]
73
+ **Action**: [[SKILL: archi-decompose-roadmap|Follow the skill protocol to generate incremental task data from Scope Brief task list.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-decompose-roadmap/SKILL.md` and follow its protocol)]]
113
74
 
114
- **Display format** (convert Skill output into the following format, present to user and await confirmation):
75
+ **Display format** (convert Skill output to the following format, present to user, await confirmation):
115
76
 
116
77
  ```
117
78
  #### Phase 1: Infrastructure
@@ -120,79 +81,79 @@
120
81
  #### Phase 2: Core Features
121
82
  | ID | Title | Description Summary | Deps | Tag |
122
83
 
123
- #### Execution Batches (Parallel Groups)
124
- (Derived from deps via topological sort)
84
+ #### Execution Batches (parallel execution groups)
125
85
  Batch 1 (ready immediately): ...
126
- Batch 2 (after Batch 1): ...
86
+ Batch 2 (after Batch 1 complete): ...
127
87
 
128
- #### NFR Cross-Cutting Concerns (merged, not in Roadmap)
129
- (From Skill's NFR merge list)
130
- - [NFR name] → injected into [task ID] | affects: [other task IDs]
88
+ #### NFR cross-cutting concerns (merged, not in Roadmap)
89
+ - [NFR name] → inject [task ID] | affects: [other task IDs]
131
90
  ```
132
91
 
133
- **Gate**: Proceed to step_4 only after user replies **OK**. Do not write to Roadmap without confirmation. User may refine the plan before confirming (merge/split/adjust deps).
134
- </step_3_decompose>
92
+ **Gate**: User replies **OK** to enter step_5_roadmap_update; do not write to Roadmap without confirmation.
93
+ </step_4_decompose>
135
94
 
136
- <step_3_5_refinement>
137
- **Role**: Consultant
138
- **Trigger**: User replies non-OK, with merge/split/add/remove/dependency adjustments.
95
+ <step_4_5_refinement>
96
+ **Trigger**: User reply is not OK — contains merge/split/add/remove/dependency adjustments.
139
97
  **Action**: Incorporate user feedback, refresh decomposition plan and re-output, await re-confirmation.
140
- </step_3_5_refinement>
98
+
99
+ User replies OK → enter step_5_roadmap_update.
100
+ </step_4_5_refinement>
141
101
 
142
102
  <step_4_roadmap_update>
143
- **Role**: System Administrator
144
103
  **Input**: User-confirmed decomposition plan.
145
104
 
146
105
  **Action**:
147
- 1. Append new tasks to corresponding Phase's `tasks` array in `[[__DOCS_DIR__]]/global/roadmap.json`.
106
+ 1. Append new tasks to corresponding Phase's `tasks` array in roadmap.json.
148
107
  2. If new Phase needed → append to `phases` array.
149
- 3. Update `lastUpdated` field.
150
- 4. [?New modules] Update `directoryMapping` in `[[__DOCS_DIR__]]/global/map.json`: pre-register inferred module paths for new tasks (based on tech_stack architecture pattern and task descriptions; directory-level only — details to be filled during `/archi.plan`).
108
+ 3. Update `lastUpdated`.
109
+ 4. (New modules) Update map.json `directoryMapping`: pre-register inferred module paths for new tasks.
151
110
 
152
- **Terminal Gate** (Do not skip; must complete before output summary):
153
- | Step | Command | Pass Condition |
154
- |:---|:---|:---|
155
- | 1 | `npx archi task --check` | No ERROR-level issues |
156
- | 2 | `npx archi render` | `.md` views generated |
111
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
112
+
113
+ **Output**: Write confirmation. Enter step_6_signoff.
114
+ </step_5_roadmap_update>
157
115
 
158
- **Output**: Write confirmation.
159
- </step_4_roadmap_update>
116
+ <step_6_signoff>
117
+ **Pre-signoff Checklist** (confirm each item before Output):
118
+ □ Decomposition proposal confirmed by user (replied OK before writing to roadmap — step_4 Gate)
119
+ □ roadmap.json — tasks appended (not overwritten), lastUpdated updated
120
+ □ (new modules) map.json directoryMapping + logicalTopology — new task module paths pre-registered
121
+ □ featureRelations — synced if new tasks involve impact on existing file linkages
122
+ □ step_5 Terminal Gate — task --check + render passed
160
123
 
161
- <step_5_signoff>
162
- **Action** (Gate must complete in step_4):
163
- 1. Run `npx archi task` to display task progress overview.
124
+ **Action** (Gate must complete in step_5):
125
+ 1. Run `npx archi task` to output task progress overview.
164
126
  2. Output summary.
165
127
 
166
128
  **Output**: Requirement decomposition summary, including:
167
- - **Brief Source Confirmation**: Initiative name and core objective
168
- - **New Tasks**: Count and phase distribution
169
- - **Impact on Existing Tasks**: Impact list (if any)
129
+ - **Brief source confirmation**: Initiative name and core goal
130
+ - **New tasks**: Count and phase distribution
131
+ - **Impact on existing tasks**: Impact list (if any)
170
132
  - **Next Steps**:
171
133
 
172
- | Priority | Action | Description |
134
+ | Priority | Action | Notes |
173
135
  |:---|:---|:---|
174
- | [?UI] Recommended | [[SKILL: archi-ui-wireframe|Run skill (append mode)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]] | Append screens for new tasks to `ui_concept.html`, sync `ui_context.md` |
175
- | 1 | `/archi.plan <first pending task ID>` | Deep planning for the first actionable task |
136
+ | (UI projects only) Recommended | `/archi.ui` | Generate/update UI concept design (`screens/` multi-file structure) |
137
+ | 1 | `/archi.plan <first pending task ID>` | Deep-plan the first executable task |
176
138
  | 2 | Review roadmap | Confirm dependency relationships and priorities |
177
139
  </step_5_signoff>
178
140
 
179
141
  <fallback_interview>
180
- **Trigger**: Brief file does not exist or is empty.
181
- **Role**: Product Consultant
142
+ **Trigger**: Brief file not found or empty, or user entered via natural language description.
182
143
 
183
144
  **Action**:
184
- 1. Inform user that `scope-brief.md` was not found. Suggest:
185
- - Run `npx archi template scope-brief` to fetch template to project root
145
+ 1. Inform user that requirements will be gathered via conversation. Suggest:
146
+ - Run `npx archi template scope-brief` to get template to project root
186
147
  - Fill in and re-run `/archi.scope scope-brief.md`
187
- - Or continue conversation to provide information via interview
188
- 2. If user chooses to continue conversation, guide in this order:
189
- a. What do you want to build? (Initiative name, one-line description, motivation)
190
- b. What tasks does it include? (Specific task list)
191
- c. What constraints exist? (Out of scope, dependencies, technical limits)
192
- d. Which existing tasks will be affected?
193
- 3. After collection, write information to `scope-brief.md` (project root), then jump to `<step_1_load>`.
194
-
195
- > This mode is for backward compatibility; core flow remains Brief-driven.
148
+ - Or continue conversation and provide info via interview
149
+ 2. If user chooses to continue, guide by the following dimensions (skip if already known, 1-2 questions each):
150
+ a. **Motivation & Goals**: Why build this? What problem does it solve? What outcome is expected?
151
+ b. **Scope**: Which features/modules are included? What's excluded?
152
+ c. **Task Breakdown**: Do you have a rough task split in mind? (If not, AI will decompose in step_3)
153
+ d. **Constraints**: Technical limits, time constraints, dependencies?
154
+ e. **Impact**: Which existing features will be affected?
155
+ 3. After collection, write to `scope-brief.md` (project root), following scope-brief template structure.
156
+ 4. Inform user brief is generated, then goto `<step_1_load>` to continue.
196
157
  </fallback_interview>
197
158
 
198
159
  </protocol_scope>
@@ -0,0 +1,102 @@
1
+ <protocol_script>
2
+ **Trigger**: `/archi.script`
3
+ **Goal**: Generate/update `.architext/scripts/` based on frozen `tech_stack.md`.
4
+ **When**: After infrastructure tasks (INF-01, etc.) complete, when `tech_stack` commands are actual values (not placeholders) and runnable.
5
+
6
+ <meta>
7
+ <style>Deterministic, Auto-Detect, Post-Infra</style>
8
+ <language>English</language>
9
+ <principles>
10
+ 1. **Post-Infra Only**: Only run after infrastructure is ready, `tech_stack` commands must be actual values.
11
+ 2. **Auto-Detect**: Auto-detect OS, generate `.sh` (Unix) and `.ps1` (Windows).
12
+ 3. **Tech-Stack Driven**: Strictly extract actual commands from `tech_stack.md`, no hardcoding.
13
+ 4. **Idempotent**: Multiple runs produce same result, only write on change.
14
+ </principles>
15
+ </meta>
16
+
17
+ <step_1_ingest>
18
+ **Action**:
19
+ 1. Read `[[__DOCS_DIR__]]/global/tech_stack.md`
20
+ 2. Read actual project code, extract real commands:
21
+ - `package.json` → `scripts` field (if exists)
22
+ - Config files → `vite.config.*` / `webpack.config.*` / `tsconfig.json`, etc.
23
+ - CI configs → `.github/workflows/` / `.gitlab-ci.yml`, etc. (if exists)
24
+ 3. Cross-validate: tech_stack commands vs actual config
25
+ - Consistent → use tech_stack commands
26
+ - Inconsistent → use actual code (tech_stack may be outdated)
27
+ 4. Extract commands (skip `[e.g.: ...]` placeholders):
28
+ - **Lint**: Section 3 Static Analysis
29
+ - **Format**: Section 3 Formatter
30
+ - **Build**: Section 3 Build Command
31
+ - **Test**: Section 5 Test Command
32
+ - **Dev**: Section 3 Dev Command
33
+ - **Install**: Section 3 Package Manager + install
34
+ 5. Detect current OS (Windows / Unix-like)
35
+
36
+ **Output**: Internal command map (tech_stack + actual code cross-validated), enter step_2_generate.
37
+ </step_1_ingest>
38
+
39
+ <step_2_generate>
40
+ **Action**: Generate three scripts based on extracted commands:
41
+
42
+ ### validate
43
+ Aggregated checks: Lint → Format Check → Type Check → Build → Test
44
+ - Exit on first failure (exit 1)
45
+ - Colored output (green=pass, red=fail, yellow=skip)
46
+
47
+ ### dev-up
48
+ Start environment: Install → Build → Health Check
49
+ - Health Check: Run build artifact (e.g., `--version` for CLI)
50
+
51
+ ### dev-reset
52
+ Reset environment: Kill Process → Clean Cache → Reinstall → Rebuild → Health Check
53
+ - Kill: Terminate node/tsx processes
54
+ - Clean: Remove node_modules/.cache, dist, coverage
55
+
56
+ **Script Structure**:
57
+ - Unix (`.sh`): `#!/bin/bash`, `set -e`, ANSI colors
58
+ - Windows (`.ps1`): PowerShell, `$ErrorActionPreference`, Write-Host colors
59
+
60
+ **Output**: Script content in memory, enter step_3_write.
61
+ </step_2_generate>
62
+
63
+ <step_3_write>
64
+ **Action**:
65
+ 1. Ensure `[[__DOCS_DIR__]]/scripts/` directory exists
66
+ 2. Compare with existing scripts (if any):
67
+ - Same content → skip
68
+ - Changed → overwrite, mark `MODIFIED`
69
+ - Not exists → write, mark `ADDED`
70
+ 3. Write files:
71
+ - Unix: `validate`, `dev-up`, `dev-reset` (no ext, +x)
72
+ - Windows: `validate.ps1`, `dev-up.ps1`, `dev-reset.ps1`
73
+
74
+ **Output**: File change list.
75
+ </step_3_write>
76
+
77
+ <step_4_signoff>
78
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
79
+
80
+ **Pre-signoff Checklist**:
81
+ □ tech_stack.md — Successfully extracted non-placeholder commands
82
+ □ scripts/ — validate/dev-up/dev-reset generated (Unix + Windows)
83
+ □ Change labels — ADDED / MODIFIED / SKIPPED correctly output
84
+
85
+ **Output**:
86
+ ```
87
+ ✅ Scripts Generated
88
+
89
+ | Script | OS | Status |
90
+ |:---|:---|:---|
91
+ | validate | Unix | ADDED/MODIFIED/SKIPPED |
92
+ | validate | Windows | ADDED/MODIFIED/SKIPPED |
93
+ | dev-up | Unix | ... |
94
+ | dev-up | Windows | ... |
95
+ | dev-reset | Unix | ... |
96
+ | dev-reset | Windows | ... |
97
+
98
+ **Next**: AI will auto-use `scripts/validate` when running `/archi.code`
99
+ ```
100
+ </step_4_signoff>
101
+
102
+ </protocol_script>