psyclaw 0.28.0 → 0.28.2

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 (167) hide show
  1. package/README.md +5 -5
  2. package/agents/recommended/catalog.json +99 -0
  3. package/dist/apps/panel/index.html +5 -5
  4. package/dist/src/adapters/pi/extension.js +164 -18
  5. package/dist/src/adapters/pi/extension.js.map +1 -1
  6. package/dist/src/adapters/pi/rpc.d.ts +2 -0
  7. package/dist/src/adapters/pi/rpc.js +9 -2
  8. package/dist/src/adapters/pi/rpc.js.map +1 -1
  9. package/dist/src/agents/recommended-personas.d.ts +42 -0
  10. package/dist/src/agents/recommended-personas.js +135 -0
  11. package/dist/src/agents/recommended-personas.js.map +1 -0
  12. package/dist/src/ars/mode-editor.d.ts +20 -0
  13. package/dist/src/ars/mode-editor.js +57 -0
  14. package/dist/src/ars/mode-editor.js.map +1 -0
  15. package/dist/src/ars/profile.d.ts +4 -1
  16. package/dist/src/ars/profile.js +23 -6
  17. package/dist/src/ars/profile.js.map +1 -1
  18. package/dist/src/cli.js +6 -3
  19. package/dist/src/cli.js.map +1 -1
  20. package/dist/src/creation/contracts.d.ts +3 -0
  21. package/dist/src/creation/service.js +17 -5
  22. package/dist/src/creation/service.js.map +1 -1
  23. package/dist/src/index.d.ts +1 -0
  24. package/dist/src/index.js +1 -0
  25. package/dist/src/index.js.map +1 -1
  26. package/dist/src/orchestration/bundled-personas.d.ts +16 -0
  27. package/dist/src/orchestration/bundled-personas.js +101 -0
  28. package/dist/src/orchestration/bundled-personas.js.map +1 -0
  29. package/dist/src/orchestration/effects.d.ts +8 -0
  30. package/dist/src/orchestration/effects.js +39 -0
  31. package/dist/src/orchestration/effects.js.map +1 -0
  32. package/dist/src/orchestration/personas.d.ts +2 -1
  33. package/dist/src/orchestration/personas.js +20 -7
  34. package/dist/src/orchestration/personas.js.map +1 -1
  35. package/dist/src/orchestration/pi-executor.d.ts +9 -5
  36. package/dist/src/orchestration/pi-executor.js +55 -22
  37. package/dist/src/orchestration/pi-executor.js.map +1 -1
  38. package/dist/src/orchestration/research-agents.d.ts +3 -7
  39. package/dist/src/orchestration/research-agents.js +5 -69
  40. package/dist/src/orchestration/research-agents.js.map +1 -1
  41. package/dist/src/panel/server.js +6 -0
  42. package/dist/src/panel/server.js.map +1 -1
  43. package/dist/src/style/cli-ui.d.ts +14 -0
  44. package/dist/src/style/cli-ui.js +45 -0
  45. package/dist/src/style/cli-ui.js.map +1 -1
  46. package/dist/src/tui/skill-manager.js +1 -1
  47. package/dist/src/tui/skill-manager.js.map +1 -1
  48. package/dist/src/updates/update.js +9 -3
  49. package/dist/src/updates/update.js.map +1 -1
  50. package/package.json +11 -3
  51. package/vendor/academic-paper-skills/LICENSE +21 -0
  52. package/vendor/academic-paper-skills/NOTICE.md +7 -0
  53. package/vendor/academic-paper-skills/PSYCLAW_SOURCE.json +14 -0
  54. package/vendor/academic-paper-skills/academic-paper-composer/SKILL.md +840 -0
  55. package/vendor/academic-paper-skills/academic-paper-composer/references/section_guides.md +675 -0
  56. package/vendor/academic-paper-skills/academic-paper-composer/references/writing_standards.md +629 -0
  57. package/vendor/academic-paper-skills/academic-paper-composer/scripts/chapter_quality_check.py +470 -0
  58. package/vendor/academic-paper-skills/academic-paper-composer/scripts/final_evaluation.py +550 -0
  59. package/vendor/academic-paper-skills/academic-paper-strategist/SKILL.md +670 -0
  60. package/vendor/academic-paper-skills/academic-paper-strategist/references/quality_standards.md +336 -0
  61. package/vendor/academic-paper-skills/academic-paper-strategist/references/search_strategy.md +459 -0
  62. package/vendor/academic-paper-skills/academic-paper-strategist/scripts/evaluate_samples.py +300 -0
  63. package/vendor/academic-paper-skills/academic-paper-strategist/scripts/gap_analysis.py +399 -0
  64. package/vendor/ars/pi/wrapper.js +9 -0
  65. package/vendor/nature-skills/LICENSE +201 -0
  66. package/vendor/nature-skills/NOTICE.md +7 -0
  67. package/vendor/nature-skills/PSYCLAW_SOURCE.json +19 -0
  68. package/vendor/nature-skills/skills/nature-figure/README.md +107 -0
  69. package/vendor/nature-skills/skills/nature-figure/README_EN.md +107 -0
  70. package/vendor/nature-skills/skills/nature-figure/SKILL.md +154 -0
  71. package/vendor/nature-skills/skills/nature-figure/agents/openai.yaml +4 -0
  72. package/vendor/nature-skills/skills/nature-figure/evals/evals.json +325 -0
  73. package/vendor/nature-skills/skills/nature-figure/manifest.yaml +103 -0
  74. package/vendor/nature-skills/skills/nature-figure/references/ai-graphical-abstract-workflow.md +129 -0
  75. package/vendor/nature-skills/skills/nature-figure/references/api.md +576 -0
  76. package/vendor/nature-skills/skills/nature-figure/references/asset-adaptation.md +72 -0
  77. package/vendor/nature-skills/skills/nature-figure/references/backend-selection.md +118 -0
  78. package/vendor/nature-skills/skills/nature-figure/references/chart-types.md +348 -0
  79. package/vendor/nature-skills/skills/nature-figure/references/common-patterns.md +371 -0
  80. package/vendor/nature-skills/skills/nature-figure/references/demos.md +58 -0
  81. package/vendor/nature-skills/skills/nature-figure/references/design-theory.md +467 -0
  82. package/vendor/nature-skills/skills/nature-figure/references/figure-contract.md +122 -0
  83. package/vendor/nature-skills/skills/nature-figure/references/figure-legend-conventions.md +90 -0
  84. package/vendor/nature-skills/skills/nature-figure/references/multipanel-evidence-architecture.md +268 -0
  85. package/vendor/nature-skills/skills/nature-figure/references/nature-2026-observations.md +124 -0
  86. package/vendor/nature-skills/skills/nature-figure/references/nature-article-requirements.md +149 -0
  87. package/vendor/nature-skills/skills/nature-figure/references/openrouter-image-generation.md +141 -0
  88. package/vendor/nature-skills/skills/nature-figure/references/qa-contract.md +344 -0
  89. package/vendor/nature-skills/skills/nature-figure/references/r-template-index.md +66 -0
  90. package/vendor/nature-skills/skills/nature-figure/references/r-workflow.md +234 -0
  91. package/vendor/nature-skills/skills/nature-figure/references/template-catalog.md +33 -0
  92. package/vendor/nature-skills/skills/nature-figure/references/tutorials.md +260 -0
  93. package/vendor/nature-skills/skills/nature-figure/requirements.txt +1 -0
  94. package/vendor/nature-skills/skills/nature-figure/scripts/audit_figure_collisions.py +742 -0
  95. package/vendor/nature-skills/skills/nature-figure/scripts/audit_panel_alignment.py +933 -0
  96. package/vendor/nature-skills/skills/nature-figure/scripts/audit_pdf_text.py +152 -0
  97. package/vendor/nature-skills/skills/nature-figure/scripts/figure_safety.py +50 -0
  98. package/vendor/nature-skills/skills/nature-figure/scripts/generate_openrouter_schematic.py +260 -0
  99. package/vendor/nature-skills/skills/nature-figure/scripts/nature_figure_backend.py +93 -0
  100. package/vendor/nature-skills/skills/nature-figure/scripts/panel_alignment.R +188 -0
  101. package/vendor/nature-skills/skills/nature-figure/scripts/plot_templates.py +604 -0
  102. package/vendor/nature-skills/skills/nature-figure/scripts/validate_figure.py +835 -0
  103. package/vendor/nature-skills/skills/nature-figure/static/core/contract.md +55 -0
  104. package/vendor/nature-skills/skills/nature-figure/static/core/stance.md +41 -0
  105. package/vendor/nature-skills/skills/nature-figure/static/fragments/backend/python.md +56 -0
  106. package/vendor/nature-skills/skills/nature-figure/static/fragments/backend/r.md +63 -0
  107. package/vendor/nature-skills/skills/nature-figure/tests/test_figure_safety.py +209 -0
  108. package/vendor/nature-skills/skills/nature-polishing/README.md +58 -0
  109. package/vendor/nature-skills/skills/nature-polishing/README_EN.md +58 -0
  110. package/vendor/nature-skills/skills/nature-polishing/SKILL.md +111 -0
  111. package/vendor/nature-skills/skills/nature-polishing/agents/openai.yaml +4 -0
  112. package/vendor/nature-skills/skills/nature-polishing/manifest.yaml +101 -0
  113. package/vendor/nature-skills/skills/nature-polishing/references/latex-layout.md +211 -0
  114. package/vendor/nature-skills/skills/nature-polishing/references/nat-comms-2025-diction.md +73 -0
  115. package/vendor/nature-skills/skills/nature-polishing/references/phrasebank-playbook.md +175 -0
  116. package/vendor/nature-skills/skills/nature-polishing/references/published-article-patterns.md +126 -0
  117. package/vendor/nature-skills/skills/nature-polishing/references/section-moves.md +252 -0
  118. package/vendor/nature-skills/skills/nature-polishing/references/style-guardrails.md +94 -0
  119. package/vendor/nature-skills/skills/nature-polishing/references/writing-strategy.md +160 -0
  120. package/vendor/nature-skills/skills/nature-polishing/static/core/failure-modes.md +29 -0
  121. package/vendor/nature-skills/skills/nature-polishing/static/core/output-format.md +21 -0
  122. package/vendor/nature-skills/skills/nature-polishing/static/core/stance.md +26 -0
  123. package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/generic.md +17 -0
  124. package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nat-comms.md +38 -0
  125. package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nat-mach-intell.md +102 -0
  126. package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nature.md +19 -0
  127. package/vendor/nature-skills/skills/nature-polishing/static/fragments/language/en.md +19 -0
  128. package/vendor/nature-skills/skills/nature-polishing/static/fragments/language/zh-to-en.md +19 -0
  129. package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/algorithmic.md +18 -0
  130. package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/hypothesis.md +17 -0
  131. package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/methods.md +35 -0
  132. package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/research.md +29 -0
  133. package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/review.md +17 -0
  134. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/abstract.md +26 -0
  135. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/conclusion.md +15 -0
  136. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/discussion.md +48 -0
  137. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/intro.md +33 -0
  138. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/methods.md +26 -0
  139. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/results.md +61 -0
  140. package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/title.md +17 -0
  141. package/vendor/nature-skills/skills/nature-ref-verifier/README.md +44 -0
  142. package/vendor/nature-skills/skills/nature-ref-verifier/README_EN.md +44 -0
  143. package/vendor/nature-skills/skills/nature-ref-verifier/SKILL.md +196 -0
  144. package/vendor/nature-skills/skills/nature-ref-verifier/agents/openai.yaml +4 -0
  145. package/vendor/nature-skills/skills/nature-ref-verifier/manifest.yaml +19 -0
  146. package/vendor/nature-skills/skills/nature-ref-verifier/references/common-patterns.md +96 -0
  147. package/vendor/nature-skills/skills/nature-shared/README.md +43 -0
  148. package/vendor/nature-skills/skills/nature-shared/README_EN.md +43 -0
  149. package/vendor/nature-skills/skills/nature-shared/SKILL.md +33 -0
  150. package/vendor/nature-skills/skills/nature-shared/agents/openai.yaml +6 -0
  151. package/vendor/nature-skills/skills/nature-shared/core/consistency-sweep.md +122 -0
  152. package/vendor/nature-skills/skills/nature-shared/core/discussion-argument-language.md +192 -0
  153. package/vendor/nature-skills/skills/nature-shared/core/ethics.md +88 -0
  154. package/vendor/nature-skills/skills/nature-shared/core/main-text-discipline.md +179 -0
  155. package/vendor/nature-skills/skills/nature-shared/core/nature-abstract.md +171 -0
  156. package/vendor/nature-skills/skills/nature-shared/core/nature-introduction.md +164 -0
  157. package/vendor/nature-skills/skills/nature-shared/core/nature-results-discussion.md +215 -0
  158. package/vendor/nature-skills/skills/nature-shared/core/paper-type-taxonomy.md +41 -0
  159. package/vendor/nature-skills/skills/nature-shared/core/reader-workflow.md +21 -0
  160. package/vendor/nature-skills/skills/nature-shared/core/research-compliance.md +192 -0
  161. package/vendor/nature-skills/skills/nature-shared/core/terminology-ledger.md +58 -0
  162. package/vendor/nature-skills/skills/nature-shared/journal-formats/nat-comms.md +139 -0
  163. package/vendor/nature-skills/skills/nature-shared/journal-formats/nature-machine-intelligence.md +431 -0
  164. package/vendor/nature-skills/skills/nature-shared/journal-formats/nature.md +313 -0
  165. package/vendor/nature-skills/skills/nature-shared/manifest.yaml +52 -0
  166. package/vendor/nature-skills/skills/nature-shared/scripts/check_consistency.py +273 -0
  167. package/vendor/nature-skills/skills/nature-shared/tests/test_check_consistency.py +63 -0
@@ -100,6 +100,15 @@ export default function (pi) {
100
100
  });
101
101
 
102
102
  pi.on("input", (event) => {
103
+ // PsyClaw conversation mode: `ars: <task>` (entered via bare `ars` + Tab).
104
+ const modeMatch = event.text.match(/^ars:\s*([\s\S]*)$/i);
105
+ if (modeMatch) {
106
+ setArsActive(true);
107
+ const body = modeMatch[1].trim();
108
+ if (!body) return { action: "handled" };
109
+ return { action: "transform", text: body };
110
+ }
111
+
103
112
  const match = event.text.match(commandPattern);
104
113
  if (!match) {
105
114
  if (skillPattern.test(event.text)) setArsActive(true);
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ # Nature Skills (bundled subset)
2
+
3
+ Source: https://github.com/Yuan1z0825/nature-skills
4
+ License: Apache-2.0 (see `LICENSE`)
5
+ Pinned commit: `28150f30f8b4017991fca8c7b2839f02c6586d2f`
6
+
7
+ PsyClaw ships only the ARS gap-fill leaves (`nature-figure`, `nature-ref-verifier`, `nature-polishing`) plus the `nature-shared` support package they reference. Large example assets under `nature-figure/assets` are omitted from this bundle.
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": "psyclaw/bundled-upstream/v1",
3
+ "name": "nature-skills",
4
+ "source": "https://github.com/Yuan1z0825/nature-skills",
5
+ "ref": "main",
6
+ "commit": "28150f30f8b4017991fca8c7b2839f02c6586d2f",
7
+ "contentSha256": "3dccb12c2dbfd430d2e133b434a9c8ef88ec9d0c31abded0776aba6e855f6509",
8
+ "license": "Apache-2.0",
9
+ "includes": [
10
+ "skills/nature-figure",
11
+ "skills/nature-ref-verifier",
12
+ "skills/nature-polishing",
13
+ "skills/nature-shared"
14
+ ],
15
+ "omissions": [
16
+ "skills/nature-figure/assets (chart-atlas / figures4papers / gallery examples omitted to keep the npm package small; runtime scripts and references remain)"
17
+ ],
18
+ "distribution": "Bundled in the PsyClaw npm package for offline ARS gap-fill; no runtime GitHub download is required."
19
+ }
@@ -0,0 +1,107 @@
1
+ # `nature-figure` 技能
2
+
3
+ [English](README_EN.md)
4
+
5
+ `nature-figure` 用于设计、生成和审查投稿级科研图件,面向 Nature 系列、高影响力期刊、论文图版、机制示意图和 graphical abstract 草稿。
6
+
7
+ ## 适合用它做什么
8
+
9
+ - 根据数据、图注或论文结论生成 Python / R 绘图脚本和可编辑图件。
10
+ - 将已有图件重画为更清楚的多面板论文 figure。
11
+ - 按“一张 Figure 回答一个 Results 级科学问题”的默认逻辑规划多面板证据链,让各 panel 分别承担主证据、control、正交验证、扰动、机制或边界等不同推理角色,而不是只把同一结果换指标重画。
12
+ - 规划 Figure 1、机制图、workflow、graphical abstract 或补充图。
13
+ - 检查面板标签、配色与视觉层级、逐面板误差线、最终 PDF 实际字号、统计标注、source data 和导出格式;多面板图在渲染时自动检查同行/同列轴框、宽高、panel 标签锚点和重复间距是否在 1.5 pt 容差内,每次生成或修改布局后再检测文字—文字、文字—线条/曲线、页面裁切及可疑色块/图片边缘重合。
14
+ - 区分旗舰 `Nature` 初投稿、主图终稿和 Extended Data 的文件契约,并执行 `<250` 词图注上限。
15
+ - 对 `Nature Machine Intelligence` 单独执行 6 个主 display、最多 10 个 Extended Data、初投稿/终稿边界、300 dpi/180 mm 和 source data 要求;当前官网未给独立图注数字,保留 2018 官方 `<300` 英文词为历史建议线,整张图注建议 150–250 词且不是每个 panel 分别计算。
16
+ - 在用户明确要求时,通过 OpenRouter Images API 调用 `openai/gpt-image-2` 生成 AI 概念示意图草稿。
17
+ - 对 AI 辅助 graphical abstract 先定义单一中心信息、图件类型、目标读者和证据边界,再比较构图与可访问配色;投稿前单独核验目标期刊最新 AI 政策、科学准确性、版权、披露和 provenance。`Nature Careers` 专栏仅作为实践建议,不等于投稿许可。
18
+
19
+ ## 工作方式
20
+
21
+ 绘图前先建立图件契约,而不是直接套模板:
22
+
23
+ - 核心结论:这张图要证明什么。
24
+ - 证据层级:哪些面板是主证据,哪些是补充解释。
25
+ - 多面板架构:先写 figure-level claim,再决定每个 panel 的独特证据角色以及主图、另一张图或 Extended Data/SI 的去向。
26
+ - 图件原型:散点、箱线、热图、机制图、流程图、多面板组合等。
27
+ - 后端选择:Python 或 R;第一次选择后会作为默认偏好复用。
28
+ - 数据完整性:默认保留全部观测和指定变量,任何排除都记录规则与前后计数。
29
+ - 模板兼容性:先核对科学含义、数据结构和变换条件,再决定精确复用、结构适配或只继承样式。
30
+ - 投稿约束:尺寸、字体、色彩、分辨率、矢量格式和 source-data 可追溯性。
31
+ - 子图对齐门:由 Python axes 或 R patchwork/gtable 在最终尺寸下测量真实 panel 矩形;横排 3/4 张等跨度 panel 自动保证等宽,普通网格及“左二右一 / 左一右二”等跨行布局自动推断,可靠错位阻断导出,free-positioned hero panel、inset 和 colorbar 只能带理由豁免。
32
+ - 渲染碰撞门:最终 PDF 每次重绘后都生成 collision JSON;可靠碰撞必须修复,可疑 overlay 必须逐项复核。
33
+
34
+ ## 典型请求
35
+
36
+ - “把这组数据做成 Nature 风格多面板图,优先 Python。”
37
+ - “参考 figures4papers 里 Nature Machine Intelligence 的布局,帮我补一个方法对比图。”
38
+ - “重画这个机制示意图,导出 SVG/PDF,并给我 source data 表。”
39
+ - “用 OpenRouter 生成 graphical abstract 草稿,但不要当作定量数据图。”
40
+
41
+ ## 示例预览
42
+
43
+ | 方向 | 预览 | 可借鉴模式 |
44
+ |------|------|------------|
45
+ | 多面板论文图 | <a href="assets/gallery/fig1-material-mechanism-rich.png"><img src="assets/gallery/fig1-material-mechanism-rich.png" width="220" alt="Material design and physical validation"></a> | 机制示意、图像面板、定量结果和相关性放在同一证据链中 |
46
+ | 图表类型 atlas | <a href="assets/chart-atlas/atlas-03-heatmaps.png"><img src="assets/chart-atlas/atlas-03-heatmaps.png" width="220" alt="Heatmap atlas"></a> | 热图、注释矩阵、聚类块和发散色标的组合模式 |
47
+ | 第三方 figures4papers 参考 | <a href="assets/figures4papers/figure_VIGIL/figures/comparison_radar.png"><img src="assets/figures4papers/figure_VIGIL/figures/comparison_radar.png" width="220" alt="VIGIL comparison radar"></a> | 仅用于研究 layout、legend 和多指标比较语法;使用前阅读独立版权说明 |
48
+
49
+ ## 你需要提供
50
+
51
+ - 原始数据、已有图、图注、论文 claim 或想表达的机制。
52
+ - 目标期刊、单栏/双栏尺寸、输出格式和是否需要 source data。
53
+ - Python / R 偏好;如果没有偏好,技能会先询问或沿用本机记录。
54
+
55
+ ## 产出
56
+
57
+ - 可运行的 Python 或 R 绘图脚本。
58
+ - SVG/PDF/TIFF/PNG 等图件文件,优先保留可编辑矢量版本。
59
+ - 面板说明、source data 映射、排除计数、逐面板视觉审查表、alignment JSON/诊断 SVG、碰撞 JSON/诊断 PDF 和投稿前 QA 记录。
60
+ - AI 示意图任务中,输出概念草稿和需要人工重画/核实的元素列表。
61
+
62
+ ## 内置参考
63
+
64
+ - `references/api.md`:Python 配色、样式和绘图 helper 约定。
65
+ - `references/asset-adaptation.md`:模板语义匹配、字段映射和数据完整性规则。
66
+ - `references/multipanel-evidence-architecture.md`:从 Results 级问题到 panel 证据角色、图内闭环、跨 Figure claim escalation 和主图/Extended Data/SI 去向的规划与审计。
67
+ - `references/template-catalog.md`:volcano、ROC、marker dot plot、marginal 和 paired 的已验证 Python CSV 模板。
68
+ - `references/chart-types.md`:常见图型选择和视觉规则。
69
+ - `references/demos.md`:第三方 `figures4papers` 示例索引、使用边界和原创适配模式。
70
+ - `references/qa-contract.md`:导出前检查项、source-data 约束和静态预检入口。
71
+ - `references/ai-graphical-abstract-workflow.md`:AI 图形摘要的信息简报、构图与配色、期刊政策门、人工科学核验、披露和 provenance 工作流。
72
+ - `references/openrouter-image-generation.md`:OpenRouter / GPT Image 2 的 provider-specific 生成与 QA 路径。
73
+ - `scripts/validate_figure.py`:Python/R 绘图源码的可复现静态 QA。
74
+ - `scripts/audit_pdf_text.py`:扫描导出 PDF 的 `Tf` 操作符,发现 mathtext 上下标等低于 5 pt 的实际字形。
75
+ - `scripts/audit_panel_alignment.py` 与 `scripts/panel_alignment.R`:在最终物理尺寸下测量 Matplotlib axes 或 R patchwork/gtable,对同行 3/4 panel 等宽、同行/同列边界、跨行面板共享外边界、panel 标签和重复间距执行阻断式自动审计。
76
+ - `scripts/audit_figure_collisions.py`:对 Python/R 最终 PDF 执行自动几何碰撞审计,输出阻断性 FAIL、需复核 WARN、JSON 报告和可选带框诊断 PDF。
77
+ - `scripts/figure_safety.py`:严格单调插值和基于数据/误差范围的标签高度 helper。
78
+ - `assets/figures4papers/`:保留的第三方参考脚本与预览图;不自动适用本仓库 MIT License,使用前阅读 `THIRD_PARTY_NOTICES.md`。
79
+
80
+ ## 边界
81
+
82
+ - 不会把 AI 生成图片当作真实实验结果或定量数据面板。
83
+ - 不会把内部可用的 AI 草稿自动称为可投稿终稿;两者分别判定。
84
+ - 不会凭空补统计检验、样本量、误差线含义或实验条件。
85
+ - 不会为了渲染方便静默抽样、忽略变量或删除不完整观测。
86
+ - 不会把自动校验通过当作视觉验收;对齐门只保证已声明的几何关系在容差内,最终交付仍需逐面板检查不确定性、标签碰撞、间距和显著性层级。
87
+ - 私有模板可以在本机使用,但不应在面向用户输出中暴露私有路径、文件名或来源。
88
+ - 第三方参考材料的版权和再使用条件以其来源及 `THIRD_PARTY_NOTICES.md` 为准;本仓库不额外授予这些文件的使用权。
89
+
90
+ 自动碰撞审计需要 PyMuPDF:
91
+
92
+ ```bash
93
+ python -m pip install -r skills/nature-figure/requirements.txt
94
+ ```
95
+
96
+ ## 相关技能
97
+
98
+ - `nature-statistics`:检查统计标注、n 定义和 p 值表述。
99
+ - `nature-writing`:把图件结论放回手稿叙事。
100
+ - `nature-paper2ppt`:把论文图件整理成汇报幻灯片。
101
+
102
+ ## 与其他技能的关系
103
+
104
+ - 如果任务核心是统计解释、样本量定义或显著性表述,优先让 `nature-statistics` 先把文字审清,再回到 `nature-figure` 画图。
105
+ - 如果图件已经定稿,但需要把结论组织成摘要、引言或结果段落,交给 `nature-writing` 继续承接。
106
+ - 如果图件要直接转成组会材料或答辩汇报,再交给 `nature-paper2ppt` 组织成页面。
107
+ - `nature-figure` 负责图件本身;它不替代统计审查,也不替代手稿叙事。
@@ -0,0 +1,107 @@
1
+ # `nature-figure` Skill
2
+
3
+ [中文说明](README.md)
4
+
5
+ `nature-figure` designs, generates, and audits submission-grade scientific figures for Nature-series papers, high-impact journals, manuscript panels, mechanism schematics, and graphical-abstract drafts.
6
+
7
+ ## What To Use It For
8
+
9
+ - Generate Python / R plotting scripts and editable figures from data, legends, or manuscript claims.
10
+ - Redraw existing figures into clearer multi-panel manuscript figures.
11
+ - Plan multi-panel evidence chains around the default that one figure answers one Results-level scientific question, with panels serving different inferential roles such as primary evidence, control, orthogonal validation, perturbation, mechanism, or boundary rather than merely redrawing the same result under new metrics.
12
+ - Plan Figure 1, mechanism diagrams, workflows, graphical abstracts, or supplementary figures.
13
+ - Check panel labels, color hierarchy, panel-by-panel uncertainty, actual PDF glyph sizes, statistical annotations, source data, and export formats; at render time, automatically enforce a 1.5 pt tolerance for comparable row/column axes rectangles, dimensions, panel-label anchors, and repeated gutters, then detect text-text, text-stroke/curve, page-clipping, and suspicious fill/image-edge overlaps after every generation or layout revision.
14
+ - Separate flagship `Nature` initial, final main-figure, and Extended Data file contracts, including the under-250-word legend limit.
15
+ - Apply `Nature Machine Intelligence` (NMI)'s separate six-main-display, up-to-ten Extended Data, initial/final, 300-dpi/180-mm, and source-data requirements; the current pages give no standalone legend number, so retain the official 2018 `<300`-English-word rule only as a historical advisory, count the whole legend rather than each panel, and aim for 150–250 words.
16
+ - When explicitly requested, call `openai/gpt-image-2` through the OpenRouter Images API to draft AI concept schematics.
17
+ - For AI-assisted graphical abstracts, define one central message, figure type, audience, and evidence boundary before comparing compositions and accessible palettes; then separately verify the target journal's current AI policy, scientific accuracy, copyright, disclosure, and provenance. Treat the *Nature Careers* column as practitioner advice, not submission permission.
18
+
19
+ ## Workflow
20
+
21
+ Start with a figure contract rather than a template:
22
+
23
+ - Core conclusion: what the figure must demonstrate.
24
+ - Evidence hierarchy: which panels are primary evidence and which are explanatory.
25
+ - Multi-panel architecture: write the figure-level claim first, then assign every panel a distinct evidence role and decide whether displaced material belongs in another figure or Extended Data/SI.
26
+ - Figure prototype: scatter, box plot, heatmap, mechanism diagram, workflow, multi-panel composition, and so on.
27
+ - Backend choice: Python or R; the first choice can be reused as the default preference.
28
+ - Data integrity: preserve all observations and requested variables by default, and record every exclusion rule with before/after counts.
29
+ - Template compatibility: compare scientific meaning, data shape, and transform constraints before exact reuse, structural adaptation, or style-only inheritance.
30
+ - Submission constraints: size, typography, color, resolution, vector format, and source-data traceability.
31
+ - Panel-alignment gate: Python axes or R patchwork/gtable measures real panel rectangles at final dimensions; horizontal rows of three or four equal-span panels must be equal width, regular grids and unequal-span `left two/right one` or mirrored layouts are inferred automatically, reliable misalignment blocks export, and free-positioned hero panels, insets, or colorbars require reasoned exemptions.
32
+ - Rendered collision gate: regenerate a collision JSON after every final-PDF render; reliable collisions must be fixed and ambiguous overlays reviewed individually.
33
+
34
+ ## Typical Requests
35
+
36
+ - "Make a Nature-style multi-panel figure from this dataset, preferably in Python."
37
+ - "Use the figures4papers Nature Machine Intelligence layout as a reference and add a method-comparison figure."
38
+ - "Redraw this mechanism schematic, export SVG/PDF, and give me the source-data table."
39
+ - "Use OpenRouter to draft a graphical abstract, but do not treat it as a quantitative data figure."
40
+
41
+ ## Example Preview
42
+
43
+ | Direction | Preview | Reusable Pattern |
44
+ |-----------|---------|------------------|
45
+ | Multi-panel manuscript figure | <a href="assets/gallery/fig1-material-mechanism-rich.png"><img src="assets/gallery/fig1-material-mechanism-rich.png" width="220" alt="Material design and physical validation"></a> | Mechanism schematic, image panels, quantitative results, and correlation in one evidence chain |
46
+ | Chart-type atlas | <a href="assets/chart-atlas/atlas-03-heatmaps.png"><img src="assets/chart-atlas/atlas-03-heatmaps.png" width="220" alt="Heatmap atlas"></a> | Heatmaps, annotation matrices, cluster blocks, and diverging color scales |
47
+ | Third-party figures4papers reference | <a href="assets/figures4papers/figure_VIGIL/figures/comparison_radar.png"><img src="assets/figures4papers/figure_VIGIL/figures/comparison_radar.png" width="220" alt="VIGIL comparison radar"></a> | Study layout, legend, and multi-metric comparison grammar only; read the separate copyright notice before use |
48
+
49
+ ## What You Need To Provide
50
+
51
+ - Raw data, existing figure, legend, manuscript claim, or intended mechanism.
52
+ - Target journal, single-column / double-column size, output format, and whether source data is required.
53
+ - Python / R preference; if absent, the skill asks or reuses the local preference.
54
+
55
+ ## Outputs
56
+
57
+ - Runnable Python or R plotting script.
58
+ - SVG/PDF/TIFF/PNG figure files, with editable vector output preferred.
59
+ - Panel notes, source-data mapping, exclusion counts, a panel-by-panel visual audit, alignment JSON/diagnostic SVG, collision JSON/diagnostic PDF, and a pre-submission QA record.
60
+ - For AI-schematic tasks, a concept draft and a list of elements that need human redrawing or verification.
61
+
62
+ ## Built-In References
63
+
64
+ - `references/api.md`: Python palette, style, and plotting-helper conventions.
65
+ - `references/asset-adaptation.md`: semantic matching, field mapping, and data-integrity rules for templates.
66
+ - `references/multipanel-evidence-architecture.md`: planning and audit from Results-level question to panel evidence roles, within-figure closure, cross-figure claim escalation, and main-figure/Extended-Data/SI placement.
67
+ - `references/template-catalog.md`: validated Python CSV templates for volcano, ROC, marker dot plot, marginal, and paired figures.
68
+ - `references/chart-types.md`: chart selection and visual rules.
69
+ - `references/demos.md`: third-party `figures4papers` index, use boundaries, and original adaptation patterns.
70
+ - `references/qa-contract.md`: export QA, source-data constraints, and static-preflight entry points.
71
+ - `references/ai-graphical-abstract-workflow.md`: message brief, composition and color, journal-policy gate, human scientific verification, disclosure, and provenance for AI-assisted graphical abstracts.
72
+ - `references/openrouter-image-generation.md`: provider-specific OpenRouter / GPT Image 2 generation and QA.
73
+ - `scripts/validate_figure.py`: reproducible static QA for Python and R plotting source.
74
+ - `scripts/audit_pdf_text.py`: scan exported PDF `Tf` operators for real glyph runs below the 5 pt floor, including reduced mathtext scripts.
75
+ - `scripts/audit_panel_alignment.py` and `scripts/panel_alignment.R`: measure final-size Matplotlib axes or R patchwork/gtable geometry and block unequal widths in three/four-panel rows, row/column edges, shared outer edges of spanning panels, panel labels, or repeated-gutter misalignment.
76
+ - `scripts/audit_figure_collisions.py`: automatic geometry audit for final Python/R PDFs, with blocking FAIL findings, review-required WARN findings, JSON output, and an optional marked diagnostic PDF.
77
+ - `scripts/figure_safety.py`: strict monotone interpolation and data/uncertainty-driven label positioning helpers.
78
+ - `assets/figures4papers/`: retained third-party scripts and previews; the repository MIT License does not automatically apply, so read `THIRD_PARTY_NOTICES.md` before use.
79
+
80
+ ## Boundaries
81
+
82
+ - AI-generated images are not treated as real experimental results or quantitative data panels.
83
+ - An internally useful AI draft is not automatically described as a submission-ready final asset; assess those two states separately.
84
+ - The skill does not invent statistical tests, sample sizes, error-bar meanings, or experiment conditions.
85
+ - The skill does not silently sample for rendering convenience, ignore requested variables, or remove incomplete observations.
86
+ - Passing automated checks is not treated as visual acceptance; the alignment gate only proves declared geometric relationships are within tolerance, and uncertainty, label collisions, spacing, and salience still require panel-by-panel inspection.
87
+ - Private templates can be used locally, but user-facing outputs should not expose private paths, filenames, or sources.
88
+ - Third-party reference materials remain subject to their source terms and `THIRD_PARTY_NOTICES.md`; this repository grants no additional rights to those files.
89
+
90
+ The automatic collision audit requires PyMuPDF:
91
+
92
+ ```bash
93
+ python -m pip install -r skills/nature-figure/requirements.txt
94
+ ```
95
+
96
+ ## Related Skills
97
+
98
+ - `nature-statistics`: check statistical annotations, n definitions, and p-value wording.
99
+ - `nature-writing`: align figure conclusions with manuscript narrative.
100
+ - `nature-paper2ppt`: turn manuscript figures into presentation slides.
101
+
102
+ ## Relationship With Other Skills
103
+
104
+ - If the core task is statistical interpretation, sample-size definition, or significance wording, let `nature-statistics` audit the text before returning to `nature-figure`.
105
+ - If the figure is finished but the user needs the claim written into an abstract, introduction, or results section, hand off to `nature-writing`.
106
+ - If the figure should become a lab meeting deck or presentation slide, hand off to `nature-paper2ppt`.
107
+ - `nature-figure` is responsible for the figure itself; it does not replace statistical review or manuscript narration.
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: nature-figure
3
+ description: >-
4
+ Create, revise, audit, and export submission-grade scientific figures for Nature-family and other high-impact venues in Python (matplotlib/seaborn) or R (ggplot2/patchwork/ComplexHeatmap), including multi-panel plots, figures4papers-style work, and journal-ready SVG/PDF/TIFF outputs. Use for paper or scientific plots, manuscript data visualization, 论文配图、学术写作配图、科研绘图、科研作图、画图、作图、出图、论文图表、可视化. Define the conclusion, evidence logic, data integrity, template compatibility, export needs, and reviewer risks before plotting; honor or persist the Python/R backend choice. Also use the separate OpenRouter GPT Image 2 route for explicit AI-generated graphical abstracts, mechanism diagrams, concept schematics, 论文示意图、机制示意图、图形摘要; this route skips backend choice and treats outputs as drafts. Do not use for interactive dashboards, statistics-only analysis, data cleaning, literature review, code debugging, pure photo editing, or Illustrator/Figma-first infographics without manuscript-figure intent.
5
+ ---
6
+
7
+ # Nature Figure Making — Router
8
+
9
+ This skill is split into two layers:
10
+
11
+ - A **static layer** under `static/` that holds versioned, reusable content fragments (the figure contract and default stance, plus a per-backend quick-start for Python and R).
12
+ - A **dynamic layer** (this file plus `manifest.yaml`) that detects the plotting backend and loads only the fragment needed for the current job. The large design, API, pattern, and QA material lives in on-demand references.
13
+
14
+ Do not try to apply the figure logic from memory or from this router. Always load fragments from disk as described below.
15
+
16
+ ## Routing protocol
17
+
18
+ Follow these steps every time the skill is invoked.
19
+
20
+ ### 0. Check for graphical-abstract and AI-schematic routes
21
+
22
+ For every graphical-abstract planning, generation, revision, or audit task that
23
+ uses AI, read
24
+ [references/ai-graphical-abstract-workflow.md](references/ai-graphical-abstract-workflow.md)
25
+ first. It owns the message/audience brief, composition and palette workflow,
26
+ policy gate, human scientific review, disclosure boundary, and provenance
27
+ requirements. A Nature Careers article is practitioner advice, not submission
28
+ clearance; verify the current official policy for the exact target journal.
29
+
30
+ If the request is planning or auditing only, do not ask for Python or R unless
31
+ the user also asks to render or revise a data-driven figure.
32
+
33
+ If the user explicitly asks to generate a manuscript schematic, graphical abstract, mechanism diagram, concept illustration, or paper schematic with OpenRouter, GPT Image 2, an image-generation API, or similar wording, do **not** ask "Python or R?". This is a non-plotting AI-schematic route.
34
+
35
+ For this route:
36
+
37
+ 1. Read [manifest.yaml](manifest.yaml) and the `always_load` files.
38
+ 2. Read [references/ai-graphical-abstract-workflow.md](references/ai-graphical-abstract-workflow.md).
39
+ 3. Read [references/openrouter-image-generation.md](references/openrouter-image-generation.md).
40
+ 4. Use [scripts/generate_openrouter_schematic.py](scripts/generate_openrouter_schematic.py) when the user wants a real API call or a reproducible payload.
41
+ 5. Treat output as a draft schematic / graphical abstract, not as a quantitative data panel. Do not invent experimental values, author logos, institutional marks, or unsupported mechanisms. Keep internal usefulness separate from submission eligibility.
42
+
43
+ Only continue to the Python/R backend gate for plotting, charting, data visualization, or manuscript figure assembly tasks that are not explicit OpenRouter AI image-generation requests.
44
+
45
+ ### 1. Load the manifest and the core layer
46
+
47
+ Read [manifest.yaml](manifest.yaml). It declares the `backend` axis, the allowed values, and the file paths each value maps to.
48
+
49
+ Also read every file listed under `always_load` (`static/core/contract.md` and `static/core/stance.md`). These hold the figure contract, the backend gate, the missing-runtime rule, the privacy rule, and the default operating stance that apply to every figure job.
50
+
51
+ ### 2. Resolve the plotting backend
52
+
53
+ Backend selection applies only to rendering or editing plotting code. Reuse a choice already established in the same task and its follow-ups; do not ask again merely because a new message omits the language. Read-only figure review and backend-independent data inspection may proceed without this choice. If the backend remains unresolved, retain the one-time Python/R question and pause only dependent plotting steps. Explicit approval requirements and backend exclusivity remain in force.
54
+
55
+ Resolve the plotting backend from the current task before consulting the saved default. Decide the `backend` value in this order:
56
+
57
+ 1. If the current request explicitly chooses Python or R, use that backend and save it with `scripts/nature_figure_backend.py set python` or `scripts/nature_figure_backend.py set r`.
58
+ 2. If the request provides a clearly language-specific input file/workflow, use that backend and save it.
59
+ 3. Otherwise reuse a Python/R choice already established in this task. If none exists, run `scripts/nature_figure_backend.py get` and use a returned `python` or `r` preference.
60
+ 4. If neither a task choice nor a saved preference exists, ask exactly one concise question — **Python or R? I will remember this as your default.** — and pause only dependent plotting steps. After the user answers, save the answer before proceeding.
61
+
62
+ - `python` — matplotlib / seaborn.
63
+ - `r` — ggplot2 / patchwork / ComplexHeatmap.
64
+
65
+ Do not guess or choose a backend by aesthetics alone. Only recommend a backend when the user explicitly asks you to choose; then use `references/backend-selection.md`, state the reason, save the selected backend, and proceed. Once selected, the backend is **exclusive** for all drawing, previewing, exporting, and visual QA (see `core/contract.md`). This gate does not apply to the explicit OpenRouter AI-schematic route above.
66
+
67
+ ### 3. Load the matching backend fragment
68
+
69
+ After the backend is resolved, Read the mapped fragment (`static/fragments/backend/python.md` or `static/fragments/backend/r.md`). It carries the backend-only execution rule and the publication quick-start (rcParams/theme and export helper). Do **not** load the other backend's fragment.
70
+
71
+ ### 4. Build the figure using the loaded material
72
+
73
+ Apply the loaded material in this order:
74
+
75
+ 1. Figure contract (`core/contract.md`) — write the core conclusion, map the evidence chain, classify the archetype, set the journal/export contract, before any code.
76
+ 2. Multi-panel evidence architecture — when planning, restructuring, or auditing a labelled multi-panel figure, load `references/multipanel-evidence-architecture.md`. Make the figure answer one Results-level scientific question; assign panels different inferential roles, not merely different metrics. When figure order must follow the manuscript argument, also load `../nature-shared/core/nature-results-discussion.md`.
77
+ 3. Default stance (`core/stance.md`) — archetype-first composition, hero panel, restrained palette, statistics/integrity as part of the figure.
78
+ 4. Backend fragment — the exclusive Python or R quick-start and execution rule.
79
+ 5. Template adaptation — when reusing built-in original examples, licensed external material, or user-provided plotting code, load `references/asset-adaptation.md` before mapping data or changing the script.
80
+ 6. Rendered QA and delivery preflight — load `references/qa-contract.md`, run the render-time panel-alignment gate for every multi-panel figure, `scripts/validate_figure.py` on the plotting source, `scripts/audit_pdf_text.py` on the exported PDF, and `scripts/audit_figure_collisions.py` on the same final PDF. Then inspect every panel and the complete figure at final physical size. Automated checks do not replace the panel-by-panel uncertainty, salience, spacing, and ambiguity audit.
81
+
82
+ For every figure containing two or more comparable panels, measure the **final
83
+ rendered plot-area rectangles** before export and preserve the alignment JSON.
84
+ Python figures must call `require_matplotlib_panel_alignment()` from
85
+ `scripts/audit_panel_alignment.py` after the final layout draw. R/patchwork
86
+ figures must source `scripts/panel_alignment.R`, write the patchwork layout
87
+ manifest at the final export dimensions, and run the same backend-neutral JSON
88
+ auditor. Use a default physical tolerance of `1.5 pt` for shared edges, widths,
89
+ heights, panel-label anchors and repeated gutters. `FIX BEFORE DELIVERY` or exit
90
+ code `1` blocks export; `NOT AUDITABLE` or exit code `2` blocks any claim that
91
+ alignment passed. A horizontal row of three or four equal-grid-span panels must
92
+ have equal final plot-area widths as well as equal heights and gutters; an
93
+ intentional unequal-width design requires a recorded `panel-width` exemption.
94
+ Structured unequal-span grids—including two stacked panels
95
+ beside one panel spanning both rows, in either column—must be inferred from
96
+ shared grid start/stop boundaries and checked automatically. Nested grids,
97
+ free-positioned hero panels, insets and colorbars may be excluded only through
98
+ explicit comparable groups or a recorded exemption with a reason. Do not
99
+ weaken the global tolerance to hide one intentional exception.
100
+
101
+ After every generated or revised Python/R scientific figure, export the final
102
+ PDF and run the collision audit again; this is mandatory after any change to
103
+ data geometry, text, fonts, legends, annotations, axes, error bars, panel size
104
+ or layout, not only at final submission. Use:
105
+
106
+ ```bash
107
+ python skills/nature-figure/scripts/audit_figure_collisions.py figure.pdf \
108
+ --json-out figure.collision-audit.json \
109
+ --overlay-pdf figure.collision-audit.pdf
110
+ ```
111
+
112
+ - `FIX BEFORE DELIVERY` or exit code `1`: repair the figure, re-export with the
113
+ selected plotting backend, and rerun all rendered QA.
114
+ - `REVIEW REQUIRED`: inspect every WARN at final physical size; record why an
115
+ intentional overlay is acceptable. Use `--strict` when WARN must block.
116
+ - `NOT AUDITABLE` or exit code `2`: report the dependency/PDF blocker and do not
117
+ claim collision validation. Install `requirements.txt` when PyMuPDF is absent.
118
+
119
+ The collision audit reads PDF geometry for both Python and R output. It does not redraw
120
+ the scientific figure or authorize cross-backend plotting. Its optional marked
121
+ PDF is a QA-only diagnostic artifact and must never replace the selected
122
+ backend's source or submission files.
123
+
124
+ When the target is the flagship journal Nature, also load
125
+ `references/nature-article-requirements.md`. It separates initial-review files
126
+ from accepted-in-principle main and Extended Data production contracts and owns
127
+ the flagship legend limit.
128
+
129
+ When the target is Nature Machine Intelligence, instead load
130
+ `../nature-shared/journal-formats/nature-machine-intelligence.md`. Apply its
131
+ combined six-item main display budget, ten-item Extended Data maximum,
132
+ initial-versus-production boundary, 300-dpi/180-mm production checks and source-
133
+ data contract. NMI's current live pages do not assign a standalone per-legend
134
+ number, but its official 2018 brief guide set a historical advisory ceiling of
135
+ fewer than 300 English words per complete figure legend. Count the whole legend,
136
+ not each panel; aim for 150–250 words and keep it below 300 unless the live
137
+ submission system or editor gives a newer instruction. Do not import flagship
138
+ Nature's limit.
139
+
140
+ The chart serves the scientific logic; aesthetic polish is subordinate to making the core conclusion clear, defensible, and reviewable.
141
+
142
+ ### 5. Reach for references only when needed
143
+
144
+ The files under `references/` are deep references, not defaults. Open them on demand per the `references.on_demand` table in the manifest — for example `references/figure-contract.md` to build the contract, `references/multipanel-evidence-architecture.md` to turn one Results-level question into complementary panel roles and a claim-escalating figure sequence, `references/asset-adaptation.md` to reuse a plotting template safely, `references/template-catalog.md` for validated Python CSV templates, `references/api.md` for the Python palette and numerical/layout safety helpers, `references/r-workflow.md` for R, `references/design-theory.md` for color/typography/export rationale, `references/common-patterns.md` and `references/chart-types.md` for layout/chart recipes, `references/nature-2026-observations.md` for real Nature page archetypes, `references/qa-contract.md` before final delivery, `references/nature-article-requirements.md` for exact flagship Nature stage and upload rules, `../nature-shared/journal-formats/nature-machine-intelligence.md` for exact NMI figure rules, `references/ai-graphical-abstract-workflow.md` for AI-assisted graphical-abstract planning, policy gating, human verification, and provenance, and `references/tutorials.md` / `references/demos.md` for worked examples.
145
+
146
+ Do not infer flagship Nature or NMI requirements from a Nature Communications
147
+ corpus or from the visual-style examples in this skill.
148
+
149
+ ## Why this split
150
+
151
+ - The static layer is versioned and reviewable. The backend gate is now explicit in the manifest rather than buried in prose.
152
+ - The dynamic layer keeps each invocation cheap: only the selected backend's quick-start enters context, and the 2,600+ lines of reference depth load only when a step needs them.
153
+ - The router itself is short on purpose. Update fragments and references, not this file, when adding scope.
154
+ - This structure mirrors `nature-writing`, `nature-polishing`, `nature-reader`, and `nature-paper2ppt`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Nature Figure"
3
+ short_description: "Create and audit submission-ready scientific figures"
4
+ default_prompt: "Use $nature-figure to create and audit a submission-ready scientific figure from these data."