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,69 +1,61 @@
1
1
  <protocol_help>
2
2
  **Trigger**: `/archi.help [question]`
3
- **Goal**: Project navigation and contextual Q&A. Analyze current project state to recommend next actions; or answer user questions based on project context.
3
+ **Goal**: Project navigation and context Q&A. Analyze project current state, recommend next actions; or answer user questions based on project context.
4
4
 
5
5
  <meta>
6
6
  <style>Concise, Contextual, Actionable</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Context-Aware**: Answer based on real project state. No guessing.
10
- 2. **Actionable Output**: Every output must include an executable next step (specific command + args).
11
- 3. **Minimal Token**: Keep output concise. Don't repeat what the user already knows. Only present conclusions and recommendations.
12
- 4. **No Audit**: No deep auditing (that's `/archi.audit`'s job). Focus on navigation and Q&A.
9
+ 1. **Context-Aware**: Answer based on actual project state; no guessing.
10
+ 2. **Actionable Output**: Every output must include executable next-step suggestions (concrete command + params).
11
+ 3. **Minimal Token**: Concise output; don't restate known info. Present reasoning and suggestions only.
12
+ 4. **No Audit**: Do not do deep audit (that's `/archi.audit`). Focus on navigation and Q&A.
13
13
  </principles>
14
14
  </meta>
15
15
 
16
16
  <step_1_load_context>
17
- **Role**: Project Observer
18
17
  **Action**:
19
- 1. Read `[[__DOCS_DIR__]]/global/roadmap.json` — extract only `id/title/status/deps/tag` fields per task; skip `goal/notes` (navigation and status aggregation do not need these details).
20
- 2. Scan `[[__DOCS_DIR__]]/tasks/` directory — get existing Tasks and their doc completeness (spec.md / ui.md / plan.json).
21
- 3. [?question] If user provided a question, locate relevant files by semantic match (spec / plan / vision / tech_stack / data_snapshot, etc.), read as needed.
18
+ 1. **Load**: roadmap.json (id/title/status/deps/tag only; skip goal/notes).
19
+ 2. **Scan Tasks**: Scan tasks/ — get existing Tasks and doc completeness (has spec.md / ui.md / plan.json).
20
+ 3. [?question] If user provided a question, locate and read relevant files by semantics.
22
21
 
23
22
  **Output**: Internal context (not shown to user).
24
23
  </step_1_load_context>
25
24
 
26
25
  <step_2_route>
27
- **Role**: Router
28
- **Action**: Branch based on input:
26
+ **Action**: Branch by input:
29
27
 
30
28
  | Input | Branch |
31
29
  |:---|:---|
32
30
  | No args | → step_3_navigate (project navigation) |
33
- | Has `[question]` | → step_4_answer (contextual Q&A) |
31
+ | Has `[question]` | → step_4_answer (context Q&A) |
34
32
 
35
33
  </step_2_route>
36
34
 
37
35
  <step_3_navigate>
38
- **Role**: Project Navigator
39
36
  **Action**:
40
37
  1. **Determine project phase**:
41
38
 
42
- | Signal | Phase | Recommendation |
39
+ | Signal | Phase | Suggestion |
43
40
  |:---|:---|:---|
44
41
  | roadmap.json missing | Not initialized | New project → `/archi.start`; existing code → `/archi.inherit` |
45
- | Has roadmap but no Task dirs | Started, not planned | Run `/archi.scope` to plan new tasks |
46
- | Has Legacy stubs (Spec-Status: Stub) | Inherited, not enriched | Run `/archi.edit LEG-xx` to enrich spec |
47
- | Has active tasks with complete plan.json | Ready to code | Run `/archi.code <ID>` |
48
- | Has active tasks but missing spec/plan | Planning incomplete | Run `/archi.plan <ID>` to complete |
49
- | All tasks done | Complete | Run `/archi.scope` to plan new tasks or release |
50
- | Has blocked tasks | Blocked | Show blocking reason and prerequisites |
51
-
52
- 2. **Output format**:
53
- - One-line summary of current state
54
- - Recommended next action (with specific command)
55
- - If multiple paths available, list by priority (max 3)
42
+ | Has roadmap but no tasks/ | Started, not planned | `/archi.scope` to plan new tasks |
43
+ | Has Legacy stub (Spec-Status: Stub) | Inherited, not enriched | `/archi.edit LEG-xx` to enrich spec |
44
+ | Has active task and plan.json complete | Ready to code | `/archi.code <ID>` |
45
+ | Has active task but missing spec/plan | Planning incomplete | `/archi.plan <ID>` to complete |
46
+ | All tasks done | Completed | `/archi.scope` to plan new or release |
47
+ | Has blocked task | Blocked | Show block reason and upstream deps |
48
+
49
+ 2. **Output**: One-line state summary + recommended next step (with command) + optional paths (≤3, by priority).
56
50
  </step_3_navigate>
57
51
 
58
52
  <step_4_answer>
59
- **Role**: Project Advisor
60
53
  **Action**:
61
- 1. Parse `[question]` semantics, locate relevant project files.
62
- 2. Read relevant files, synthesize answer.
63
- 3. If question involves an action (e.g. "how to do X"), include specific command suggestions.
64
- 4. If insufficient info to answer, state what's missing instead of fabricating.
54
+ 1. Parse `[question]` semantics; locate and read relevant project files.
55
+ 2. Answer comprehensively; operational questions must include concrete command suggestions.
56
+ 3. When info insufficient, state what's missing; do not fabricate.
65
57
 
66
- **Output**: Concise answer based on project context + relevant file references.
58
+ **Output**: Concise answer based on project context + relevant file refs.
67
59
  </step_4_answer>
68
60
 
69
61
  </protocol_help>
@@ -1,23 +1,29 @@
1
1
  <protocol_inherit>
2
- **Trigger**: `/archi.inherit`
2
+ **Trigger**: `/archi.inherit [brief_path]`
3
3
  **Phase**: Legacy Adoption
4
- **Goal**: Reverse-engineer an existing codebase to generate the Architext document skeleton, bringing the project under framework governance.
4
+ **Goal**: Reverse-engineer existing codebase to fill the init-deployed document skeleton (`[[__DOCS_DIR__]]`) with analysis results, bringing project under framework governance. Fills empty placeholders; does not overwrite user's existing content. Optionally provide Brief to supplement vision/roadmap (for skeleton repos with minimal code).
5
5
 
6
6
  <meta>
7
7
  <style>Analytical, Systematic, Evidence-Based</style>
8
8
  <language>English</language>
9
9
  <principles>
10
- 1. **Code-Driven**: Code is the sole source of truth; do not speculate on tasks without evidence.
11
- 2. **AI-Native Perspective**: All analysis from AI Agent perspective. Focus: Context Locality, Type Safety, Module Boundaries.
12
- 3. **User Agency First**: AI analysis must be confirmed by the user. When code interpretation is ambiguous, ask the user; do not decide unilaterally.
13
- 4. **Minimal Token**: Prioritize config files and entry points; avoid scanning every line of code.
10
+ 1. **Code-Driven**: Code is the sole source of truth; no speculation on features without evidence.
11
+ 2. **AI-Native Perspective**: Analysis from AI Agent perspective. Focus: Context Locality, Type Safety, Module Boundaries.
12
+ 3. **User Agency First**: AI analysis must be confirmed by user. When code interpretation is ambiguous, ask user; do not decide unilaterally.
13
+ 4. **Thorough Discovery, Layered Recording**: Read all non-third-party business code (exclude node_modules/vendor/dist and other generated artifacts), no file count limit. Record in three tiers: core modules with detailed flow documentation, shared logic with signatures and dependency relationships, pure utilities with signatures and purpose. Better to over-read than to miss — downstream protocols cannot use code that was not recorded.
14
14
  5. **Option Z Everywhere**: Supplementary questions must include `[Z] Custom`.
15
15
  </principles>
16
16
  </meta>
17
17
 
18
18
  <step_0_recon>
19
19
  **Role**: Intelligence Analyst
20
- **Action**:
20
+
21
+ **Brief detection** (only when user provides `[brief_path]`):
22
+ 1. Parse `[brief_path]`: if path provided → read that file; if not → search `project-brief.md` (project root), then `[[__DOCS_DIR__]]/project-brief.md`
23
+ 2. If file exists and non-empty: parse Brief sections, extract project identity, core tasks, tech preferences, boundaries, supplementary notes (same as start step_0_ingest)
24
+ 3. If file missing or empty: skip Brief; subsequent steps use code only as input
25
+
26
+ **Code reconnaissance**:
21
27
  1. Read project root config files (auto-detect type):
22
28
 
23
29
  | Language/Ecosystem | Config Files |
@@ -30,80 +36,52 @@
30
36
  | Other | Use root directory config files |
31
37
 
32
38
  2. Read README.md (if exists).
33
- 3. Scan directory structure (top-level + core source directories, two levels deep).
34
- 4. Infer project feature tags (UI / Data / CLI / Lib / API — from directory structure, dependencies, and config).
35
- 5. Identify entry points and core modules.
39
+ 3. Scan directory structure (full depth).
40
+ 4. Infer project feature tags (UI / Data / CLI / Lib / API — from directory structure, deps, and config).
41
+ 5. Identify entry points and core modules. Trace import chains from entry points to build a module dependency sketch.
36
42
 
37
43
  **Output**: Internal summary (not shown to user), proceed to step_1.
38
44
  </step_0_recon>
39
45
 
40
46
  <step_1_analysis>
41
- **Role**: System Analyst
42
- **Scan Strategy**: Medium-depth scan — read each module's entry file and core business files, extract main flow chains. Do not traverse every file.
47
+ **Role**: Chief Product Strategist (CPO)
48
+ **Scan strategy**: Deep scan — starting from entry files, follow call chains to read all business files. For large modules (>10 files), prioritize files imported by multiple consumers.
43
49
 
44
50
  **Action**:
45
51
  1. For each identified functional module:
46
- - Read entry file + 1-2 core business files
52
+ - Starting from entry file, follow import/call chains layer by layer until the module's main business logic is covered
47
53
  - Extract main flows (user action → system processing → result)
48
54
  - Record associated file paths
49
55
  2. For shared/infrastructure code (utils, middleware, config):
50
- - Record directory and responsibility only; do not treat as functional modules
56
+ Read all files and record in two tiers:
57
+ - **Medium tier** (business shared logic: auth/validation/error-handling/permission): record responsibility + exported function signatures + dependents
58
+ - **Brief tier** (pure utility functions: format/slugify/logger/helpers): record function name + parameter signature + one-line purpose
59
+ Both tiers write to map.json publicAPI field, ensuring downstream protocols can discover and reuse.
51
60
  3. Extract domain terminology and naming conventions from code.
52
61
 
53
- **Output**: Present structured analysis report to user:
54
- ```
55
- ### Codebase Analysis Report
56
- > **Project**: [Name] | **Type**: [UI/Data/CLI/Lib/API] | **Scale**: ~[file count] files, [dir count] directories
57
-
58
- **Tech Stack**:
59
- | Category | Selection |
60
- |:---|:---|
61
- | Language | ... |
62
- | Framework | ... |
63
- | Build | ... |
64
- | Testing | ... |
65
- | Deployment | ... |
66
-
67
- **Architecture Pattern**: [Inference] — [Evidence]
68
-
69
- **Functional Module Inventory**:
70
- | # | Module | Source Location | Responsibility | Key Flows |
71
- |:---|:---|:---|:---|:---|
72
- | 1 | [Name] | [Path] | [One sentence] | [Flow1], [Flow2] |
73
-
74
- **Shared Infrastructure**:
75
- | Directory | Responsibility |
76
- |:---|:---|
77
- | [Path] | [Description] |
78
-
79
- **Domain Terminology**: [Term list]
80
-
81
- **Uncertain Items** (if any):
82
- - [Ambiguous item]
83
- ```
62
+ **Output**: Output structured analysis report to user — include project overview (name/type/scale), tech stack table (language/framework/build/test/deploy), architecture pattern and evidence, functional module list (module/source location/responsibility/key flows), shared infrastructure (directory/responsibility/key exported interfaces), domain terminology, AI uncertain items (if any).
84
63
 
85
64
  **Gate**: User confirms or corrects. Do not proceed to step_2 without confirmation.
86
65
  </step_1_analysis>
87
66
 
88
67
  <step_2_supplementary>
89
- **Role**: Product Consultant
90
68
  **Trigger**: Only when step_1 has items AI cannot determine. Skip if no ambiguity.
91
69
 
92
70
  **Action**: Ask ambiguous items in multiple-choice format.
93
- - 3-5 options per question + `[Z] Custom`; AI recommendation marked `[Recommended]`.
71
+ - 35 options per question + `[Z] Custom`; AI recommendation marked `[Recommended]`.
94
72
  - Total questions capped at 3.
95
73
 
96
74
  Common ambiguities:
97
75
  - Architecture pattern cannot be confirmed
98
- - Certain directory responsibilities unclear
99
- - Vision info (North Star Metric, design philosophy) cannot be inferred from code
76
+ - Certain directory responsibility unclear
77
+ - Vision info (North Star metric, design philosophy) cannot be inferred from code
100
78
 
101
79
  **Output Format**:
102
80
  ```
103
81
  ### Supplementary Confirmation
104
82
 
105
- **[Q1] Question Title**
106
- > Why this information is needed
83
+ **[Q1] Question title**
84
+ > Why this info is needed
107
85
 
108
86
  | ID | Option | Description |
109
87
  |:---|:---|:---|
@@ -118,40 +96,53 @@
118
96
 
119
97
  <step_3_constitution>
120
98
  **Role**: Chief Architect
121
- **Input**: Step 1 analysis report + Step 2 supplements (if any).
122
- **Action**: Generate project document skeleton in one pass.
99
+ **Input**: Step 0 Brief parse (if any) + Step 1 analysis report + Step 2 supplements (if any).
100
+ **Action**: Fill the init-deployed document skeleton in one pass. **With Brief**: Brief takes precedence for vision/roadmap/tech_stack; code still used for map, LEG-xx, directory structure. **Without Brief**: Code only as input (original logic).
123
101
 
124
102
  ### Information Routing Rules
125
103
 
126
- > Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by the IDE — the AI knows their paths; write directly.
104
+ > Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by IDE; AI knows their paths, write directly.
127
105
 
128
- | Information from Code | Target File |
106
+ **With Brief** (Brief target file):
107
+ | Brief content | Target file |
129
108
  |:---|:---|
130
- | README project description, target users, task list | `[[__DOCS_DIR__]]/global/vision.md` |
131
- | Dependency list, config files, code patterns | rule file `02_tech_stack` |
132
- | Directory structure, module dependencies, user journeys | `[[__DOCS_DIR__]]/global/map.json` |
133
- | Domain terminology, abbreviations, naming conventions | `[[__DOCS_DIR__]]/global/dictionary.json` |
134
- | eslint/prettier and existing standards | rule file `90_custom_rules` |
135
- | Error code definitions in code | `[[__DOCS_DIR__]]/global/error_codes.json` |
136
- | [?UI] CSS variables/theme config | `[[__DOCS_DIR__]]/global/design_tokens.json` |
137
- | [?Data] Schema/Migration files | `[[__DOCS_DIR__]]/global/data_snapshot.json` |
109
+ | Project identity, target users, success metrics, references | `[[__DOCS_DIR__]]/global/vision.md` |
110
+ | Tech stack, deploy target, 3rd-party libs/services | rule file `02_tech_stack` |
111
+ | Core task list | `[[__DOCS_DIR__]]/global/roadmap.json` (phase-1/2, call archi-decompose-roadmap) |
112
+ | Rules/conventions/preferences from supplementary notes | rule file `90_custom_rules` |
113
+ | Style/tone (UI only) | `design_tokens.json` aestheticDirection etc. |
114
+
115
+ **From code** (always applies):
116
+ | Source | Target file |
117
+ |:---|:---|
118
+ | README description/features | vision.md |
119
+ | Dependencies/config/code patterns | 02_tech_stack |
120
+ | Directory structure/module deps/user journeys | map.json |
121
+ | Domain terminology/naming conventions | dictionary.json |
122
+ | eslint/prettier etc. | 90_custom_rules |
123
+ | Error codes in code | error_codes.json |
124
+ | (UI projects only) CSS variables/theme | design_tokens.json |
125
+ | (Data projects only) Schema/Migration | data_snapshot.json |
138
126
 
139
127
  ### 3.1 Vision (`[[__DOCS_DIR__]]/global/vision.md`)
140
- - Derive from README + project config
141
- - Items that cannot be derived: mark `(AI Inferred — user review recommended)`
128
+ - **With Brief**: Fill from Brief (same as start); code/README as supplement only
129
+ - **Without Brief**: Derive from README + project config; mark un-inferrable items `(AI completion — user review suggested)`
142
130
  - Do not retain template placeholders
143
131
 
144
132
  ### 3.2 Tech Stack (rule file `02_tech_stack`)
145
- - Existing dependencies/config → write directly
146
- - Visible code conventions (naming, structure) → write to Coding Standards
147
- - Must populate complete Section 1-8
133
+ - **With Brief**: Brief confirmed → write directly; blank/recommend → AI recommends; code deps as supplement
134
+ - **Without Brief**: Existing deps/config write directly; visible conventions → write to Coding Standards
135
+ - Fill complete Section 1-8
148
136
 
149
137
  ### 3.3 Custom Rules (rule file `90_custom_rules`)
150
- - Extract rules from eslint/prettier/editorconfig
151
- - Identify team conventions from code patterns (e.g., named export preference, async/await style)
138
+ - **With Brief**: Merge supplementary notes + code eslint/prettier
139
+ - **Without Brief**: Extract from eslint/prettier/editorconfig; identify team conventions from code patterns
152
140
 
153
141
  ### 3.4 Roadmap (`[[__DOCS_DIR__]]/global/roadmap.json`)
154
142
 
143
+ **With Brief**: [[SKILL: archi-decompose-roadmap|Generate phase-1/2 task chain from Brief task list]]; code functional modules → phase-0 LEG-xx (status=done). Merge both.
144
+ **Without Brief**: Code functional modules only → phase-0 LEG-xx; phase-1/2 remain empty skeletons.
145
+
155
146
  **Structure**:
156
147
  ```json
157
148
  {
@@ -165,7 +156,7 @@
165
156
  "tasks": [
166
157
  {
167
158
  "id": "LEG-01",
168
- "title": "<Module Name>",
159
+ "title": "<Module name>",
169
160
  "status": "done",
170
161
  "goal": "<One-line summary>. See tasks/LEG-01_<Slug>/spec.md",
171
162
  "deps": [],
@@ -182,9 +173,8 @@
182
173
 
183
174
  **Rules**:
184
175
  - Functional modules → `phase-0: Legacy`, status `done`, tag `Legacy`, ID prefix `LEG-`
185
- - Shared/infrastructure code does not enter roadmap; only goes to map.json directoryMapping
186
- - phase-1/2 remain as empty skeletons
187
- - Dependencies between LEG tasks must be reflected in deps
176
+ - Shared/infrastructure code does not enter roadmap; only map.json directoryMapping
177
+ - Dependencies between LEG tasks must be in deps
188
178
 
189
179
  ### 3.5 Task Stub Specs
190
180
 
@@ -200,71 +190,75 @@
200
190
  [One paragraph description]
201
191
 
202
192
  ## Key Flows
203
- 1. **[Flow Name]**: [A] → [B] → [C]
204
- 2. **[Flow Name]**: [A] → [B] → [C]
193
+ 1. **[Flow name]**: [A] → [B] → [C]
205
194
 
206
195
  ## Associated Files
207
196
  - [Role]: `[Path]`
208
- - [Role]: `[Path]`
209
197
  ```
210
198
 
211
- > Stubs are a starting point, not the final state. Enrich later via `/archi.edit` (auto-triggers the `step_1_5_enrich` flow).
199
+ > Stub is starting point, not final state. Enrich later via `/archi.edit` (auto-triggers `step_1_5_enrich` flow).
212
200
 
213
- ### 3.6 map.json Population
201
+ ### 3.6 map.json population
214
202
  - `directoryMapping`: Each core directory → `{ "path", "layer", "responsibility", "publicAPI" }`
215
203
  - `logicalTopology`: Inter-module dependencies → `{ "from", "to", "type" }` (imports / calls / extends)
216
204
  - `criticalUserJourneys`: Core flows → `{ "name", "steps": ["module → module → ..."] }`
217
- - `featureRelations`: Scan code to identify "aggregator modules" and record them.
218
- **Recognition patterns**: A module that iterates/enumerates/dynamically loads modules of the same type (e.g., `for (const cmd of allCommands)`, `Object.values(registry)`, reading a directory then dynamic import), or is described as "aggregating/listing/registering all X".
219
- Record format: `{ "aggregator": "<ID or file path>", "sources": "<source range description>", "evidence": "<code basis>", "checkNote": "When tasks of this type are added or removed, check whether <aggregator> needs to be updated" }`
205
+ - `featureRelations`: Scan code to identify "aggregator modules" and record.
206
+ **Recognition pattern**: Module that iterates/enumerates/dynamic-loads same-type modules, or described as "aggregating/listing/registering all X".
207
+ Record format: `{ "aggregator", "sources", "evidence", "checkNote" }`
220
208
 
221
- ### 3.7 Other Global Documents (as needed)
209
+ ### 3.7 Other global docs (as needed)
222
210
  - `dictionary.json`: Extract domain terminology from code
223
- - [?UI] `design_tokens.json`: Extract from CSS variables/theme
224
- - [?UI] `ui_concept.html` + `ui_context.md`: **Not generated by this command.** After inherit completes, prompt the user to run the `archi-ui-wireframe` Skill to generate the global UI wireframe (Skill generates both files simultaneously).
225
- - [?Data] `data_snapshot.json`: Extract from schema/migration
211
+ - (UI projects only) `design_tokens.json`: Extract from CSS variables/theme
212
+ - (Data projects only) `data_snapshot.json`: Extract from schema/migration
226
213
  - `error_codes.json`: Extract from error definitions in code
227
214
 
228
- **Output**: Write all files, then run `npx archi render`.
215
+ UI projects only: **UI concept design (Adopt mode)**: [[SKILL: archi-ui-wireframe|Invoke skill (adopt mode) to reverse-generate UI concept design from code.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its Adopt protocol)]]
216
+ - Read route definitions, page components, layout files from code
217
+ - Read design_tokens.json written in step_3 (containing CSS variables/theme extracted from code)
218
+ - When tokens incomplete, triggers skill's built-in guidance flow
219
+ - Write `ui_concept.html` + `ui_context.md`
220
+ - Output UI concept design summary; await user confirmation or feedback for adjustments
221
+
222
+ **Output**: Write all files, run `npx archi render`. Enter step_4_verify.
229
223
  </step_3_constitution>
230
224
 
231
- <step_4_audit>
232
- **Role**: Chief Auditor
233
- **Checklist**:
234
- 1. **Vision Alignment**: Does vision.md match actual code functionality?
235
- 2. **Tech Stack Consistency**: Does rule file `02_tech_stack` match package.json/config?
236
- 3. **Map Coverage**: Does map.json cover all core directories?
237
- 4. **Roadmap Completeness**: Does phase-0 cover all identified functional modules?
238
- 5. **Stub Completeness**: Does every LEG-xx have a corresponding tasks/ directory and spec.md?
239
- 6. **Dictionary Consistency**: No ambiguous or duplicate terms?
225
+ <step_4_verify>
226
+ **Role**: Independent Reviewer
227
+ [[SUBAGENT: archi-silent-audit|mode: init, context: Review step_3 generated global files (vision, tech_stack, roadmap, map, dictionary, stub specs, etc.)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: init review dimension table item by item)]]
240
228
 
241
- Silently fix issues; mark severe problems as `Risk Warning`.
242
- </step_4_audit>
229
+ [[INCLUDE: shared/verify-result-handling.md]]
230
+ </step_4_verify>
243
231
 
244
232
  <step_5_signoff>
245
- **Terminal Gate** (Do not skip; must complete before output summary):
246
- | Step | Command | Pass Condition |
247
- |:---|:---|:---|
248
- | 1 | `npx archi task --check` | No ERROR-level issues |
249
- | 2 | `npx archi render` | `.md` views generated |
250
-
251
- **Action** (After Gate passes):
252
- 1. Run `npx archi task` to display task overview.
233
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
234
+
235
+ **Pre-signoff Checklist** (confirm each item after Gate passes, before Output):
236
+ vision.md filled (without Brief: inferred content annotated `(AI completion review recommended)`)
237
+ 02_tech_stack.md Sections 1-8 fully filled
238
+ □ roadmap.json — each functional module has a corresponding LEG-xx (status: done, tag: Legacy)
239
+ tasks/LEG-xx_<Slug>/spec.md — each LEG has a corresponding Stub spec (with related file list)
240
+ □ map.json directoryMapping + logicalTopology + criticalUserJourneys + featureRelations all filled
241
+ □ dictionary.json + error_codes.json — extracted from codebase
242
+ □ (UI projects only) design_tokens.json + ui_concept.html + ui_context.md — Adopt mode executed
243
+ □ Step 4 Silent Audit — executed, all CRITICAL issues resolved
244
+
245
+ **Action** (after Checklist confirmed):
246
+ 1. Run `npx archi task` to output task overview.
253
247
  2. Output summary.
254
248
 
255
- **Output**: Reverse-engineering summary containing:
256
- - **Project Overview**: Type, scale, number of core modules
257
- - **Legacy Tasks**: LEG-xx list (ID / Name / Source location)
258
- - **Generated Documents**: File list
259
- - **AI Inferred Items**: Mark confidence level (High/Medium/Low)
249
+ **Output**: Reverse-engineering summary, including:
250
+ - **Project overview**: Type, scale, core module count
251
+ - **Legacy tasks**: LEG-xx list (ID / name / source location)
252
+ - **Generated docs**: File list
253
+ - **AI completions**: Mark confidence (High/Medium/Low)
260
254
  - **Next Steps**:
261
255
 
262
- | Priority | Action | Description |
256
+ | Priority | Action | Notes |
263
257
  |:---|:---|:---|
264
- | 1 | Review vision.md | Confirm AI-inferred vision description is accurate |
265
- | 2 | `/archi.edit LEG-xx` | Enrich core module stubs into full specs (auto-triggers Enrich flow) |
266
- | 3 | `/archi.scope [file_path]` | Plan new tasks/major modules |
267
- | 4 | `/archi.plan <task ID>` | Deep-plan individual tasks |
258
+ | 1 | Review vision.md | Confirm AI-completed vision description |
259
+ | 2 | `/archi.edit LEG-xx` | Enrich core module stubs into full spec (auto-triggers Enrich flow) |
260
+ | 3 | `/archi.scope [file_path]` | Plan new features/major modules |
261
+ | 4 | `/archi.plan <task ID>` | Deep-plan individual task |
268
262
  </step_5_signoff>
269
263
 
270
264
  </protocol_inherit>
@@ -1,131 +1,109 @@
1
1
  <protocol_map>
2
- **Trigger**: `/archi.map`
3
- **Goal**: Scan actual project directory structure, diff against `map.json`, identify additions/stale/changes, and update the architecture map after user confirmation.
2
+ **Trigger**: `/archi.map` | Auto-loaded by Workflow Dispatch on natural language trigger
3
+ **Goal**: Scan project actual directory structure, compare with `map.json`, identify additions/stale/changes; update architecture map after user confirmation.
4
4
 
5
5
  <meta>
6
6
  <style>Systematic, Precise, Architecture-Aware</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Scan vs Map**: Actual filesystem is Ground Truth; map.json is the old snapshot.
10
- 2. **Smart Granularity**: Directory-level by default; drill to file-level when a single file carries multiple responsibilities.
11
- 3. **Architecture Inference**: New entry classification must reference existing map patterns + `02_tech_stack.md`.
12
- 4. **Batch Confirm**: Present all changes at once; user confirms in batch.
9
+ 1. **Scan vs Map**: Actual filesystem is Ground Truth; map.json is old snapshot.
10
+ 2. **Smart Granularity**: Directory-level by default; when single file has multiple responsibilities, refine to file-level.
11
+ 3. **Architecture Inference**: New entry layer/location must reference existing map pattern + `02_tech_stack.md`.
12
+ 4. **Batch Confirm**: Show all changes at once; user confirms in batch.
13
+ 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.
13
14
  </principles>
14
15
  </meta>
15
16
 
16
17
  <step_1_scan>
17
- **Role**: Surveyor
18
18
  **Action**:
19
19
  1. **Read Map**: Read `[[__DOCS_DIR__]]/global/map.json` — current architecture map.
20
- 2. **Read Tech Stack**: Read `02_tech_stack.md` — directory conventions, architecture patterns.
20
+ 2. **Read Tech Stack**: Read `02_tech_stack.md` — directory structure conventions, architecture pattern.
21
21
  3. **Scan Directory Tree**: Scan project directory structure.
22
- - **Exclude**: `.git/`, `node_modules/`, `dist/`, `build/`, `[[__DOCS_DIR__]]/`, and paths declared in `.gitignore`.
23
- - **Depth**: Follow granularity patterns of existing map.json entries. If existing entries include file-level → scan to file-level too.
22
+ - **Exclude**: `.git/`, `node_modules/`, `dist/`, `build/`, `[[__DOCS_DIR__]]/`, and paths in `.gitignore`.
23
+ - **Depth**: Follow granularity pattern of existing map.json entries.
24
24
 
25
- **Output**: Internal data (actual tree + existing map structure), not shown to user.
25
+ **Output**: Internal data (actual dir tree + existing map structure); not shown to user.
26
26
  </step_1_scan>
27
27
 
28
28
  <step_2_diff>
29
- **Role**: Diff Analyst
30
- **Action**: Compare actual directory tree against map.json entry by entry, classify into three diff types.
29
+ **Action**: Compare actual dir tree with map.json entry by entry; classify as three diff types.
31
30
 
32
31
  | Diff Type | Criteria | Handling |
33
32
  |:---|:---|:---|
34
- | **New** | Exists on disk but not in map | Classify and register |
35
- | **Stale** | In map but no longer exists on disk | Remove directly |
36
- | **Possible Rename** | Map path missing, but a new path has highly similar structure/content | Flag as rename candidate |
33
+ | **New** | Exists in reality but not in map | Must classify and register |
34
+ | **Stale** | In map but no longer exists | Remove directly |
35
+ | **Suspected Rename** | Map path gone, but new path structure/content highly similar | Mark as rename candidate |
37
36
 
38
- ### File-Level Detection
37
+ ### File-level detection
39
38
 
40
- Quick-scan files in new directories (read exports/declarations) to identify **single-file multi-responsibility** cases:
41
- - A file exporting multiple unrelated classes/functions/modules
42
- - An entry file aggregating multiple sub-module registrations (e.g. route registration, store registration)
43
- - A file serving multiple Tasks
39
+ Quick scan of files in new directories; identify **single file multi-responsibility** → refine granularity to file-level.
44
40
 
45
- When detected drill granularity to file-level, register the file separately in map with its contained responsibilities.
46
-
47
- **Output**: Diff list (internal), proceed to step_3.
41
+ **Output**: Diff list (internal); proceed to step_3.
48
42
  </step_2_diff>
49
43
 
50
44
  <step_3_classify>
51
45
  **Role**: Chief Architect
52
- **Action**: Classify new entries by architectural layer.
46
+ **Action**: Classify new entries by architecture.
53
47
 
54
- ### Classification Strategy
48
+ ### Classification strategy
55
49
 
56
- 1. **Pattern Matching**: Reference existing entries at the same level. If `src/services/auth/` is "Service Layer", then `src/services/payment/` likely is too.
57
- 2. **Tech Stack Conventions**: Directory structure rules defined in `02_tech_stack.md` (e.g. "commands/ is Task Layer").
58
- 3. **Content Inference**: Read file contents (imports, export types) to determine architectural role.
59
- 4. **Uncertain**: Mark as `[?]`, let user specify during confirmation.
50
+ 1. **Pattern match**: Reference same-level existing entries in map.json.
51
+ 2. **Tech Stack conventions**: Directory structure rules in `02_tech_stack.md`.
52
+ 3. **Content inference**: Read file content (imports, exported types).
53
+ 4. **Cannot determine**: Mark `[?]` for user to specify.
60
54
 
61
- For each new entry, populate:
62
- - `path`: Directory or file path
63
- - `layer`: Architectural layer
64
- - `description`: One-line responsibility description
65
- - `[?file-level]` `contains`: List of sub-responsibilities in the file
55
+ For each new entry fill: `path`, `layer`, `description`, `[?file-level] contains`.
66
56
 
67
- **Output**: Classified new entries list (internal), proceed to step_4.
57
+ **Output**: Classified new entries list (internal); proceed to step_4.
68
58
  </step_3_classify>
69
59
 
70
60
  <step_4_propose>
71
- **Role**: Advisor
72
- **Action**: Present the full change manifest to user.
61
+ **Action**: Present full change list to user.
73
62
 
74
63
  **Output**:
75
64
  ```
76
65
  ### Architecture Map Change Proposal
77
66
 
78
67
  **Scan scope**: [project root]
79
- **Current map entries**: N | **After update**: M
68
+ **Current map entries**: N | **After change**: M
80
69
 
81
70
  ---
82
71
 
83
- #### Stale Entries (will remove)
84
- | Path | Original Layer |
72
+ #### Stale entries (to remove)
73
+ | Path | Original layer |
85
74
  |:---|:---|
86
- | src/legacy/old-module/ | Service Layer |
87
75
 
88
- #### New Entries (will register)
76
+ #### New entries (to register)
89
77
  | Path | Layer | Description | Granularity |
90
78
  |:---|:---|:---|:---|
91
- | src/services/payment/ | Service Layer | Payment service module | Directory |
92
- | src/utils/validators.ts | Shared Layer | Form + data + API param validation | File |
93
- | src/routes/api.ts [?] | [to specify] | Aggregates multiple API route registrations | File |
94
79
 
95
- #### Possible Renames
96
- | Original Path | New Path | Confidence |
80
+ #### Suspected renames
81
+ | Original path | New path | Confidence |
97
82
  |:---|:---|:---|
98
- | src/helpers/ | src/utils/ | High (file content match) |
99
83
 
100
84
  ---
101
- > Reply **OK** to confirm all; or specify changes:
102
- > - "src/routes/api.ts belongs to App Layer"
103
- > - "src/helpers/ is not a rename, keep original entry"
104
- > - "add src/config/ as Config Layer"
85
+ > Reply **OK** to confirm all; or specify modifications.
105
86
  ```
106
87
 
107
88
  **Gate**: Proceed to step_5 after user confirms.
108
89
  </step_4_propose>
109
90
 
110
91
  <step_5_apply>
111
- **Role**: System Administrator
112
92
  **Action**:
113
- 1. Update `[[__DOCS_DIR__]]/global/map.json` per confirmed changes:
114
- - Remove stale entries
115
- - Add new entries (with layer, description)
116
- - Handle renames (update path, preserve other metadata)
117
- 2. Update `lastUpdated` field.
118
-
119
- **Terminal Gate** (Do not skip; must complete before output summary):
120
- | Step | Command | Pass Condition |
121
- |:---|:---|:---|
122
- | 1 | `npx archi render` | `.md` views generated |
93
+ 1. Update map.json per confirmed list (remove stale, add new, handle renames).
94
+ 2. Update `lastUpdated`.
95
+
96
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
97
+
98
+ **Pre-signoff Checklist** (confirm each item before Output):
99
+ User explicitly confirmed change list in step_4 (Gate passed before execution)
100
+ Stale entries removed from directoryMapping
101
+ □ New entries correctly classified (path + layer + description all filled)
102
+ Renamed entries explicitly handled (not silently ignored)
103
+ □ lastUpdated updated
104
+ □ Terminal Gate — task --check + render passed
123
105
 
124
- **Output**: Update summary:
125
- - **Removed**: N stale entries
126
- - **Added**: N entries (M file-level)
127
- - **Renamed**: N entries
128
- - **Current map total**: X entries
106
+ **Output**: Update summary — removed N / added N (M file-level) / renamed N / total entries.
129
107
  </step_5_apply>
130
108
 
131
109
  </protocol_map>