architext 0.0.4 → 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 (56) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README.md +84 -7
  3. package/README.zh-CN.md +84 -7
  4. package/dist/index.js +38 -38
  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/prompts/audit.md +80 -94
  8. package/dist/templates/en/docs/prompts/code.md +87 -89
  9. package/dist/templates/en/docs/prompts/edit.md +47 -51
  10. package/dist/templates/en/docs/prompts/fix.md +49 -42
  11. package/dist/templates/en/docs/prompts/help.md +23 -31
  12. package/dist/templates/en/docs/prompts/inherit.md +91 -116
  13. package/dist/templates/en/docs/prompts/map.md +47 -69
  14. package/dist/templates/en/docs/prompts/plan.md +134 -239
  15. package/dist/templates/en/docs/prompts/recover.md +19 -34
  16. package/dist/templates/en/docs/prompts/ref.md +43 -138
  17. package/dist/templates/en/docs/prompts/remove.md +55 -107
  18. package/dist/templates/en/docs/prompts/revise.md +63 -106
  19. package/dist/templates/en/docs/prompts/scope.md +77 -117
  20. package/dist/templates/en/docs/prompts/start.md +89 -129
  21. package/dist/templates/en/rules/00_system.md +36 -79
  22. package/dist/templates/en/rules/01_workflow.md +59 -57
  23. package/dist/templates/en/rules/03_data_governance.md +46 -42
  24. package/dist/templates/en/skills/archi-data-sync/SKILL.md +12 -12
  25. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +3 -34
  26. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +1 -0
  27. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +4 -4
  28. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -1
  29. package/dist/templates/en/skills/archi-plan-options/SKILL.md +4 -3
  30. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +20 -20
  31. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
  32. package/dist/templates/zh/briefs/_base.md +44 -12
  33. package/dist/templates/zh/briefs/_modules.md +27 -0
  34. package/dist/templates/zh/docs/prompts/audit.md +42 -56
  35. package/dist/templates/zh/docs/prompts/code.md +47 -49
  36. package/dist/templates/zh/docs/prompts/edit.md +38 -42
  37. package/dist/templates/zh/docs/prompts/fix.md +30 -29
  38. package/dist/templates/zh/docs/prompts/help.md +13 -21
  39. package/dist/templates/zh/docs/prompts/inherit.md +59 -83
  40. package/dist/templates/zh/docs/prompts/map.md +24 -47
  41. package/dist/templates/zh/docs/prompts/plan.md +92 -197
  42. package/dist/templates/zh/docs/prompts/recover.md +9 -24
  43. package/dist/templates/zh/docs/prompts/ref.md +11 -106
  44. package/dist/templates/zh/docs/prompts/remove.md +31 -71
  45. package/dist/templates/zh/docs/prompts/revise.md +37 -86
  46. package/dist/templates/zh/docs/prompts/scope.md +51 -91
  47. package/dist/templates/zh/docs/prompts/start.md +67 -106
  48. package/dist/templates/zh/rules/00_system.md +18 -91
  49. package/dist/templates/zh/rules/01_workflow.md +60 -59
  50. package/dist/templates/zh/rules/03_data_governance.md +41 -68
  51. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +2 -33
  52. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +1 -0
  53. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
  54. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +1 -0
  55. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
  56. package/package.json +1 -1
@@ -1,153 +1,151 @@
1
1
  <protocol_code>
2
- **Trigger**: `/archi.code <id>`
3
- **Goal**: Based on the `tasks/<id>_<Slug>/plan.json` task list, complete task implementation; follow `02_tech_stack.md` ([?UI] also follow `design_tokens.json`); pass build, type check, lint, formatting, test and audit.
2
+ **Trigger**: `/archi.code <id>` | Auto-loaded by Workflow Dispatch on natural language trigger
3
+ **Goal**: Complete feature development per `tasks/<id>_<Slug>/plan.json` task list; follow `02_tech_stack.md` (UI projects only: also follow `design_tokens.json`); pass build, types, Lint, format, tests and audit.
4
4
 
5
5
  <meta>
6
6
  <style>Deterministic, Type-Safe, SOTA-First</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Frontmatter Preservation**: Prohibited from modifying existing files' YAML Frontmatter.
10
- 2. **Follow Conventions**: Use only existing repo libraries and patterns; read before modify.
11
- 3. **Security First**: Prohibit introducing/printing secrets; sensitive info must not be written to disk.
12
- 4. **SOTA Pattern Check**: Reject outdated practices; adopt best practices defined in tech_stack.
9
+ 1. **Frontmatter Preservation**: Do not change existing files' YAML Frontmatter.
10
+ 2. **Follow Conventions**: Use only repo-existing libs and patterns; read before modify.
11
+ 3. **Security First**: Do not introduce/print secrets; sensitive info must not be persisted.
12
+ 4. **SOTA Pattern Check**: Reject outdated patterns; use tech_stack defined best practices.
13
13
  5. **No Commit Policy**: Do not commit without authorization; present changes as patches.
14
- 6. **Static Check First**: Must pass all static checks (Type/Lint/Format).
15
- 7. **Plan Completion Gate**: Verify Plan completion before signing off. All AI-completable tasks must be finished; only "Human Intervention" and "Force Majeure" are exempt.
14
+ 6. **Static Check First**: Must pass all static checks (types/Lint/format).
15
+ 7. **Plan Completion Gate**: Verify Plan completion before finish. All tasks AI can complete must be done; only exempt "manual intervention" and "force majeure".
16
+ 8. **IDE-Native First**: Leverage IDE native capabilities to drive execution rhythm; this protocol defines quality standards and checkpoints, not fight IDE planning/execution mechanisms.
16
17
  </principles>
17
18
  </meta>
18
19
 
19
20
  <step_1_resolve>
20
- **Role**: System Analyst
21
21
  **Action**:
22
- 1. **Resolve ID**: Parse `<id>` → Task Name, Slug, phase/status from `[[__DOCS_DIR__]]/global/roadmap.json`.
23
- 2. **Status Gate** — Only `active` can enter code workflow:
22
+ 1. **Resolve ID**: Parse `<id>` from roadmap.json → Task Name, Slug, phase/status.
23
+ 2. **Status Gate** — only `active` may enter code flow:
24
24
 
25
25
  | Status | Handling |
26
26
  |:---|:---|
27
27
  | `active` | Pass, continue |
28
28
  | `pending` | Reject — prompt to run `/archi.plan <ID>` first |
29
- | `blocked` | Reject — prerequisites not completed |
30
- | `done` | Reject — already completed, use `/archi.edit <ID>` for modifications |
31
-
32
- 3. **Load Context** (Use Roadmap `📁 Slug` to locate):
33
- - `[[__DOCS_DIR__]]/tasks/<id>_<Slug>/spec.md` — Logic & Scenarios
34
- - `[[__DOCS_DIR__]]/tasks/<id>_<Slug>/ui.md` task UI scope declaration (if exists)
35
- - [?Complex] `[[__DOCS_DIR__]]/tasks/<id>_<Slug>/design.md` — Technical design (if exists): state machine/pipeline/protocol definitions, parameter table, invariants
36
- - [?UI] `[[__DOCS_DIR__]]/global/ui_context.md` — AI screen index (screen IDs / routes / states / navigation graph / shared components)
37
- - [?UI] `[[__DOCS_DIR__]]/global/ui_concept.html` — read-only visual reference (calibrate layout against this during implementation; do not redesign — design is already locked in ui.md)
38
- - `[[__DOCS_DIR__]]/tasks/<id>_<Slug>/plan.json` — Task breakdown (contains `notes` shorthand; must reference during execution)
39
- - `02_tech_stack.md` — Technical Red Lines
40
- - [?UI] `[[__DOCS_DIR__]]/global/design_tokens.json`
41
- - [?Data] `[[__DOCS_DIR__]]/global/data_snapshot.json`
42
- - **Read Refs** (if any): Read `[[__DOCS_DIR__]]/refs/index.json` (if exists); match by tags and spec.md tech domain semantics; load only matched ref files as supplementary context; skip if `refs/` missing or empty.
43
-
44
- **Output**: Atomic list of tasks to implement, marking dependencies and order.
29
+ | `blocked` | Reject — upstream deps incomplete |
30
+ | `done` | Reject — already done; use `/archi.edit <ID>` for changes |
31
+
32
+ 3. **Load**: task docs (spec/ui/design/plan) + project context (tech_stack/design_tokens/data_snapshot/ui_context/ui_concept) + refs (match by tags; load only matched files).
33
+
34
+ **Output**: Atomic task list to implement with dependencies and order.
45
35
  </step_1_resolve>
46
36
 
47
37
  <step_2_plan>
48
- **Role**: Tech Lead
49
38
  **Action**:
50
- Generate execution blueprint (dynamically adjusted by project type):
51
- - **Phase A (Domain/Data/API)**: Data models/interfaces/validation
52
- - **Phase B (UI/Presentation)**: Component structure/styling (use Design Tokens only); non-UI projects adjust to corresponding presentation layer
53
- - **Phase C (Integration)**: End-to-end wiring (state management, routing, data flow, error handling)
39
+ Generate execution blueprint (adjust by project type):
40
+ - **Phase A (Domain/Data/API)**: Data models / interfaces / validation
41
+ - **Phase B (UI/Presentation)**: Component structure / styles (Design Tokens only); non-UI projects adjust to corresponding presentation layer
42
+ - **Phase C (Integration)**: End-to-end wiring (state, routing, data flow, error handling)
54
43
 
55
- Write completion criteria for each task: static checks passed, tests passed, compliant with tech_stack specs.
44
+ Each task must have completion criteria: static checks pass, tests pass, comply with tech_stack.
56
45
 
57
- **Output**: Implementation-oriented atomic task list (Checkbox).
46
+ **Output**: Atomic task list for implementation (Checkbox).
58
47
  </step_2_plan>
59
48
 
60
49
  <step_3_implement>
61
- **Role**: Senior Engineer
62
50
  **Protocol**:
63
- - **Read First**: Must read target file before modification; follow existing code style.
64
- - **Use Existing Stack**: Use only technologies and libraries declared in `02_tech_stack.md`.
65
- - [?UI] **Design Tokens Only**: Styles strictly use visual patterns defined by Tokens/Presets; prohibited hardcoding magic values (colors, sizes, spacing, etc.).
66
- - **Type-Safe**: Complete type definitions; use the project tech stack's type system to guard boundaries.
67
- - **Code Organization**: Follow the architecture pattern and file placement strategy defined in `02_tech_stack.md`.
68
- - **Comments**: Explain Why, not What; reject nonsense comments.
69
- - **Naming**: Self-documenting names; reject `a`, `b`, `tmp` etc. (except loop variable `i`).
70
- - [?Complex] **Design Adherence**: When `design.md` exists, implementation must strictly follow its state machine/pipeline/protocol definitions; parameters must reference design.md § 3 values (no hardcoding other values); must satisfy all § 4 Invariants (use assert or runtime checks).
71
- - **Error Handling**: Prohibit swallowing errors/silent failures; must properly propagate errors and provide observable feedback to callers (UI: Toast; CLI: Exit Code; API: Status Code + Body).
72
- - **Robustness**: Explicitly handle edge cases (Loading/Error/Empty/Timeout); prohibit writing only Happy Path.
51
+ - **Read First**: Must read target file before modify; follow existing project code style.
52
+ - **Use Existing Stack**: Use only tech and libs declared in `02_tech_stack.md`.
53
+ - (When this task involves UI) **Design Tokens Only**: Styles strictly use Token/Preset; no hardcoded magic values.
54
+ - **Type-Safe**: Complete type definitions; use project type system to guard boundaries.
55
+ - **Code Organization**: Follow `02_tech_stack.md` architecture and file placement.
56
+ - **Comments**: Explain Why, not What.
57
+ - **Naming**: Self-explanatory names; no meaningless names.
58
+ - Complex tasks only: **Design Adherence**: When `design.md` exists, implementation must strictly follow its state machine/pipeline/protocol; params reference § 3 values; must satisfy all § 4 Invariants.
59
+ - **Error Handling**: No swallowing/silent failure; propagate and give callers observable feedback.
60
+ - **Robustness**: Explicitly handle boundaries (Loading/Error/Empty/Timeout); no Happy Path only.
73
61
  - **SOTA**: Follow tech_stack best practices; reject explicitly forbidden outdated patterns.
74
- - **Scaffold Safety**: Scaffolds in non-empty directories may overwrite files — must generate in new directory and protect `[[__DOCS_DIR__]]/`; delete/overwrite operations must list manifest and confirm first.
75
- - **.gitkeep Cleanup**: Empty dirs may use `.gitkeep` for Git tracking; when adding other files to a dir, must remove that dir's `.gitkeep`.
76
- - **Patch Output**: Output changes as patches, with Code References.
77
- - **Progress Tracking**: After completing each task, immediately update the corresponding task's `done: true` in `plan.json`; prohibited from batch-updating at signoff (progress will be lost if session is interrupted).
62
+ - **Scaffold Safety**: Non-empty dirs must protect `[[__DOCS_DIR__]]/`.
63
+ - **.gitkeep Cleanup**: Remove `.gitkeep` when adding files to dir.
64
+ - **Patch Output**: Output changes as patches with Code Reference.
65
+ - **Progress Tracking**: After each task, update `plan.json` corresponding `done: true` immediately; do not batch at signoff.
78
66
 
79
- **Action**: Implement Phase A/B/C step by step; produce complete, production-quality code (with necessary tests); new files/directories must align with tech_stack.
67
+ **Action**: Implement phase A/B/C item by item; produce complete, production-ready code (including necessary tests).
80
68
  </step_3_implement>
81
69
 
82
70
  <step_4_validate>
83
- **Role**: Validation Engineer
84
- **Action** (Fix and re-run on failure; commands subject to `02_tech_stack.md` Section 5):
71
+ **Action** (on failure fix and re-run; commands per `02_tech_stack.md` Section 5):
85
72
 
86
- **Automated Check**: Run `[[__DOCS_DIR__]]/scripts/validate` (if exists); otherwise execute the checklist below manually.
73
+ **Automated Check**: Run `[[__DOCS_DIR__]]/scripts/validate` (if exists); otherwise execute checklist:
87
74
 
88
- | Phase | Check Item | Requirement |
75
+ | Phase | Check | Requirement |
89
76
  |:---|:---|:---|
90
- | **Static** | Build | Zero compilation errors |
77
+ | **Static** | Build | Zero compile errors |
91
78
  | | Type Check | Zero type errors |
92
- | | Lint | Zero lint errors (warnings must explain reason) |
93
- | | Format | Compliant with format rules (if failed, auto-fix then re-check) |
94
- | **Test** | Existing Tests | Run existing test suite, all pass; must not break existing tests |
95
- | | New Coverage | Add tests for newly added/modified critical logic; pure styling exempt |
79
+ | | Lint | Zero Lint errors (warnings require reason) |
80
+ | | Format | Compliant (auto-fix then re-check if fail) |
81
+ | **Test** | Existing Tests | All pass; do not break old tests |
82
+ | | New Coverage | Add tests for new/modified critical logic |
96
83
 
97
- **Task Verification (Mandatory)**
84
+ **Task Verification (mandatory)**
98
85
 
99
- > Prohibited from marking complete via code review or automated tests alone; must actually run and verify the target task.
100
- > If dev server is not running, execute `[[__DOCS_DIR__]]/scripts/dev-up` first.
101
- > **Read `notes.Verify` first**: Read the `Verify: [...]` portion at the end of the current task's `notes` field and use that operation as the concrete e2e step. Fall back to the table below only if the `notes` field has no `Verify` entry.
86
+ > Do not mark complete by code review only; must actually run target feature and verify.
87
+ > **Prefer `notes.验证`**: First read current task `notes` end `Verify: [...]` and run e2e; fallback to table by type when no verify field.
102
88
 
103
89
  | Project Type | Verification Action | Pass Criteria |
104
90
  |:---|:---|:---|
105
- | [?Web] | Browser-navigate target task path | Renders correctly, no interaction errors, clean console |
106
- | [?API] | Call new/modified endpoints | Status code and body match spec |
107
- | [?CLI] | Execute target command (normal args + edge cases) | stdout as expected, correct exit code |
108
- | [?Lib] | Run example code or playground to verify exported API | No runtime errors, correct return values |
109
- | [?Mobile] | Emulator/device operate target task | UI renders, interactions respond |
110
- | [?Desktop] | Launch app operate target task | Window renders, task functional |
91
+ | When this task involves UI | Browser: operate target feature path | Render OK, interaction no errors |
92
+ | When this task involves API | Call new/modified endpoint | Status and Body match spec |
93
+ | When this task involves CLI | Execute target command (normal + edge params) | stdout expected, exit code correct |
94
+ | When this task involves lib | Run sample code to verify exported API | No runtime error, return correct |
95
+ | When this task involves mobile | Simulator/device: operate | UI OK, interaction responsive |
96
+ | When this task involves desktop | Launch app and operate | Window OK, feature works |
111
97
 
112
- **Evidence**: Output must include verification results (command output summary / screenshot / error log).
113
- **Fallback**: If verification keeps failing and environment issues suspected → `[[__DOCS_DIR__]]/scripts/dev-reset` → `[[__DOCS_DIR__]]/scripts/dev-up` → retry.
98
+ **Evidence**: Attach verification result (command output summary / screenshot / error log).
99
+ **Fallback**: If verification keeps failing → `scripts/dev-reset` → `scripts/dev-up` → retry.
114
100
 
115
- **Output**: ✅/❌ status and reason for each check; Task Verification evidence.
101
+ **Output**: Each check ✅/❌ status and reason; Task Verification evidence.
116
102
  </step_4_validate>
117
103
 
118
104
  <step_5_verify>
119
105
  **Role**: Independent Reviewer
120
106
 
121
107
  **5A. Code quality review**:
122
- [[SUBAGENT: archi-silent-audit|mode: code-impl, context: Review step_3 implemented code (Tech/SOTA/Security/Performance + conditional dimensions)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: code-impl review dimension table item by item)]]
108
+ [[SUBAGENT: archi-silent-audit|mode: code-impl, context: Review step_3 implemented code (Tech/SOTA/Security/Performance + conditional dimensions)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: code-impl review dimension table)]]
123
109
 
124
110
  **5B. Linkage check**:
125
- [[SUBAGENT: archi-feature-relations|mode: check, context: Semantically compare this implementation with featureRelations sources]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: check logic)]]
111
+ [[SUBAGENT: archi-feature-relations|mode: check, context: Compare implemented feature with featureRelations sources semantically]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: check logic)]]
126
112
 
127
113
  **5C. Data governance sync**:
128
- [[SUBAGENT: archi-data-sync|context: Scan this implementation for new business entities/error codes/Schema; incremental sync per 03_data_governance.md rules]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-data-sync/SKILL.md`, follow its execution protocol)]]
114
+ [[SUBAGENT: archi-data-sync|context: Scan new business entities/error codes/Schema from implementation; incrementally sync per 03_data_governance.md]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-data-sync/SKILL.md` and follow its protocol)]]
129
115
 
130
116
  [[INCLUDE: shared/verify-result-handling.md]]
131
117
  </step_5_verify>
132
118
 
133
119
  <step_6_signoff>
134
- **Terminal Gate** (Do not skip; must complete before output summary):
120
+ **Terminal Gate** (do not skip):
135
121
  | Step | Command | Pass Condition |
136
122
  |:---|:---|:---|
137
- | 1 | `npx archi plan <ID>` | All done or exempt only; not passed return to step_3 |
123
+ | 1 | `npx archi plan <ID>` | All complete or exempt only; if fail do not sign off, return to step_3 |
138
124
  | 2 | `npx archi task <ID> --status done` | Task status updated |
139
- | 3 | `npx archi task --check` | No ERROR-level issues |
140
- | 4 | `npx archi render` | `.md` views generated |
141
-
142
- **Action** (After Gate passes):
143
- 1. Confirm all task `done` marks in `plan.json` are updated (should be done in real-time during step_3; this is a final check).
144
- 2. **Drift Warning**: Compare code changes against `spec.md`'s key checkpoints (interface signatures, return types, key operations in Gherkin scenarios). If code exceeds spec coverage → mark `⚠️ Spec Drift`, suggest running `/archi.edit <ID>` to sync docs.
145
- 3. Output completed task list with patch links (Code Reference).
146
- 4. Provide next step suggestions and Git Commit Suggestion (Conventional Commits).
147
-
148
- **Checkpoint** (Confirm before Output): Terminal Gate all executed
149
-
150
- **Output**: Completion summary with completed tasks, exempt items (if any), Git Commit suggestion, Next Steps table.
125
+ | 3 | Standard check (task --check + render) | No ERROR + views generated |
126
+
127
+ **Action** (after Gate passes):
128
+ 1. Confirm `plan.json` each task `done` flag updated.
129
+ 2. **Drift Warning**: Compare code changes with `spec.md` key points. If beyond spec coverage mark `⚠️ Spec drift`, suggest `/archi.edit <ID>`.
130
+ 3. Output completed task list and patch links.
131
+ 4. Provide next steps and Git Commit Suggestion (Conventional Commits).
132
+
133
+ **Pre-signoff Checklist** (confirm each item before Output):
134
+ plan.json every task done flag updated in real-time (not batch-updated at signoff)
135
+ □ Step 4 — Build / type check / Lint / format all passed
136
+ Step 4 Task Verification executed for each project type with Evidence attached
137
+ □ Step 5A Silent Audit — executed, all CRITICAL issues resolved
138
+ □ Step 5B featureRelations check — executed
139
+ □ Step 5C data governance sync — executed
140
+ □ Terminal Gate — npx archi plan <ID> all complete (exempt items only)
141
+
142
+ **Output**: Completion summary with completed tasks, exempt items (if any), Git Commit suggestion, Next Steps:
143
+
144
+ | Priority | Action | Notes |
145
+ |:---|:---|:---|
146
+ | Recommended | `/archi.audit <ID>` | Independent review of implementation |
147
+ | (If Spec drift) | `/archi.edit <ID>` | Update docs before continuing |
148
+ | (If next pending task) | `/archi.plan <next pending ID>` | Plan the next task |
151
149
  </step_6_signoff>
152
150
 
153
151
  </protocol_code>
@@ -1,96 +1,92 @@
1
1
  <protocol_edit>
2
- **Trigger**: `/archi.edit <id> [context]`
3
- **Goal**: Based on new requirements/feedback, update Spec/UI docs of an already managed module and append development plans.
2
+ **Trigger**: `/archi.edit <id> [context]` | Auto-loaded by Workflow Dispatch on natural language trigger
3
+ **Goal**: Update managed module's Spec/UI docs per new requirements/feedback, and append development plan.
4
4
 
5
5
  <meta>
6
6
  <style>Collaborative, Iterative, Traceable</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Doc First**: Must modify docs (Spec/UI) first, then generate Plan. Prohibited from skipping docs to change code plans directly.
10
- 2. **Incremental**: Only append new Tasks to Plan, keep completed history (unless rollback needed).
9
+ 1. **Doc First**: Must modify docs (Spec/UI) first, then generate Plan. Do not skip docs to change code plan.
10
+ 2. **Incremental**: Only append new Tasks to Plan; keep completed history (unless rollback needed).
11
11
  3. **Conflict Check**: Check if new requirements conflict with tech_stack / design_tokens.
12
- 4. **Frontmatter Preservation**: Prohibited from destroying existing document Metadata.
12
+ 4. **Frontmatter Preservation**: Do not break existing document Metadata.
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_load>
17
- **Role**: Product Manager
18
18
  **Action**:
19
- - Read `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>/` spec.md, ui.md, plan.json.
20
- - [?UI] Read `[[__DOCS_DIR__]]/global/ui_context.md` (locate the screen scope and navigation graph for this task).
21
- - Check `Spec-Status` field in spec.md:
22
- - `Full` Normal flow, proceed to step_2.
23
- - `Stub` → Proceed to step_1_5_enrich.
24
- - [?Major UX Change] Quick search for similar product best practices.
19
+ - Read spec.md, ui.md, plan.json under `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>/`.
20
+ - (UI projects only) Read ui_context.md (locate screen scope and navigation for this feature).
21
+ - Check `Spec-Status` in spec.md: `Full` → normal flow step_2 | `Stub` → step_1_5_enrich.
22
+ - (Major UX change) Quick search for similar product best practices.
25
23
  </step_1_load>
26
24
 
27
25
  <step_1_5_enrich>
28
- **Role**: Reverse Engineer
29
- **Trigger**: spec.md contains `Spec-Status: Stub` (lightweight snapshot generated by `/archi.inherit`).
26
+ **Trigger**: spec.md contains `Spec-Status: Stub` (lightweight snapshot from `/archi.inherit`).
30
27
 
31
28
  **Action**:
32
- 1. Inform user: "This task only has a lightweight snapshot. A full spec must be generated before modifications can proceed."
33
- 2. Extract source file paths from the stub's "Associated Files" section.
34
- 3. Read each associated file with medium-depth scan (entry point + core logic).
35
- 4. Enrich the stub into a full spec based on code analysis:
36
- - Preserve existing overview and key flows
37
- - Add Gherkin Scenarios (covering normal flows + exception paths)
38
- - Add interface/type definitions (if this task is upstream of others)
39
- 5. Update `Spec-Status: Stub → Full`.
40
- 6. [?UI] If module has UI → generate or update `ui.md` (scope declaration); if new screens are needed, [[SKILL: archi-ui-wireframe|invoke skill or notify user to run]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and prompt user to follow the document)]] (Skill syncs both `ui_concept.html` + `ui_context.md`).
41
- 7. Generate `plan.json` (all tasks as done, recording implemented content).
42
- 8. Present enriched spec summary to user.
43
-
44
- **Gate**: User confirms enriched content is correct before proceeding to step_2_refine_docs.
29
+ 1. Inform user: "This task has only a lightweight snapshot; must complete full spec before modification."
30
+ 2. Extract source paths from stub "Associated Files"; read each (entry + core logic).
31
+ 3. Enrich into full spec from code analysis: keep existing overview and flows; add Gherkin Scenarios + interface/type definitions.
32
+ 4. Update `Spec-Status: Stub Full`.
33
+ 5. (UI projects only) If module has UI → generate `ui.md`; if new screens needed, [[SKILL: archi-ui-wireframe|invoke skill]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md`)]].
34
+ 6. Generate `plan.json` (all tasks done).
35
+ 7. Output enriched spec summary to user.
36
+
37
+ **Gate**: Proceed to step_2_refine_docs after user confirms.
45
38
  **Exception**: Associated files missing/moved → prompt user to update paths.
46
39
  </step_1_5_enrich>
47
40
 
48
41
  <step_2_refine_docs>
49
- **Role**: Requirements Analyst & Designer
50
42
  **Action**:
51
- - Modify spec.md (logic/rule changes) and ui.md (structure/interaction changes) based on `[context]`.
52
- - [?UI Modification] [[SKILL: archi-ui-wireframe|Follow the skill protocol to sync `ui_concept.html` + `ui_context.md` (Skill is the sole writer of both files)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its protocol)]]:
43
+ - Modify spec.md and ui.md per `[context]`.
44
+ - (UI modified) [[SKILL: archi-ui-wireframe|Follow the skill protocol to sync `ui_concept.html` + `ui_context.md`]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md`)]]:
53
45
 
54
- | Change Type | Criteria | Action |
46
+ | Change Type | Criteria | Handling |
55
47
  |:---|:---|:---|
56
- | No screen impact | Logic/data only, no visual diff | Update spec.md only; `ui_concept.html` / `ui_context.md` unchanged |
57
- | Minor UI tweak | New/modified state, popup, or local area; overall layout unchanged | Call skill (Modify screens mode) to update both files; output `MODIFIED: S-XX` |
58
- | Screen structure change | Layout refactor, new standalone screen, navigation path change | Call skill (Modify screens mode) to update both files; output `MODIFIED: S-XX`; if Phase 2 coloring is done, re-color only the modified screen |
59
- | Task reduction | Screen/region removed entirely | Call skill (Remove screens mode) to update both files; output `REMOVED: S-XX` |
48
+ | No screen impact | Logic/data change only | Update spec.md only |
49
+ | Minor UI tweak | New/modified state, popup, local area | Call skill to update; output `MODIFIED: S-XX` |
50
+ | Screen structure change | Layout refactor, new screen, navigation change | Call skill to update |
51
+ | Task reduction | Screen/region removed entirely | Call skill to remove; output `REMOVED: S-XX` |
60
52
 
61
- - Ask user questions (A/B/C/D options) to confirm details when requirements are vague.
53
+ - Ask user when requirements are vague.
62
54
 
63
- **Output**: Updated Spec, UI documents, and `ui_concept.html` / `ui_context.md` change summary.
55
+ **Output**: Updated docs and change summary.
64
56
  </step_2_refine_docs>
65
57
 
66
58
  <step_3_update_plan>
67
- **Role**: Tech Lead
68
59
  **Action**:
69
- - Append new Phase object to `plan.json` phases array.
70
- - List specific Tasks (API update, UI tweak, Test update); each must be verifiable.
71
- - **Status Transition**: If current task status=`done`, reset to `active` after appending the Phase (otherwise `/archi.code` will be rejected by the Status Gate).
60
+ - Append new Phase to `plan.json` with specific Tasks; each must be verifiable.
61
+ - **Status transition**: When status=`done`, after appending Phase must reset to `active`.
72
62
 
73
- **Terminal Gate** (Do not skip; must complete before step_3_5 starts):
63
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
74
64
  | Step | Command | Pass Condition |
75
65
  |:---|:---|:---|
76
- | 1 | `npx archi task --check` | No ERROR-level issues |
77
- | 2 | `npx archi render` | `.md` views generated |
78
- | 3 | [if current status=done] `npx archi task <ID> --status active` | Task status reset to active |
66
+ | 3 | [when status=done] `npx archi task <ID> --status active` | Status reset |
79
67
 
80
- **Output**: plan.json with new tasks appended; if status transition was performed, output `MODIFIED: roadmap.json <ID>.status done→active`.
68
+ **Output**: plan.json with new tasks appended; if status transition performed, output `MODIFIED: roadmap.json <ID>.status done→active`. Enter step_4_verify.
81
69
  </step_3_update_plan>
82
70
 
83
- <step_3_5_verify>
71
+ <step_4_verify>
84
72
  **Role**: Independent Reviewer
85
73
 
86
- [[SUBAGENT: archi-silent-audit|mode: plan-docs, context: Review step_2 updated spec.md/ui.md and step_3 appended plan.json new Phase; ensure doc logic is consistent and new Phase tasks are verifiable]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: plan-docs review dimension table item by item)]]
74
+ [[SUBAGENT: archi-silent-audit|mode: plan-docs, context: Review step_2 updated spec.md/ui.md and step_3 appended plan.json new Phase]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: plan-docs review)]]
87
75
 
88
76
  [[INCLUDE: shared/verify-result-handling.md]]
89
- </step_3_5_verify>
77
+ </step_4_verify>
78
+
79
+ <step_5_summary>
80
+ **Pre-signoff Checklist** (confirm each item before Output):
81
+ □ spec.md — updated per context, changes tracked
82
+ □ (if UI changed) ui.md + ui_concept.html + ui_context.md — synced
83
+ □ plan.json — new Phase appended (history tasks fully preserved)
84
+ □ (if original status=done) roadmap.json — status reset to active
85
+ □ Step 4 Silent Audit — executed, all CRITICAL issues resolved
86
+ □ Terminal Gate — task --check no ERROR (executed in step_3)
90
87
 
91
- <step_4_summary>
92
88
  **Action** (Gate must complete in step_3):
93
89
  **Output**: Task update summary with Spec/UI/Plan change overview and Next Steps table. Recommend running `/archi.code <ID>`.
94
- </step_4_summary>
90
+ </step_5_summary>
95
91
 
96
92
  </protocol_edit>
@@ -1,86 +1,93 @@
1
1
  <protocol_fix>
2
- **Trigger**: `/archi.fix [id] <context>`
3
- **Goal**: Diagnose Bug and execute fix directly. If `[id]` not provided, auto-locate relevant task module.
2
+ **Trigger**: `/archi.fix [id] <context>` | Auto-loaded by Workflow Dispatch on natural language trigger
3
+ **Goal**: Diagnose and fix bugs. If `[id]` not provided, auto-locate related feature module by context.
4
4
 
5
5
  <meta>
6
6
  <style>Diagnostic, Surgical, Spec-Compliant</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Spec Immutable**: Prohibited from modifying `spec.md` / `ui.md` (unless Bug itself is a documentation error).
10
- 2. **Reproduction**: Must conceive reproduction steps or test cases first.
11
- 3. **Root Cause**: Must analyze root cause, not patch the surface.
9
+ 1. **Spec Immutable**: Do not modify `spec.md` / `ui.md` (unless the bug is a doc error).
10
+ 2. **Reproduction**: Must have reproduction steps or test case first.
11
+ 3. **Root Cause**: Must analyze root cause, not patch surface.
12
12
  4. **Test-Driven**: Fix plan must include new test cases.
13
- 5. **Auto-Discovery**: If ID not specified, locate Task via Context semantic search.
13
+ 5. **Auto-Discovery**: If ID not specified, locate Task via context semantic search.
14
+ 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.
14
15
  </principles>
15
16
  </meta>
16
17
 
17
18
  <step_1_diagnose>
18
- **Role**: Fault Analyst
19
+ **Role**: Failure Analyst
19
20
  **Action**:
20
21
  1. **Resolve Target**:
21
- - Has `<id>`: Lock target `tasks/<ID>_<Slug>/`.
22
- - No `<id>`: Analyze `[context]` to search most relevant module.
23
- Unique match → Auto lock | Multiple matches → List candidates and ask | Cannot locate → Report error requesting ID.
24
- 2. Read all docs under target directory (`spec.md`, `ui.md`, `plan.json`) and related code.
25
- 3. Read `02_tech_stack.md` (ensure fix does not violate tech red lines) and `[[__DOCS_DIR__]]/global/vision.md` (ensure fix direction stays aligned with project vision).
26
- 4. Analyze `[context]`, combine with code logic to locate potential failure points.
27
- 5. **Hypothesis**: Propose 1-3 root cause hypotheses.
28
-
29
- **Output**: Root Cause Analysis report.
22
+ - With `<id>`: Lock `tasks/<ID>_<Slug>/`.
23
+ - Without `<id>`: Analyze `[context]` to find most relevant module.
24
+ Single match → auto lock | Multiple matches → list candidates and ask | Cannot locate → error, request ID.
25
+ 2. Read all docs and related code in target directory.
26
+ 3. Read 02_tech_stack.md (tech red lines) and vision.md (direction anchor).
27
+ 4. Analyze `[context]` with code logic to locate potential fault points.
28
+ 5. **Hypothesis**: Propose 13 root cause hypotheses.
29
+
30
+ **Output**: Fault diagnosis report (Root Cause Analysis).
30
31
  </step_1_diagnose>
31
32
 
32
33
  <step_2_plan_fix>
33
- **Role**: Tech Lead
34
34
  **Action**:
35
- - Update `[[__DOCS_DIR__]]/tasks/<ID>_<Slug>/plan.json`, append to `phases` array a phase object with `name`: `Bugfix: <Bug Title>`.
36
- - Tasks: 1) Create reproduction test (Red) 2) Apply fix (Green) 3) Regression test.
35
+ - Update plan.json; append phase `Bugfix: <Bug Title>`.
36
+ - Tasks: 1) Create reproduction test (Red) 2) Fix (Green) 3) Regression test.
37
37
 
38
- **Terminal Gate** (Do not skip; must complete before step_5 output):
39
- | Step | Command | Pass Condition |
40
- |:---|:---|:---|
41
- | 1 | `npx archi render` | `.md` views generated |
38
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
42
39
 
43
40
  **Output**: plan.json with fix tasks appended.
44
41
  </step_2_plan_fix>
45
42
 
46
43
  <step_3_execute_fix>
47
- **Role**: Senior Engineer (Surgical Fix — bug only, no scope creep)
48
44
  **Action**:
49
- - Modify code directly according to Plan.
50
- - Fix Bug only; prohibited from opportunistic refactoring or modifying unrelated code.
51
- - Error handling follows `code.md` specs (no swallowing errors/no silent failures).
45
+ - Modify code per Plan. Fix bug only; do not refactor.
46
+ - Error handling follows `code.md` protocol.
52
47
  </step_3_execute_fix>
53
48
 
54
49
  <step_4_verify>
55
- **Role**: QA Engineer
56
- **Terminal Gate** (Do not skip; must complete before step_5 output):
50
+ **Terminal Gate** (do not skip):
57
51
  | Step | Command | Pass Condition |
58
52
  |:---|:---|:---|
59
- | 1 | Run build command | Build succeeds |
53
+ | 1 | Run build command | Build success |
60
54
  | 2 | Run type check | Zero type errors |
61
55
  | 3 | Run Lint/Format | Pass |
62
- | 4 | Run tests | Reproduction + regression tests pass |
56
+ | 4 | Run tests | Reproduction test + regression test pass |
63
57
 
64
- Any failure must be fixed until passed.
58
+ Fix any failure until pass.
59
+
60
+ **Code quality review**:
61
+ [[SUBAGENT: archi-silent-audit|mode: code-impl, context: Review fix code; focus Tech/Security/Performance + Spec Immutable]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: code-impl check)]]
62
+
63
+ [[INCLUDE: shared/verify-result-handling.md]]
65
64
  </step_4_verify>
66
65
 
67
- <step_4_5_plan_update>
68
- **Role**: Tech Lead
66
+ <step_5_plan_update>
69
67
  **Action**:
70
- 1. Update `plan.json`: set `done: true` for completed tasks in the Bugfix Phase.
71
- 2. [current status=`done` and all Bugfix Phase tasks passed] → Keep status as `done`.
72
- 3. [Bugfix Phase has unresolved tasks] → Run `npx archi task <ID> --status active`; note in signoff that `/archi.code` is needed to complete remaining fixes.
68
+ 1. Update plan.json Bugfix Phase completed tasks `done: true`.
69
+ 2. [status=`done` and Bugfix all pass] → keep `done`.
70
+ 3. [Bugfix has incomplete items] → `npx archi task <ID> --status active`; signoff note to re-run `/archi.code`.
71
+
72
+ **Output**: `MODIFIED: plan.json Bugfix Phase done flags`. Enter step_6_summary.
73
+ </step_5_plan_update>
73
74
 
74
- **Output**: `MODIFIED: plan.json Bugfix Phase done marks` (if status changed, append `MODIFIED: roadmap.json <ID>.status`).
75
- </step_4_5_plan_update>
75
+ <step_6_summary>
76
+ **Pre-signoff Checklist** (confirm each item before Output):
77
+ □ Root cause analyzed (not surface patch), Hypothesis output in step_1
78
+ □ plan.json — Bugfix Phase appended (step_2)
79
+ □ Reproduction test created and verified (Red → Green)
80
+ □ Code fix targets Bug only, no opportunistic refactoring
81
+ □ Step 4 Terminal Gate — Build / type check / Lint / tests all passed
82
+ □ Step 4 Silent Audit — executed, all CRITICAL issues resolved
83
+ □ plan.json Bugfix Phase — done flags updated (step_5)
76
84
 
77
- <step_5_summary>
78
85
  **Output**: Bug fix summary with Root Cause analysis, fix content, new tests, and Next Steps table:
79
86
 
80
87
  | Priority | Action | Notes |
81
88
  |:---|:---|:---|
82
- | Recommended | `/archi.audit <ID>` | Re-audit to confirm fix is complete and no new issues introduced |
83
- | Optional | `/archi.code <ID>` | If Bugfix Phase has remaining incomplete tasks |
89
+ | Recommended | `/archi.audit <ID>` | Re-audit to confirm fix complete |
90
+ | Optional | `/archi.code <ID>` | If incomplete items, continue implementation |
84
91
  </step_5_summary>
85
92
 
86
93
  </protocol_fix>