teamai-cli 0.25.0-beta.6 → 0.26.0-beta.0

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 (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.ja.md +26 -227
  3. package/README.ko.md +26 -227
  4. package/README.md +26 -227
  5. package/README.th.md +26 -227
  6. package/README.zh-CN.md +32 -227
  7. package/dist/index.js +5885 -3199
  8. package/package.json +4 -1
  9. package/skill-data/core/SKILL.md +114 -0
  10. package/skill-data/core/references/commands.md +339 -0
  11. package/{skills/teamai → skill-data/core}/references/contribute-member.md +13 -10
  12. package/{skills/teamai → skill-data/core}/references/troubleshooting.md +1 -1
  13. package/skill-data/setup/SKILL.md +76 -0
  14. package/{skills/teamai → skill-data/setup}/references/join-member.md +21 -20
  15. package/{skills/teamai → skill-data/setup}/references/manage-admin.md +8 -6
  16. package/skill-data/setup/references/provider-tgit.md +78 -0
  17. package/{skills/teamai → skill-data/setup}/references/setup-admin.md +49 -93
  18. package/skill-data/share/SKILL.md +70 -0
  19. package/skill-data/share/references/doc-template.md +44 -0
  20. package/skill-data/wiki/SKILL.md +314 -0
  21. package/skill-data/wiki/references/agents/graph-rag-agent.md +344 -0
  22. package/skill-data/wiki/references/agents/kb-doc-generator.md +323 -0
  23. package/skill-data/wiki/references/methodology/phase0-collection.md +54 -0
  24. package/skill-data/wiki/references/methodology/phase1-reverse-engineering.md +89 -0
  25. package/skill-data/wiki/references/methodology/phase2-document-types.md +341 -0
  26. package/skill-data/wiki/references/methodology/phase3-ai-enhancement.md +164 -0
  27. package/skill-data/wiki/references/methodology/phase4-quality.md +232 -0
  28. package/skill-data/wiki/references/overview.md +124 -0
  29. package/skill-data/wiki/references/phases/k1-reverse-engineering.md +118 -0
  30. package/skill-data/wiki/references/phases/k2-documents.md +68 -0
  31. package/skill-data/wiki/references/phases/k3-ai-native.md +121 -0
  32. package/skill-data/wiki/references/phases/k4-quality.md +190 -0
  33. package/skill-data/wiki/references/phases/phase0-init.md +112 -0
  34. package/skill-data/wiki/references/templates/project-overview.md +148 -0
  35. package/{skills/team-wiki-codebase → skill-data/wiki}/scripts/scan_repo.py +52 -52
  36. package/{skills/team-wiki-codebase → skill-data/wiki}/scripts/validate_kb.py +68 -62
  37. package/skills/teamai/SKILL.md +28 -134
  38. package/skills/team-wiki-codebase/README.md +0 -121
  39. package/skills/team-wiki-codebase/SKILL.md +0 -905
  40. package/skills/team-wiki-codebase/references/agents/graph-rag-agent.md +0 -344
  41. package/skills/team-wiki-codebase/references/agents/kb-doc-generator.md +0 -323
  42. package/skills/team-wiki-codebase/references/methodology/phase0-collection.md +0 -54
  43. package/skills/team-wiki-codebase/references/methodology/phase1-reverse-engineering.md +0 -89
  44. package/skills/team-wiki-codebase/references/methodology/phase2-document-types.md +0 -341
  45. package/skills/team-wiki-codebase/references/methodology/phase3-ai-enhancement.md +0 -164
  46. package/skills/team-wiki-codebase/references/methodology/phase4-quality.md +0 -232
  47. package/skills/team-wiki-codebase/references/templates/project-overview.md +0 -148
  48. package/skills/teamai-share-learnings/SKILL.md +0 -87
  49. /package/{skills/teamai → skill-data/setup}/references/uninstall.md +0 -0
@@ -0,0 +1,341 @@
1
+ # Phase 2: Generation Specs and Templates for the Nine Document Types
2
+
3
+ ## Type-1: Technical Architecture Overview
4
+
5
+ **Size**: ~200KB | **Count**: 1
6
+
7
+ ### Required Sections
8
+
9
+ ```
10
+ Reader navigation guide (recommended reading paths by role)
11
+ Knowledge base retrieval routing guide (AI only, 4 routing rules + 4 priority levels)
12
+ 1. Architecture overview (30-second quick reference table, overall ASCII architecture diagram, component relationship matrix)
13
+ 2. Three-dimensional architecture views (logical/data/deployment)
14
+ 3. Core call chains ⭐ (complete sequence diagram + call chain for every core API)
15
+ 4. Core components in detail (overview + table per component)
16
+ 5. Configuration management and service discovery
17
+ 6. Data model and storage architecture ⭐
18
+ 7. High availability and technical architecture
19
+ 8. Architecture evolution and design decisions
20
+ 9. AI development knowledge base spec ⭐ (metadata QA / global state machine / MQ topology / scheduling engine / cross-layer tracing)
21
+ Appendix: code repositories / glossary / code entry index / error codes
22
+ ```
23
+
24
+ ### Generation Rules
25
+ - T1-R01: must include a reader navigation guide
26
+ - T1-R02: must include AI retrieval routing rules
27
+ - T1-R03: core call chains must have sequence diagrams
28
+ - T1-R04: the component table must include a code repository column
29
+ - T1-R05: the glossary must include external-to-internal mappings
30
+ - T1-R06: must have an AI-only chapter 9
31
+ - T1-R07: architecture diagrams use ASCII Art
32
+
33
+ ---
34
+
35
+ ## Type-2: Business Architecture Document
36
+
37
+ **Size**: ~70KB | **Count**: 1
38
+
39
+ ```
40
+ 1. Product capability matrix (capability domain / sub-capability / corresponding API / billing impact)
41
+ 2. Billing model in detail (mode comparison / state machine / refund and renewal rules)
42
+ 3. Core entity lifecycle (complete state machine / operations allowed per state / mutual exclusion rules)
43
+ 4. Core business flows (user-perspective sequence diagram + preconditions + exception handling)
44
+ 5. Product specification system (naming rules / mapping from specs to underlying resources)
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Type-3: Deployment Architecture Document
50
+
51
+ **Size**: ~40KB | **Count**: 1
52
+
53
+ ```
54
+ 1. Layered deployment architecture diagram
55
+ 2. Service deployment matrix (service name / deployment method / instance count / resource config / dependencies)
56
+ 3. Environment configuration (production / test / difference comparison)
57
+ 4. Deployment process and change management
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Type-4: Component Design Document (Core Output)
63
+
64
+ **Size**: 20~100KB each | **Count**: N (one per component)
65
+
66
+ ### Standard Template
67
+
68
+ ```
69
+ # {component} Internal Design
70
+ <!-- search-anchor: component name, aliases, core keywords -->
71
+ > Project name / version / code repository / code size
72
+ > Position in the overall architecture: [📘 link to the Technical Architecture document]
73
+
74
+ ## 🤖 AI Quick Reference
75
+ (10-dimension structured summary, detailed definition in [phase3-ai-enhancement.md §1](phase3-ai-enhancement.md))
76
+
77
+ ## 📋 Project Overview (core responsibilities + position in the architecture)
78
+ ## 🏗️ Architecture Design (ASCII architecture diagram + core sub-modules, function signatures)
79
+ ## 📊 Data Model (SQL DDL with comments + data flow diagram)
80
+ ## 🔌 Interface Design (external interface table + internal interfaces + error codes)
81
+ ## ⚙️ Core Flows (sequence diagram + step descriptions + exception handling)
82
+ ## 🔧 Configuration (config item / default / description / impact scope)
83
+ ## 📈 Monitoring and Alerting
84
+ ## 🐛 Common Issues and Troubleshooting
85
+ ```
86
+
87
+ ### Generation Rules
88
+ - T4-R01: must have an AI Quick Reference table
89
+ - T4-R02: must have bidirectional links to the Technical Architecture document
90
+ - T4-R03: core functions must list their signatures
91
+ - T4-R04: SQL DDL must include comments
92
+ - T4-R05: config items must state their impact scope
93
+ - T4-R06: architecture diagrams use ASCII Art
94
+ - T4-R07: code entries must be precise to the function name
95
+
96
+ ### Steps for Generating from Code
97
+
98
+ > The detailed execution spec is in `{SKILL_DIR}/references/agents/kb-doc-generator.md`; only the outline is listed here:
99
+ > 1. Code structure scan (three-step Glob → Grep → Read, adapted per language)
100
+ > 2. Information extraction (10 dimensions: core responsibilities / architecture layer / upstream and downstream / code entries / core mechanisms / data flow / tech stack / data model / config items / scheduled tasks)
101
+ > 3. Document assembly (in the section order of the template above)
102
+ > 4. Self-check (accuracy statistics + interface reconciliation)
103
+
104
+ ---
105
+
106
+ ## Type-5: Product-to-Code Mapping (Bridge Document)
107
+
108
+ ### One Section per Core API
109
+
110
+ ```
111
+ ### N.1 User intent (one sentence)
112
+ ### N.2 Product constraints (constraint / value / affected components / validation location)
113
+ ### N.3 User-visible state transitions (ASCII diagram + internal state mapping)
114
+ ### N.4 Internal call chain (standard format, precise to the code file)
115
+ ### N.5 Must-consider items when writing code (numbered list of hard constraints)
116
+ ### N.6 Error codes and internal exception mapping (external code / internal component / meaning)
117
+ ```
118
+
119
+ ### Generation Rules
120
+ - T5-R01: the constraint table must state the "affected components" and "validation location"
121
+ - T5-R02: call chains must be precise to the code file path
122
+ - T5-R03: state transitions must be annotated with the internal state code mapping
123
+ - T5-R04: "Must-consider items when writing code" is a mandatory section
124
+ - T5-R05: error code mappings must include the owning internal component
125
+
126
+ ### Bridge Document Generation Method (3 Steps)
127
+
128
+ **Step 1: Extract product constraints**. From the product docs, extract every constraint that affects the code implementation:
129
+
130
+ ```
131
+ Scan dimensions:
132
+ ├── Quantity limits (batch caps, quotas, maximums)
133
+ ├── Type constraints (enum values, mutual exclusion)
134
+ ├── State preconditions (what state a resource must be in before an operation)
135
+ ├── Billing rules (different handling per billing mode)
136
+ ├── Security constraints (auth, encryption, data masking)
137
+ └── Compatibility constraints (type compatibility, version compatibility, regional limits)
138
+ ```
139
+
140
+ **Step 2: Map to code locations**. For each product constraint, trace to the concrete validation location in the code:
141
+
142
+ ```
143
+ Product constraint: "{API name} batch cap N"
144
+ ↓ trace
145
+ Code location: {API gateway component} → {file path} → validate_params()
146
+ ↓ confirm
147
+ Validation: if len(resource_ids) > N: raise InvalidParameterValue
148
+ ```
149
+
150
+ **Step 3: Build the mapping table**. Assemble the information above into the standard product-to-code mapping table (see the Type-5 template).
151
+
152
+ **Bridge document quality criteria**:
153
+
154
+ | Quality dimension | Standard | Check method |
155
+ |---------|------|---------|
156
+ | **Completeness** | Every core API has a mapping | Check one by one against the API list |
157
+ | **Precision** | Code paths are precise to file and function | Open the code and verify |
158
+ | **Consistency** | Constraint values match the product docs | Cross-check against the product docs |
159
+ | **Freshness** | In sync with the latest code version | Periodic diff check |
160
+
161
+ ---
162
+
163
+ ## Type-6: Product Rules Cheat Sheet
164
+
165
+ ```
166
+ ## N. {rule category}
167
+ | Rule | Constraint value | Affected components | Validation location | Source document |
168
+
169
+ ## State and Operation Mutual Exclusion Rules
170
+ | Current state | Allowed operations | Forbidden operations |
171
+ ```
172
+
173
+ - T6-R01: every rule must state the "affected components"
174
+ - T6-R02: constraint values must be exact numbers
175
+ - T6-R03: must have a "source document" column
176
+ - T6-R04: state mutual exclusion rules must be a complete matrix
177
+
178
+ ---
179
+
180
+ ## Type-7: Business Development SOP
181
+
182
+ ```
183
+ 1. Why a standard code template is needed (the problem of unmanaged code)
184
+ 2. Core conventions (never expose low-level errors externally / pass Context all the way down / validate parameters up front)
185
+ 3. Standard Handler code template (copy-ready, annotated with "AI coding iron rules")
186
+ 4. Error code mapping table (scenario described in AI reasoning terms / recommended error code / Message)
187
+ 5. AI review checklist (machine-checkable)
188
+ ```
189
+
190
+ - T7-R01: code templates must be directly copyable and runnable
191
+ - T7-R02: every key comment is annotated with "AI coding iron rule"
192
+ - T7-R03: the error code table uses "the AI's reasoning" as the scenario description
193
+
194
+ ---
195
+
196
+ ## Type-8: Knowledge Enhancement Documents
197
+
198
+ ### Type-8a: Product Knowledge Library
199
+ Marked `type: bridge`; tables compare easily confused concepts and include "code parameter example" and "architecture and business impact" columns.
200
+
201
+ ### Type-8b: Anti-Patterns and Pitfalls Guide
202
+ Five-part structure: **trigger scenario → faulty behavior → root cause analysis → correct approach → related components**
203
+ The overview table records number / category / severity (P0 fatal / P1 severe / P2 important) / related components.
204
+
205
+ ### Type-8c: RPC Interface Contracts
206
+ Struct definitions with serialization tags + required/optional markers + AI coding contract requirements.
207
+
208
+ ### Type-8d: Troubleshooting Case Records (Memorix)
209
+ Structure: symptom → investigation process (Step N) → root cause → fix → lessons learned → related documents.
210
+
211
+ ---
212
+
213
+ ## Type-9: Graph Document Set (Graph RAG)
214
+
215
+ **Size**: 10~30KB each | **Count**: 5~10 | **Directory**: `graph/`
216
+
217
+ > Extracts the **cross-component relationship information** scattered across N component documents into a structured index, solving the "scattered information" problem RAG retrieval hits on relationship queries.
218
+
219
+ ### Graph Document Type List
220
+
221
+ | ID | Document name | Core content | Retrieval pain point solved |
222
+ |------|--------|---------|--------------|
223
+ | G1 | Component Dependency Matrix | N×N communication matrix + forward/reverse dependency index + external service dependencies | "Who depends on X?" requires traversing every document |
224
+ | G2 | Component Call Chain Overview | End-to-end core API chains + read/write separation mechanism + **complete state machine diagram** + operation-state constraint matrix | "Which modules does the API pass through?" information is scattered |
225
+ | G3 | Data Flow and Storage Dependencies | Storage dependency matrix + MQ queue topology + cache strategy | "Where is the data stored?" |
226
+ | G4 | Error Code Component Map | Error code range allocation + external → internal mapping | "Which module owns this error code?" |
227
+ | G5 | Cross-Component Interaction Scenarios | mermaid sequence diagrams for ≥10 scenarios + exception handling | "How is the quota check done?" |
228
+ | G6 | Knowledge Graph Triples | (S, P, O) triples + multi-hop dependency path index | "Who does A depend on indirectly?" |
229
+ | G7 | Architecture Risks and Impact Analysis | Blast radius + cluster analysis + critical paths/bottlenecks | "How big is the impact if X goes down?" |
230
+ | G8 | **Core Config Parameter Index** | Layered config item → behavior impact mapping + change impact surface quick lookup | "How do I change config XX?" |
231
+ | G9 | **Business Rule Constraint Matrix** | Operation preconditions + hardware/migration/billing constraints + AI reasoning decision tree | "Can XX be done?" |
232
+
233
+ ### Graph Document Generation Rules
234
+
235
+ - T9-R01: every graph document must have a `🤖 AI Quick Reference` table
236
+ - T9-R02: every graph document must have a `<!-- search-anchor: ... -->` anchor
237
+ - T9-R03: the graph directory must have a `README.md` index with a "lookup by question type" table and "retrieval routing rule suggestions"
238
+ - T9-R04: state machines must use the mermaid `stateDiagram-v2` format
239
+ - T9-R05: constraint decision trees must use the mermaid `graph TD` format
240
+ - T9-R06: operation-state constraints must be in ✅/❌ matrix format
241
+ - T9-R07: config parameters must state "behavior impact", "change risk" (🟢 low / 🟡 medium / 🔴 high), and "activation" (hot reload / restart required)
242
+ - T9-R08: business rule constraints must include an AI reasoning check flow (mermaid flowchart)
243
+ - T9-R09: triples must follow the standard (Subject, Predicate, Object) format
244
+ - T9-R10: graph documents **do not replace** component documents; they provide a **structured index from the relationship perspective**
245
+
246
+ ### Graph Document Generation Method
247
+
248
+ **Step 1: Relationship extraction**. Extract cross-component relationships from the N component documents:
249
+
250
+ ```
251
+ Scan dimensions:
252
+ ├── Call relationships (A calls B, protocol, scenario)
253
+ ├── Data dependencies (A reads/writes B, data content)
254
+ ├── Message topology (A publishes_to/consumes_from Queue)
255
+ ├── State transitions (operation → initial state → intermediate state → final state)
256
+ ├── Constraints (operation → preconditions → hardware/billing/quota constraints)
257
+ ├── Config mapping (config item → behavior impact → change risk)
258
+ └── Error code ownership (error code range → component → investigation direction)
259
+ ```
260
+
261
+ **Step 2: Structured modeling**. Convert the extracted relationships into standard formats:
262
+
263
+ ```
264
+ Relationship matrix → N×N table
265
+ Call chains → end-to-end text chain + mermaid sequence diagram
266
+ State machine → mermaid stateDiagram-v2
267
+ Constraint rules → decision tree (mermaid graph TD) + summary table
268
+ Config index → layered table (config item / default / behavior impact / change risk / activation)
269
+ Triples → (Subject, Predicate, Object, Protocol, Scenario) table
270
+ ```
271
+
272
+ **Step 3: Index weaving**. Build cross-references and retrieval routing between the graph documents:
273
+
274
+ ```
275
+ README.md:
276
+ ├── Document directory table (file / size / core content)
277
+ ├── Lookup-by-question-type table (question type / example / document to consult)
278
+ └── Retrieval routing rule suggestions (keyword → document to search first)
279
+ ```
280
+
281
+ ### Key Templates
282
+
283
+ #### State Machine Diagram Template
284
+
285
+ ```markdown
286
+ ## Complete Instance State Machine Diagram
287
+
288
+ ### Core State Transition Diagram
289
+ ​```mermaid
290
+ stateDiagram-v2
291
+ [*] --> PENDING: CreateAction
292
+ PENDING --> RUNNING: creation succeeded (flag: 2→1)
293
+ RUNNING --> STOPPING: StopAction (flag: 1→8)
294
+ STOPPING --> STOPPED: shutdown succeeded (flag: 8→3)
295
+ ...
296
+ ​```
297
+
298
+ ### Operation-State Constraint Quick Lookup Matrix
299
+ | Operation \ Current state | RUNNING | STOPPED | PENDING | ... |
300
+ |---------------|:-------:|:-------:|:-------:|:---:|
301
+ | **Start** | ❌ | ✅ | ❌ | ... |
302
+ | **Stop** | ✅ | ❌ | ❌ | ... |
303
+ ```
304
+
305
+ #### Business Rule Constraint Matrix Template
306
+
307
+ ```markdown
308
+ ## Operation Precondition Matrix
309
+ | Operation | State requirement | Hardware constraint | Billing constraint | Quota constraint | Other constraints |
310
+
311
+ ## Migration Constraint Decision Tree
312
+ ​```mermaid
313
+ graph TD
314
+ A[Migration request] --> B{Hardware constraint 1?}
315
+ B -->|Yes| C["❌ Forbidden"]
316
+ B -->|No| D{Hardware constraint 2?}
317
+ ...
318
+ ​```
319
+
320
+ ## AI Reasoning Rules Quick Lookup
321
+ ​```mermaid
322
+ graph TD
323
+ A["User asks: can XX be executed?"] --> B["Step 1: state check"]
324
+ B --> B1{"Look up the operation-state constraint matrix"}
325
+ B1 -->|❌| Z1["No, the state does not allow it"]
326
+ B1 -->|✅| C["Step 2: type check"]
327
+ ...
328
+ ​```
329
+ ```
330
+
331
+ #### Config Parameter Index Template
332
+
333
+ ```markdown
334
+ ## {component layer} Config Parameters
335
+ | Config item | Default | Behavior impact | Change risk | Activation |
336
+ |--------|--------|---------|---------|---------|
337
+ | `config.key` | value | description | 🟢 low / 🟡 medium / 🔴 high | hot reload / restart required |
338
+
339
+ ## Config Change Impact Surface Quick Lookup
340
+ | Change type | Impact scope | Activation | Rollback strategy | Change risk |
341
+ ```
@@ -0,0 +1,164 @@
1
+ # Phase 3: AI-Native Enhancement, Making the Knowledge Base Understandable to AI
2
+
3
+ ## 1. AI Quick Reference Table (required in every component document)
4
+
5
+ The chunk returned by RAG retrieval is usually a fragment of a document. The AI Quick Reference table ensures that no matter which part of the document is retrieved, the AI gets the component's global context from the table at the top.
6
+
7
+ ```markdown
8
+ ## 🤖 AI Quick Reference
9
+
10
+ | Dimension | Key Information |
11
+ |------|---------|
12
+ | **Core Responsibility** | {one sentence, no more than 30 words} |
13
+ | **Architecture Layer** | {layer it belongs to} → {role within that layer} |
14
+ | **Upstream Components** | {component (communication method)} |
15
+ | **Downstream Components** | {component (communication method)} |
16
+ | **Code Entry Point** | {entry file} → {core function} |
17
+ | **Core Mechanism** | {the 1-2 most important technical mechanisms} |
18
+ | **Mutual Exclusion** | {concurrency control method} |
19
+ | **Data Flow** | {where it comes from → what it passes through → where it goes} |
20
+ | **Tech Stack** | {language + framework + middleware} |
21
+ | **Scheduled Jobs** | {N scheduled jobs (brief description of the core ones)} |
22
+ ```
23
+
24
+ Rules:
25
+ - Every dimension must be **concrete**, never a generic description
26
+ - "Code Entry Point" is precise down to `file name → function name`
27
+ - "Upstream/Downstream Components" must state the communication method (RPC/MQ/DB)
28
+ - The table goes at the very top of the document (immediately after the title)
29
+
30
+ ## 2. Retrieval Routing Rules (required in the main architecture document)
31
+
32
+ Prevents RAG retrieval from "cross-talk" between internal and external documents:
33
+
34
+ ```markdown
35
+ ## Knowledge Base Retrieval Routing Guide (AI only)
36
+
37
+ ### Document Category Overview
38
+ | Category | Directory | Document Count | Content Nature |
39
+ | [Internal, Bridge] Product-Code Mapping | ... | N docs | Core API intent → constraints → call chain |
40
+ | [Internal] Component Design Documents | ... | N docs | Architecture design, code entry points |
41
+ | [External] Product API Documentation | ... | N docs | Official API reference |
42
+
43
+ ### Retrieval Routing Rules
44
+ Rule 1, internal architecture first: involves component names / internal concepts → search internal documents only
45
+ Rule 2, external documents apply: involves API parameters / product limits → search external documents
46
+ Rule 3, mixed queries: involves both → internal first, supplemented by external
47
+ Rule 4, check constraints before writing code: the bridge documents must be searched first
48
+
49
+ ### Document Priority
50
+ | Level 1 (core) | Product-Code Mapping + Rules Cheat Sheet | Must check before writing code |
51
+ | Level 2 (architecture) | Component Design Documents + main architecture document | Understand internal implementation |
52
+ | Level 3 (business) | Business architecture + core call chains | Understand business flows |
53
+ | Level 4 (reference) | Raw external API documentation | Only when the above cannot answer |
54
+ ```
55
+
56
+ ## 3. Search Anchor (semantic retrieval anchor)
57
+
58
+ Add below the title of every document:
59
+
60
+ ```html
61
+ <!-- search-anchor: keyword1, keyword2, synonym, English term, Chinese term -->
62
+ ```
63
+
64
+ - Include: Chinese name, English name, abbreviations, synonyms, common search terms
65
+ - Count: 5~15
66
+ - Example: `<!-- search-anchor: RPC contract, Schema, interface contract, Protobuf, IDL -->`
67
+
68
+ ## 4. Bidirectional Link Weaving
69
+
70
+ ```markdown
71
+ # Component document → main architecture document
72
+ > Position in the overall architecture: [📘 Technical Architecture - 4.5 {component}](./{project_name} Technical Architecture.md#45-component)
73
+
74
+ # Main architecture document → component document
75
+ See [{component} Design](./XX_{component}_Design.md)
76
+
77
+ # Bridge document → component document
78
+ | [{component}](./XX_{component}_Design.md) | Input validation layer |
79
+ ```
80
+
81
+ Weaving rules:
82
+ 1. Every component document has ≥ 1 link pointing to the main architecture document
83
+ 2. Every mention of a component in the main architecture document links to the component document
84
+ 3. Every component mentioned in a bridge document has a link
85
+ 4. The "Related Components" of anti-pattern documents have links
86
+
87
+ ## 5. QA Pair Generation (AI metadata layer)
88
+
89
+ Pre-populate high-frequency QA pairs (10~20) in the AI-only section of the main architecture document:
90
+
91
+ ```markdown
92
+ - **Q: How is the state machine of the core entity defined?**
93
+ A: See `3.7 Complete Entity State Machine` and `9.2.1 Global State Consistency Mapping Table`.
94
+
95
+ - **Q: Where are the workflow steps configured? How are exceptions compensated and rolled back?**
96
+ A: N-level orchestration is used. Macro flows are in {config file 1}, fine-grained steps in {config file 2}.
97
+
98
+ - **Q: What are the message queue topology and routing rules?**
99
+ A: See `9.3.1 MQ Routing Topology`. Core Exchanges/Topics include {list}.
100
+
101
+ - **Q: What is the resource mutual exclusion (locking) convention?**
102
+ A: See `9.4.4 Distributed Locking and Idempotency Conventions`. {lock scheme} is used.
103
+ ```
104
+
105
+ Every A must include a concrete section / document reference.
106
+
107
+ ## 6. Graph Document AI Enhancement Spec
108
+
109
+ Graph documents are the **relationship index layer** of an AI-Native knowledge base. They specifically solve retrieval failures of RAG in "cross-component relationship query" scenarios.
110
+
111
+ ### 6.1 Required Structure of the Graph Document README
112
+
113
+ ```markdown
114
+ # Graph Document Set (Graph RAG)
115
+ ## Relationship to the Main Document System (three-layer positioning table)
116
+ ## Document Index (file / size / core content)
117
+ ## Lookup by Question Type (question type / example / document to consult)
118
+ ## Suggested Retrieval Routing Rules (keyword → document to search first)
119
+ ## Maintenance Notes
120
+ ```
121
+
122
+ ### 6.2 Graph Document AI Quick Reference Table
123
+
124
+ Every graph document must have this immediately after the title:
125
+
126
+ ```markdown
127
+ ## 🤖 AI Quick Reference
128
+ | Dimension | Key Information |
129
+ |------|---------|
130
+ | **Document Positioning** | {one-sentence positioning} |
131
+ | **Core Value** | {what the AI can do with this document} |
132
+ | **Coverage** | {which entities / relationships are covered} |
133
+ | **Usage Scenarios** | {typical example questions} |
134
+ | **Relationship to the State Machine** | {if applicable: the state machine solves X, this document solves Y} |
135
+ ```
136
+
137
+ ### 6.3 Embedded AI Reasoning Rules
138
+
139
+ Constraint-type graph documents must embed the AI reasoning decision flow:
140
+
141
+ ```markdown
142
+ ## AI Reasoning Rules Quick Reference
143
+ > When the AI decides "whether an operation can be executed", check layer by layer in this priority order:
144
+
145
+ 1. **State check** → consult the operation-state constraint matrix
146
+ 2. **Type check** → consult the special instance type constraint summary
147
+ 3. **Hardware check** → consult the detailed hardware constraint table
148
+ 4. **Billing check** → consult the detailed billing constraint table
149
+ 5. **Quota check** → consult the product rules cheat sheet
150
+ 6. **Mutual exclusion check** → is there an operation in progress
151
+ ```
152
+
153
+ ### 6.4 Configuration Change Checklist
154
+
155
+ For configuration-type graph documents, when the AI answers "how do I change configuration XX" it must also state:
156
+
157
+ ```
158
+ 1. Config file location: which file / repository it lives in
159
+ 2. Impact scope: all regions, or a single region / single machine
160
+ 3. Activation method: hot reload, or restart required
161
+ 4. Rollback strategy: how to roll back quickly
162
+ 5. Change risk: 🟢 low / 🟡 medium / 🔴 high
163
+ 6. Canary recommendation: whether a canary release is needed
164
+ ```