research-copilot 0.2.17 → 0.2.21

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 (83) hide show
  1. package/README.md +7 -1
  2. package/app/out/main/index.mjs +2842 -188
  3. package/app/out/preload/index.js +2 -0
  4. package/app/out/renderer/assets/{MilkdownMarkdownEditor-tTNRIB2K.css → MilkdownMarkdownEditor-BW0Pt28W.css} +103 -15
  5. package/app/out/renderer/assets/{MilkdownMarkdownEditor-CuTa5j4S.js → MilkdownMarkdownEditor-OhCrq3X0.js} +99 -52
  6. package/app/out/renderer/assets/{arc-BAWS3N-F.js → arc-DLr0RP8F.js} +1 -1
  7. package/app/out/renderer/assets/{blockDiagram-c4efeb88-BHadwPqY.js → blockDiagram-c4efeb88-XhKChw2n.js} +8 -8
  8. package/app/out/renderer/assets/{c4Diagram-c83219d4-B3kOxRad.js → c4Diagram-c83219d4-DDoJmoIQ.js} +3 -3
  9. package/app/out/renderer/assets/{channel-Bll9CBqI.js → channel-CJCgJSqV.js} +1 -1
  10. package/app/out/renderer/assets/{classDiagram-beda092f-Dv7owGyx.js → classDiagram-beda092f-CAmimZpz.js} +6 -6
  11. package/app/out/renderer/assets/{classDiagram-v2-2358418a-cWrqk5tQ.js → classDiagram-v2-2358418a-Bma4E_Eg.js} +10 -10
  12. package/app/out/renderer/assets/{clone-D-DQ4nnY.js → clone-C338dmoI.js} +1 -1
  13. package/app/out/renderer/assets/{createText-1719965b-ciE8YuqI.js → createText-1719965b-_up4NJqB.js} +2 -2
  14. package/app/out/renderer/assets/{edges-96097737-DycnAYk_.js → edges-96097737-Bpp6hVLn.js} +3 -3
  15. package/app/out/renderer/assets/{erDiagram-0228fc6a-Sv78YNMY.js → erDiagram-0228fc6a-bjTh_7ap.js} +5 -5
  16. package/app/out/renderer/assets/{flowDb-c6c81e3f-BiOarg9b.js → flowDb-c6c81e3f-BjVV4DVk.js} +1 -1
  17. package/app/out/renderer/assets/{flowDiagram-50d868cf-19J80nxU.js → flowDiagram-50d868cf-gmeaaZ6z.js} +12 -12
  18. package/app/out/renderer/assets/{flowDiagram-v2-4f6560a1-c-kGsubV.js → flowDiagram-v2-4f6560a1-nem5zs2M.js} +12 -12
  19. package/app/out/renderer/assets/{flowchart-elk-definition-6af322e1-DRrYbiSC.js → flowchart-elk-definition-6af322e1-DPaGAYRw.js} +6 -6
  20. package/app/out/renderer/assets/{ganttDiagram-a2739b55-BadmpvMy.js → ganttDiagram-a2739b55-CnAti19E.js} +3 -3
  21. package/app/out/renderer/assets/{gitGraphDiagram-82fe8481-BdVoj60Q.js → gitGraphDiagram-82fe8481-DQWHD3SJ.js} +2 -2
  22. package/app/out/renderer/assets/{graph-jZhookGR.js → graph-DKiKgH8m.js} +1 -1
  23. package/app/out/renderer/assets/{index-B8fh500_.js → index-4s-c5d65.js} +3 -3
  24. package/app/out/renderer/assets/{index-5325376f-CbxmatXv.js → index-5325376f-G-0aO-2i.js} +6 -6
  25. package/app/out/renderer/assets/{index-CAlpJ3-o.js → index-9q_P5ULR.js} +4 -4
  26. package/app/out/renderer/assets/{index-cavFRVgM.js → index-B1A3JxQj.js} +3 -3
  27. package/app/out/renderer/assets/{index-B9kkJj3J.js → index-BBUrmGmY.js} +6 -6
  28. package/app/out/renderer/assets/{index-CMGDsC_t.js → index-BQho5LH-.js} +6 -6
  29. package/app/out/renderer/assets/{index-CirXkIv2.js → index-BUVlmsgO.js} +3 -3
  30. package/app/out/renderer/assets/{index-BWCwSkxb.js → index-BzEthrJ4.js} +3 -3
  31. package/app/out/renderer/assets/{index-B2UUF9y9.js → index-C1YzkB4z.js} +1289 -419
  32. package/app/out/renderer/assets/{index-D-ZMmLhv.js → index-CGo665vD.js} +3 -3
  33. package/app/out/renderer/assets/{index-DQwFQR1s.js → index-CPZaxR35.js} +3 -3
  34. package/app/out/renderer/assets/{index-DOUTte7i.js → index-CSyD1mbL.js} +3 -3
  35. package/app/out/renderer/assets/{index-BUcSHPha.js → index-Cf7vlFSn.js} +3 -3
  36. package/app/out/renderer/assets/{index-CZX0435B.js → index-CluH1o2q.js} +6 -6
  37. package/app/out/renderer/assets/{index-lAZsmnj1.css → index-CogwQwDN.css} +185 -32
  38. package/app/out/renderer/assets/{index-DEO9Jh2Y.js → index-Cw1n3klA.js} +5 -5
  39. package/app/out/renderer/assets/{index-BBUnWjLe.js → index-DFzvntIw.js} +3 -3
  40. package/app/out/renderer/assets/{index-g91Iwgxa.js → index-DHzyAhWM.js} +4 -4
  41. package/app/out/renderer/assets/{index-47oNNEnx.js → index-DhliHfCM.js} +6 -6
  42. package/app/out/renderer/assets/{index-DF_C6DjR.js → index-DkVFbCxC.js} +3 -3
  43. package/app/out/renderer/assets/{index-HCRA2-Q6.js → index-DpZJP5MT.js} +6 -6
  44. package/app/out/renderer/assets/{index-BXpNbFhG.js → index-Gfd_DiMG.js} +3 -3
  45. package/app/out/renderer/assets/{index-B110aKST.js → index-jOvNAYyP.js} +3 -3
  46. package/app/out/renderer/assets/{index-BTE0dEKO.js → index-rrJkk8KV.js} +6 -6
  47. package/app/out/renderer/assets/{index-DO5LsHlM.js → index-vfSerSmF.js} +1 -1
  48. package/app/out/renderer/assets/{infoDiagram-8eee0895-DpVt3Scv.js → infoDiagram-8eee0895-BCnBkXXS.js} +2 -2
  49. package/app/out/renderer/assets/{journeyDiagram-c64418c1-RYKX5mcV.js → journeyDiagram-c64418c1-Bq2wSX3k.js} +4 -4
  50. package/app/out/renderer/assets/{layout-BsbNXXgR.js → layout-BvkumzoT.js} +2 -2
  51. package/app/out/renderer/assets/{line-OzQTpJsh.js → line-eU4el-G4.js} +1 -1
  52. package/app/out/renderer/assets/{linear-DO5pdnqi.js → linear-DlBjMBEa.js} +1 -1
  53. package/app/out/renderer/assets/{mindmap-definition-8da855dc-D3zWs3h1.js → mindmap-definition-8da855dc-CzLBu7ao.js} +3 -3
  54. package/app/out/renderer/assets/{pieDiagram-a8764435-DDoNhSgQ.js → pieDiagram-a8764435--olrXFr_.js} +3 -3
  55. package/app/out/renderer/assets/{quadrantDiagram-1e28029f-ZO85SsRM.js → quadrantDiagram-1e28029f-BnpnBBgc.js} +3 -3
  56. package/app/out/renderer/assets/{requirementDiagram-08caed73-C-vKE6g8.js → requirementDiagram-08caed73-6O9WS7hn.js} +5 -5
  57. package/app/out/renderer/assets/{sankeyDiagram-a04cb91d-Cbqb2K-X.js → sankeyDiagram-a04cb91d-D-iJnK91.js} +2 -2
  58. package/app/out/renderer/assets/{sequenceDiagram-c5b8d532-BK4uvpEA.js → sequenceDiagram-c5b8d532-DBlK15cV.js} +3 -3
  59. package/app/out/renderer/assets/{stateDiagram-1ecb1508-DXa_YqNi.js → stateDiagram-1ecb1508-DKXKPYuk.js} +6 -6
  60. package/app/out/renderer/assets/{stateDiagram-v2-c2b004d7-Dm203Z8l.js → stateDiagram-v2-c2b004d7-DY288Eo5.js} +10 -10
  61. package/app/out/renderer/assets/{styles-b4e223ce-BV4b1eAh.js → styles-b4e223ce-CRJ_xgJ-.js} +1 -1
  62. package/app/out/renderer/assets/{styles-ca3715f6-CKhYSe7r.js → styles-ca3715f6-Bp_k5KLD.js} +1 -1
  63. package/app/out/renderer/assets/{styles-d45a18b0-DTCMfE-4.js → styles-d45a18b0-DLA8Gg6D.js} +4 -4
  64. package/app/out/renderer/assets/{svgDrawCommon-b86b1483-DK4i-dfJ.js → svgDrawCommon-b86b1483-Dm5CK2gQ.js} +1 -1
  65. package/app/out/renderer/assets/{timeline-definition-faaaa080-CE2LmuDH.js → timeline-definition-faaaa080-D-m9BHUg.js} +3 -3
  66. package/app/out/renderer/assets/{xychartDiagram-f5964ef8-Bd8KT9X9.js → xychartDiagram-f5964ef8-Drn4Rqev.js} +5 -5
  67. package/app/out/renderer/index.html +2 -2
  68. package/lib/skills/builtin/academic-marp-slides/SKILL.md +933 -0
  69. package/lib/skills/builtin/research-grants/SKILL.md +15 -11
  70. package/lib/skills/builtin/scholar-evaluation/SKILL.md +12 -11
  71. package/lib/skills/builtin/scientific-schematics/SKILL.md +463 -560
  72. package/lib/skills/builtin/teaching-marp-slides/SKILL.md +1218 -0
  73. package/package.json +1 -1
  74. package/scripts/audit-diagram-prompts.mjs +67 -0
  75. package/scripts/test-skill-routing.mjs +238 -0
  76. package/lib/skills/builtin/marp-slides/SKILL.md +0 -642
  77. package/lib/skills/builtin/scientific-schematics/references/QUICK_REFERENCE.md +0 -182
  78. package/lib/skills/builtin/scientific-schematics/references/README.md +0 -292
  79. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic.cpython-312.pyc +0 -0
  80. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic_ai.cpython-312.pyc +0 -0
  81. package/lib/skills/builtin/scientific-schematics/scripts/example_usage.sh +0 -85
  82. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic.py +0 -141
  83. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic_ai.py +0 -910
@@ -1,182 +0,0 @@
1
- # Scientific Schematics - Quick Reference
2
-
3
- **How it works:** Describe your diagram → AI generates it via OpenRouter automatically
4
-
5
- Path convention: use `@skill/...` for skill files and `@ws/...` for workspace inputs/outputs in shell commands.
6
-
7
- ## Setup (One-Time)
8
-
9
- Default image model: `google/gemini-3-pro-image-preview`. Normal skill usage does not require choosing a model.
10
-
11
- ```bash
12
- # Required
13
- export OPENROUTER_API_KEY='your-openrouter-api-key'
14
- ```
15
-
16
- ## Basic Usage
17
-
18
- ```bash
19
- # Describe your diagram, AI creates it
20
- python @skill/scripts/generate_schematic.py "your diagram description" -o @ws/output.png
21
-
22
- # That's it! Automatic:
23
- # - Iterative refinement (up to 2 rounds)
24
- # - Quality review and improvement
25
- # - Publication-ready output
26
- ```
27
-
28
- ## Common Examples
29
-
30
- ### CONSORT Flowchart
31
- ```bash
32
- python @skill/scripts/generate_schematic.py \
33
- "CONSORT flow: screened n=500, excluded n=150, randomized n=350" \
34
- -o @ws/consort.png
35
- ```
36
-
37
- ### Neural Network
38
- ```bash
39
- python @skill/scripts/generate_schematic.py \
40
- "Transformer architecture with encoder and decoder stacks" \
41
- -o @ws/transformer.png
42
- ```
43
-
44
- ### Biological Pathway
45
- ```bash
46
- python @skill/scripts/generate_schematic.py \
47
- "MAPK pathway: EGFR → RAS → RAF → MEK → ERK" \
48
- -o @ws/mapk.png
49
- ```
50
-
51
- ### Circuit Diagram
52
- ```bash
53
- python @skill/scripts/generate_schematic.py \
54
- "Op-amp circuit with 1kΩ resistor and 10µF capacitor" \
55
- -o @ws/circuit.png
56
- ```
57
-
58
- ## Command Options
59
-
60
- | Option | Description | Example |
61
- |--------|-------------|---------|
62
- | `-o, --output` | Output file path | `-o @ws/figures/diagram.png` |
63
- | `--iterations N` | Number of refinements (1-2) | `--iterations 2` |
64
- | `-v, --verbose` | Show detailed output | `-v` |
65
-
66
- ## Prompt Tips
67
-
68
- ### Good Prompts (Specific)
69
- - "CONSORT flowchart with screening (n=500), exclusion (n=150), randomization (n=350)"
70
- - "Transformer architecture: encoder on left with 6 layers, decoder on right, cross-attention connections"
71
- - "MAPK signaling: receptor → RAS → RAF → MEK → ERK → nucleus, label each phosphorylation"
72
-
73
- ### Avoid (Too Vague)
74
- - "Make a flowchart"
75
- - "Neural network"
76
- - "Pathway diagram"
77
-
78
- ## Output Files
79
-
80
- For input `@ws/diagram.png`, you get:
81
- - `@ws/diagram_v1.png` - First iteration
82
- - `@ws/diagram_v2.png` - Second iteration
83
- - `@ws/diagram.png` - Copy of final
84
- - `@ws/diagram_review_log.json` - Quality scores and critiques
85
-
86
- ## Review Log
87
-
88
- ```json
89
- {
90
- "iterations": [
91
- {
92
- "iteration": 1,
93
- "score": 7.0,
94
- "critique": "Good start. Font too small..."
95
- },
96
- {
97
- "iteration": 2,
98
- "score": 8.5,
99
- "critique": "Much improved. Minor spacing issues..."
100
- },
101
- ],
102
- "final_score": 8.5
103
- }
104
- ```
105
-
106
- ## Supported Automation Interface
107
-
108
- ```bash
109
- python @skill/scripts/generate_schematic.py "diagram description" -o @ws/output.png --iterations 2
110
- ```
111
-
112
- Use the CLI wrapper inside workflows. Do not rely on importing private
113
- skill modules directly from Python.
114
-
115
- ## Troubleshooting
116
-
117
- ### API Key Not Found
118
- ```bash
119
- # Set your OpenRouter API key
120
- export OPENROUTER_API_KEY='your-api-key'
121
- ```
122
-
123
- ### Import Error
124
- ```bash
125
- # Install requests
126
- pip install requests
127
- ```
128
-
129
- ### Low Quality Score
130
- - Make prompt more specific
131
- - Include layout details (left-to-right, top-to-bottom)
132
- - Specify label requirements
133
- - Increase iterations: `--iterations 2`
134
-
135
- ## Testing
136
-
137
- ```bash
138
- # Smoke test
139
- python @skill/scripts/generate_schematic.py "test diagram" -o @ws/test.png -v
140
- ```
141
-
142
- ## Cost
143
-
144
- Typical cost per diagram (max 2 iterations):
145
- - Simple (1 iteration): $0.05-0.15
146
- - Complex (2 iterations): $0.10-0.30
147
-
148
- ## How It Works
149
-
150
- **Simply describe your diagram in natural language:**
151
- - No coding required
152
- - No templates needed
153
- - No manual drawing
154
- - Automatic quality review
155
- - Publication-ready output
156
- - Works for any diagram type
157
-
158
- **Just describe what you want, and it's generated automatically.**
159
-
160
- ## Getting Help
161
-
162
- ```bash
163
- # Show help
164
- python @skill/scripts/generate_schematic.py --help
165
-
166
- # Verbose mode for debugging
167
- python @skill/scripts/generate_schematic.py "diagram" -o @ws/out.png -v
168
- ```
169
-
170
- ## Quick Start Checklist
171
-
172
- - [ ] Set `OPENROUTER_API_KEY`
173
- - [ ] Run `python @skill/scripts/generate_schematic.py "test diagram" -o @ws/test.png -v`
174
- - [ ] Review output files (test_v1.png, test_v2.png, review_log.json)
175
- - [ ] Read SKILL.md for detailed documentation
176
- - [ ] Check README.md for examples
177
-
178
- ## Resources
179
-
180
- - Full documentation: `@skill/SKILL.md`
181
- - Detailed guide: `@skill/references/README.md`
182
- - Example script: `@skill/scripts/example_usage.sh`
@@ -1,292 +0,0 @@
1
- # Scientific Schematics - OpenRouter API
2
-
3
- **Generate any scientific diagram by describing it in natural language.**
4
-
5
- AI image models create publication-quality diagrams automatically via OpenRouter - no coding, no templates, no manual drawing required.
6
-
7
- ## Quick Start
8
-
9
- Default image model: `google/gemini-3-pro-image-preview`. Normal skill usage does not require model selection.
10
-
11
- ### Generate Any Diagram
12
-
13
- ```bash
14
- # Set your OpenRouter API key
15
- export OPENROUTER_API_KEY='your-openrouter-api-key'
16
-
17
- # Generate any scientific diagram
18
- python @skill/scripts/generate_schematic.py "CONSORT participant flow diagram" -o @ws/figures/consort.png
19
-
20
- # Neural network architecture
21
- python @skill/scripts/generate_schematic.py "Transformer encoder-decoder architecture" -o @ws/figures/transformer.png
22
-
23
- # Biological pathway
24
- python @skill/scripts/generate_schematic.py "MAPK signaling pathway" -o @ws/figures/pathway.png
25
- ```
26
-
27
- ### Path Conventions
28
-
29
- - Shell commands in this document use scoped paths:
30
- - `@skill/...` points to skill-owned files.
31
- - `@ws/...` points to workspace files.
32
- - Python API examples and generated review logs use raw filesystem paths (often workspace-relative like `figures/...`).
33
-
34
- ### What You Get
35
-
36
- - **Up to two iterations** (v1, v2) with progressive refinement
37
- - **Automatic quality review** after each iteration
38
- - **Detailed review log** with scores and critiques (JSON format)
39
- - **Publication-ready images** following scientific standards
40
-
41
- ## Features
42
-
43
- ### Iterative Refinement Process
44
-
45
- 1. **Generation 1**: Create initial diagram from your description
46
- 2. **Review 1**: AI evaluates clarity, labels, accuracy, accessibility
47
- 3. **Decision**: If quality meets threshold → DONE; otherwise continue
48
- 4. **Generation 2**: Improve based on critique
49
- 5. **Review 2**: Second evaluation with specific feedback
50
-
51
- ### Automatic Quality Standards
52
-
53
- All diagrams automatically follow:
54
- - Clean white/light background
55
- - High contrast for readability
56
- - Clear labels (minimum 10pt font)
57
- - Professional typography
58
- - Colorblind-friendly colors
59
- - Proper spacing between elements
60
- - Scale bars, legends, axes where appropriate
61
-
62
- ## Installation
63
-
64
- ```bash
65
- # Set OpenRouter API key
66
- export OPENROUTER_API_KEY='your-openrouter-api-key'
67
-
68
- # Install Python dependencies (if not already installed)
69
- pip install requests
70
- ```
71
-
72
- ## Usage Examples
73
-
74
- ### Example 1: CONSORT Flowchart
75
-
76
- ```bash
77
- python @skill/scripts/generate_schematic.py \
78
- "CONSORT participant flow diagram for RCT. \
79
- Assessed for eligibility (n=500). \
80
- Excluded (n=150): age<18 (n=80), declined (n=50), other (n=20). \
81
- Randomized (n=350) into Treatment (n=175) and Control (n=175). \
82
- Lost to follow-up: 15 and 10 respectively. \
83
- Final analysis: 160 and 165." \
84
- -o @ws/figures/consort.png
85
- ```
86
-
87
- **Output:**
88
- - `@ws/figures/consort_v1.png` - Initial generation
89
- - `@ws/figures/consort_v2.png` - After review (if needed)
90
- - `@ws/figures/consort.png` - Copy of final version
91
- - `@ws/figures/consort_review_log.json` - Detailed review log
92
-
93
- ### Example 2: Neural Network Architecture
94
-
95
- ```bash
96
- python @skill/scripts/generate_schematic.py \
97
- "Transformer architecture with encoder on left (input embedding, \
98
- positional encoding, multi-head attention, feed-forward) and \
99
- decoder on right (masked attention, cross-attention, feed-forward). \
100
- Show cross-attention connection from encoder to decoder." \
101
- -o @ws/figures/transformer.png \
102
- --iterations 2
103
- ```
104
-
105
- ### Example 3: Biological Pathway
106
-
107
- ```bash
108
- python @skill/scripts/generate_schematic.py \
109
- "MAPK signaling pathway: EGFR receptor → RAS → RAF → MEK → ERK → nucleus. \
110
- Label each step with phosphorylation. Use different colors for each kinase." \
111
- -o @ws/figures/mapk.png
112
- ```
113
-
114
- ### Example 4: System Architecture
115
-
116
- ```bash
117
- python @skill/scripts/generate_schematic.py \
118
- "IoT system block diagram: sensors (bottom) → microcontroller → \
119
- WiFi module and display (middle) → cloud server → mobile app (top). \
120
- Label all connections with protocols." \
121
- -o @ws/figures/iot_system.png
122
- ```
123
-
124
- ## Command-Line Options
125
-
126
- ```bash
127
- python @skill/scripts/generate_schematic.py [OPTIONS] "description" -o @ws/output.png
128
-
129
- Options:
130
- --iterations N Number of AI refinement iterations (default: 2, max: 2)
131
- --doc-type TYPE Document type for quality threshold (journal, poster, etc.)
132
- --image-model MODEL Override image generation model
133
- --review-model MODEL Override review model
134
- -v, --verbose Verbose output
135
- -h, --help Show help message
136
- ```
137
-
138
- ## Supported Automation Interface
139
-
140
- Use the CLI wrapper as the supported interface:
141
-
142
- ```bash
143
- python @skill/scripts/generate_schematic.py \
144
- "CONSORT flowchart" \
145
- -o @ws/figures/consort.png \
146
- --iterations 2
147
- ```
148
-
149
- This skill does not ship as an installable Python package, so avoid direct
150
- `import scripts.generate_schematic_ai` patterns.
151
-
152
- ## Prompt Engineering Tips
153
-
154
- ### Be Specific About Layout
155
- - "Flowchart with vertical flow, top to bottom"
156
- - "Architecture diagram with encoder on left, decoder on right"
157
- - Avoid: "Make a diagram" (too vague)
158
-
159
- ### Include Quantitative Details
160
- - "Neural network: input (784), hidden (128), output (10)"
161
- - "Flowchart: n=500 screened, n=150 excluded, n=350 randomized"
162
-
163
- ### Specify Visual Style
164
- - "Minimalist block diagram with clean lines"
165
- - "Detailed biological pathway with protein structures"
166
- - "Technical schematic with engineering notation"
167
-
168
- ### Request Specific Labels
169
- - "Label all arrows with activation/inhibition"
170
- - "Include layer dimensions in each box"
171
- - "Show time progression with timestamps"
172
-
173
- ### Mention Color Requirements
174
- - "Use colorblind-friendly colors"
175
- - "Grayscale-compatible design"
176
- - "Color-code by function: blue=input, green=processing, red=output"
177
-
178
- ## Review Log Format
179
-
180
- Each generation produces a JSON review log:
181
-
182
- ```json
183
- {
184
- "user_prompt": "CONSORT participant flow diagram...",
185
- "doc_type": "default",
186
- "quality_threshold": 7.5,
187
- "iterations": [
188
- {
189
- "iteration": 1,
190
- "image_path": "figures/consort_v1.png",
191
- "score": 7.0,
192
- "critique": "Score: 7/10. Issues: font too small...",
193
- "success": true
194
- },
195
- {
196
- "iteration": 2,
197
- "image_path": "figures/consort_v2.png",
198
- "score": 8.5,
199
- "critique": "Much improved. Publication ready."
200
- }
201
- ],
202
- "final_image": "figures/consort_v2.png",
203
- "final_score": 8.5,
204
- "success": true,
205
- "early_stop": true,
206
- "early_stop_reason": "Quality score 8.5 meets threshold 7.5 for default"
207
- }
208
- ```
209
-
210
- Note: in review log JSON, file paths are stored as raw workspace-relative paths (`figures/...`), not scoped command prefixes.
211
-
212
- ## Why Use AI Image Generation
213
-
214
- **Simply describe what you want - AI creates it:**
215
-
216
- - **Fast**: Results in minutes
217
- - **Easy**: Natural language descriptions (no coding)
218
- - **Quality**: Automatic review and refinement
219
- - **Universal**: Works for all diagram types
220
- - **Publication-ready**: High-quality output immediately
221
-
222
- **Just describe your diagram, and it's generated automatically.**
223
-
224
- ## Troubleshooting
225
-
226
- ### API Key Issues
227
-
228
- ```bash
229
- # Check API key is set
230
- echo $OPENROUTER_API_KEY
231
-
232
- # Set it if missing
233
- export OPENROUTER_API_KEY='your-api-key'
234
- ```
235
-
236
- ### Import Errors
237
-
238
- ```bash
239
- # Install requests library
240
- pip install requests
241
- ```
242
-
243
- ### Generation Fails
244
-
245
- ```bash
246
- # Use verbose mode to see detailed errors
247
- python @skill/scripts/generate_schematic.py "diagram" -o @ws/out.png -v
248
- ```
249
-
250
- ### Low Quality Scores
251
-
252
- If iterations consistently score below 7/10:
253
- 1. Make your prompt more specific
254
- 2. Include more details about layout and labels
255
- 3. Specify visual requirements explicitly
256
- 4. Increase iterations: `--iterations 2`
257
-
258
- ## Testing
259
-
260
- Run a simple smoke test:
261
-
262
- ```bash
263
- python @skill/scripts/generate_schematic.py "test diagram" -o @ws/test.png -v
264
- ```
265
-
266
- ## Cost Considerations
267
-
268
- Costs depend on the models used via OpenRouter. Typical costs per diagram:
269
- - Simple diagram (1 iteration): ~$0.05-0.15
270
- - Complex diagram (2 iterations): ~$0.10-0.30
271
-
272
- ## Examples Gallery
273
-
274
- See the full SKILL.md for extensive examples including:
275
- - CONSORT flowcharts
276
- - Neural network architectures (Transformers, CNNs, RNNs)
277
- - Biological pathways
278
- - Circuit diagrams
279
- - System architectures
280
- - Block diagrams
281
-
282
- ## Support
283
-
284
- For issues or questions:
285
- 1. Check SKILL.md for detailed documentation
286
- 2. Run a verbose smoke test with `python @skill/scripts/generate_schematic.py "test diagram" -o @ws/test.png -v`
287
- 3. Use verbose mode (-v) to see detailed errors
288
- 4. Review the review_log.json for quality feedback
289
-
290
- ## License
291
-
292
- Part of the scientific-schematics skill. See main repository for license information.
@@ -1,85 +0,0 @@
1
- #!/bin/bash
2
- # Example usage of AI-powered scientific schematic generation
3
- #
4
- # Prerequisites:
5
- # 1. Set OPENROUTER_API_KEY environment variable
6
- # 2. Ensure Python 3.10+ is installed
7
- # 3. Install requests: pip install requests
8
-
9
- set -e
10
-
11
- echo "=========================================="
12
- echo "Scientific Schematics - AI Generation"
13
- echo "Example Usage Demonstrations"
14
- echo "=========================================="
15
- echo ""
16
-
17
- # Check for API key
18
- if [ -z "$OPENROUTER_API_KEY" ]; then
19
- echo "Error: OPENROUTER_API_KEY is not set"
20
- echo ""
21
- echo "Set OPENROUTER_API_KEY='your-api-key'"
22
- exit 1
23
- fi
24
-
25
- echo "✓ OPENROUTER_API_KEY is set"
26
- echo ""
27
-
28
- # Create output directory
29
- mkdir -p figures
30
- echo "✓ Created figures/ directory"
31
- echo ""
32
-
33
- # Example 1: Simple flowchart
34
- echo "Example 1: CONSORT Flowchart"
35
- echo "----------------------------"
36
- python scripts/generate_schematic.py \
37
- "CONSORT participant flow diagram. Assessed for eligibility (n=500). Excluded (n=150) with reasons: age<18 (n=80), declined (n=50), other (n=20). Randomized (n=350) into Treatment (n=175) and Control (n=175). Lost to follow-up: 15 and 10. Final analysis: 160 and 165." \
38
- -o figures/consort_example.png \
39
- --iterations 2
40
-
41
- echo ""
42
- echo "✓ Generated: figures/consort_example.png"
43
- echo ""
44
-
45
- # Example 2: Neural network (shorter for demo)
46
- echo "Example 2: Simple Neural Network"
47
- echo "--------------------------------"
48
- python scripts/generate_schematic.py \
49
- "Simple feedforward neural network diagram. Input layer with 4 nodes, hidden layer with 6 nodes, output layer with 2 nodes. Show all connections. Label layers clearly." \
50
- -o figures/neural_net_example.png \
51
- --iterations 2
52
-
53
- echo ""
54
- echo "✓ Generated: figures/neural_net_example.png"
55
- echo ""
56
-
57
- # Example 3: Biological pathway (minimal)
58
- echo "Example 3: Signaling Pathway"
59
- echo "---------------------------"
60
- python scripts/generate_schematic.py \
61
- "Simple signaling pathway: Receptor → Kinase A → Kinase B → Transcription Factor → Gene. Show arrows with 'activation' labels. Use different colors for each component." \
62
- -o figures/pathway_example.png \
63
- --iterations 2
64
-
65
- echo ""
66
- echo "✓ Generated: figures/pathway_example.png"
67
- echo ""
68
-
69
- echo "=========================================="
70
- echo "All examples completed successfully!"
71
- echo "=========================================="
72
- echo ""
73
- echo "Generated files in figures/:"
74
- ls -lh figures/*example*.png 2>/dev/null || echo " (Files will appear after running with valid API key)"
75
- echo ""
76
- echo "Review the review_log.json files to see:"
77
- echo " - Quality scores for each iteration"
78
- echo " - Detailed critiques and suggestions"
79
- echo " - Improvement progression"
80
- echo ""
81
- echo "Next steps:"
82
- echo " 1. View the generated images"
83
- echo " 2. Review the quality scores in *_review_log.json"
84
- echo " 3. Try your own prompts!"
85
- echo ""
@@ -1,141 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Scientific schematic generation using OpenRouter API.
4
-
5
- Generate any scientific diagram by describing it in natural language.
6
- AI handles everything automatically with smart iterative refinement.
7
-
8
- Smart iteration: Only regenerates if quality is below threshold for your document type.
9
- Quality review: Uses Gemini for professional scientific evaluation.
10
-
11
- Usage:
12
- # Generate for journal paper (highest quality threshold)
13
- python generate_schematic.py "CONSORT flowchart" -o flowchart.png --doc-type journal
14
-
15
- # Generate for presentation (lower threshold, faster)
16
- python generate_schematic.py "Transformer architecture" -o transformer.png --doc-type presentation
17
-
18
- # Generate for poster
19
- python generate_schematic.py "MAPK signaling pathway" -o pathway.png --doc-type poster
20
- """
21
-
22
- import argparse
23
- import subprocess
24
- import sys
25
- from pathlib import Path
26
-
27
-
28
- def main():
29
- """Command-line interface."""
30
- parser = argparse.ArgumentParser(
31
- description="Generate scientific schematics using AI with smart iterative refinement",
32
- formatter_class=argparse.RawDescriptionHelpFormatter,
33
- epilog="""
34
- How it works:
35
- Simply describe your diagram in natural language.
36
- AI generates it automatically via OpenRouter with:
37
- - Smart iteration (only regenerates if quality is below threshold)
38
- - Quality review by Gemini
39
- - Document-type aware quality thresholds
40
- - Publication-ready output
41
-
42
- Document Types (quality thresholds):
43
- journal 8.5/10 - Nature, Science, peer-reviewed journals
44
- conference 8.0/10 - Conference papers
45
- thesis 8.0/10 - Dissertations, theses
46
- grant 8.0/10 - Grant proposals
47
- preprint 7.5/10 - arXiv, bioRxiv, etc.
48
- report 7.5/10 - Technical reports
49
- poster 7.0/10 - Academic posters
50
- presentation 6.5/10 - Slides, talks
51
- default 7.5/10 - General purpose
52
-
53
- Examples:
54
- # Generate for journal paper (strict quality)
55
- python generate_schematic.py "CONSORT participant flow" -o flowchart.png --doc-type journal
56
-
57
- # Generate for poster (moderate quality)
58
- python generate_schematic.py "Transformer architecture" -o arch.png --doc-type poster
59
-
60
- # Generate for slides (faster, lower threshold)
61
- python generate_schematic.py "System diagram" -o system.png --doc-type presentation
62
-
63
- # Custom max iterations
64
- python generate_schematic.py "Complex pathway" -o pathway.png --iterations 2
65
-
66
- # Verbose output
67
- python generate_schematic.py "Circuit diagram" -o circuit.png -v
68
-
69
- Environment Variables:
70
- OPENROUTER_API_KEY Required. Your OpenRouter API key.
71
- """
72
- )
73
-
74
- parser.add_argument("prompt",
75
- help="Description of the diagram to generate")
76
- parser.add_argument("-o", "--output", required=True,
77
- help="Output file path")
78
- parser.add_argument("--doc-type", default="default",
79
- choices=["journal", "conference", "poster", "presentation",
80
- "report", "grant", "thesis", "preprint", "default"],
81
- help="Document type for quality threshold (default: default)")
82
- parser.add_argument("--iterations", type=int, default=2,
83
- help="Maximum refinement iterations (default: 2, max: 2)")
84
- parser.add_argument("--api-key",
85
- help="OpenRouter API key (or use OPENROUTER_API_KEY)")
86
- parser.add_argument("--image-model",
87
- help="Image generation model (default: google/gemini-3-pro-image-preview)")
88
- parser.add_argument("--review-model",
89
- help="Review model (default: google/gemini-3-pro-preview)")
90
- parser.add_argument("--timeout-seconds", type=int,
91
- help=argparse.SUPPRESS)
92
- parser.add_argument("-v", "--verbose", action="store_true",
93
- help="Verbose output")
94
-
95
- args = parser.parse_args()
96
-
97
- # Find AI generation script
98
- script_dir = Path(__file__).parent
99
- ai_script = script_dir / "generate_schematic_ai.py"
100
-
101
- if not ai_script.exists():
102
- print(f"Error: AI generation script not found: {ai_script}")
103
- sys.exit(1)
104
-
105
- # Build command
106
- cmd = [sys.executable, str(ai_script), args.prompt, "-o", args.output]
107
-
108
- if args.doc_type != "default":
109
- cmd.extend(["--doc-type", args.doc_type])
110
-
111
- # Enforce max 2 iterations
112
- iterations = min(args.iterations, 2)
113
- if iterations != 2:
114
- cmd.extend(["--iterations", str(iterations)])
115
-
116
- if args.api_key:
117
- cmd.extend(["--api-key", args.api_key])
118
-
119
- if args.image_model:
120
- cmd.extend(["--image-model", args.image_model])
121
-
122
- if args.review_model:
123
- cmd.extend(["--review-model", args.review_model])
124
-
125
- if args.timeout_seconds:
126
- cmd.extend(["--timeout-seconds", str(args.timeout_seconds)])
127
-
128
- if args.verbose:
129
- cmd.append("-v")
130
-
131
- # Execute
132
- try:
133
- result = subprocess.run(cmd, check=False)
134
- sys.exit(result.returncode)
135
- except Exception as e:
136
- print(f"Error executing AI generation: {e}")
137
- sys.exit(1)
138
-
139
-
140
- if __name__ == "__main__":
141
- main()