@ia-ccun/code-agent-cli 0.0.47 → 0.0.49-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 (77) hide show
  1. package/config/agent/skills/design-md/README.md +34 -0
  2. package/config/agent/skills/design-md/SKILL.md +172 -0
  3. package/config/agent/skills/design-md/examples/DESIGN.md +154 -0
  4. package/config/agent/skills/fireworks-tech-graph/LICENSE +21 -0
  5. package/config/agent/skills/fireworks-tech-graph/README.md +528 -0
  6. package/config/agent/skills/fireworks-tech-graph/README.zh.md +499 -0
  7. package/config/agent/skills/fireworks-tech-graph/SKILL.md +537 -0
  8. package/config/agent/skills/fireworks-tech-graph/agentloop-core.svg +101 -0
  9. package/config/agent/skills/fireworks-tech-graph/agents/openai.yaml +4 -0
  10. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style1-flat.png +0 -0
  11. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style2-dark.png +0 -0
  12. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style3-blueprint.png +0 -0
  13. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style4-notion.png +0 -0
  14. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style5-glass.png +0 -0
  15. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style6-claude.png +0 -0
  16. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style7-openai.png +0 -0
  17. package/config/agent/skills/fireworks-tech-graph/fixtures/agent-memory-types-style4.json +181 -0
  18. package/config/agent/skills/fireworks-tech-graph/fixtures/api-flow-style7.json +40 -0
  19. package/config/agent/skills/fireworks-tech-graph/fixtures/mem0-style1.json +297 -0
  20. package/config/agent/skills/fireworks-tech-graph/fixtures/microservices-style3.json +64 -0
  21. package/config/agent/skills/fireworks-tech-graph/fixtures/multi-agent-style5.json +45 -0
  22. package/config/agent/skills/fireworks-tech-graph/fixtures/system-architecture-style6.json +48 -0
  23. package/config/agent/skills/fireworks-tech-graph/fixtures/tool-call-style2.json +182 -0
  24. package/config/agent/skills/fireworks-tech-graph/package.json +42 -0
  25. package/config/agent/skills/fireworks-tech-graph/references/icons.md +406 -0
  26. package/config/agent/skills/fireworks-tech-graph/references/style-1-flat-icon.md +108 -0
  27. package/config/agent/skills/fireworks-tech-graph/references/style-2-dark-terminal.md +107 -0
  28. package/config/agent/skills/fireworks-tech-graph/references/style-3-blueprint.md +113 -0
  29. package/config/agent/skills/fireworks-tech-graph/references/style-4-notion-clean.md +94 -0
  30. package/config/agent/skills/fireworks-tech-graph/references/style-5-glassmorphism.md +125 -0
  31. package/config/agent/skills/fireworks-tech-graph/references/style-6-claude-official.md +209 -0
  32. package/config/agent/skills/fireworks-tech-graph/references/style-7-openai.md +215 -0
  33. package/config/agent/skills/fireworks-tech-graph/references/style-diagram-matrix.md +135 -0
  34. package/config/agent/skills/fireworks-tech-graph/references/svg-layout-best-practices.md +100 -0
  35. package/config/agent/skills/fireworks-tech-graph/scripts/README.md +244 -0
  36. package/config/agent/skills/fireworks-tech-graph/scripts/generate-diagram.sh +157 -0
  37. package/config/agent/skills/fireworks-tech-graph/scripts/generate-from-template.py +1556 -0
  38. package/config/agent/skills/fireworks-tech-graph/scripts/test-all-styles.sh +135 -0
  39. package/config/agent/skills/fireworks-tech-graph/scripts/validate-svg.sh +292 -0
  40. package/config/agent/skills/fireworks-tech-graph/templates/agent-architecture.svg +28 -0
  41. package/config/agent/skills/fireworks-tech-graph/templates/architecture.svg +23 -0
  42. package/config/agent/skills/fireworks-tech-graph/templates/comparison-matrix.svg +14 -0
  43. package/config/agent/skills/fireworks-tech-graph/templates/data-flow.svg +28 -0
  44. package/config/agent/skills/fireworks-tech-graph/templates/er-diagram.svg +21 -0
  45. package/config/agent/skills/fireworks-tech-graph/templates/flowchart.svg +21 -0
  46. package/config/agent/skills/fireworks-tech-graph/templates/sequence.svg +20 -0
  47. package/config/agent/skills/fireworks-tech-graph/templates/state-machine.svg +20 -0
  48. package/config/agent/skills/fireworks-tech-graph/templates/timeline.svg +19 -0
  49. package/config/agent/skills/fireworks-tech-graph/templates/use-case.svg +21 -0
  50. package/config/agent/skills/impeccable/adapt/SKILL.md +205 -0
  51. package/config/agent/skills/impeccable/animate/SKILL.md +178 -0
  52. package/config/agent/skills/impeccable/arrange/SKILL.md +128 -0
  53. package/config/agent/skills/impeccable/audit/SKILL.md +129 -0
  54. package/config/agent/skills/impeccable/bolder/SKILL.md +120 -0
  55. package/config/agent/skills/impeccable/clarify/SKILL.md +186 -0
  56. package/config/agent/skills/impeccable/colorize/SKILL.md +146 -0
  57. package/config/agent/skills/impeccable/critique/SKILL.md +123 -0
  58. package/config/agent/skills/impeccable/delight/SKILL.md +307 -0
  59. package/config/agent/skills/impeccable/distill/SKILL.md +125 -0
  60. package/config/agent/skills/impeccable/extract/SKILL.md +95 -0
  61. package/config/agent/skills/impeccable/frontend-design/reference/color-and-contrast.md +132 -0
  62. package/config/agent/skills/impeccable/frontend-design/reference/interaction-design.md +123 -0
  63. package/config/agent/skills/impeccable/frontend-design/reference/motion-design.md +99 -0
  64. package/config/agent/skills/impeccable/frontend-design/reference/responsive-design.md +114 -0
  65. package/config/agent/skills/impeccable/frontend-design/reference/spatial-design.md +100 -0
  66. package/config/agent/skills/impeccable/frontend-design/reference/typography.md +133 -0
  67. package/config/agent/skills/impeccable/frontend-design/reference/ux-writing.md +107 -0
  68. package/config/agent/skills/impeccable/harden/SKILL.md +358 -0
  69. package/config/agent/skills/impeccable/normalize/SKILL.md +74 -0
  70. package/config/agent/skills/impeccable/onboard/SKILL.md +249 -0
  71. package/config/agent/skills/impeccable/optimize/SKILL.md +269 -0
  72. package/config/agent/skills/impeccable/overdrive/SKILL.md +145 -0
  73. package/config/agent/skills/impeccable/polish/SKILL.md +206 -0
  74. package/config/agent/skills/impeccable/quieter/SKILL.md +106 -0
  75. package/config/agent/skills/impeccable/teach-impeccable/SKILL.md +72 -0
  76. package/config/agent/skills/impeccable/typeset/SKILL.md +119 -0
  77. package/package.json +1 -1
@@ -0,0 +1,537 @@
1
+ ---
2
+ name: "fireworks-tech-graph"
3
+ description: >-
4
+ "Create production-quality SVG technical diagrams (architecture, data flow,
5
+ flowchart, sequence, UML, mind map, etc.) exported as PNG. Supports 7 visual
6
+ styles including Flat, Dark Terminal, Blueprint, Notion Clean, Glassmorphism,
7
+ Claude Official, and OpenAI Official. Trigger on: '画图' '帮我画' '生成图'
8
+ '做个图' '架构图' '流程图' '可视化' '出图' '选择风格' '换风格'
9
+ 'generate diagram' 'draw diagram' 'visualize' or any system/flow description
10
+ the user wants illustrated."
11
+ ---
12
+
13
+ # Fireworks Tech Graph
14
+
15
+ Generate production-quality SVG technical diagrams exported as PNG via `rsvg-convert`.
16
+
17
+ ## Install Source
18
+
19
+ Install this skill from GitHub:
20
+
21
+ ```bash
22
+ npx skills add yizhiyanhua-ai/fireworks-tech-graph
23
+ ```
24
+
25
+ Public package page:
26
+
27
+ ```text
28
+ https://www.npmjs.com/package/@yizhiyanhua-ai/fireworks-tech-graph
29
+ ```
30
+
31
+ Do not pass `@yizhiyanhua-ai/fireworks-tech-graph` directly to `skills add`, because the CLI expects a GitHub or local repository source.
32
+
33
+ Update command:
34
+
35
+ ```bash
36
+ npx skills add yizhiyanhua-ai/fireworks-tech-graph --force -g -y
37
+ ```
38
+
39
+ ## Helper Scripts (Recommended)
40
+
41
+ Four helper scripts in `scripts/` directory provide stable SVG generation and validation:
42
+
43
+ ### 1. `generate-diagram.sh` - Validate SVG + export PNG
44
+ ```bash
45
+ ./scripts/generate-diagram.sh -t architecture -s 1 -o ./output/arch.svg
46
+ ```
47
+ - Validates an existing SVG file
48
+ - Exports PNG after validation
49
+ - Example: `./scripts/generate-diagram.sh -t architecture -s 1 -o ./output/arch.svg`
50
+
51
+ ### 2. `generate-from-template.py` - Create starter SVG from template
52
+ ```bash
53
+ python3 ./scripts/generate-from-template.py architecture ./output/arch.svg '{"title":"My Diagram","nodes":[],"arrows":[]}'
54
+ ```
55
+ - Loads a built-in SVG template
56
+ - Renders nodes, arrows, and legend entries from JSON input
57
+ - Escapes text content to keep output XML-valid
58
+
59
+ ### 3. `validate-svg.sh` - Validate SVG syntax
60
+ ```bash
61
+ ./scripts/validate-svg.sh <svg-file>
62
+ ```
63
+ - Checks XML syntax
64
+ - Verifies tag balance
65
+ - Validates marker references
66
+ - Checks attribute completeness
67
+ - Validates path data
68
+
69
+ ### 4. `test-all-styles.sh` - Batch test all styles
70
+ ```bash
71
+ ./scripts/test-all-styles.sh
72
+ ```
73
+ - Tests multiple diagram sizes
74
+ - Validates all generated SVGs
75
+ - Generates test report
76
+
77
+ **When to use scripts:**
78
+ - Use scripts when generating complex SVGs to avoid syntax errors
79
+ - Scripts provide automatic validation and error reporting
80
+ - Recommended for production diagrams
81
+
82
+ **When to generate SVG directly:**
83
+ - Simple diagrams with few elements
84
+ - Quick prototypes
85
+ - When you need full control over SVG structure
86
+
87
+ ## Style Selection (Interactive)
88
+
89
+ When user requests a diagram **without specifying a style**, always ask for style preference first:
90
+
91
+ ### Style Selection Prompt (Chinese)
92
+ ```
93
+ 🎨 请选择图表风格:
94
+
95
+ 1️⃣ Flat Icon(默认) ████ 白底清新,适合技术文档
96
+ 2️⃣ Dark Terminal ▓▓▓▓ 深色终端风,适合开发者
97
+ 3️⃣ Blueprint ▒▒▒▒ 深蓝蓝图,适合架构图
98
+ 4️⃣ Notion Clean ░░░░ 极简白,适合 Notion
99
+ 5️⃣ Glassmorphism ▦▦▦▦ 玻璃拟态,适合演讲展示
100
+ 6️⃣ Claude Official ▤▤▤▤ 暖奶油色,Claude 风格
101
+ 7️⃣ OpenAI Official ▬▬▬▬ 纯白简洁,OpenAI 风格
102
+
103
+ 请输入数字 1-7,或直接描述你想要的风格效果。
104
+ 直接发送编号即可,例如:「3」表示 Blueprint 风格
105
+ ```
106
+
107
+ ### Style Selection Prompt (English)
108
+ ```
109
+ 🎨 Choose a diagram style:
110
+
111
+ 1️⃣ Flat Icon (default) White, clean, for docs
112
+ 2️⃣ Dark Terminal Dark #0f0f1a, for devs
113
+ 3️⃣ Blueprint Deep blue #0a1628, for arch
114
+ 4️⃣ Notion Clean Minimal white
115
+ 5️⃣ Glassmorphism Dark gradient, for slides
116
+ 6️⃣ Claude Official Warm cream #f8f6f3
117
+ 7️⃣ OpenAI Official Pure white
118
+
119
+ Enter a number 1-7, or describe the style you want.
120
+ ```
121
+
122
+ ### Style Selection Rules
123
+
124
+ 1. **User specifies style** → Use that style directly, skip selection
125
+ 2. **User doesn't specify** → Show style selection prompt above
126
+ 3. **User says "随便"/"default"/"无所谓"** → Use Style 1 (Flat Icon)
127
+ 4. **User says "换风格"/"换个风格"** → Show style options, apply selected
128
+ 5. **User provides partial info** (e.g., "深色", "dark") → Map to closest match:
129
+ - "深色"/"dark"/"黑色" → Style 2 (Dark Terminal)
130
+ - "蓝色"/"蓝色系"/"blue" → Style 3 (Blueprint)
131
+ - "简洁"/"简单"/"minimal" → Style 4 (Notion Clean)
132
+ - "高级"/"酷"/"fancy"/"modern" → Style 5 (Glassmorphism)
133
+ - "Claude"/"暖色"/"温暖" → Style 6
134
+ - "OpenAI"/"白色"/"纯白" → Style 7
135
+
136
+ ### Quick Style Preview
137
+
138
+ After selecting style, show brief confirmation:
139
+ - ✓ **已选择 Style 3 (Blueprint)** - 深蓝背景,适合架构文档
140
+
141
+ ---
142
+
143
+ ## Workflow (Always Follow This Order)
144
+
145
+ 1. **Confirm style** — Ask style preference if not specified (see Style Selection above)
146
+ 2. **Classify** the diagram type (see Diagram Types below)
147
+ 3. **Extract structure** — identify layers, nodes, edges, flows, and semantic groups from user description
148
+ 4. **Plan layout** — apply the layout rules for the diagram type
149
+ 5. **Load style reference** — load `references/style-N.md` for exact color tokens and SVG patterns (N = selected style number)
150
+ 6. **Map nodes to shapes** — use Shape Vocabulary below
151
+ 7. **Check icon needs** — load `references/icons.md` for known products
152
+ 8. **Write SVG** with adaptive strategy (see SVG Generation Strategy below)
153
+ 9. **Validate**: Run `rsvg-convert file.svg -o /dev/null 2>&1` to check syntax
154
+ 10. **Export PNG**: `rsvg-convert -w 1920 file.svg -o file.png`
155
+ 11. **Add Watermark**: Use sharp to add "世界那么哒" watermark to bottom-right
156
+
157
+ ### Watermark Implementation
158
+
159
+ ```javascript
160
+ // Watermark function using sharp
161
+ const addWatermark = async (pngPath) => {
162
+ const sharp = require('/path/to/sharp'); // Use known sharp location
163
+
164
+ const pngBuffer = fs.readFileSync(pngPath);
165
+ const image = sharp(pngBuffer);
166
+ const metadata = await image.metadata();
167
+
168
+ // Create watermark SVG
169
+ const watermarkSvg = Buffer.from(`
170
+ <svg width="${metadata.width}" height="${metadata.height}">
171
+ <defs>
172
+ <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
173
+ <feDropShadow dx="1" dy="1" stdDeviation="2" flood-opacity="0.5"/>
174
+ </filter>
175
+ </defs>
176
+ <text
177
+ x="${metadata.width - 20}"
178
+ y="${metadata.height - 20}"
179
+ text-anchor="end"
180
+ font-family="Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif"
181
+ font-size="${Math.max(16, Math.floor(metadata.width / 60))}"
182
+ fill="rgba(128, 128, 128, 0.5)"
183
+ filter="url(#shadow)"
184
+ >世界那么哒</text>
185
+ </svg>
186
+ `);
187
+
188
+ await sharp(watermarkSvg)
189
+ .composite([{ input: pngBuffer, blend: 'over' }])
190
+ .png()
191
+ .toFile(pngPath + '.tmp');
192
+
193
+ fs.renameSync(pngPath + '.tmp', pngPath);
194
+ };
195
+ ```
196
+
197
+ **Note**: Watermark size scales with image width (font-size = width / 60, min 16px). Positioned 20px from bottom-right corner with semi-transparent gray color and subtle shadow.
198
+
199
+ 12. **Report** the generated file paths
200
+
201
+ ## Diagram Types & Layout Rules
202
+
203
+ ### Architecture Diagram
204
+ Nodes = services/components. Group into **horizontal layers** (top→bottom or left→right).
205
+ - Typical layers: Client → Gateway/LB → Services → Data/Storage
206
+ - Use `<rect>` dashed containers to group related services in the same layer
207
+ - Arrow direction follows data/request flow
208
+ - ViewBox: `0 0 960 600` standard, `0 0 960 800` for tall stacks
209
+
210
+ ### Data Flow Diagram
211
+ Emphasizes **what data moves where**. Focus on data transformation.
212
+ - Label every arrow with the data type (e.g., "embeddings", "query", "context")
213
+ - Use wider arrows (`stroke-width: 2.5`) for primary data paths
214
+ - Dashed arrows for control/trigger flows
215
+ - Color arrows by data category (not just Agent/RAG — use semantics)
216
+
217
+ ### Flowchart / Process Flow
218
+ Sequential decision/process steps.
219
+ - Top-to-bottom preferred; left-to-right for wide flows
220
+ - Diamond shapes for decisions, rounded rects for processes, parallelograms for I/O
221
+ - Keep node labels short (≤3 words); put detail in sub-labels
222
+ - Align nodes on a grid: x positions snap to 120px intervals, y to 80px
223
+
224
+ ### Agent Architecture Diagram
225
+ Shows how an AI agent reasons, uses tools, and manages memory.
226
+ Key conceptual layers to always consider:
227
+ - **Input layer**: User, query, trigger
228
+ - **Agent core**: LLM, reasoning loop, planner
229
+ - **Memory layer**: Short-term (context window), Long-term (vector/graph DB), Episodic
230
+ - **Tool layer**: Tool calls, APIs, search, code execution
231
+ - **Output layer**: Response, action, side-effects
232
+ Use cyclic arrows (loop arcs) to show iterative reasoning. Separate memory types visually.
233
+
234
+ ### Memory Architecture Diagram (Mem0, MemGPT-style)
235
+ Specialized agent diagram focused on memory operations.
236
+ - Show memory **write path** and **read path** separately (different arrow colors)
237
+ - Memory tiers: Working Memory → Short-term → Long-term → External Store
238
+ - Label memory operations: `store()`, `retrieve()`, `forget()`, `consolidate()`
239
+ - Use stacked rects or layered cylinders for storage tiers
240
+
241
+ ### Sequence Diagram
242
+ Time-ordered message exchanges between participants.
243
+ - Participants as vertical **lifelines** (top labels + vertical dashed lines)
244
+ - Messages as horizontal arrows between lifelines, top-to-bottom time order
245
+ - Activation boxes (thin filled rects on lifeline) show active processing
246
+ - Group with `<rect>` loop/alt frames with label in top-left corner
247
+ - ViewBox height = 80 + (num_messages × 50)
248
+
249
+ ### Comparison / Feature Matrix
250
+ Side-by-side comparison of approaches, systems, or components.
251
+ - Column headers = systems, row headers = attributes
252
+ - Row height: 40px; column width: min 120px; header row height: 50px
253
+ - Checked cell: tinted background (e.g. `#dcfce7`) + `✓` checkmark; unsupported: `#f9fafb` fill
254
+ - Alternating row fills (`#f9fafb` / `#ffffff`) for readability
255
+ - Max readable columns: 5; beyond that, split into two diagrams
256
+
257
+ ### Timeline / Gantt
258
+ Horizontal time axis showing durations, phases, and milestones.
259
+ - X-axis = time (weeks/months/quarters); Y-axis = items/tasks/phases
260
+ - Bars: rounded rects, colored by category, labeled inside or beside
261
+ - Milestone markers: diamond or filled circle at specific x position with label above
262
+ - ViewBox: `0 0 960 400` typical; wider for many time periods: `0 0 1200 400`
263
+
264
+ ### Mind Map / Concept Map
265
+ Radial layout from central concept.
266
+ - Central node at `cx=480, cy=280`
267
+ - First-level branches: evenly distributed around center (360/N degrees)
268
+ - Second-level branches: branch off first-level at 30-45° offset
269
+ - Use curved `<path>` with cubic bezier for branches, not straight lines
270
+
271
+ ### Class Diagram (UML)
272
+ Static structure showing classes, attributes, methods, and relationships.
273
+ - **Class box**: 3-compartment rect (name / attributes / methods), min width 160px
274
+ - Top compartment: class name, bold, centered (abstract = *italic*)
275
+ - Middle: attributes with visibility (`+` public, `-` private, `#` protected)
276
+ - Bottom: method signatures, same visibility notation
277
+ - **Relationships**:
278
+ - Inheritance (extends): solid line + hollow triangle arrowhead, child → parent
279
+ - Implementation (interface): dashed line + hollow triangle, class → interface
280
+ - Association: solid line + open arrowhead, label with multiplicity (1, 0..*, 1..*)
281
+ - Aggregation: solid line + hollow diamond on container side
282
+ - Composition: solid line + filled diamond on container side
283
+ - Dependency: dashed line + open arrowhead
284
+ - **Interface**: `<<interface>>` stereotype above name, or circle/lollipop notation
285
+ - **Enum**: compartment rect with `<<enumeration>>` stereotype, values in bottom
286
+ - Layout: parent classes top, children below; interfaces to the left/right of implementors
287
+ - ViewBox: `0 0 960 600` standard; `0 0 960 800` for deep hierarchies
288
+
289
+ ### Use Case Diagram (UML)
290
+ System functionality from user perspective.
291
+ - **Actor**: stick figure (circle head + body line) placed outside system boundary
292
+ - Label below figure, 13-14px
293
+ - Primary actors on left, secondary/supporting on right
294
+ - **Use case**: ellipse with label centered inside, min 140×60px
295
+ - Keep names verb phrases: "Create Order", "Process Payment"
296
+ - **System boundary**: large rect with dashed border + system name in top-left
297
+ - **Relationships**:
298
+ - Include: dashed arrow `<<include>>` from base to included use case
299
+ - Extend: dashed arrow `<<extend>>` from extension to base use case
300
+ - Generalization: solid line + hollow triangle (specialized → general)
301
+ - Layout: system boundary centered, actors outside, use cases inside
302
+ - ViewBox: `0 0 960 600` standard
303
+
304
+ ### State Machine Diagram (UML)
305
+ Lifecycle states and transitions of an entity.
306
+ - **State**: rounded rect with state name, min 120×50px
307
+ - Internal activities: small text `entry/ action`, `exit/ action`, `do/ activity`
308
+ - **Initial state**: filled black circle (r=8), one outgoing arrow
309
+ - **Final state**: filled circle (r=8) inside hollow circle (r=12)
310
+ - **Choice**: small hollow diamond, guard labels on outgoing arrows `[condition]`
311
+ - **Transition**: arrow with optional label `event [guard] / action`
312
+ - Guard conditions in square brackets
313
+ - Actions after `/`
314
+ - **Composite/nested state**: larger rect containing sub-states, with name tab
315
+ - **Fork/join**: thick horizontal or vertical black bar (synchronization)
316
+ - Layout: initial state top-left, final state bottom-right, flow top-to-bottom
317
+ - ViewBox: `0 0 960 600` standard
318
+
319
+ ### ER Diagram (Entity-Relationship)
320
+ Database schema and data relationships.
321
+ - **Entity**: rect with entity name in header (bold), attributes below
322
+ - Primary key attribute: underlined
323
+ - Foreign key: italic or marked with (FK)
324
+ - Min width: 160px; attribute font-size: 12px
325
+ - **Relationship**: diamond shape on connecting line
326
+ - Label inside diamond: "has", "belongs to", "enrolls in"
327
+ - Cardinality labels near entity: `1`, `N`, `0..1`, `0..*`, `1..*`
328
+ - **Weak entity**: double-bordered rect with double diamond relationship
329
+ - **Associative entity**: diamond + rect hybrid (rect with diamond inside)
330
+ - Line style: solid for identifying relationships, dashed for non-identifying
331
+ - Layout: entities in 2-3 rows, relationships between related entities
332
+ - ViewBox: `0 0 960 600` standard; wider `0 0 1200 600` for many entities
333
+
334
+ ### Network Topology
335
+ Physical or logical network infrastructure.
336
+ - **Devices**: icon-like rects or rounded rects
337
+ - Router: circle with cross arrows
338
+ - Switch: rect with arrow grid
339
+ - Server: stacked rect (rack icon)
340
+ - Firewall: brick-pattern rect or shield shape
341
+ - Load Balancer: horizontal split rect with arrows
342
+ - Cloud: cloud path (overlapping arcs)
343
+ - **Connections**: lines between device centers
344
+ - Ethernet/wired: solid line, label bandwidth
345
+ - Wireless: dashed line with WiFi symbol
346
+ - VPN: dashed line with lock icon
347
+ - **Subnets/Zones**: dashed rect containers with zone label (DMZ, Internal, External)
348
+ - **Labels**: device hostname + IP below, 12-13px
349
+ - Layout: tiered top-to-bottom (Internet → Edge → Core → Access → Endpoints)
350
+ - ViewBox: `0 0 960 600` standard
351
+
352
+ ## UML Coverage Map
353
+
354
+ Full mapping of UML 14 diagram types to supported diagram types:
355
+
356
+ | UML Diagram | Supported As | Notes |
357
+ |-------------|-------------|-------|
358
+ | Class | Class Diagram | Full UML notation |
359
+ | Component | Architecture Diagram | Use colored fills per component type |
360
+ | Deployment | Architecture Diagram | Add node/instance labels |
361
+ | Package | Architecture Diagram | Use dashed grouping containers |
362
+ | Composite Structure | Architecture Diagram | Nested rects within components |
363
+ | Object | Class Diagram | Instance boxes with underlined name |
364
+ | Use Case | Use Case Diagram | Full actor/ellipse/relationship |
365
+ | Activity | Flowchart / Process Flow | Add fork/join bars |
366
+ | State Machine | State Machine Diagram | Full UML notation |
367
+ | Sequence | Sequence Diagram | Add alt/opt/loop frames |
368
+ | Communication | — | Approximate with Sequence (swap axes) |
369
+ | Timing | Timeline | Adapt time axis |
370
+ | Interaction Overview | Flowchart | Combine activity + sequence fragments |
371
+ | ER Diagram | ER Diagram | Chen/Crow's foot notation |
372
+
373
+ ## Shape Vocabulary
374
+
375
+ Map semantic concepts to consistent shapes across all diagram types:
376
+
377
+ | Concept | Shape | Notes |
378
+ |---------|-------|-------|
379
+ | User / Human | Circle + body path | Stick figure or avatar |
380
+ | LLM / Model | Rounded rect with brain/spark icon or gradient fill | Use accent color |
381
+ | Agent / Orchestrator | Hexagon or rounded rect with double border | Signals "active controller" |
382
+ | Memory (short-term) | Rounded rect, dashed border | Ephemeral = dashed |
383
+ | Memory (long-term) | Cylinder (database shape) | Persistent = solid cylinder |
384
+ | Vector Store | Cylinder with grid lines inside | Add 3 horizontal lines |
385
+ | Graph DB | Circle cluster (3 overlapping circles) | |
386
+ | Tool / Function | Gear-like rect or rect with wrench icon | |
387
+ | API / Gateway | Hexagon (single border) | |
388
+ | Queue / Stream | Horizontal tube (pipe shape) | |
389
+ | File / Document | Folded-corner rect | |
390
+ | Browser / UI | Rect with 3-dot titlebar | |
391
+ | Decision | Diamond | Flowcharts only |
392
+ | Process / Step | Rounded rect | Standard box |
393
+ | External Service | Rect with cloud icon or dashed border | |
394
+ | Data / Artifact | Parallelogram | I/O in flowcharts |
395
+
396
+ ## Arrow Semantics
397
+
398
+ Always assign arrow meaning, not just color:
399
+
400
+ | Flow Type | Color | Stroke | Dash | Meaning |
401
+ |-----------|-------|--------|------|---------|
402
+ | Primary data flow | blue `#2563eb` | 2px solid | none | Main request/response path |
403
+ | Control / trigger | orange `#ea580c` | 1.5px solid | none | One system triggering another |
404
+ | Memory read | green `#059669` | 1.5px solid | none | Retrieval from store |
405
+ | Memory write | green `#059669` | 1.5px | `5,3` | Write/store operation |
406
+ | Async / event | gray `#6b7280` | 1.5px | `4,2` | Non-blocking, event-driven |
407
+ | Embedding / transform | purple `#7c3aed` | 1px solid | none | Data transformation |
408
+ | Feedback / loop | purple `#7c3aed` | 1.5px curved | none | Iterative reasoning loop |
409
+
410
+ Always include a **legend** when 2+ arrow types are used.
411
+
412
+ ## Layout Rules & Validation
413
+
414
+ **Spacing**:
415
+ - Same-layer nodes: 80px horizontal, 120px vertical between layers
416
+ - Canvas margins: 40px minimum, 60px between node edges
417
+ - Snap to 8px grid: horizontal 120px intervals, vertical 120px intervals
418
+
419
+ **Arrow Labels** (CRITICAL):
420
+ - MUST have background rect: `<rect fill="canvas_bg" opacity="0.95"/>` with 4px horizontal, 2px vertical padding
421
+ - Place mid-arrow, ≤3 words, stagger by 15-20px when multiple arrows converge
422
+ - Maintain 10px safety distance from nodes
423
+
424
+ **Arrow Routing**:
425
+ - Prefer orthogonal (L-shaped) paths to minimize crossings
426
+ - Anchor arrows on component edges, not geometric centers
427
+ - Route around dense node clusters, use different y-offsets for parallel arrows
428
+ - Jump-over arcs (5px radius) for unavoidable crossings
429
+
430
+ **Line Overlap Prevention** (CRITICAL - most common bug on Codex):
431
+ When two arrows must cross each other, ALWAYS use jump-over arcs to prevent visual overlap:
432
+ - Crossing horizontal arrows: add a small semicircle arc (radius 5px, stroke same color as arrow, fill none) that "jumps over" the other line
433
+ - SVG pattern for jump-over: use a white/matching-background arc on the lower layer, then draw the upper arc on top
434
+ - Multiple crossings: stagger arc radii (5px, 7px, 9px) so arcs don't overlap each other
435
+ - Never let two arrows' straight-line segments cross without a jump-over arc
436
+
437
+ **Validation Checklist** (run before finalizing):
438
+ 1. **Arrow-Component Collision**: Arrows MUST NOT pass through component interiors (route around with orthogonal paths)
439
+ 2. **Text Overflow**: All text MUST fit with 8px padding (estimate: `text.length × 7px ≤ shape_width - 16px`)
440
+ 3. **Arrow-Text Alignment**: Arrow endpoints MUST connect to shape edges (not floating); all arrow labels MUST have background rects
441
+ 4. **Container Discipline**: Prefer arrows entering and leaving section containers through open gaps between components, not through inner component bodies
442
+
443
+ ## SVG Technical Rules
444
+
445
+ - ViewBox: `0 0 960 600` default; `0 0 960 800` tall; `0 0 1200 600` wide
446
+ - Fonts: embed via `<style>font-family: ...</style>` — no external `@import` (breaks rsvg-convert)
447
+ - `<defs>`: arrow markers, gradients, filters, clip paths
448
+ - Text: minimum 12px, prefer 13-14px labels, 11px sub-labels, 16-18px titles
449
+ - All arrows: `<marker>` with `markerEnd`, sized `markerWidth="10" markerHeight="7"`
450
+ - Drop shadows: `<feDropShadow>` in `<filter>`, apply sparingly (key nodes only)
451
+ - Curved paths: use `M x1,y1 C cx1,cy1 cx2,cy2 x2,y2` cubic bezier for loops/feedback arrows
452
+ - Clip content: use `<clipPath>` if text might overflow a node box
453
+
454
+ ## SVG Generation & Error Prevention
455
+
456
+ **MANDATORY: Python List Method** (ALWAYS use this):
457
+ ```python
458
+ python3 << 'EOF'
459
+ lines = []
460
+ lines.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 700">')
461
+ lines.append(' <defs>')
462
+ # ... each line separately
463
+ lines.append('</svg>')
464
+
465
+ with open('/path/to/output.svg', 'w') as f:
466
+ f.write('\n'.join(lines))
467
+ print("SVG generated successfully")
468
+ EOF
469
+ ```
470
+
471
+ **Why mandatory**: Prevents character truncation, typos, and syntax errors. Each line is independent and easy to verify.
472
+
473
+ **Pre-Tool-Call Checklist** (CRITICAL - use EVERY time):
474
+ 1. ✅ Can I write out the COMPLETE command/content right now?
475
+ 2. ✅ Do I have ALL required parameters ready?
476
+ 3. ✅ Have I checked for syntax errors in my prepared content?
477
+
478
+ **If ANY answer is NO**: STOP. Do NOT call the tool. Prepare the content first.
479
+
480
+ **Error Recovery Protocol**:
481
+ - **First error**: Analyze root cause, apply targeted fix
482
+ - **Second error**: Switch method entirely (Python list → chunked generation)
483
+ - **Third error**: STOP and report to user - do NOT loop endlessly
484
+ - **Never**: Retry the same failing command or call tools with empty parameters
485
+
486
+ **Validation** (run after generation):
487
+ ```bash
488
+ rsvg-convert file.svg -o /tmp/test.png 2>&1 && echo "✓ Valid" && rm /tmp/test.png
489
+ ```
490
+
491
+ **If using `generate-from-template.py`**:
492
+ - Prefer `source` / `target` node ids in arrow JSON so the generator can snap to node edges
493
+ - Keep `x1,y1,x2,y2` as hints or fallback coordinates, not the main routing primitive
494
+ - Let the generator choose orthogonal routes; avoid hardcoding center-to-center straight lines unless the path is guaranteed clear
495
+
496
+ **Common Syntax Errors to Avoid**:
497
+ - ❌ `yt-anchor` → ✅ `y="60" text-anchor="middle"`
498
+ - ❌ `x="390` (missing y) → ✅ `x="390" y="250"`
499
+ - ❌ `fill=#fff` → ✅ `fill="#ffffff"`
500
+ - ❌ `marker-end=` → ✅ `marker-end="url(#arrow)"`
501
+ - ❌ `L 29450` → ✅ `L 290,220`
502
+ - ❌ Missing `</svg>` at end
503
+
504
+ ## Output
505
+
506
+ - **Default**: `./[derived-name].svg` and `./[derived-name].png` in current directory
507
+ - **Custom**: user specifies path with `--output /path/` or `输出到 /path/`
508
+ - **PNG export**: `rsvg-convert -w 1920 file.svg -o file.png` (1920px = 2x retina)
509
+ - **Watermark**: Automatically add "世界那么哒" watermark to bottom-right corner
510
+
511
+ ## Styles
512
+
513
+ | # | Name | Background | Best For |
514
+ |---|------|-----------|----------|
515
+ | 1 | **Flat Icon** (default) | White | Blogs, docs, presentations |
516
+ | 2 | **Dark Terminal** | `#0f0f1a` | GitHub, dev articles |
517
+ | 3 | **Blueprint** | `#0a1628` | Architecture docs |
518
+ | 4 | **Notion Clean** | White, minimal | Notionnce |
519
+ | 5 | **Glassmorphism** | Dark gradient | Product sites, keynotes |
520
+ | 6 | **Claude Official** | Warm cream `#f8f6f3` | Anthropic-style diagrams |
521
+ | 7 | **OpenAI Official** | Pure white `#ffffff` | OpenAI-style diagrams |
522
+
523
+ Load `references/style-N.md` for exact color tokens and SVG patterns.
524
+
525
+ ## Style Selection
526
+
527
+ **Default**: Style 1 (Flat Icon) for most diagrams. Load `references/style-diagram-matrix.md` for detailed style-to-diagram-type recommendations.
528
+
529
+ These patterns appear frequently — internalize them:
530
+
531
+ **RAG Pipeline**: Query → Embed → VectorSearch → Retrieve → Augment → LLM → Response
532
+ **Agentic RAG**: adds Agent loop with Tool use between Query and LLM
533
+ **Agentic Search**: Query → Planner → [Search Tool / Calculator / Code] → Synthesizer → Response
534
+ **Mem0 / Memory Layer**: Input → Memory Manager → [Write: VectorDB + GraphDB] / [Read: Retrieve+Rank] → Context
535
+ **Agent Memory Types**: Sensory (raw input) → Working (context window) → Episodic (past interactions) → Semantic (facts) → Procedural (skills)
536
+ **Multi-Agent**: Orchestrator → [SubAgent A / SubAgent B / SubAgent C] → Aggregator → Output
537
+ **Tool Call Flow**: LLM → Tool Selector → Tool Execution → Result Parser → LLM (loop)
@@ -0,0 +1,101 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 700">
2
+ <defs>
3
+ <marker id="arrowBlue" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
4
+ <polygon points="0 0, 10 3.5, 0 7" fill="#2563eb"/>
5
+ </marker>
6
+ <marker id="arrowPurple" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
7
+ <polygon points="0 0, 10 3.5, 0 7" fill="#7c3aed"/>
8
+ </marker>
9
+ <marker id="arrowGreen" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
10
+ <polygon points="0 0, 10 3.5, 0 7" fill="#059669"/>
11
+ </marker>
12
+ <marker id="arrowOrange" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
13
+ <polygon points="0 0, 10 3.5, 0 7" fill="#ea580c"/>
14
+ </marker>
15
+ </defs>
16
+ <style>
17
+ text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
18
+ .title { font-size: 24px; font-weight: 700; fill: #1e293b; }
19
+ .node-label { font-size: 16px; font-weight: 600; fill: #1e293b; }
20
+ .sub-label { font-size: 13px; font-weight: 400; fill: #64748b; }
21
+ .arrow-label { font-size: 12px; font-weight: 400; fill: #475569; }
22
+ </style>
23
+ <rect width="960" height="700" fill="#ffffff"/>
24
+ <text x="480" y="50" text-anchor="middle" class="title">AgentLoop Core Architecture</text>
25
+
26
+ <!-- Input Layer -->
27
+ <circle cx="480" cy="120" r="35" fill="#dbeafe" stroke="#2563eb" stroke-width="2.5"/>
28
+ <text x="480" y="118" text-anchor="middle" class="node-label">User</text>
29
+ <text x="480" y="135" text-anchor="middle" class="sub-label">Input</text>
30
+
31
+ <!-- Agent Core -->
32
+ <rect x="360" y="200" width="240" height="100" rx="12" fill="#f3e8ff" stroke="#7c3aed" stroke-width="3"/>
33
+ <text x="480" y="235" text-anchor="middle" class="node-label">Agent Loop</text>
34
+ <text x="480" y="255" text-anchor="middle" class="sub-label">Reasoning Engine</text>
35
+ <text x="480" y="275" text-anchor="middle" class="sub-label">Plan → Act → Observe</text>
36
+
37
+ <!-- Memory Layer -->
38
+ <rect x="100" y="220" width="180" height="60" rx="8" fill="#dcfce7" stroke="#059669" stroke-width="2.5" stroke-dasharray="5,3"/>
39
+ <text x="190" y="245" text-anchor="middle" class="node-label">Short-term</text>
40
+ <text x="190" y="265" text-anchor="middle" class="sub-label">Context Window</text>
41
+
42
+ <ellipse cx="190" cy="400" rx="80" ry="50" fill="#dcfce7" stroke="#059669" stroke-width="2.5"/>
43
+ <text x="190" y="395" text-anchor="middle" class="node-label">Long-term</text>
44
+ <text x="190" y="415" text-anchor="middle" class="sub-label">Vector Store</text>
45
+
46
+ <!-- Tool Layer -->
47
+ <rect x="680" y="220" width="160" height="60" rx="8" fill="#fed7aa" stroke="#ea580c" stroke-width="2.5"/>
48
+ <text x="760" y="245" text-anchor="middle" class="node-label">Tools</text>
49
+ <text x="760" y="265" text-anchor="middle" class="sub-label">Functions</text>
50
+
51
+ <!-- Output Layer -->
52
+ <rect x="390" y="500" width="180" height="70" rx="8" fill="#dbeafe" stroke="#2563eb" stroke-width="2.5"/>
53
+ <text x="480" y="525" text-anchor="middle" class="node-label">Response</text>
54
+ <text x="480" y="545" text-anchor="middle" class="sub-label">Action / Output</text>
55
+
56
+ <!-- Arrows -->
57
+ <line x1="480" y1="155" x2="480" y2="200" stroke="#2563eb" stroke-width="2" marker-end="url(#arrowBlue)"/>
58
+ <rect x="455" y="168" width="50" height="18" fill="#ffffff" opacity="0.95"/>
59
+ <text x="480" y="180" text-anchor="middle" class="arrow-label">query</text>
60
+
61
+ <path d="M 360,250 L 280,250" stroke="#059669" stroke-width="2" marker-end="url(#arrowGreen)"/>
62
+ <rect x="295" y="237" width="50" height="18" fill="#ffffff" opacity="0.95"/>
63
+ <text x="320" y="249" text-anchor="middle" class="arrow-label">read</text>
64
+
65
+ <path d="M 280,250 L 360,250" stroke="#059669" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arrowGreen)"/>
66
+ <rect x="297" y="257" width="50" height="18" fill="#ffffff" opacity="0.95"/>
67
+ <text x="320" y="269" text-anchor="middle" class="arrow-label">write</text>
68
+
69
+ <path d="M 600,250 L 680,250" stroke="#ea580c" stroke-width="2" marker-end="url(#arrowOrange)"/>
70
+ <rect x="615" y="237" width="50" height="18" fill="#ffffff" opacity="0.95"/>
71
+ <text x="640" y="249" text-anchor="middle" class="arrow-label">call</text>
72
+
73
+ <path d="M 680,250 L 600,250" stroke="#ea580c" stroke-width="2" marker-end="url(#arrowOrange)"/>
74
+ <rect x="615" y="257" width="55" height="18" fill="#ffffff" opacity="0.95"/>
75
+ <text x="642" y="269" text-anchor="middle" class="arrow-label">result</text>
76
+
77
+ <line x1="480" y1="300" x2="480" y2="500" stroke="#2563eb" stroke-width="2" marker-end="url(#arrowBlue)"/>
78
+ <rect x="445" y="390" width="70" height="18" fill="#ffffff" opacity="0.95"/>
79
+ <text x="480" y="402" text-anchor="middle" class="arrow-label">generate</text>
80
+
81
+ <path d="M 240,380 Q 240,320 360,280" stroke="#059669" stroke-width="1.5" marker-end="url(#arrowGreen)"/>
82
+ <rect x="265" y="317" width="60" height="18" fill="#ffffff" opacity="0.95"/>
83
+ <text x="295" y="329" text-anchor="middle" class="arrow-label">retrieve</text>
84
+
85
+ <path d="M 420,300 Q 420,450 390,520" stroke="#7c3aed" stroke-width="2" marker-end="url(#arrowPurple)"/>
86
+ <rect x="365" y="400" width="60" height="18" fill="#ffffff" opacity="0.95"/>
87
+ <text x="395" y="412" text-anchor="middle" class="arrow-label">feedback</text>
88
+
89
+ <!-- Legend -->
90
+ <line x1="750" y1="90" x2="780" y2="90" stroke="#2563eb" stroke-width="2" marker-end="url(#arrowBlue)"/>
91
+ <text x="790" y="95" class="arrow-label">Data Flow</text>
92
+
93
+ <line x1="750" y1="115" x2="780" y2="115" stroke="#059669" stroke-width="2" marker-end="url(#arrowGreen)"/>
94
+ <text x="790" y="120" class="arrow-label">Memory</text>
95
+
96
+ <line x1="750" y1="140" x2="780" y2="140" stroke="#ea580c" stroke-width="2" marker-end="url(#arrowOrange)"/>
97
+ <text x="790" y="145" class="arrow-label">Tool Call</text>
98
+
99
+ <line x1="750" y1="165" x2="780" y2="165" stroke="#7c3aed" stroke-width="2" marker-end="url(#arrowPurple)"/>
100
+ <text x="790" y="170" class="arrow-label">Feedback Loop</text>
101
+ </svg>
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Fireworks Tech Graph"
3
+ short_description: "Generate polished SVG and PNG technical diagrams"
4
+ default_prompt: "Turn the user's system or workflow description into a polished SVG diagram and export a PNG."