architext 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/README.md +93 -14
  3. package/README.zh-CN.md +92 -14
  4. package/dist/index.js +53 -39
  5. package/dist/templates/en/briefs/_base.md +53 -13
  6. package/dist/templates/en/briefs/_modules.md +31 -4
  7. package/dist/templates/en/docs/global/error_memory.json +40 -0
  8. package/dist/templates/en/docs/global/map.json +46 -90
  9. package/dist/templates/en/{rules/04_cli_tools.md → docs/global/references/cli_reference.md} +6 -13
  10. package/dist/templates/en/{rules/02_tech_stack.md → docs/global/tech_stack.md} +7 -18
  11. package/dist/templates/en/docs/global/vision.md +1 -1
  12. package/dist/templates/en/docs/prompts/audit.md +80 -94
  13. package/dist/templates/en/docs/prompts/code.md +99 -89
  14. package/dist/templates/en/docs/prompts/edit.md +61 -51
  15. package/dist/templates/en/docs/prompts/fix.md +59 -43
  16. package/dist/templates/en/docs/prompts/help.md +23 -31
  17. package/dist/templates/en/docs/prompts/inherit.md +97 -117
  18. package/dist/templates/en/docs/prompts/map.md +48 -69
  19. package/dist/templates/en/docs/prompts/plan.md +141 -240
  20. package/dist/templates/en/docs/prompts/recover.md +19 -34
  21. package/dist/templates/en/docs/prompts/ref.md +43 -138
  22. package/dist/templates/en/docs/prompts/remove.md +63 -110
  23. package/dist/templates/en/docs/prompts/revise.md +71 -106
  24. package/dist/templates/en/docs/prompts/scope.md +78 -117
  25. package/dist/templates/en/docs/prompts/script.md +102 -0
  26. package/dist/templates/en/docs/prompts/start.md +98 -132
  27. package/dist/templates/en/docs/prompts/ui.md +113 -0
  28. package/dist/templates/en/docs/shared/ui-redlines.md +7 -0
  29. package/dist/templates/en/docs/templates/spec.template.md +1 -1
  30. package/dist/templates/en/docs/templates/ui.template.md +8 -8
  31. package/dist/templates/en/rules/00_system.md +268 -117
  32. package/dist/templates/en/rules/90_custom_rules.md +3 -1
  33. package/dist/templates/en/skills/archi-data-sync/SKILL.md +37 -23
  34. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +138 -240
  35. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +6 -1
  36. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +10 -6
  37. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -2
  38. package/dist/templates/en/skills/archi-plan-options/SKILL.md +77 -301
  39. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +24 -25
  40. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +175 -305
  41. package/dist/templates/icon.svg +16 -0
  42. package/dist/templates/zh/briefs/_base.md +56 -17
  43. package/dist/templates/zh/briefs/_modules.md +28 -1
  44. package/dist/templates/zh/docs/global/error_memory.json +40 -0
  45. package/dist/templates/zh/docs/global/map.json +39 -109
  46. package/dist/templates/zh/{rules/04_cli_tools.md → docs/global/references/cli_reference.md} +0 -7
  47. package/dist/templates/zh/{rules/02_tech_stack.md → docs/global/tech_stack.md} +9 -20
  48. package/dist/templates/zh/docs/global/vision.md +1 -1
  49. package/dist/templates/zh/docs/prompts/audit.md +43 -57
  50. package/dist/templates/zh/docs/prompts/code.md +66 -56
  51. package/dist/templates/zh/docs/prompts/edit.md +52 -42
  52. package/dist/templates/zh/docs/prompts/fix.md +39 -29
  53. package/dist/templates/zh/docs/prompts/help.md +13 -21
  54. package/dist/templates/zh/docs/prompts/inherit.md +67 -86
  55. package/dist/templates/zh/docs/prompts/map.md +28 -50
  56. package/dist/templates/zh/docs/prompts/plan.md +100 -199
  57. package/dist/templates/zh/docs/prompts/recover.md +9 -24
  58. package/dist/templates/zh/docs/prompts/ref.md +11 -106
  59. package/dist/templates/zh/docs/prompts/remove.md +39 -74
  60. package/dist/templates/zh/docs/prompts/revise.md +47 -88
  61. package/dist/templates/zh/docs/prompts/scope.md +52 -91
  62. package/dist/templates/zh/docs/prompts/script.md +102 -0
  63. package/dist/templates/zh/docs/prompts/start.md +75 -110
  64. package/dist/templates/zh/docs/prompts/ui.md +113 -0
  65. package/dist/templates/zh/docs/shared/ui-redlines.md +7 -0
  66. package/dist/templates/zh/docs/templates/spec.template.md +1 -1
  67. package/dist/templates/zh/docs/templates/ui.template.md +8 -8
  68. package/dist/templates/zh/rules/00_system.md +252 -131
  69. package/dist/templates/zh/rules/90_custom_rules.md +2 -1
  70. package/dist/templates/zh/skills/archi-data-sync/SKILL.md +27 -13
  71. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +133 -235
  72. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +6 -1
  73. package/dist/templates/zh/skills/archi-feature-relations/SKILL.md +6 -2
  74. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -2
  75. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +77 -301
  76. package/dist/templates/zh/skills/archi-silent-audit/SKILL.md +4 -5
  77. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +174 -301
  78. package/package.json +3 -1
  79. package/dist/templates/en/rules/01_workflow.md +0 -93
  80. package/dist/templates/en/rules/03_data_governance.md +0 -102
  81. package/dist/templates/en/rules/99_context_glue.md +0 -53
  82. package/dist/templates/zh/rules/01_workflow.md +0 -94
  83. package/dist/templates/zh/rules/03_data_governance.md +0 -133
  84. package/dist/templates/zh/rules/99_context_glue.md +0 -53
@@ -1,23 +1,23 @@
1
1
  <protocol_ref>
2
2
  **Trigger**: `/archi.ref <sub> [args]`
3
- **Goal**: Manage external knowledge references (third-party APIs, internal SDKs, business rules, etc.), store them in `refs/` in a structured way, and inject context into `plan`/`code` on demand.
3
+ **Goal**: Manage external knowledge refs (3rd-party APIs, internal SDKs, business rules, etc.); store in `refs/` in structured form; inject into `plan`/`code` on demand.
4
4
 
5
5
  **Subcommands**:
6
6
  | Subcommand | Format | Purpose |
7
7
  |:---|:---|:---|
8
8
  | `add` | `/archi.ref add [input]` | Summarize and store external knowledge (core) |
9
- | `list` | `/archi.ref list` | List all stored references |
10
- | `update` | `/archi.ref update <id>` | Re-summarize a specified reference |
11
- | `remove` | `/archi.ref remove <id>` | Remove a specified reference |
9
+ | `list` | `/archi.ref list` | List all stored refs |
10
+ | `update` | `/archi.ref update <id>` | Re-summarize specified ref |
11
+ | `remove` | `/archi.ref remove <id>` | Remove specified ref |
12
12
 
13
13
  <meta>
14
14
  <style>Analytical, Precise, Context-Aware</style>
15
15
  <language>English</language>
16
16
  <principles>
17
- 1. **Summarize, Not Copy**: Do not copy full original content; distill into structured summaries (key interfaces / constraints / examples) for efficient AI use, compression ratio ≥ 50%.
18
- 2. **Format-Aware**: Choose the most suitable carrier format (`.md` / `.json` / `.yaml`) based on content type, preserving semantic advantages of the original format.
19
- 3. **Tag-Driven**: Each ref must carry tags for `plan`/`code` to match and inject on demand; no tagless references allowed.
20
- 4. **Index-First**: All operations must sync with `refs/index.json`; AI loads on demand via index, no full scan.
17
+ 1. **Summarize, Not Copy**: Do not copy full original; must distill into structured summary (key interfaces / constraints / examples) for efficient AI use; compression ratio ≥ 50%.
18
+ 2. **Format-Aware**: Auto-select best carrier format (`.md` / `.json` / `.yaml`) by content type; preserve original format semantics.
19
+ 3. **Tag-Driven**: Each ref must carry tags for `plan`/`code` to match and inject; no tagless refs.
20
+ 4. **Index-First**: All ops must sync `refs/index.json`; AI loads via index on demand; no full scan.
21
21
  </principles>
22
22
  </meta>
23
23
 
@@ -27,11 +27,11 @@
27
27
 
28
28
  | Content type | Recommended format | Rationale |
29
29
  |:---|:---|:---|
30
- | Web page / URL / PDF / plain text | `.md` | Structured summary, highest AI read efficiency |
30
+ | Web / URL / PDF / plain text | `.md` | Structured summary; highest AI read efficiency |
31
31
  | OpenAPI / Swagger spec | `.yaml` | Preserve machine-readable structure; do not convert to .md |
32
- | JSON Schema / config files | `.json` | Original structured data format is optimal |
33
- | Mixed (with many code examples) | `.md` (with code blocks) | Preserve syntax in code blocks, add explanatory context |
34
- | User pasted (pure Markdown) | `.md` | Store in same format, may refine |
32
+ | JSON Schema / config files | `.json` | Original structured data format optimal |
33
+ | Mixed (many code examples) | `.md` (with code blocks) | Code blocks keep syntax; add explanatory context |
34
+ | User paste (pure Markdown) | `.md` | Same format store; may refine |
35
35
  </format_selection>
36
36
 
37
37
  <!-- ═══════════════════════════════════════════════ -->
@@ -47,117 +47,47 @@
47
47
 
48
48
  | input form | Handling |
49
49
  |:---|:---|
50
- | Local file path (e.g. `./docs/api.yaml`) | Read file content, record `sourceType: local-file` |
51
- | URL (e.g. `https://...`) | Fetch page content, record `sourceType: url` |
52
- | Not provided (conversation mode) | Ask user to paste content or provide path/URL, wait for input, record `sourceType: manual` |
50
+ | Local file path (e.g. `./docs/api.yaml`) | Read file content; record `sourceType: local-file` |
51
+ | URL (e.g. `https://...`) | Fetch page content; record `sourceType: url` |
52
+ | Not provided (conversation mode) | Ask user to paste content or provide path/URL; wait for input; record `sourceType: manual` |
53
53
 
54
54
  Check if `[[__DOCS_DIR__]]/refs/index.json` exists:
55
- - Exists → Read, get existing id list (avoid duplicate names)
56
- - Not exists → Initialize as `{ "refs": [] }`
55
+ - Exists → read; get existing id list (avoid duplicate names)
56
+ - Not exists → initialize as `{ "refs": [] }`
57
57
 
58
- **Output**: Internal (raw content + sourceType + existing id list), proceed to `<step_1_analyze>`.
58
+ **Output**: Internal (raw content + sourceType + existing id list); proceed to `<step_1_analyze>`.
59
59
  </step_0_ingest>
60
60
 
61
61
  <step_1_analyze>
62
- **Role**: System Analyst
63
62
  **Action**:
64
- 1. **Content type identification**: Determine which type the raw content belongs to (see `<format_selection>`), decide recommended storage format.
65
- 2. **Key info extraction**: From content extract:
66
- - Core interfaces/endpoints/function signatures
67
- - Parameter list and types (input/output)
68
- - Important constraints, limits, caveats
69
- - Auth/authorization (if any)
70
- - Typical usage examples (≤ 3)
71
- 3. **Info gap identification**:
72
- - id naming (infer a candidate, e.g. `wechat-pay`, pending user confirmation)
73
- - tags (infer from standard tags: `api` / `sdk` / `internal` / `payment` / `auth` / `map` / `notification` / `storage` / custom)
74
- - Focus areas (if content is large, confirm which interfaces/features user cares about)
75
-
76
- **Output**: Internal analysis summary, proceed to `<step_2_interview>` (if gaps) or directly `<step_3_store>` (if complete).
63
+ 1. **Content type identification**: Determine raw content type (per `<format_selection>`); decide recommended storage format.
64
+ 2. **Key info extraction**: Core interfaces/endpoints/signatures, params and types, important constraints/limits, auth (if any), typical examples (≤3).
65
+ 3. **Info gap identification**: id naming (infer candidate), tags (from standard: `api`/`sdk`/`internal`/`payment`/`auth`/`map`/`notification`/`storage`/custom), focus areas (when content large, confirm user's priority interfaces).
66
+
67
+ **Output**: Internal analysis summary; proceed to `<step_2_interview>` (when gaps) or directly `<step_3_store>` (when complete).
77
68
  </step_1_analyze>
78
69
 
79
70
  <step_2_interview>
80
- **Role**: Product Consultant
81
- **Trigger**: Execute only when id / tags / focus is uncertain.
82
- **Action**: Ask user questions, max 3 questions, prefer multiple choice.
83
-
84
- **Output format**:
85
- ```
86
- ### Reference info confirmation
87
-
88
- **Content type**: [identified] → will store as [.md / .yaml / .json]
89
- **Content summary**: [one-sentence description of raw content]
90
-
91
- **Q1 — Reference ID** (for file naming and reference):
92
- [A] [AI-inferred candidate] (recommended)
93
- [B] Custom
94
-
95
- **Q2 — Tags** (multi-select):
96
- [A] api [B] sdk [C] internal [D] payment [E] auth [F] Other: ___
71
+ **Trigger**: Only when id / tags / focus uncertain.
72
+ **Action**: Ask user; max 3 questions; options preferred.
97
73
 
98
- (If content is large) **Q3 Focus**:
99
- [A] Keep full [B] Keep only [specific interface list] [C] Custom
100
-
101
- **INPUT**: Q1 answer | Q2 answer | Q3 answer (if any)
102
- ```
74
+ **Output**: Ref info confirmation — include content type and storage format, content summary, Q1 ref ID (AI inferred candidate + custom), Q2 tags (multi-select), (when content large) Q3 focus areas.
103
75
 
104
76
  **Gate**: Wait for user reply before `<step_3_store>`.
105
77
  </step_2_interview>
106
78
 
107
79
  <step_3_store>
108
- **Role**: Senior Engineer
109
80
  **Action**:
110
- 1. Determine storage params:
111
- - `id`: User-confirmed value (or AI-inferred)
112
- - `format`: File extension from `<format_selection>` rules
113
- - `filename`: `{id}.{format}`
114
- - `tags`: User-confirmed tags list
81
+ 1. Determine storage params: `id` (user confirmed or AI inferred), `format` (from format_selection), `filename: {id}.{format}`, `tags`.
115
82
 
116
83
  2. **Generate ref file content** (by format):
117
-
118
- **`.md` format skeleton**:
119
- ```markdown
120
- ---
121
- id: {id}
122
- title: {title}
123
- tags: [{tags}]
124
- sourceType: url | local-file | manual
125
- source: {source path or URL, "manual-input" when manual}
126
- created: {YYYY-MM-DD}
127
- updated: {YYYY-MM-DD}
128
- ---
129
-
130
- ## Core info
131
- <!-- Base URL, version, auth, etc. -->
132
-
133
- ## Key interfaces
134
- | Interface/Function | Path/Signature | Description |
135
- |:---|:---|:---|
136
-
137
- ## Important constraints and caveats
138
-
139
- ## Examples
140
- <!-- ≤ 3 most representative examples -->
141
- ```
142
-
143
- **`.yaml` format**: Store original OpenAPI/Swagger content (trim redundant example fields in responses, keep schema structure).
144
-
145
- **`.json` format**: Store original JSON Schema or config (remove comments, keep structure).
84
+ - **`.md`**: frontmatter (id/title/tags/sourceType/source/created/updated) + 4 sections (core info, key interfaces table, important constraints, examples ≤3)
85
+ - **`.yaml`**: Store trimmed OpenAPI/Swagger (remove redundant example fields; keep schema)
86
+ - **`.json`**: Store original structure (remove comments; keep structure)
146
87
 
147
88
  3. **Write file**: `[[__DOCS_DIR__]]/refs/{id}.{ext}`
148
89
 
149
- 4. **Update index**: Append to `[[__DOCS_DIR__]]/refs/index.json` refs array:
150
- ```json
151
- {
152
- "id": "{id}",
153
- "title": "{title}",
154
- "tags": ["{tags}"],
155
- "format": "{ext}",
156
- "file": "{id}.{ext}",
157
- "sourceType": "url | local-file | manual",
158
- "updatedAt": "{YYYY-MM-DD}"
159
- }
160
- ```
90
+ 4. **Update index**: Append to `[[__DOCS_DIR__]]/refs/index.json` refs array (id/title/tags/format/file/sourceType/updatedAt).
161
91
 
162
92
  **Output**:
163
93
  ```
@@ -167,18 +97,7 @@
167
97
  </step_3_store>
168
98
 
169
99
  <step_4_signoff_add>
170
- **Output**: Add summary including:
171
- - **Reference ID**: `{id}`
172
- - **Storage format**: `{ext}` — rationale (one sentence)
173
- - **Tags**: `[tags]`
174
- - **File path**: `[[__DOCS_DIR__]]/refs/{id}.{ext}`
175
- - **How to use**:
176
-
177
- | Scenario | Description |
178
- |:---|:---|
179
- | `/archi.plan <ID>` | When planning involves `[tags]`-related features, AI auto-reads this ref |
180
- | `/archi.code <ID>` | Injected as supplementary context during coding, provides interface signatures and constraint details |
181
- | Manual reference | Mention "see `refs/{id}`" in conversation |
100
+ **Output**: Add summary — ref ID, storage format and rationale, tags, file path, usage notes (plan: auto-read / code: supplement context / manual ref).
182
101
  </step_4_signoff_add>
183
102
 
184
103
  </sub_add>
@@ -189,59 +108,45 @@
189
108
 
190
109
  <sub_list>
191
110
 
192
- **Role**: System Analyst
193
111
  **Trigger**: `/archi.ref list`
194
112
  **Action**: Read `[[__DOCS_DIR__]]/refs/index.json`.
195
113
 
196
114
  | Condition | Handling |
197
115
  |:---|:---|
198
- | Index missing / refs empty | Prompt "No references yet, run `/archi.ref add` to add the first" |
199
- | Normal | Display grouped by tags |
200
-
201
- **Output**:
202
- ```
203
- ### External knowledge references (N total)
204
-
205
- #### [tag group name]
206
- | ID | Title | Format | Updated |
207
- |:---|:---|:---|:---|
208
- | wechat-pay | WeChat Pay V3 API | .md | 2025-01-15 |
209
- | openapi-spec | Internal service OpenAPI | .yaml | 2025-01-10 |
210
- ```
116
+ | Index missing / refs empty | Prompt "No refs yet; run `/archi.ref add` to add first" |
117
+ | Normal | Display grouped by tags (ID / title / format / updated) |
211
118
 
212
119
  </sub_list>
213
120
 
214
121
  <!-- ═══════════════════════════════════════════════ -->
215
- <!-- UPDATE subcommand -->
122
+ <!-- UPDATE subcommand -->
216
123
  <!-- ═══════════════════════════════════════════════ -->
217
124
 
218
125
  <sub_update>
219
126
 
220
- **Role**: Senior Engineer
221
127
  **Trigger**: `/archi.ref update <id>`
222
128
  **Action**:
223
- 1. Find `<id>` in `index.json`, get `file` and `sourceType`.
224
- 2. If `sourceType` is `url` → re-fetch original URL; `local-file` → re-read file; `manual` → prompt user to paste new content.
225
- 3. Re-run `<step_1_analyze>` + `<step_3_store>` (keep original id/tags/format, only refresh content and `updatedAt`).
129
+ 1. Find `<id>` in index.json; get `file` and `sourceType`.
130
+ 2. If `sourceType` is `url` → re-fetch; `local-file` → re-read; `manual` → prompt paste new content.
131
+ 3. Re-run `<step_1_analyze>` + `<step_3_store>` (keep original id/tags/format; refresh content and `updatedAt` only).
226
132
 
227
133
  | Condition | Handling |
228
134
  |:---|:---|
229
- | id not in index.json | Stop — prompt to check id, run `/archi.ref list` to view |
135
+ | id not in index.json | Stop — prompt to check id; run `/archi.ref list` to view |
230
136
 
231
137
  </sub_update>
232
138
 
233
139
  <!-- ═══════════════════════════════════════════════ -->
234
- <!-- REMOVE subcommand -->
140
+ <!-- REMOVE subcommand -->
235
141
  <!-- ═══════════════════════════════════════════════ -->
236
142
 
237
143
  <sub_remove>
238
144
 
239
- **Role**: System Administrator
240
145
  **Trigger**: `/archi.ref remove <id>`
241
146
  **Action**:
242
- 1. Find and remove `<id>` from `index.json`.
147
+ 1. Find and remove `<id>` entry from index.json.
243
148
  2. Delete corresponding `refs/{id}.{ext}` file.
244
- 3. Update `index.json`.
149
+ 3. Update index.json.
245
150
 
246
151
  **Output**:
247
152
  ```
@@ -251,7 +156,7 @@ MODIFIED [[__DOCS_DIR__]]/refs/index.json
251
156
 
252
157
  | Condition | Handling |
253
158
  |:---|:---|
254
- | id not found | Stop — prompt to check id, run `/archi.ref list` to view |
159
+ | id not found | Stop — prompt to check id; run `/archi.ref list` to view |
255
160
 
256
161
  </sub_remove>
257
162
 
@@ -1,161 +1,114 @@
1
1
  <protocol_remove>
2
2
  **Trigger**: `/archi.remove <id>`
3
- **Goal**: Fully decommission the specified Task — delete docs, code, and global references with zero residue.
3
+ **Goal**: Decommission the specified Task from the project — delete docs, code, global refs; ensure zero residue.
4
4
 
5
5
  <meta>
6
6
  <style>Surgical, Cautious, Thorough</style>
7
7
  <language>English</language>
8
8
  <principles>
9
- 1. **Dependency Safety**: If other tasks depend on this Task, dependencies must be resolved before proceeding.
10
- 2. **Confirmation Gate**: Deletion is irreversible; must present full impact and obtain explicit confirmation.
11
- 3. **Zero Residue**: Cleanup must cover all associated layers (docs/code/global data/glue entries).
12
- 4. **No Side Effects**: Only remove content related to the target Task; forbidden to touch unrelated files.
9
+ 1. **Dependency Safety**: When other tasks depend on this Task, must decouple first to continue.
10
+ 2. **Confirmation Gate**: Delete is irreversible; must show full impact and get explicit user confirmation.
11
+ 3. **Zero Residue**: Cleanup must cover all layers (docs/code/global data/addressing entries).
12
+ 4. **No Side Effects**: Only delete target Task content; do not touch unrelated files.
13
13
  </principles>
14
14
  </meta>
15
15
 
16
16
  <step_1_resolve>
17
- **Role**: System Analyst
18
17
  **Action**:
19
- 1. **Resolve ID**: Parse `<id>` from `[[__DOCS_DIR__]]/global/roadmap.json` → Task Name, Slug, status.
20
- 2. **ID Not Found** → Error with list of available task IDs.
21
- 3. **Load Context**:
22
- - `[[__DOCS_DIR__]]/tasks/<id>_<Slug>/` — All docs (spec.md, ui.md, plan.json, etc.)
23
- - `[[__DOCS_DIR__]]/global/roadmap.json` — Task dependency graph
24
- - `[[__DOCS_DIR__]]/global/map.json` — Architecture registry
25
- - `99_context_glue.md` — Code↔doc associations
18
+ 1. **Resolve ID**: Parse `<id>` from roadmap.json → Task Name, Slug, status.
19
+ 2. **ID Not Found** → Error and list available task IDs.
20
+ 3. **Load**: task docs directory, roadmap.json (deps), map.json (architecture reg).
26
21
 
27
22
  **Output**: Target Task info (ID, name, status, associated file count).
28
23
  </step_1_resolve>
29
24
 
30
25
  <step_2_impact>
31
- **Role**: Impact Assessor
32
- **Action**: Scan each layer to produce an impact manifest.
26
+ **Action**: Scan layer by layer; generate impact list.
33
27
 
34
- ### 2.1 Dependency Check (Blocking)
28
+ ### 2.1 Dependency check (blocking)
35
29
 
36
- Scan all tasks' `deps` in `roadmap.json` for references to `<id>`.
30
+ Scan roadmap.json all tasks `deps`; find tasks depending on `<id>`.
37
31
 
38
- | Situation | Handling |
32
+ | Condition | Handling |
39
33
  |:---|:---|
40
- | No downstream deps | Pass, continue |
41
- | Has downstream deps with `pending`/`blocked` status | List affected tasks; ask user: remove dependency and continue, or abort |
42
- | Has downstream deps with `active`/`done` status | **Block** — these tasks may use this Task's interfaces/components. Must `/archi.edit` to decouple first |
34
+ | No downstream deps | Pass |
35
+ | Has downstream deps and `pending`/`blocked` | List; ask: remove dep and continue or abort |
36
+ | Has downstream deps and `active`/`done` | **Block** — must `/archi.edit` to decouple first |
43
37
 
44
- ### 2.2 Code File Identification
38
+ ### 2.2 Code file identification
45
39
 
46
- Locate code files belonging to this Task via:
47
- 1. `99_context_glue.md` code paths associated with `<id>`.
48
- 2. `map.json` modules/directories registered for this Task.
49
- 3. `plan.json` file paths mentioned in tasks.
50
- 4. Scan code directories for files named with Slug or clearly scoped to this Task.
40
+ Locate code files via: map.json registered modules, plan.json mentioned files, Slug-named or clearly owned files.
51
41
 
52
- ### 2.3 Global Reference Scan
42
+ ### 2.3 Global ref scan
53
43
 
54
- | File | Scan Target |
44
+ | File | Scan content |
55
45
  |:---|:---|
56
- | `roadmap.json` | Task entry + `deps` references in other tasks |
57
- | `map.json` | Module registry entries + `featureRelations` entries where the deleted Task is the aggregator |
58
- | `99_context_glue.md` | Association entries |
59
- | `dictionary.json` | Terms exclusive to this Task (flag only, no auto-delete) |
60
- | `error_codes.json` | Error codes exclusive to this Task (flag only, no auto-delete) |
46
+ | `roadmap.json` | Task entry + deps refs |
47
+ | `map.json` | Module entry + featureRelations where deleted Task is aggregator |
48
+ | `dictionary.json` | Exclusive terms (mark only) |
49
+ | `error_codes.json` | Exclusive error codes (mark only) |
61
50
 
62
- ### 2.4 Aggregation Linkage Check
51
+ ### 2.4 Aggregator linkage check
63
52
 
64
- Read `map.json.featureRelations`; determine whether the deleted Task falls within any aggregator's `sources` coverage.
53
+ [[SUBAGENT: archi-feature-relations|mode: cleanup, context: Check deleted Task refs in featureRelations; output impact report]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-feature-relations/SKILL.md`, follow mode: cleanup logic)]]
65
54
 
66
- | Situation | Handling |
67
- |:---|:---|
68
- | Not in any aggregator's sources range | No special handling |
69
- | In an aggregator's sources range | List in impact report; prompt to check if aggregator content needs to be cleaned up after deletion |
70
- | Deleted Task is itself an aggregator | Also remove its entry from `featureRelations` |
71
-
72
- ### 2.5 Cross-Task References
73
-
74
- Scan other Tasks' `spec.md` for references to the target Task's interfaces, components, or data. Flag as `[Breaking]`.
75
-
76
- **Output**: Impact report to user:
77
- ```
78
- ### Decommission Impact Report: <ID> <Name>
79
-
80
- **Task Status**: [status]
81
-
82
- **Docs to delete**:
83
- - [[__DOCS_DIR__]]/tasks/<id>_<slug>/ (N files)
84
-
85
- **Code to delete**:
86
- | File/Directory | Source |
87
- |:---|:---|
88
- | src/xxx/xxx.ts | context_glue |
89
- | src/xxx/ | map.json |
55
+ ### 2.5 Cross-Task refs
90
56
 
91
- **Global reference cleanup**:
92
- - roadmap.json: remove task <id>, clean N deps references
93
- - map.json: remove N module entries
94
- - context_glue: remove N associations
57
+ Scan other Tasks' `spec.md`; check refs to deleted Task's interface/components/data. Mark refs as `[Breaking]`.
95
58
 
96
- **[?present] Terms/error codes residue** (manual confirmation needed):
97
- - dictionary.json: [term1], [term2]
98
- - error_codes.json: [ERR_XXX]
59
+ **Output**: Output decommission impact report to user — include Task status, docs and code to delete (file/source table), global ref cleanup items (roadmap/map), (if any) term/error code residue (manual confirm needed), (if any) aggregator linkage table, (if any) cross-Task ref [Breaking] table. End: OK to execute / Abort to cancel.
99
60
 
100
- **[?present] Aggregation linkage** (check needed):
101
- | Aggregator | checkNote |
102
- |:---|:---|
103
- | [aggregator ID/path] | [checkNote content] |
104
-
105
- **[?present] Cross-Task references [Breaking]**:
106
- | Referencing Task | Reference Content | Suggestion |
107
- |:---|:---|:---|
108
- | FEAT-005 spec.md | Calls <id>'s UserAPI | /archi.edit FEAT-005 to decouple first |
109
-
110
- ---
111
- > Reply **OK** to confirm; reply **abort** to cancel.
112
- ```
113
-
114
- **Gate**: Proceed to step_3 after user replies OK. Re-warn if `[Breaking]` cross-Task refs exist.
61
+ **Gate**: Proceed to step_3 only after user replies OK. Re-warn when `[Breaking]` refs exist.
115
62
  </step_2_impact>
116
63
 
117
64
  <step_3_execute>
118
65
  **Role**: Surgeon
119
- **Action**: Execute in this order (order is mandatory).
66
+ **Action**: Execute in this order (order immutable).
120
67
 
121
- | # | Operation | Target |
68
+ | # | Action | Target |
122
69
  |:---|:---|:---|
123
- | 1 | Delete code files/directories | Code paths from step_2 |
124
- | 2 | Delete Task doc directory | `[[__DOCS_DIR__]]/tasks/<id>_<slug>/` |
125
- | 3 | Update `roadmap.json` | Remove task entry; clean `deps` refs to `<id>` in other tasks |
126
- | 4 | Update `map.json` | Remove module entries; if this Task is an aggregator, also remove its `featureRelations` entry |
127
- | 5 | Update `99_context_glue.md` | Remove association entries for this Task |
128
- | 6 | [?exclusive terms] Update `dictionary.json` | Remove or mark deprecated |
129
- | 7 | [?exclusive codes] Update `error_codes.json` | Remove or mark deprecated |
130
- | 8 | [?aggregation linkage] Check aggregator code | Verify aggregator no longer references the deleted Task |
131
-
132
- Log each operation (file path + operation type) as it completes.
70
+ | 1 | Delete code files/dirs | Code paths from step_2 |
71
+ | 2 | Delete Task docs dir | `[[__DOCS_DIR__]]/tasks/<id>_<slug>/` |
72
+ | 3 | Update `roadmap.json` | Remove task entry; clean deps refs |
73
+ | 4 | Update `map.json` | Remove module entry + featureRelations entry |
74
+ | 5 | [?exclusive terms] Update `dictionary.json` | Remove or mark deprecated |
75
+ | 7 | [?exclusive error codes] Update `error_codes.json` | Remove or mark deprecated |
76
+ | 8 | [?aggregator linkage] Check aggregator code | Confirm refs cleaned |
77
+
78
+ Record operation log after each step.
133
79
  </step_3_execute>
134
80
 
135
81
  <step_4_verify>
136
- **Role**: Verification Engineer
137
- **Terminal Gate** (Do not skip; must complete before step_5 output):
82
+ **Terminal Gate** (do not skip): Standard check (task --check + render).
138
83
  | Step | Command | Pass Condition |
139
84
  |:---|:---|:---|
140
- | 1 | `npx archi task --check` | No ERROR-level issues, no dangling deps |
141
- | 2 | `npx archi render` | `.md` views generated |
142
- | 3 | Run project build command | Zero compilation errors |
143
-
144
- | Check | Pass Criteria |
145
- |:---|:---|
146
- | Roadmap consistency | `--check` passes, no dangling deps |
147
- | Build | Zero compilation errors |
148
- | Residual refs | No import/require of deleted modules in codebase |
85
+ | 3 | Run project build command | Zero compile errors; no import/require to deleted module |
149
86
 
150
- Build failure or residual refs found → locate, fix, and recheck.
87
+ If build fails or residual refs found → locate, fix, re-check.
151
88
  </step_4_verify>
152
89
 
153
90
  <step_5_summary>
154
- **Output**: Decommission summary:
91
+ **Pre-signoff Checklist** (confirm each item before Output):
92
+ □ Code files/directories — deleted (step_3 action #1)
93
+ □ tasks/<id>_<slug>/ doc directory — deleted (step_3 action #2)
94
+ □ roadmap.json — task entry + deps refs — cleaned (step_3 action #3)
95
+ □ map.json — module entry + featureRelations — cleaned (step_3 action #4)
96
+ □ (if exclusive terms/codes) dictionary.json + error_codes.json — handled
97
+ □ Global files cleanup check:
98
+ - vision.md + tech_stack.md — required
99
+ - dictionary.json + error_codes.json + env_registry.json — required
100
+ - (UI projects only) design_tokens.json + ui_context.md
101
+ - (Data projects only) data_snapshot.json
102
+ - (API projects only) api_snapshot.json
103
+ - (CLI projects only) command_api.json
104
+ - (Lib projects only) public_api.json
105
+ □ Terminal Gate — project build passes, no residual import refs (step_4)
106
+
107
+ **Output**: Decommission completion summary:
155
108
  - **Deleted**: N doc files, N code files
156
- - **Cleaned**: roadmap / map / context_glue references
157
- - **Build status**: pass/fail
158
- - **[?present] Manual follow-up needed**: terms/error codes/cross-Task ref residue
109
+ - **Cleaned**: refs in roadmap / map
110
+ - **Build status**: Pass/Fail
111
+ - **[?if any] Manual follow-up**: Term/error code/cross-Task ref residue
159
112
  - **Git Commit Suggestion**: `feat(remove): decommission <ID> <Name>`
160
113
  </step_5_summary>
161
114