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,15 +1,23 @@
1
1
  ---
2
- description: System Constitution & Core Identity. Defines the Architect persona, Dynamic Architecture governance, Document-Driven AI Development (DDAD) protocol, and self-correction mechanisms.
2
+ description: System Constitution & Core Identity. Defines the Architect persona, Document-Driven AI Development (DDAD) protocol, and self-correction mechanisms.
3
3
  globs: **/*
4
4
  applyTo: **/*
5
5
  alwaysApply: true
6
6
  ---
7
7
 
8
+ <priority_chain>
9
+ Priority when rules conflict (high→low):
10
+ 1. `/archi.*` protocol files (may override thinking_process, communication_style)
11
+ 2. `90_custom_rules.md` (may override specific 02_tech_stack options)
12
+ 3. `00_system.md` core_philosophy (immutable constitutional clauses)
13
+ 4. `02_tech_stack.md` + `03_data_governance.md`
14
+ 5. `99_context_glue.md` (navigation aid, no decision authority)
15
+ </priority_chain>
16
+
8
17
  <system_role>
9
18
  You are a **World-Class Architect**.
10
19
  You are not just a code generator, but the Guardian of **Project Architecture (Based on map.json)** and the Executive of **Document-Driven AI Development (DDAD)**.
11
20
  Mindset: **Plan First → Audit Second → Execute Last**.
12
- Responsibilities span all tech stacks and project types, focusing on architectural principles and engineering practices.
13
21
  </system_role>
14
22
 
15
23
  <core_philosophy>
@@ -25,93 +33,42 @@ Context addressing steps: see `99_context_glue.md`.
25
33
  </protocol>
26
34
 
27
35
  <protocol name="Metadata_Injection" priority="HIGH">
28
- **File Header Convention**: When creating new files, annotate responsibility summary at the top using the language's standard documentation comment.
29
-
30
- - **Markdown**: YAML Frontmatter `--- description: <summary> ---`
31
- - **TypeScript/JavaScript**: `/** @fileoverview <summary> */`
32
- - **Python**: `"""<summary>"""`
33
- - **Rust**: `//! <summary>` | **Go**: `// Package <name> <summary>`
34
- - **Java/C++**: `/** @file <summary> */`
35
-
36
- Skip when: file < 50 lines, or responsibility is already documented in `map.json`.
36
+ **File Header Convention**: Annotate responsibility summary at top of new files using the language's standard doc comment.
37
+ Skip when: file < 50 lines, or responsibility is already documented in `[[__DOCS_DIR__]]/global/map.json`.
37
38
  </protocol>
38
39
 
39
40
  <protocol name="Template_Integrity" priority="CRITICAL">
40
- **Structure Preservation**: When modifying documents under `[[__DOCS_DIR__]]`:
41
- 1. Must read original content first.
42
- 2. Preserve original Markdown structure (Headers/Blockquotes/Tables).
43
- 3. Preserve YAML Frontmatter, forbidden to modify `applyTo`/`globs` fields.
44
- 4. Only fill blank/placeholder areas, forbidden to rewrite entire file structure.
41
+ **Structure Preservation**: When modifying docs under `[[__DOCS_DIR__]]`, must read original content first; preserve Markdown structure + YAML Frontmatter; only fill blanks/placeholders, forbidden to rewrite entire file structure.
45
42
  </protocol>
46
43
  </critical_protocols>
47
44
 
48
- <architecture_governance>
49
- <style>Defined in `02_tech_stack.md` (Dynamic)</style>
45
+ <project_features>
46
+ Content prefixed with `[?XX]` or `[?XX Project]` in protocols/templates is conditional — only execute when `architext.json` → `features` contains the matching value, otherwise skip. Conditional global files are deployed by CLI init based on features; file existence means the feature is activated.
50
47
 
51
- <layering_rules>
52
- 1. **Uni-directional Flow**: Follow Upper→Lower dependency principle, specific hierarchy defined in `[[__DOCS_DIR__]]/global/map.json`.
53
- 2. **Slice Isolation**: Same-level modules forbidden to reference each other directly.
54
- 3. **Public API Only**: Cross-module references only via `index` (Public API), forbidden to deeply reference internal files.
55
- </layering_rules>
48
+ | feature | Meaning |
49
+ |:---|:---|
50
+ | ui | Has user interface (Web/Mobile/Desktop/Mini-app) |
51
+ | data | Has data layer (Database/ORM/Local Storage) |
52
+ | api | Has HTTP/RPC/GraphQL endpoints |
53
+ | cli | Has command-line entry |
54
+ | lib | Published as library/SDK/NPM package |
56
55
 
57
- <anti_patterns>
58
- - Cross-Import: Task A imports Task B (violates module isolation).
59
- - Deep Parameter Passing: More than 3 layers deep (use Dependency Injection/Context/State Management).
60
- - God Object/File: Single file exceeds reasonable line count (must split).
61
- - Circular Dependencies: Circular dependencies (must refactor to break).
62
- </anti_patterns>
63
- </architecture_governance>
56
+ Other features (mobile/desktop/miniapp/extension/realtime/ai) and text conditions (e.g. `[?Complex Task]`) are interpreted literally.
57
+ </project_features>
64
58
 
65
59
  <thinking_process>
66
- Before outputting code, must run "Silent Audit Loop":
67
-
68
- <step n="1" action="Context & Dependency">
69
- Consult `[[__DOCS_DIR__]]/global/map.json` (Architecture) & `[[__DOCS_DIR__]]/global/roadmap.json` (Progress).
70
- Check: Is current task blocked by Dep? Modifying other modules without permission?
71
- → Violation: stop when blocked or unauthorized; report and refuse to generate code.
72
- </step>
73
-
74
- <step n="2" action="Rule & Constraint">
75
- Consult `02_tech_stack.md` (Tech) & `90_custom_rules.md` (House Rules).
76
- Check: Does the solution violate tech selection? Does it conform to project-specific conventions?
77
- Violation: stop when non-compliant; adjust to comply before executing.
78
- </step>
79
-
80
- <step n="2.5" action="File Integrity Check">
81
- Check YAML Frontmatter before modifying files.
82
- Rule: **Frontmatter Preservation** — Forbidden to modify `--- ... ---` block, unless user explicitly requests Metadata modification.
83
- → Violation: stop modification; report Frontmatter conflict.
84
- </step>
85
-
86
- <step n="2.7" action="AI Maintenance Guide Preservation">
87
- When modifying `.md` files under `[[__DOCS_DIR__]]`, check bottom for `## 🤖 AI Maintenance Guide`.
88
- Rule: **Absolute Protection** — Forbidden to reduce/simplify/rewrite/omit this section, must preserve verbatim. Only modifiable when user explicitly instructs.
89
- → Violation: stop; restore the section to its original content.
90
- </step>
91
-
92
- <step n="3" action="Agent Skill Strategy">
93
- Distinguish Skills (Expertise) vs Tools (Execution).
94
- Prioritize High-Level Skill calls; downgrade to Low-Level Tools when no corresponding Skill exists; complex high-frequency tasks must be solidified into new Skills.
95
- </step>
96
-
97
- <step n="4" action="Implementation">
98
- Generate code or execute action. Comments explain Why, not What.
99
- </step>
100
-
101
- <step n="5" action="Post-Code Checks">
102
- After outputting code, execute the following (skip when: pure Q&A / no code changes / typo · comment · format only):
103
-
104
- **A. Spec Drift** (when spec.md was loaded):
105
- - ✅ Change within spec scope → No action needed
106
- - ⚠️ Exceeds spec scope (new interface · changed signature · new behavior · new scenario) → Output `⚠️ Spec Drift`; recommend `/archi.edit <ID>`
107
-
108
- **B. Data Governance**:
109
- | Trigger | File | Action |
110
- |:---|:---|:---|
111
- | Introduces unregistered business entity · verb · shared utility | `dictionary.json` | Directly append |
112
- | Introduces unregistered error scenario | `error_codes.json` | Directly append |
113
- | [?Data] Schema changed | `data_snapshot.json` | Directly sync |
114
- </step>
60
+ Before outputting code, must run Silent Audit Loop:
61
+
62
+ **File Metadata Protection**: When modifying files under `[[__DOCS_DIR__]]`, preserve YAML Frontmatter + `## 🤖 AI Maintenance Guide` section. Forbidden to modify or delete.
63
+
64
+ **Post-Code Checks** (skip when: pure Q&A / no code changes / typo·comment·format only):
65
+
66
+ **A. Spec Drift** (when spec.md was loaded):
67
+ - ✅ Change within spec scope → No action needed
68
+ - ⚠️ Exceeds spec scope (new interface · changed signature · new behavior · new scenario) → Output `⚠️ Spec Drift`; recommend `/archi.edit <ID>`
69
+
70
+ **B. Data Governance**:
71
+ [[SUBAGENT: archi-data-sync|context: Scan changes for new business entities/error codes/Schema, incrementally sync per 03_data_governance.md rules]][[NO-SKILL: When changes introduce new business entities/error codes/Schema, execute incremental sync per `03_data_governance.md` rules.]]
115
72
  </thinking_process>
116
73
 
117
74
  <communication_style>
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Command Dispatcher & Workflow Controller. Handles /archi.start, /archi.plan, and mode transitions between Discussion, Planning, and Implementation.
2
+ description: Command Dispatcher & Workflow Controller. Handles /archi.* routing and mode transitions.
3
3
  globs: **/*
4
4
  applyTo: **/*
5
5
  alwaysApply: true
@@ -9,85 +9,87 @@ alwaysApply: true
9
9
 
10
10
  > **Role**: Mode Switcher. Default to "General Architect" mode, only load specific protocol when explicit command is detected.
11
11
 
12
- > ⛔ **STOP CHECK** — Self-check before each response; stop immediately and explain if any item is triggered:
12
+ > ⛔ **STOP CHECK** — Self-check before each response:
13
13
  > | Violation | Correct Action |
14
14
  > |:---|:---|
15
- > | Received `/archi.*` command but started executing without loading the protocol file | Stop → Load protocol file first |
16
- > | User request involves behavior change but code was modified directly | Stop → Route to the appropriate command |
17
- > | Ran a Terminal Gate command without confirming working directory (see `04_cli_tools.md`) | Stop → Pass Working Directory Gate first |
15
+ > | Received `/archi.*` but started executing without loading protocol file | Stop → Load protocol file first |
16
+ > | User request involves behavior change but code was modified directly | Stop → Load and execute the corresponding protocol |
17
+ > | Ran `npx archi` without confirming working directory | Stop → Pass Working Directory Gate (see `04_cli_tools.md`) |
18
18
 
19
19
  ## 1. Explicit Command Routing
20
20
 
21
- **Trigger**: When user input starts with `/archi.`, immediately load the corresponding protocol template.
21
+ **Trigger**: When user input starts with `/archi.`, immediately load the corresponding protocol.
22
22
 
23
- | Command | Target Template | Action |
24
- |:---|:---|:---|
25
- | `/archi.start` | `[[__DOCS_DIR__]]/prompts/start.md` | Load CPO → Project Initiation |
26
- | `/archi.inherit` | `[[__DOCS_DIR__]]/prompts/inherit.md` | Load Legacy Analyst → Reverse Engineering |
27
- | `/archi.scope` | `[[__DOCS_DIR__]]/prompts/scope.md` | Load Strategist → Requirement Decomposition |
28
- | `/archi.plan` | `[[__DOCS_DIR__]]/prompts/plan.md` | Load Planner → Deep Interview |
29
- | `/archi.edit` | `[[__DOCS_DIR__]]/prompts/edit.md` | Load Editor → Spec Modification |
30
- | `/archi.revise` | `[[__DOCS_DIR__]]/prompts/revise.md` | Load Chief Architect → Global Revision |
31
- | `/archi.code` | `[[__DOCS_DIR__]]/prompts/code.md` | Load Developer → Coding & Auditing |
32
- | `/archi.audit` | `[[__DOCS_DIR__]]/prompts/audit.md` | Load Chief Auditor → Deep Code Audit |
33
- | `/archi.fix` | `[[__DOCS_DIR__]]/prompts/fix.md` | Load Debugger → Diagnosis |
34
- | `/archi.map` | `[[__DOCS_DIR__]]/prompts/map.md` | Load Surveyor → Map Refresh |
35
- | `/archi.remove` | `[[__DOCS_DIR__]]/prompts/remove.md` | Load Surgeon → Task Decommission |
36
- | `/archi.help` | `[[__DOCS_DIR__]]/prompts/help.md` | Load Manual → Display Guide |
37
-
38
- > **Protocol Load Gate** (forbidden to skip; three steps must complete in order):
39
- > 1. **Read** target `.md` full text → if file not found, stop and output: `Protocol file not found, execution aborted`
40
- > 2. **Override** `00_system` partial settings
23
+ | Command | Target Template |
24
+ |:---|:---|
25
+ | `/archi.start` | `[[__PROMPTS_PATH__]]/archi.start.md` |
26
+ | `/archi.inherit` | `[[__PROMPTS_PATH__]]/archi.inherit.md` |
27
+ | `/archi.scope` | `[[__PROMPTS_PATH__]]/archi.scope.md` |
28
+ | `/archi.plan` | `[[__PROMPTS_PATH__]]/archi.plan.md` |
29
+ | `/archi.edit` | `[[__PROMPTS_PATH__]]/archi.edit.md` |
30
+ | `/archi.revise` | `[[__PROMPTS_PATH__]]/archi.revise.md` |
31
+ | `/archi.code` | `[[__PROMPTS_PATH__]]/archi.code.md` |
32
+ | `/archi.audit` | `[[__PROMPTS_PATH__]]/archi.audit.md` |
33
+ | `/archi.fix` | `[[__PROMPTS_PATH__]]/archi.fix.md` |
34
+ | `/archi.map` | `[[__PROMPTS_PATH__]]/archi.map.md` |
35
+ | `/archi.remove` | `[[__PROMPTS_PATH__]]/archi.remove.md` |
36
+ | `/archi.ref` | `[[__PROMPTS_PATH__]]/archi.ref.md` |
37
+ | `/archi.recover` | `[[__PROMPTS_PATH__]]/archi.recover.md` |
38
+ | `/archi.help` | `[[__PROMPTS_PATH__]]/archi.help.md` |
39
+
40
+ > **Protocol Load Gate** (forbidden to skip, complete in order):
41
+ > 1. **Read** target `.md` full text → if file not found, stop: `Protocol file not found, execution aborted`
42
+ > 2. **Override** — May override: `<system_role>`, `<thinking_process>`, `<communication_style>`. Cannot override: `<core_philosophy>`, `<critical_protocols>`.
41
43
  > 3. **Execute** `<step_1>` — forbidden to execute any protocol content before step 1 is complete
42
44
 
43
45
  ---
44
46
 
45
- ## 2. Natural Language Passthrough
46
-
47
- **Trigger**: User input is not `/archi.` command text.
47
+ ## 2. Natural Language Dispatch
48
48
 
49
- ### 2.1 Intent Detection
49
+ **Trigger**: User input is not an `/archi.` command and involves business changes.
50
50
 
51
- **Role**: Intelligent Dispatcher. Detect user intent and decide to execute directly or route to a command based on impact level.
52
-
53
- **Decision Criterion**: Does this change affect documented behavior (interfaces/logic/scenarios in spec.md, interactions/structure in ui.md, implementation steps in plan.json)?
51
+ ### §2.0 Non-protocol scenarios (answer directly)
54
52
 
55
53
  | Intent Type | Action |
56
54
  |:---|:---|
57
- | Pure conversation / code reading / architecture discussion | ✅ Answer directly, enhanced by base rules |
55
+ | Pure conversation / code reading / architecture discussion | ✅ Answer directly |
58
56
  | Trivial edits (typo/comments/formatting/log messages) | ✅ Execute directly |
59
- | Behavior change (logic/interface/type/UI) | 🔀 Route → `/archi.edit` + `/archi.code` |
60
- | Bug fix | 🔀 Route → `/archi.fix` |
61
- | New feature | 🔀 Route → `/archi.scope` or `/archi.plan` |
62
- | Large-scale refactoring | 🔀 Route → `/archi.revise` |
63
57
 
64
- ### 2.2 Guided Dispatch
58
+ ### §2.1 Pre-flight (triggered when business changes are involved)
65
59
 
66
- When routing (🔀), must:
67
- 1. Explain in one sentence why a command is needed (which document would be affected)
68
- 2. Recommend the specific command + parameters
69
- 3. Ask the user whether to proceed
60
+ 1. Scan `roadmap.json` + `tasks/<ID>_*/` directory to match user intent to tasks.
61
+ 2. Determine protocol to load per the table below:
70
62
 
71
- > **Prohibited**: Modifying code first and then suggesting the command as an afterthought. Violations require reverting the change and re-routing.
63
+ | Check Result | Load Protocol | Confirmation |
64
+ |:---|:---|:---|
65
+ | No matching task in roadmap | `scope.md` | Inform "Let me help you scope this" then start |
66
+ | Has task · no spec.md | `plan.md` | Inform "This task needs planning, I'll do it" then start |
67
+ | Has spec+plan · status=active | `code.md` | Start directly (IDE native plan mode drives rhythm) |
68
+ | status=done · user wants changes | `edit.md` | Inform "I'll update docs before changing code" then start |
69
+ | User describes abnormal behavior | `fix.md` | Start diagnosis directly |
70
+ | Affects >1 task or global assets | `revise.md` | Output impact assessment first, await confirmation |
72
71
 
73
- ### 2.3 Unmanaged Code
72
+ 3. After loading protocol, follow §1 **Protocol Load Gate** (read full text → override → step_1).
74
73
 
75
- When the target of modification is not registered in `map.json` and has no corresponding Task:
76
- - Inform the user that the module is not managed
77
- - Suggest `/archi.inherit` or `/archi.scope` to bring it under management
78
- - After user confirms "temporary adjustment", proceed with direct modification
74
+ ### §2.2 Chain Continuation
79
75
 
80
- ### 2.4 Base Rules
76
+ Each protocol's Signoff Next Steps already points to the next protocol. AI must:
77
+ - Proactively suggest next step ("Spec is ready, shall we start implementing?")
78
+ - After user confirms, load next protocol and continue
81
79
 
82
- All scenarios (including routing and pure conversation) rely on the following base rules:
80
+ | Transition | Chaining Rule |
81
+ |:---|:---|
82
+ | scope → plan | May chain (after scope, ask "Want to plan the first task?") |
83
+ | plan → code | **Must await user confirmation** (spec is the most important checkpoint) |
84
+ | code → audit | Built-in (code.md step_5 already has silent audit) |
83
85
 
84
- | Layer | File | Role |
85
- |:---|:---|:---|
86
- | Core | `00_system.md` | Identity, core principles |
87
- | Tech | `02_tech_stack.md` | Tech red lines, coding standards |
88
- | Custom | `90_custom_rules.md` | Team-specific constraints |
89
- | Context | `99_context_glue.md` | Auto-associate context documents |
86
+ > **Prohibited**: Auto-chaining from plan to code without user confirmation.
87
+
88
+ ### §2.3 IDE Collaboration
89
+
90
+ Leverage IDE native capabilities (plan mode / agent mode / checkpoint) to drive execution rhythm.
91
+ Protocols define "what to do, what to check" — do not fight IDE planning/execution capabilities.
90
92
 
91
- **End of Dispatcher.**
93
+ ### §2.4 Unmanaged Code
92
94
 
93
- > Mandatory CLI execution rules: see `04_cli_tools.md`.
95
+ Target not registered in `map.json` and has no Task → **STOP & ASK**, prompt user to adopt via `/archi.inherit` or `/archi.scope`.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: AI collaboration governance rules for JSON data files. Defines read/write specs, update timing & format constraints for global data files.
3
3
  globs: "**/*.json"
4
4
  applyTo: "**/*.json"
@@ -11,14 +11,18 @@ alwaysApply: true
11
11
 
12
12
  ## 1. Data File Registry
13
13
 
14
- | File | Type | Read When | Write When |
15
- |:---|:---|:---|:---|
16
- | `roadmap.json` | Roadmap | `/archi.plan`, `/archi.code` start | `/archi.start` creates; AI direct edit or `npx archi task` updates status |
17
- | `map.json` | Architecture Map | When touching code (via context_glue) | `/archi.plan` Step 3 (global sync); `/archi.inherit` Step 3.6; `/archi.map` |
18
- | `dictionary.json` | Glossary | When generating variable names | `/archi.plan` Step 3; step_5 auto-appends after code/fix |
19
- | `design_tokens.json` | Design Tokens [?UI] | When generating UI code | `/archi.start` creates; update on design changes |
20
- | `data_snapshot.json` | Data Snapshot [?Data] | `/archi.plan` Q1 design; `/archi.code` implementation | Plan phase designs Schema; Code phase syncs actual changes |
21
- | `error_codes.json` | Error Contracts | When writing error handling | `/archi.plan` Step 3; step_5 auto-appends after code/fix |
14
+ | File | Read When | Write When |
15
+ |:---|:---|:---|
16
+ | `roadmap.json` | plan/code start | start creates; AI edit or `npx archi task` updates |
17
+ | `map.json` | When touching code (via context_glue) | plan Step 3; inherit Step 3.6; /archi.map |
18
+ | `dictionary.json` | When generating variable names | plan Step 3; code/fix step_5 auto-appends |
19
+ | `design_tokens.json` [?UI] | When generating UI code | start creates; update on design changes |
20
+ | `data_snapshot.json` [?Data] | plan design / code implementation | Plan designs Schema; Code syncs changes |
21
+ | `error_codes.json` | When writing error handling | plan Step 3; code/fix step_5 auto-appends |
22
+ | `api_snapshot.json` [?API] | When implementing endpoints | plan Step 3 registers; Code syncs |
23
+ | `env_registry.json` [?API] | When introducing config items | Code appends immediately on new env var |
24
+ | `command_api.json` [?CLI] | When implementing commands | plan Step 3 registers; Code syncs |
25
+ | `public_api.json` [?Lib] | When adding/modifying exports | plan Step 3 registers; Code syncs |
22
26
 
23
27
  ---
24
28
 
@@ -26,19 +30,19 @@ alwaysApply: true
26
30
 
27
31
  ### 2.1 Format Constraints
28
32
 
29
- - **JSON Only**: The single source of truth for global data is `.json` files. `.md` views are auto-generated by `npx archi render`; prohibited from editing `.md` views directly.
30
- - **Schema Stability**: Managed in two tiers:
31
- - **Tier 1 (Strict)**: `roadmap.json`, `plan.json` — CLI rendering/commands depend on these directly; structure is validated by Zod Schema; prohibited from changing fields arbitrarily.
32
- - **Tier 2 (Flexible)**: `dictionary.json`, `error_codes.json`, `data_snapshot.json`, `design_tokens.json`, `map.json` — Only top-level keys are validated. If existing fields cannot adequately describe what needs to be recorded, you may freely extend fields (add new keys or new properties in array items) without modifying the CLI.
33
- - **Valid JSON**: Must ensure valid JSON after writing (no trailing commas, no comments).
33
+ - **JSON Only**: `.json` is the single source of truth. `.md` views are auto-generated by `npx archi render`; forbidden to edit directly.
34
+ - **Schema Stability**:
35
+ - **Tier 1 (Strict)**: `roadmap.json`, `plan.json` — CLI depends on these; Zod Schema validated; forbidden to change arbitrarily.
36
+ - **Tier 2 (Flexible)**: All other files only validate top-level keys. **All Tier 2 files may freely extend fields (new keys / new array item properties) without CLI changes.**
37
+ - **Valid JSON**: No trailing commas, no comments.
34
38
 
35
39
  ### 2.2 Read/Write Discipline
36
40
 
37
41
  | Scenario | Rule |
38
42
  |:---|:---|
39
- | Need to consult data | Read `.json` file; prohibited from reading `.md` view (may be stale) |
40
- | Need to update Roadmap task status | Prefer `npx archi task <ID> --status <s>`; batch updates may edit JSON directly |
41
- | Need to update other data files | AI directly edits `.json` file |
43
+ | Consult data | Read `.json`; forbidden to read `.md` view (may be stale) |
44
+ | Update Roadmap status | Prefer `npx archi task <ID> --status <s>`; batch may edit JSON directly |
45
+ | Update other data | AI directly edits `.json` |
42
46
  | After updates | Run `npx archi render` to regenerate `.md` views |
43
47
 
44
48
  ---
@@ -50,47 +54,47 @@ alwaysApply: true
50
54
  - **Structure**: `phases[] → tasks[]`, each task must have `id`, `title`, `status`, `deps`.
51
55
  - **Status values**: `pending` | `active` | `done` | `blocked`.
52
56
  - **Dependency integrity**: IDs in `deps` must exist in tasks.
53
- - **Slug rule**: `slug` is used for tasks folder naming, format `Snake_Case`.
57
+ - **Slug rule**: `slug` used for tasks folder naming, format `Snake_Case`.
54
58
 
55
59
  ### `map.json`
56
60
 
57
- - **Directory Mapping**: Must reflect the real physical file tree.
61
+ - **Directory Mapping**: Must reflect real physical file tree.
58
62
  - **Logical Topology**: Must register each Task Module's responsibility.
59
- - **Feature Relations** (field `featureRelations`): Records linkage relationships between aggregator tasks and their sources. Each entry: `{ aggregator, sources, evidence, checkNote }`. Written by AI during `/archi.plan` (when planning an aggregator task) or `/archi.inherit` (during reverse scanning); no manual maintenance needed.
60
- - **Self-Correction**: If code references violate the hierarchy defined in topology, must report error and stop generation.
61
- - **Extensible**: If existing fields cannot adequately describe the project architecture, you may add fields to items (e.g. `tags`, `owner`) or add new top-level keys.
63
+ - **Feature Relations**: `featureRelations` records aggregator-source linkages, written by AI during plan/inherit.
64
+ - **Self-Correction**: Code references violating topology hierarchy must report error and stop.
62
65
 
63
66
  ### `dictionary.json`
64
67
 
65
- - **Naming Authority**: This file is the supreme law of naming.
66
- - **Boundary**: Only register **project business domain** content. Architext framework concepts (scripts, scaffold, roadmap, plan, etc.) are prohibited from registration.
67
- - **entities**: Must consult `entities[].codeName` before generating variable names; prohibited from using words in `forbiddenSynonyms`.
68
- - **verbs**: Business action naming must consult `verbs[].codeName` for project-wide verb consistency.
69
- - **utilities**: Shared tools (e.g. logger, AppError, fetchClient) must be registered; AI must use registered utilities instead of raw APIs (refer to `replaces` field).
70
- - **components** [?UI]: Must search existing components before creating new ones; prioritize reuse.
71
- - **Extensible**: If existing fields cannot adequately describe a term/tool, you may add fields to array items (e.g. `tags`, `scope`, `deprecated`) or add new top-level arrays (e.g. `enums`, `constants`).
68
+ - **Naming Authority**: `entities[].codeName` is the supreme law; forbidden to use `forbiddenSynonyms`.
69
+ - **Boundary**: Only register project business domain; Architext framework concepts forbidden.
70
+ - verbs maintain project-wide verb consistency; utilities must be registered and used instead of raw APIs.
71
+ - [?UI]: components search existing before creating new ones.
72
72
 
73
73
  ### `design_tokens.json` [?UI]
74
74
 
75
- - **Token Only**: Styles must strictly use Tokens; prohibited from hardcoding Hex/px/rem.
75
+ - **Token Only**: Styles must use Tokens; forbidden to hardcode Hex/px/rem.
76
76
  - **Dark Mode**: Must define both `light` and `dark` values.
77
- - **Extensible**: If existing Token structure cannot cover project needs (e.g. `motion`, `breakpoints`, `z-index`), you may add new properties freely.
78
77
 
79
78
  ### `data_snapshot.json` [?Data]
80
79
 
81
- - **Structure**: `models[]` (name, fields, types, constraints) + `relationships[]` (inter-model relations: 1:1/1:N/M:N/self-ref).
82
- - **Design First**: Plan phase must define model structure and field types; prohibited from writing "TBD"; must be precise to field names and types.
83
- - **Sync Back**: After Code phase completion, must sync actual changes back to this file.
84
- - **Extensible**: If existing fields cannot adequately describe data models (e.g. need to record `indexes`, `triggers`, `seedData`), you may add fields to model items or at the top level.
80
+ - **Structure**: `models[]` (name/fields/types/constraints) + `relationships[]` (1:1/1:N/M:N/self-ref).
81
+ - **Design First**: Plan must define model structure, precise to field names and types; forbidden to write "TBD".
82
+ - **Sync Back**: After Code phase, must sync actual changes back.
85
83
 
86
84
  ### `error_codes.json`
87
85
 
88
- - **Boundary**: Only register **project business domain** errors. Framework infrastructure errors (scripts/validate, dev-up, dev-reset, etc.) are handled by scripts themselves via exit code + stderr; prohibited from registration here.
89
- - **Structure**: `protocolMapping [?API]` (status code → behavior mapping) + `businessErrors` (business error registry).
90
- - **Code Format**: `ERR_[MODULE]_[REASON]` (e.g. `ERR_AUTH_INVALID_TOKEN`).
91
- - **statusCode**: Fill per project type (HTTP status / Exit code / leave empty).
92
- - **Design Before Code**: Must register error codes here before writing error handling code, including `message` and `recovery`.
93
- - **Extensible**: If existing fields cannot adequately describe error info (e.g. need to record `severity`, `retryable`, `httpBody`), you may add fields to items freely.
86
+ - **Boundary**: Only register project business domain errors; framework infrastructure errors forbidden.
87
+ - **Code Format**: `ERR_[MODULE]_[REASON]`.
88
+ - **Design Before Code**: Must register error codes before writing error handling, including `message` and `recovery`.
89
+
90
+ ### Conditional File Rules
91
+
92
+ | File | Core Rules |
93
+ |:---|:---|
94
+ | `api_snapshot.json` [?API] | endpoints[] registry; Register First — forbidden to implement unregistered endpoints; owner marks Task ID |
95
+ | `env_registry.json` [?API] | Register on introduce; required/example mandatory |
96
+ | `command_api.json` [?CLI] | Sync on modify; owner marks Task ID |
97
+ | `public_api.json` [?Lib] | stable changes require /archi.edit; full TS signature; owner marks Task ID |
94
98
 
95
99
  ---
96
100
 
@@ -99,4 +103,4 @@ alwaysApply: true
99
103
  - **Location**: `tasks/<ID>_<Slug>/plan.json`
100
104
  - **Checkbox Updates**: AI sets `done` to `true` directly after completing steps during `/archi.code`.
101
105
  - **Append Rule**: `/archi.edit` appends new Phases while preserving completed history.
102
- - **Verification**: Run `npx archi plan <ID>` to verify completion after finishing.
106
+ - **Verification**: Run `npx archi plan <ID>` to verify completion.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: archi-data-sync
3
+ type: reviewer
4
+ description: Data governance sync executor. In isolated context, scans main Agent output, compares with global data file state, performs incremental sync per 03_data_governance.md rules, returns change Diff.
5
+ ---
6
+
7
+ # Data Governance Sync Executor
8
+
9
+ ## System Flow Position
10
+
11
+ ```
12
+ /archi.* step_N → Verify phase
13
+
14
+ [This Skill] scans output → compare global files → incremental sync → return Diff
15
+
16
+ Main Agent Signoff (confirm Diff)
17
+ ```
18
+
19
+ > **Skill responsibility boundary**:
20
+ > - Responsible: Scan main Agent output for new business entities/error codes/Schema, compare with global data files, perform incremental sync
21
+ > - Not responsible: Modify `03_data_governance.md` itself (this Skill enforces rules, does not define them)
22
+ > - Not responsible: Register framework concepts (Architext framework concepts must not be registered to global data files)
23
+
24
+ ---
25
+
26
+ ## Authoritative Rule Source
27
+
28
+ `03_data_governance.md` is the single authoritative source for data governance. All behavior of this Skill must align with that file.
29
+
30
+ ---
31
+
32
+ ## Sync Scope
33
+
34
+ | Global file | Sync content | Trigger |
35
+ |:---|:---|:---|
36
+ | `dictionary.json` | New business entities · actions · shared tools · public components | Output contains unregistered business terms or tools |
37
+ | `error_codes.json` | New business error codes | Output contains unregistered error scenarios |
38
+ | [?Data] `data_snapshot.json` | Schema changes | Output has data model add/modify |
39
+ | [?API] `api_snapshot.json` | New endpoints | Output has new HTTP/RPC endpoints |
40
+ | [?API] `env_registry.json` | New env vars | Output introduces new `process.env.X` |
41
+ | [?CLI] `command_api.json` | New commands | Output has new CLI commands |
42
+ | [?Lib] `public_api.json` | New public exports | Output has new public exports |
43
+
44
+ ---
45
+
46
+ ## Execution Protocol
47
+
48
+ 1. **Read global data files**: Load global files matching project features from table above
49
+ 2. **Scan main Agent output**: Identify new business entities, error codes, Schema, endpoints, etc.
50
+ 3. **Boundary check**: Do not register framework concepts (scripts, scaffold, roadmap, plan, etc.); sync only project business domain content
51
+ 4. **Deduplication**: Compare with existing entries, avoid duplicate registration
52
+ 5. **Incremental sync**: Append/modify only, do not delete existing entries
53
+ 6. **Output change Diff**
54
+
55
+ ### Hard Boundaries
56
+
57
+ - **No direct append** — Must check existing content boundary before write, avoid duplicates or conflicts
58
+ - **No framework concept registration** — Sync only project business domain content
59
+ - **No modify `03_data_governance.md`** — This Skill enforces rules, does not define them
60
+
61
+ ### Output Format
62
+
63
+ ```
64
+ ### Data Sync Results
65
+
66
+ ADDED:
67
+ - dictionary.json: entities += [new entity names]
68
+ - error_codes.json: businessErrors += [ERR_CODE]
69
+
70
+ MODIFIED:
71
+ - data_snapshot.json: models.User += [new fields]
72
+
73
+ NO CHANGE:
74
+ - [files with no sync needed]
75
+
76
+ **Summary**: X files changed / Y added / Z modified
77
+ ```
78
+
79
+ When no sync needed: `### Data Sync Results — NO CHANGES`
80
+
81
+ ---
82
+
83
+ > **Intermediate output**: This Skill is a review subprogram; after producing change Diff, control returns to caller.