@researai/deepscientist 1.5.0 → 1.5.1

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 (163) hide show
  1. package/AGENTS.md +26 -0
  2. package/README.md +19 -179
  3. package/assets/connectors/lingzhu/openclaw-bridge/README.md +124 -0
  4. package/assets/connectors/lingzhu/openclaw-bridge/index.ts +162 -0
  5. package/assets/connectors/lingzhu/openclaw-bridge/openclaw.plugin.json +145 -0
  6. package/assets/connectors/lingzhu/openclaw-bridge/package.json +35 -0
  7. package/assets/connectors/lingzhu/openclaw-bridge/src/cli.ts +180 -0
  8. package/assets/connectors/lingzhu/openclaw-bridge/src/config.ts +196 -0
  9. package/assets/connectors/lingzhu/openclaw-bridge/src/debug-log.ts +111 -0
  10. package/assets/connectors/lingzhu/openclaw-bridge/src/events.ts +4 -0
  11. package/assets/connectors/lingzhu/openclaw-bridge/src/http-handler.ts +1133 -0
  12. package/assets/connectors/lingzhu/openclaw-bridge/src/image-cache.ts +75 -0
  13. package/assets/connectors/lingzhu/openclaw-bridge/src/lingzhu-tools.ts +246 -0
  14. package/assets/connectors/lingzhu/openclaw-bridge/src/transform.ts +541 -0
  15. package/assets/connectors/lingzhu/openclaw-bridge/src/types.ts +131 -0
  16. package/assets/connectors/lingzhu/openclaw-bridge/tsconfig.json +14 -0
  17. package/assets/connectors/lingzhu/openclaw.lingzhu.config.template.json +39 -0
  18. package/bin/ds.js +233 -53
  19. package/docs/en/00_QUICK_START.md +134 -0
  20. package/docs/en/01_SETTINGS_REFERENCE.md +1104 -0
  21. package/docs/en/02_START_RESEARCH_GUIDE.md +404 -0
  22. package/docs/en/03_QQ_CONNECTOR_GUIDE.md +325 -0
  23. package/docs/en/04_LINGZHU_CONNECTOR_GUIDE.md +216 -0
  24. package/docs/en/05_TUI_GUIDE.md +141 -0
  25. package/docs/en/06_RUNTIME_AND_CANVAS.md +679 -0
  26. package/docs/en/07_MEMORY_AND_MCP.md +253 -0
  27. package/docs/en/08_FIGURE_STYLE_GUIDE.md +97 -0
  28. package/docs/en/09_DOCTOR.md +108 -0
  29. package/docs/en/90_ARCHITECTURE.md +245 -0
  30. package/docs/en/91_DEVELOPMENT.md +195 -0
  31. package/docs/en/99_ACKNOWLEDGEMENTS.md +29 -0
  32. package/docs/zh/00_QUICK_START.md +134 -0
  33. package/docs/zh/01_SETTINGS_REFERENCE.md +1137 -0
  34. package/docs/zh/02_START_RESEARCH_GUIDE.md +414 -0
  35. package/docs/zh/03_QQ_CONNECTOR_GUIDE.md +324 -0
  36. package/docs/zh/04_LINGZHU_CONNECTOR_GUIDE.md +230 -0
  37. package/docs/zh/05_TUI_GUIDE.md +128 -0
  38. package/docs/zh/06_RUNTIME_AND_CANVAS.md +271 -0
  39. package/docs/zh/07_MEMORY_AND_MCP.md +235 -0
  40. package/docs/zh/08_FIGURE_STYLE_GUIDE.md +97 -0
  41. package/docs/zh/09_DOCTOR.md +112 -0
  42. package/docs/zh/99_ACKNOWLEDGEMENTS.md +29 -0
  43. package/install.sh +32 -8
  44. package/package.json +4 -2
  45. package/pyproject.toml +1 -1
  46. package/src/deepscientist/artifact/guidance.py +9 -2
  47. package/src/deepscientist/artifact/service.py +482 -22
  48. package/src/deepscientist/bash_exec/monitor.py +27 -5
  49. package/src/deepscientist/bash_exec/runtime.py +639 -0
  50. package/src/deepscientist/bash_exec/service.py +99 -16
  51. package/src/deepscientist/bridges/base.py +3 -0
  52. package/src/deepscientist/bridges/connectors.py +292 -13
  53. package/src/deepscientist/channels/qq.py +19 -2
  54. package/src/deepscientist/channels/relay.py +1 -0
  55. package/src/deepscientist/cli.py +32 -25
  56. package/src/deepscientist/config/models.py +28 -2
  57. package/src/deepscientist/config/service.py +201 -6
  58. package/src/deepscientist/connector_runtime.py +2 -0
  59. package/src/deepscientist/daemon/api/handlers.py +50 -5
  60. package/src/deepscientist/daemon/api/router.py +1 -0
  61. package/src/deepscientist/daemon/app.py +442 -15
  62. package/src/deepscientist/doctor.py +444 -0
  63. package/src/deepscientist/home.py +1 -0
  64. package/src/deepscientist/latex_runtime.py +17 -4
  65. package/src/deepscientist/lingzhu_support.py +182 -0
  66. package/src/deepscientist/mcp/server.py +49 -2
  67. package/src/deepscientist/prompts/builder.py +181 -58
  68. package/src/deepscientist/quest/layout.py +1 -0
  69. package/src/deepscientist/quest/service.py +63 -2
  70. package/src/deepscientist/quest/stage_views.py +19 -1
  71. package/src/deepscientist/runtime_tools/__init__.py +16 -0
  72. package/src/deepscientist/runtime_tools/builtins.py +19 -0
  73. package/src/deepscientist/runtime_tools/models.py +29 -0
  74. package/src/deepscientist/runtime_tools/registry.py +40 -0
  75. package/src/deepscientist/runtime_tools/service.py +59 -0
  76. package/src/deepscientist/runtime_tools/tinytex.py +25 -0
  77. package/src/deepscientist/tinytex.py +276 -0
  78. package/src/prompts/connectors/lingzhu.md +12 -0
  79. package/src/prompts/connectors/qq.md +121 -0
  80. package/src/prompts/system.md +177 -33
  81. package/src/skills/analysis-campaign/SKILL.md +22 -6
  82. package/src/skills/baseline/SKILL.md +5 -4
  83. package/src/skills/decision/SKILL.md +4 -3
  84. package/src/skills/experiment/SKILL.md +5 -4
  85. package/src/skills/finalize/SKILL.md +5 -4
  86. package/src/skills/idea/SKILL.md +5 -4
  87. package/src/skills/intake-audit/SKILL.md +277 -0
  88. package/src/skills/intake-audit/references/state-audit-template.md +41 -0
  89. package/src/skills/rebuttal/SKILL.md +407 -0
  90. package/src/skills/rebuttal/references/action-plan-template.md +63 -0
  91. package/src/skills/rebuttal/references/evidence-update-template.md +30 -0
  92. package/src/skills/rebuttal/references/response-letter-template.md +113 -0
  93. package/src/skills/rebuttal/references/review-matrix-template.md +55 -0
  94. package/src/skills/review/SKILL.md +293 -0
  95. package/src/skills/review/references/experiment-todo-template.md +29 -0
  96. package/src/skills/review/references/review-report-template.md +83 -0
  97. package/src/skills/review/references/revision-log-template.md +40 -0
  98. package/src/skills/scout/SKILL.md +5 -4
  99. package/src/skills/write/SKILL.md +7 -3
  100. package/src/tui/dist/components/WelcomePanel.js +17 -43
  101. package/src/tui/dist/components/messages/BashExecOperationMessage.js +3 -2
  102. package/src/tui/package.json +1 -1
  103. package/src/ui/dist/assets/{AiManusChatView-7v-dHngU.js → AiManusChatView-w5lF2Ttt.js} +109 -575
  104. package/src/ui/dist/assets/{AnalysisPlugin-B_Xmz-KE.js → AnalysisPlugin-DJOED79I.js} +1 -1
  105. package/src/ui/dist/assets/{AutoFigurePlugin-Cko-0tm1.js → AutoFigurePlugin-DaG61Y0M.js} +63 -8
  106. package/src/ui/dist/assets/{CliPlugin-BsU0ht7q.js → CliPlugin-CV4LqUB_.js} +43 -609
  107. package/src/ui/dist/assets/{CodeEditorPlugin-DcMMP0Rt.js → CodeEditorPlugin-DylfAea4.js} +8 -8
  108. package/src/ui/dist/assets/{CodeViewerPlugin-BqoQ5QyY.js → CodeViewerPlugin-F7saY0LM.js} +5 -5
  109. package/src/ui/dist/assets/{DocViewerPlugin-D7eHNhU6.js → DocViewerPlugin-COP0c7jf.js} +3 -3
  110. package/src/ui/dist/assets/{GitDiffViewerPlugin-DLJN42T5.js → GitDiffViewerPlugin-CAS05pT9.js} +1 -1
  111. package/src/ui/dist/assets/{ImageViewerPlugin-gJMV7MOu.js → ImageViewerPlugin-Bco1CN_w.js} +5 -6
  112. package/src/ui/dist/assets/{LabCopilotPanel-B857sfxP.js → LabCopilotPanel-CvMlCD99.js} +12 -15
  113. package/src/ui/dist/assets/LabPlugin-BYankkE4.js +2676 -0
  114. package/src/ui/dist/assets/LabPlugin-D9jVIo0A.css +2698 -0
  115. package/src/ui/dist/assets/{LatexPlugin-DWKEo-Wj.js → LatexPlugin-LDSMR-t-.js} +16 -16
  116. package/src/ui/dist/assets/{MarkdownViewerPlugin-DBzoEmhv.js → MarkdownViewerPlugin-B7o80jgm.js} +4 -4
  117. package/src/ui/dist/assets/{MarketplacePlugin-DoHc-8vo.js → MarketplacePlugin-CM6ZOcpC.js} +3 -3
  118. package/src/ui/dist/assets/{NotebookEditor-CKjKH-yS.js → NotebookEditor-Dc61cXmK.js} +3 -3
  119. package/src/ui/dist/assets/{PdfLoader-zFoL0VPo.js → PdfLoader-DWowuQwx.js} +1 -1
  120. package/src/ui/dist/assets/{PdfMarkdownPlugin-DXPaL9Nt.js → PdfMarkdownPlugin-BsJM1q_a.js} +3 -3
  121. package/src/ui/dist/assets/{PdfViewerPlugin-DhK8qCFp.js → PdfViewerPlugin-DB2eEEFQ.js} +10 -10
  122. package/src/ui/dist/assets/{SearchPlugin-CdSi6krf.js → SearchPlugin-CraThSvt.js} +1 -1
  123. package/src/ui/dist/assets/{Stepper-V-WiDQJl.js → Stepper-CgocRTPq.js} +1 -1
  124. package/src/ui/dist/assets/{TextViewerPlugin-hIs1Efiu.js → TextViewerPlugin-B1JGhKtd.js} +4 -4
  125. package/src/ui/dist/assets/{VNCViewer-DG8b0q2X.js → VNCViewer-CclFC7FM.js} +9 -10
  126. package/src/ui/dist/assets/{bibtex-HDac6fVW.js → bibtex-D3IKsMl7.js} +1 -1
  127. package/src/ui/dist/assets/{code-BnBeNxBc.js → code-BP37Xx0p.js} +1 -1
  128. package/src/ui/dist/assets/{file-content-IRQ3jHb8.js → file-content-BAJSu-9r.js} +1 -1
  129. package/src/ui/dist/assets/{file-diff-panel-DZoQ9I6r.js → file-diff-panel-DUGeCTuy.js} +1 -1
  130. package/src/ui/dist/assets/{file-socket-BMCdLc-P.js → file-socket-CXc1Ojf7.js} +1 -1
  131. package/src/ui/dist/assets/{file-utils-CltILB3w.js → file-utils-2J21jt7M.js} +1 -1
  132. package/src/ui/dist/assets/{image-Boe6ffhu.js → image-CMMmgvcn.js} +1 -1
  133. package/src/ui/dist/assets/{index-BlplpvE1.js → index-BaVumsQT.js} +2 -2
  134. package/src/ui/dist/assets/{index-DZqJ-qAM.js → index-CWgMgpow.js} +60 -2154
  135. package/src/ui/dist/assets/{index-DO43pFZP.js → index-DmwmJmbW.js} +6372 -8434
  136. package/src/ui/dist/assets/{index-Bq2bvfkl.css → index-KGt-z-dD.css} +225 -2920
  137. package/src/ui/dist/assets/{index-2Zf65FZt.js → index-s7aHnNQ4.js} +1 -1
  138. package/src/ui/dist/assets/{message-square-mUHn_Ssb.js → message-square-CQRfX0Am.js} +1 -1
  139. package/src/ui/dist/assets/{monaco-fe0arNEU.js → monaco-B4TbdsrF.js} +1 -1
  140. package/src/ui/dist/assets/{popover-D_7i19qU.js → popover-B8Rokodk.js} +1 -1
  141. package/src/ui/dist/assets/{project-sync-DyVGrU7H.js → project-sync-D_i96KH4.js} +2 -8
  142. package/src/ui/dist/assets/{sigma-BzazRyxQ.js → sigma-D12PnzCN.js} +1 -1
  143. package/src/ui/dist/assets/{tooltip-DN_yjHFH.js → tooltip-B6YrI4aJ.js} +1 -1
  144. package/src/ui/dist/assets/trash-Bc8jGp0V.js +32 -0
  145. package/src/ui/dist/assets/{useCliAccess-DV2L2Qxy.js → useCliAccess-mXVCYSZ-.js} +12 -42
  146. package/src/ui/dist/assets/{useFileDiffOverlay-DyTj-p_V.js → useFileDiffOverlay-Bg6b9H9K.js} +1 -1
  147. package/src/ui/dist/assets/{wrap-text-ozYHtUwq.js → wrap-text-Drh5GEnL.js} +1 -1
  148. package/src/ui/dist/assets/{zoom-out-BN9MUyCQ.js → zoom-out-CJj9DZLn.js} +1 -1
  149. package/src/ui/dist/index.html +2 -2
  150. package/assets/fonts/Inter-Variable.ttf +0 -0
  151. package/assets/fonts/NotoSerifSC-Regular-C94HN_ZN.ttf +0 -0
  152. package/assets/fonts/NunitoSans-Variable.ttf +0 -0
  153. package/assets/fonts/Satoshi-Medium-ByP-Zb-9.woff2 +0 -0
  154. package/assets/fonts/SourceSans3-Variable.ttf +0 -0
  155. package/assets/fonts/ds-fonts.css +0 -83
  156. package/src/ui/dist/assets/Inter-Variable-VF2RPR_K.ttf +0 -0
  157. package/src/ui/dist/assets/LabPlugin-bL7rpic8.js +0 -43
  158. package/src/ui/dist/assets/NotoSerifSC-Regular-C94HN_ZN-C94HN_ZN.ttf +0 -0
  159. package/src/ui/dist/assets/NunitoSans-Variable-B_ZymHAd.ttf +0 -0
  160. package/src/ui/dist/assets/Satoshi-Medium-ByP-Zb-9-GkA34YXu.woff2 +0 -0
  161. package/src/ui/dist/assets/SourceSans3-Variable-CD-WOsSK.ttf +0 -0
  162. package/src/ui/dist/assets/info-CcsK_htA.js +0 -18
  163. package/src/ui/dist/assets/user-plus-BusDx-hF.js +0 -79
@@ -0,0 +1,253 @@
1
+ # 07 Memory and MCP: Built-in MCP and Memory Protocol
2
+
3
+ This note defines the intended meaning of the three built-in DeepScientist MCP namespaces:
4
+
5
+ - `memory`
6
+ - `artifact`
7
+ - `bash_exec`
8
+
9
+ The goal is simple:
10
+
11
+ - `artifact` drives the quest
12
+ - `memory` reduces rediscovery cost
13
+ - `bash_exec` runs durable shell work
14
+
15
+ ## 1. When to use which MCP
16
+
17
+ Use `memory` when the output should help a later turn remember something reusable:
18
+
19
+ - paper notes
20
+ - failure patterns
21
+ - debugging lessons
22
+ - selected idea rationale
23
+ - stable evaluation caveats
24
+
25
+ For ideation specifically:
26
+
27
+ - review prior quest idea cards before proposing a new idea
28
+ - review prior experiment outcomes and failure patterns before broad new literature expansion
29
+ - use old idea and experiment memory as references and constraints
30
+ - do not silently treat a past line as the current active idea unless it is explicitly selected again
31
+
32
+ Use `artifact` when the output changes or reports quest state:
33
+
34
+ - idea creation or revision
35
+ - branch/worktree transitions
36
+ - experiment records
37
+ - analysis campaign records
38
+ - progress or milestone updates
39
+ - decisions and approvals
40
+ - connector-facing interaction state
41
+
42
+ Use `bash_exec` when a command should stay durable and inspectable:
43
+
44
+ - training runs
45
+ - long evaluations
46
+ - monitored scripts
47
+ - commands that may need `read`, `list`, or `kill` later
48
+
49
+ ## 2. Memory tool semantics
50
+
51
+ ### `memory.list_recent(...)`
52
+
53
+ Purpose:
54
+
55
+ - recover local context quickly
56
+ - rebuild state after pause/restart
57
+
58
+ Use it:
59
+
60
+ - at turn start
61
+ - when resuming a stopped quest
62
+ - before choosing which specific cards to inspect
63
+
64
+ Do not use it:
65
+
66
+ - as the only basis for a route decision
67
+ - as a replacement for targeted search
68
+
69
+ Example:
70
+
71
+ ```text
72
+ memory.list_recent(scope="quest", limit=5, kind="knowledge")
73
+ ```
74
+
75
+ ### `memory.search(...)`
76
+
77
+ Purpose:
78
+
79
+ - targeted retrieval before repeating work
80
+
81
+ Use it:
82
+
83
+ - before broad literature search
84
+ - before another retry on a recurring failure
85
+ - before choosing or revising an idea
86
+ - before asking the user something that may already be answered durably
87
+
88
+ Recommended search patterns:
89
+
90
+ - paper discovery:
91
+ - `kind="papers"`
92
+ - route rationale:
93
+ - `kind="decisions"`
94
+ - recurring bug or confounder:
95
+ - `kind="episodes"`
96
+ - stable reusable rule:
97
+ - `kind="knowledge"`
98
+
99
+ Examples:
100
+
101
+ ```text
102
+ memory.search(query="imagenet official split baseline", scope="both", kind="papers", limit=6)
103
+ memory.search(query="metric wiring mismatch adapter", scope="quest", kind="episodes", limit=5)
104
+ memory.search(query="adapter baseline novelty", scope="both", kind="ideas", limit=6)
105
+ ```
106
+
107
+ ### `memory.read(...)`
108
+
109
+ Purpose:
110
+
111
+ - inspect one specific card after retrieval
112
+
113
+ Use it:
114
+
115
+ - after `list_recent` or `search` returned a card that clearly matters now
116
+
117
+ Do not use it:
118
+
119
+ - on dozens of cards in one turn
120
+
121
+ Example:
122
+
123
+ ```text
124
+ memory.read(path="~/DeepScientist/quests/q-xxxx/memory/knowledge/metric-contract.md")
125
+ ```
126
+
127
+ ### `memory.write(...)`
128
+
129
+ Purpose:
130
+
131
+ - persist a durable reusable finding
132
+
133
+ Use it after:
134
+
135
+ - a useful paper reading result
136
+ - a non-trivial debugging episode
137
+ - a stable evaluation rule
138
+ - a selected or rejected idea with reason
139
+
140
+ Do not use it for:
141
+
142
+ - generic chat summaries
143
+ - temporary progress pings
144
+ - information already captured better as an artifact record
145
+
146
+ Suggested body shape:
147
+
148
+ 1. context
149
+ 2. action or observation
150
+ 3. outcome
151
+ 4. interpretation
152
+ 5. boundaries
153
+ 6. evidence paths
154
+ 7. retrieval hint for future turns
155
+
156
+ Example:
157
+
158
+ ```md
159
+ ---
160
+ id: knowledge-1234abcd
161
+ type: knowledge
162
+ title: Metric comparison is valid only under the official validation split
163
+ quest_id: q-xxxx
164
+ scope: quest
165
+ tags:
166
+ - stage:baseline
167
+ - topic:metric-contract
168
+ stage: baseline
169
+ confidence: high
170
+ evidence_paths:
171
+ - artifacts/baselines/verification_report.md
172
+ retrieval_hints:
173
+ - baseline comparison
174
+ - metric contract
175
+ updated_at: 2026-03-11T18:00:00+00:00
176
+ ---
177
+
178
+ Context: baseline verification on the official benchmark setup.
179
+
180
+ Observation: numbers matched only when the official validation split was used.
181
+
182
+ Interpretation: any comparison against this baseline is invalid under custom splits.
183
+
184
+ Boundary: this rule is benchmark-specific and should not be promoted globally unless it recurs across quests.
185
+ ```
186
+
187
+ ### `memory.promote_to_global(...)`
188
+
189
+ Purpose:
190
+
191
+ - copy a proven reusable quest-local lesson into global memory
192
+
193
+ Use it only when:
194
+
195
+ - the lesson is not just repo-specific noise
196
+ - it has become stable
197
+ - another quest would likely benefit
198
+
199
+ ## 3. Artifact versus memory
200
+
201
+ Write both only when they serve different roles.
202
+
203
+ Example:
204
+
205
+ - main experiment finished:
206
+ - `artifact.record_main_experiment(...)` stores the official run record
207
+ - `memory.write(kind="knowledge", ...)` is optional and should capture only the reusable lesson, such as a stable metric caveat or debugging rule
208
+
209
+ Do not replace an experiment artifact with a memory card.
210
+ Do not replace a reusable lesson with a progress artifact.
211
+
212
+ ## 4. Bash exec usage
213
+
214
+ Use `bash_exec` for monitored commands:
215
+
216
+ ```text
217
+ bash_exec.bash_exec(command="python train.py --config configs/main.yaml", mode="detach", workdir="<quest workspace>")
218
+ ```
219
+
220
+ Then inspect:
221
+
222
+ ```text
223
+ bash_exec.bash_exec(mode="list", status="running")
224
+ bash_exec.bash_exec(mode="read", id="<bash_id>")
225
+ ```
226
+
227
+ Use `kill` only when the quest truly needs to stop the session.
228
+
229
+ ## 5. Prompt-level expectations
230
+
231
+ The agent should normally follow this discipline:
232
+
233
+ 1. `memory.list_recent(...)` at turn start or resume
234
+ 2. `memory.search(...)` before repeated work
235
+ 3. `memory.read(...)` on the few selected cards
236
+ 4. `artifact` for quest state changes and reports
237
+ 5. `bash_exec` for durable shell work
238
+ 6. `memory.write(...)` only after a real durable finding appears
239
+
240
+ ## 6. UI expectation
241
+
242
+ In `/projects/{id}` Studio trace:
243
+
244
+ - `memory.*` calls should render as structured cards, not opaque raw JSON
245
+ - the card should show:
246
+ - operation type
247
+ - scope
248
+ - kind
249
+ - title or query
250
+ - matching items or saved card summary
251
+
252
+ If the agent is not calling memory at all, the problem is prompt/skill behavior.
253
+ If the agent is calling memory but Studio still looks like raw logs, the problem is UI rendering.
@@ -0,0 +1,97 @@
1
+ # 08 Figure Style Guide: Figure and Plot Style
2
+
3
+ This page defines the default DeepScientist figure language for experiment summaries, analysis campaigns, and paper-facing plots.
4
+
5
+ ## Core rule
6
+
7
+ Prefer restrained, evidence-first figures.
8
+
9
+ - connector milestone charts should be quick to read
10
+ - paper figures should be clean enough to survive PDF export and review
11
+ - both should use the fixed Morandi palette family from the prompt / stage skills
12
+
13
+ ## Fixed Morandi palette
14
+
15
+ - `mist-stone`: `#F3EEE8`, `#D8D1C7`, `#8A9199`
16
+ - `sage-clay`: `#E7E1D6`, `#B7A99A`, `#7F8F84`
17
+ - `dust-rose`: `#F2E9E6`, `#D8C3BC`, `#B88C8C`
18
+ - `fog-blue`: `#DCE5E8`, `#A9BCC4`, `#6F8894`
19
+ - `olive-paper`: `#E6E1D3`, `#B8B095`, `#7C7A5C`
20
+ - `lavender-ash`: `#E8E3EA`, `#B9AFC2`, `#7D7486`
21
+
22
+ Recommended use:
23
+
24
+ - main method vs baseline: `sage-clay` + `mist-stone`
25
+ - ablations: `mist-stone` + `fog-blue` + `dust-rose`
26
+ - uncertainty / sensitivity: `mist-stone` + `olive-paper`
27
+ - appendix / supplementary: `mist-stone` + `lavender-ash`
28
+
29
+ ## Chart selection
30
+
31
+ Choose chart type by the research question:
32
+
33
+ - line chart: trends over epochs, steps, budget, scaling, or ordered settings
34
+ - bar chart: a small number of categorical comparisons with a common zero baseline
35
+ - dot / point-range chart: comparisons where confidence intervals matter
36
+ - box / violin / histogram: real distribution questions only
37
+ - heatmap: only when matrix structure is genuinely the result
38
+
39
+ Do not use a crowded dashboard-style layout for one simple claim.
40
+
41
+ ## Color semantics
42
+
43
+ - ordered magnitude -> sequential muted palette
44
+ - signed delta around zero or a reference -> diverging muted palette with a neutral midpoint
45
+ - categories -> discrete palette only
46
+
47
+ Avoid rainbow / jet / HSV-like colormaps.
48
+
49
+ ## Export rules
50
+
51
+ - connector milestone chart: usually `png`
52
+ - paper figure: `pdf` or `svg` plus one `png` preview
53
+ - avoid rasterizing line art or text when vector export is possible
54
+ - keep white or near-white background
55
+ - keep grids light
56
+ - keep legends compact or use direct labeling when clearer
57
+ - ensure text remains readable after likely journal scaling
58
+ - prefer paper-like sizes inspired by common journal layouts:
59
+ - single-column: about `89 mm` wide
60
+ - double-column: about `183 mm` wide
61
+
62
+ ## Mandatory review workflow
63
+
64
+ Do not mark a meaningful figure as final immediately after rendering it.
65
+
66
+ For milestone charts, paper figures, and appendix figures:
67
+
68
+ 1. render the first version
69
+ 2. inspect the actual exported figure
70
+ 3. fix spacing, labels, legend placement, visual hierarchy, or color choices if needed
71
+ 4. re-export the final version
72
+
73
+ Treat “rendered and visually checked” as the minimum completion condition.
74
+
75
+ ## Minimal review checklist
76
+
77
+ Before treating a figure as done, verify:
78
+
79
+ - the visual encoding matches the research question
80
+ - labels, units, and baselines are explicit
81
+ - colors mean the same thing across related figures
82
+ - the source data path is known
83
+ - the generating script path is known
84
+ - the figure can be regenerated from durable files
85
+ - the figure stays readable after realistic down-scaling
86
+ - the main message is obvious within a quick scan
87
+ - the legend does not block the data
88
+
89
+ ## Reference basis
90
+
91
+ This policy was aligned with:
92
+
93
+ - PLOS Computational Biology, “Ten Simple Rules for Better Figures”: `https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003833`
94
+ - Graphics Principles: `https://graphicsprinciples.github.io/`
95
+ - Nature author formatting guidance: `https://www.nature.com/nature/for-authors/formatting-guide`
96
+ - Matplotlib colormap guidance: `https://matplotlib.org/stable/users/explain/colors/colormaps.html`
97
+ - Datawrapper accessibility guidance: `https://academy.datawrapper.de/article/206-how-we-make-sure-our-charts-maps-and-tables-are-accessible`
@@ -0,0 +1,108 @@
1
+ # 09 `ds doctor`: Repair Startup and Environment Problems
2
+
3
+ Use `ds doctor` when DeepScientist does not start cleanly after installation.
4
+
5
+ ## Recommended flow
6
+
7
+ 1. Install DeepScientist and Codex:
8
+
9
+ ```bash
10
+ npm install -g @openai/codex @researai/deepscientist
11
+ ```
12
+
13
+ 2. Try to start DeepScientist:
14
+
15
+ ```bash
16
+ ds
17
+ ```
18
+
19
+ 3. If startup fails or looks unhealthy, run:
20
+
21
+ ```bash
22
+ ds doctor
23
+ ```
24
+
25
+ 4. Read the checks from top to bottom and fix the failed items first.
26
+
27
+ 5. Run `ds doctor` again until all checks are healthy, then run `ds`.
28
+
29
+ ## What `ds doctor` checks
30
+
31
+ - local Python runtime health
32
+ - whether `~/DeepScientist` exists and is writable
33
+ - whether `git` is installed and configured
34
+ - whether required config files are valid
35
+ - whether the current release is still using `codex` as the runnable runner
36
+ - whether the Codex CLI can be found and passes a startup probe
37
+ - whether an optional local `pdflatex` runtime is available for paper PDF compilation
38
+ - whether the web and TUI bundles exist
39
+ - whether the configured web port is free or already running the correct daemon
40
+
41
+ ## Common fixes
42
+
43
+ ### Codex is missing
44
+
45
+ Run:
46
+
47
+ ```bash
48
+ npm install -g @openai/codex
49
+ ```
50
+
51
+ ### Codex is installed but not logged in
52
+
53
+ Run:
54
+
55
+ ```bash
56
+ codex
57
+ ```
58
+
59
+ Finish login once, then rerun `ds doctor`.
60
+
61
+ ### Local paper PDF compilation is unavailable
62
+
63
+ DeepScientist can compile papers without a full TeX Live install if you add a lightweight TinyTeX runtime:
64
+
65
+ ```bash
66
+ ds latex install-runtime
67
+ ```
68
+
69
+ If you prefer a system package instead, install a distribution that provides `pdflatex` and `bibtex`.
70
+
71
+ ### Port `20999` is busy
72
+
73
+ If it is your managed daemon:
74
+
75
+ ```bash
76
+ ds --stop
77
+ ```
78
+
79
+ Then run `ds` again.
80
+
81
+ If another service already uses the port, change `ui.port` in:
82
+
83
+ ```text
84
+ ~/DeepScientist/config/config.yaml
85
+ ```
86
+
87
+ ### Git user identity is missing
88
+
89
+ Run:
90
+
91
+ ```bash
92
+ git config --global user.name "Your Name"
93
+ git config --global user.email "you@example.com"
94
+ ```
95
+
96
+ ### Claude was enabled by mistake
97
+
98
+ Current open-source releases keep `claude` as a TODO/reserved slot only.
99
+ Set it back to disabled in:
100
+
101
+ ```text
102
+ ~/DeepScientist/config/runners.yaml
103
+ ```
104
+
105
+ ## Notes
106
+
107
+ - `ds docker` is kept as a compatibility alias, but the official command is `ds doctor`.
108
+ - The normal browser URL is `http://127.0.0.1:20999`.
@@ -0,0 +1,245 @@
1
+ # 90 Architecture: Maintainer Architecture Reference
2
+
3
+ This document is the maintainer-facing architecture reference for the current open-source repository.
4
+
5
+ It describes the implementation that actually exists in this checkout. When code and docs diverge, fix the docs in the same change.
6
+
7
+ ## Goals
8
+
9
+ DeepScientist is a small, local-first research operating system with these stable constraints:
10
+
11
+ - the authoritative runtime is Python
12
+ - `npm` is the install and launch path
13
+ - one quest equals one Git repository
14
+ - durable state stays in files plus Git
15
+ - the public built-in MCP surface stays limited to `memory`, `artifact`, and `bash_exec`
16
+ - the workflow remains prompt-led and skill-led instead of stage-scheduler-heavy
17
+
18
+ ## Top-Level Layout
19
+
20
+ Important repository areas:
21
+
22
+ - `bin/`
23
+ - npm launcher entrypoint
24
+ - `src/deepscientist/`
25
+ - authoritative runtime, daemon, CLI, registries, quest state, connectors
26
+ - `src/prompts/`
27
+ - system prompt source
28
+ - `src/skills/`
29
+ - first-party stage skills
30
+ - `src/ui/`
31
+ - web workspace
32
+ - `src/tui/`
33
+ - local TUI
34
+ - `docs/`
35
+ - user docs and maintainer docs
36
+ - `tests/`
37
+ - runtime, API, prompt, connector, packaging, and UI contract tests
38
+
39
+ ## Launch Chain
40
+
41
+ The normal user path is:
42
+
43
+ 1. `npm install -g @researai/deepscientist`
44
+ 2. run `ds`
45
+ 3. `bin/ds.js` ensures the local Python runtime is ready under `~/DeepScientist/runtime/venv`
46
+ 4. the launcher starts the Python daemon
47
+ 5. the daemon serves the web workspace and shared API surface
48
+ 6. the TUI and web UI both consume the same daemon contracts
49
+
50
+ `bin/ds.js` should stay thin. Product behavior belongs in Python services, prompts, and skills.
51
+
52
+ ## Runtime Home
53
+
54
+ The default runtime home is `~/DeepScientist/`.
55
+
56
+ Key directories:
57
+
58
+ - `runtime/`
59
+ - launcher-managed runtime state
60
+ - Python venv
61
+ - built bundle helpers
62
+ - managed local tool installs under `runtime/tools/`
63
+ - `config/`
64
+ - YAML configuration and baseline registry data
65
+ - `memory/`
66
+ - global memory cards
67
+ - `quests/`
68
+ - one quest per Git repository
69
+ - `logs/`
70
+ - daemon and runtime logs
71
+ - `cache/`
72
+ - reusable caches such as synced skills
73
+
74
+ ## Quest Model
75
+
76
+ Each quest lives under `~/DeepScientist/quests/<quest_id>/` and is its own Git repository.
77
+
78
+ Important quest state lives in:
79
+
80
+ - `quest.yaml`
81
+ - `brief.md`
82
+ - `plan.md`
83
+ - `status.md`
84
+ - `SUMMARY.md`
85
+ - `.ds/runtime_state.json`
86
+ - `.ds/user_message_queue.json`
87
+ - `.ds/events.jsonl`
88
+ - `.ds/interaction_journal.jsonl`
89
+
90
+ The quest layout contract is defined in `src/deepscientist/quest/layout.py`. If it changes, update quest services, daemon handlers, UI/TUI consumers, and tests together.
91
+
92
+ ## Core Runtime Boundaries
93
+
94
+ ### CLI
95
+
96
+ - file: `src/deepscientist/cli.py`
97
+ - responsibility: thin Python command surface over quest, config, doctor, and runtime services
98
+
99
+ ### Daemon
100
+
101
+ - files:
102
+ - `src/deepscientist/daemon/app.py`
103
+ - `src/deepscientist/daemon/api/router.py`
104
+ - `src/deepscientist/daemon/api/handlers.py`
105
+ - responsibility:
106
+ - serve the local web workspace
107
+ - expose shared API routes
108
+ - coordinate quest turn execution, inbox delivery, connectors, and run control
109
+
110
+ ### Quest
111
+
112
+ - files under `src/deepscientist/quest/`
113
+ - responsibility:
114
+ - create quests
115
+ - maintain quest snapshots
116
+ - persist runtime state
117
+ - derive explorer and canvas state
118
+
119
+ ### Artifact
120
+
121
+ - files under `src/deepscientist/artifact/`
122
+ - responsibility:
123
+ - durable structured artifacts
124
+ - Git-backed quest operations
125
+ - baselines, approvals, progress, reports, interactions
126
+
127
+ ### Memory
128
+
129
+ - files under `src/deepscientist/memory/`
130
+ - responsibility:
131
+ - global and quest-scoped Markdown memory
132
+
133
+ ### Bash Execution
134
+
135
+ - files under `src/deepscientist/bash_exec/`
136
+ - responsibility:
137
+ - managed, stoppable, durable shell sessions
138
+
139
+ ## Public MCP Boundary
140
+
141
+ The public built-in MCP surface must remain:
142
+
143
+ - `memory`
144
+ - `artifact`
145
+ - `bash_exec`
146
+
147
+ Do not introduce public `git`, `connector`, or `runtime_tool` MCP namespaces.
148
+
149
+ Git behavior stays inside `artifact`. Managed local tooling is a daemon/runtime concern, not a public MCP surface.
150
+
151
+ ## Registry-First Extension Points
152
+
153
+ DeepScientist prefers small explicit registries over large dispatch branches.
154
+
155
+ Current registry-backed areas include:
156
+
157
+ - runners
158
+ - channels
159
+ - connector bridges
160
+ - skill discovery
161
+ - managed local runtime tools
162
+
163
+ Patterns should stay close to:
164
+
165
+ - `register_*()`
166
+ - `get_*()`
167
+ - `list_*()`
168
+
169
+ ## Managed Local Runtime Tools
170
+
171
+ Managed local tools are optional helper runtimes installed under `~/DeepScientist/runtime/tools/`.
172
+
173
+ Examples:
174
+
175
+ - TinyTeX for local `pdflatex`
176
+ - future candidates such as `pandoc`, `graphviz`, or `ffmpeg`
177
+
178
+ The runtime-tool layer lives under `src/deepscientist/runtime_tools/` and exists to:
179
+
180
+ - keep install logic out of unrelated subsystems
181
+ - let the daemon and CLI inspect tool health in one place
182
+ - resolve binaries consistently
183
+ - make new managed tools register the same way as runners or channels
184
+
185
+ Current pieces:
186
+
187
+ - `runtime_tools/registry.py`
188
+ - `register_runtime_tool()`, `get_runtime_tool_factory()`, `list_runtime_tool_names()`
189
+ - `runtime_tools/service.py`
190
+ - high-level access for status, install, and binary resolution
191
+ - `runtime_tools/builtins.py`
192
+ - built-in registrations
193
+ - `runtime_tools/tinytex.py`
194
+ - TinyTeX provider adapter
195
+
196
+ Low-level TinyTeX implementation remains in `src/deepscientist/tinytex.py`.
197
+
198
+ ## Prompt And Skill Flow
199
+
200
+ Research workflow behavior should primarily live in:
201
+
202
+ - `src/prompts/system.md`
203
+ - `src/deepscientist/prompts/builder.py`
204
+ - `src/skills/*/SKILL.md`
205
+
206
+ The daemon should persist and route state, but avoid becoming a rigid workflow scheduler.
207
+
208
+ ## UI Contract
209
+
210
+ The web UI and TUI share the same daemon API contract.
211
+
212
+ If an API route changes:
213
+
214
+ - update daemon handlers/router
215
+ - update `src/ui/src/lib/api.ts`
216
+ - update `src/tui/src/lib/api.ts`
217
+ - update tests that enforce the contract
218
+
219
+ Preserve `/projects` and `/projects/:quest_id` as the main web workspace routes.
220
+
221
+ ## Documentation Contract
222
+
223
+ Maintainer docs:
224
+
225
+ - this file: `docs/en/90_ARCHITECTURE.md`
226
+ - `docs/en/91_DEVELOPMENT.md`
227
+
228
+ User docs:
229
+
230
+ - `docs/en/*.md`
231
+ - `docs/zh/*.md`
232
+
233
+ Do not put temporary implementation checklists or planning drafts under `docs/`.
234
+
235
+ ## Testing Layers
236
+
237
+ Typical validation layers:
238
+
239
+ - Python unit and integration tests under `tests/`
240
+ - API contract tests
241
+ - prompt and skill tests
242
+ - web/TUI bundle builds
243
+ - packaging checks such as `npm pack --dry-run --ignore-scripts`
244
+
245
+ When changing registries, quest layout, API contracts, prompts, or packaging, update the corresponding tests in the same change.