clearai-dsh 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +28 -28
  3. package/README.zh-CN.md +28 -28
  4. package/lib/client.js +861 -2555
  5. package/lib/domain-language.js +552 -48
  6. package/lib/fold.js +351 -1015
  7. package/lib/host.js +47 -557
  8. package/lib/invariant.js +9 -12
  9. package/lib/knowledge-view.js +363 -226
  10. package/lib/lang.js +81 -0
  11. package/package.json +1 -1
  12. package/presets/clearai/agent.cordis.yml +54 -82
  13. package/presets/clearai/clearai.patch.yml +54 -82
  14. package/presets/clearai/plugins/clearai-kernel.js +1590 -5437
  15. package/presets/clearai/plugins/ontology.js +56 -14
  16. package/presets/clearai/plugins/prompts.js +73 -363
  17. package/presets/clearai/skills/clearai-loop/SKILL.md +73 -59
  18. package/presets/clearai/plugins/brain.js +0 -547
  19. package/presets/clearai/plugins/commands.js +0 -199
  20. package/presets/clearai/template/knowledge/README.md +0 -25
  21. package/presets/clearai/template/memory/README.md +0 -34
  22. package/presets/clearai/template/project.md +0 -49
  23. package/presets/clearai/template/skills/README.md +0 -37
  24. package/presets/clearai/template/skills/chart-diagram-qa/SKILL.md +0 -43
  25. package/presets/clearai/template/skills/citation-management/SKILL.md +0 -73
  26. package/presets/clearai/template/skills/citation-management/references/bibtex_formatting.md +0 -908
  27. package/presets/clearai/template/skills/citation-management/references/citation_validation.md +0 -794
  28. package/presets/clearai/template/skills/citation-management/references/google_scholar_search.md +0 -725
  29. package/presets/clearai/template/skills/citation-management/references/metadata_extraction.md +0 -870
  30. package/presets/clearai/template/skills/citation-management/references/pubmed_search.md +0 -839
  31. package/presets/clearai/template/skills/citation-management/scripts/doi_to_bibtex.py +0 -204
  32. package/presets/clearai/template/skills/citation-management/scripts/extract_metadata.py +0 -569
  33. package/presets/clearai/template/skills/citation-management/scripts/format_bibtex.py +0 -349
  34. package/presets/clearai/template/skills/citation-management/scripts/generate_schematic.py +0 -139
  35. package/presets/clearai/template/skills/citation-management/scripts/generate_schematic_ai.py +0 -817
  36. package/presets/clearai/template/skills/citation-management/scripts/search_google_scholar.py +0 -282
  37. package/presets/clearai/template/skills/citation-management/scripts/search_pubmed.py +0 -398
  38. package/presets/clearai/template/skills/citation-management/scripts/validate_citations.py +0 -497
  39. package/presets/clearai/template/skills/data-analysis/SKILL.md +0 -92
  40. package/presets/clearai/template/skills/data-analysis/checklists/readiness_check.md +0 -23
  41. package/presets/clearai/template/skills/data-analysis/templates/analysis_report.md.tpl +0 -63
  42. package/presets/clearai/template/skills/data-analysis/templates/cleaning_rules_draft.yaml.tpl +0 -32
  43. package/presets/clearai/template/skills/data-analysis/templates/data_dictionary.md.tpl +0 -12
  44. package/presets/clearai/template/skills/data-analysis/templates/domain_knowledge_template.md.tpl +0 -316
  45. package/presets/clearai/template/skills/data-analysis/templates/feature_candidates.json.tpl +0 -20
  46. package/presets/clearai/template/skills/data-analysis/templates/quality_scorecard.md.tpl +0 -30
  47. package/presets/clearai/template/skills/data-analysis/workflows/01-data-profiling.md +0 -42
  48. package/presets/clearai/template/skills/data-analysis/workflows/02-quality-audit.md +0 -36
  49. package/presets/clearai/template/skills/data-analysis/workflows/03-physical-correlation.md +0 -25
  50. package/presets/clearai/template/skills/data-analysis/workflows/04-unstructured-mining.md +0 -26
  51. package/presets/clearai/template/skills/data-qa-analysis/SKILL.md +0 -102
  52. package/presets/clearai/template/skills/data-qa-analysis/checklists/readiness_check.md +0 -62
  53. package/presets/clearai/template/skills/data-qa-analysis/templates/best_in_class_report.md.tpl +0 -56
  54. package/presets/clearai/template/skills/data-qa-analysis/templates/cleaning_rules_draft.yaml.tpl +0 -56
  55. package/presets/clearai/template/skills/data-qa-analysis/templates/data_dictionary.md.tpl +0 -13
  56. package/presets/clearai/template/skills/data-qa-analysis/templates/data_source_inventory_and_lineage.md.tpl +0 -146
  57. package/presets/clearai/template/skills/data-qa-analysis/templates/data_status_report.md.tpl +0 -60
  58. package/presets/clearai/template/skills/data-qa-analysis/templates/steady_state_rules.yaml.tpl +0 -41
  59. package/presets/clearai/template/skills/data-qa-analysis/templates/subsystem_registry.md.tpl +0 -101
  60. package/presets/clearai/template/skills/data-qa-analysis/templates/unified_execution_plan.md.tpl +0 -100
  61. package/presets/clearai/template/skills/data-qa-analysis/workflows/01-data-source-inventory-and-lineage.md +0 -194
  62. package/presets/clearai/template/skills/data-qa-analysis/workflows/02-data-alignment-and-tag-semantics.md +0 -122
  63. package/presets/clearai/template/skills/data-qa-analysis/workflows/03-steady-state-identification.md +0 -126
  64. package/presets/clearai/template/skills/data-qa-analysis/workflows/04-consumption-analysis.md +0 -152
  65. package/presets/clearai/template/skills/data-qa-analysis/workflows/05-best-in-class-and-optimization-space.md +0 -78
  66. package/presets/clearai/template/skills/domain-presearch/SKILL.md +0 -131
  67. package/presets/clearai/template/skills/domain-presearch/checklists/domain_checklist.md +0 -24
  68. package/presets/clearai/template/skills/domain-presearch/references/figure_code.md +0 -78
  69. package/presets/clearai/template/skills/domain-presearch/references/strategic_frameworks.md +0 -38
  70. package/presets/clearai/template/skills/exploration-loop/SKILL.md +0 -81
  71. package/presets/clearai/template/skills/exploratory-data-analysis/SKILL.md +0 -77
  72. package/presets/clearai/template/skills/exploratory-data-analysis/references/bioinformatics_genomics_formats.md +0 -664
  73. package/presets/clearai/template/skills/exploratory-data-analysis/references/chemistry_molecular_formats.md +0 -664
  74. package/presets/clearai/template/skills/exploratory-data-analysis/references/general_scientific_formats.md +0 -518
  75. package/presets/clearai/template/skills/exploratory-data-analysis/references/microscopy_imaging_formats.md +0 -620
  76. package/presets/clearai/template/skills/exploratory-data-analysis/references/proteomics_metabolomics_formats.md +0 -517
  77. package/presets/clearai/template/skills/exploratory-data-analysis/references/spectroscopy_analytical_formats.md +0 -633
  78. package/presets/clearai/template/skills/exploratory-data-analysis/scripts/eda_analyzer.py +0 -547
  79. package/presets/clearai/template/skills/hypothesis-generation/SKILL.md +0 -73
  80. package/presets/clearai/template/skills/hypothesis-generation/references/experimental_design_patterns.md +0 -329
  81. package/presets/clearai/template/skills/hypothesis-generation/references/hypothesis_quality_criteria.md +0 -198
  82. package/presets/clearai/template/skills/hypothesis-generation/references/literature_search_strategies.md +0 -622
  83. package/presets/clearai/template/skills/hypothesis-generation/scripts/generate_schematic.py +0 -139
  84. package/presets/clearai/template/skills/hypothesis-generation/scripts/generate_schematic_ai.py +0 -817
  85. package/presets/clearai/template/skills/literature-review/SKILL.md +0 -72
  86. package/presets/clearai/template/skills/literature-review/references/citation_styles.md +0 -166
  87. package/presets/clearai/template/skills/literature-review/references/database_strategies.md +0 -455
  88. package/presets/clearai/template/skills/literature-review/scripts/generate_pdf.py +0 -176
  89. package/presets/clearai/template/skills/literature-review/scripts/generate_schematic.py +0 -139
  90. package/presets/clearai/template/skills/literature-review/scripts/generate_schematic_ai.py +0 -817
  91. package/presets/clearai/template/skills/literature-review/scripts/search_databases.py +0 -303
  92. package/presets/clearai/template/skills/literature-review/scripts/verify_citations.py +0 -221
  93. package/presets/clearai/template/skills/paper-lookup/SKILL.md +0 -59
  94. package/presets/clearai/template/skills/paper-lookup/references/arxiv.md +0 -161
  95. package/presets/clearai/template/skills/paper-lookup/references/biorxiv.md +0 -118
  96. package/presets/clearai/template/skills/paper-lookup/references/core.md +0 -150
  97. package/presets/clearai/template/skills/paper-lookup/references/crossref.md +0 -181
  98. package/presets/clearai/template/skills/paper-lookup/references/medrxiv.md +0 -104
  99. package/presets/clearai/template/skills/paper-lookup/references/openalex.md +0 -174
  100. package/presets/clearai/template/skills/paper-lookup/references/pmc.md +0 -152
  101. package/presets/clearai/template/skills/paper-lookup/references/pubmed.md +0 -124
  102. package/presets/clearai/template/skills/paper-lookup/references/semantic-scholar.md +0 -203
  103. package/presets/clearai/template/skills/paper-lookup/references/unpaywall.md +0 -127
  104. package/presets/clearai/template/skills/process-presearch/SKILL.md +0 -196
  105. package/presets/clearai/template/skills/process-presearch/checklists/process_checklist.md +0 -18
  106. package/presets/clearai/template/skills/process-presearch/references/figure_code.md +0 -107
  107. package/presets/clearai/template/skills/process-presearch/references/source_attribution_example.md +0 -22
  108. package/presets/clearai/template/skills/process-understanding-extraction/SKILL.md +0 -69
  109. package/presets/clearai/template/skills/process-understanding-extraction/checklists/readiness_check.md +0 -34
  110. package/presets/clearai/template/skills/process-understanding-extraction/templates/docx_raw_dump_extractor.py.tpl +0 -132
  111. package/presets/clearai/template/skills/process-understanding-extraction/templates/entity_map_unit_topology.json.tpl +0 -86
  112. package/presets/clearai/template/skills/process-understanding-extraction/templates/process_brief.md.tpl +0 -89
  113. package/presets/clearai/template/skills/process-understanding-extraction/templates/process_brief_builder_from_raw_dump.py.tpl +0 -203
  114. package/presets/clearai/template/skills/process-understanding-extraction/templates/process_flow_mermaid.md.tpl +0 -41
  115. package/presets/clearai/template/skills/process-understanding-extraction/templates/unified_execution_plan.md.tpl +0 -53
  116. package/presets/clearai/template/skills/process-understanding-extraction/workflows/01-process-doc-discovery.md +0 -173
  117. package/presets/clearai/template/skills/process-understanding-extraction/workflows/02-process-understanding-and-diagramming.md +0 -106
  118. package/presets/clearai/template/skills/scientific-brainstorming/SKILL.md +0 -64
  119. package/presets/clearai/template/skills/scientific-brainstorming/references/brainstorming_methods.md +0 -326
  120. package/presets/clearai/template/skills/scientific-critical-thinking/SKILL.md +0 -72
  121. package/presets/clearai/template/skills/scientific-critical-thinking/references/common_biases.md +0 -364
  122. package/presets/clearai/template/skills/scientific-critical-thinking/references/evidence_hierarchy.md +0 -485
  123. package/presets/clearai/template/skills/scientific-critical-thinking/references/experimental_design.md +0 -496
  124. package/presets/clearai/template/skills/scientific-critical-thinking/references/logical_fallacies.md +0 -478
  125. package/presets/clearai/template/skills/scientific-critical-thinking/references/scientific_method.md +0 -169
  126. package/presets/clearai/template/skills/scientific-critical-thinking/references/statistical_pitfalls.md +0 -506
  127. package/presets/clearai/template/skills/skill-creator/SKILL.md +0 -109
  128. package/presets/clearai/template/skills/skill-creator/references/authoring-guide.md +0 -89
  129. package/presets/clearai/template/skills/statistical-analysis/SKILL.md +0 -79
  130. package/presets/clearai/template/skills/statistical-analysis/references/assumptions_and_diagnostics.md +0 -369
  131. package/presets/clearai/template/skills/statistical-analysis/references/bayesian_statistics.md +0 -653
  132. package/presets/clearai/template/skills/statistical-analysis/references/effect_sizes_and_power.md +0 -578
  133. package/presets/clearai/template/skills/statistical-analysis/references/reporting_standards.md +0 -469
  134. package/presets/clearai/template/skills/statistical-analysis/references/test_selection_guide.md +0 -129
  135. package/presets/clearai/template/skills/statistical-analysis/scripts/assumption_checks.py +0 -538
  136. package/presets/clearai/template/skills/web-artifact/SKILL.md +0 -165
  137. package/presets/clearai/template/skills/web-artifact/assets/renderer/renderer.css +0 -229
  138. package/presets/clearai/template/skills/web-artifact/assets/renderer/renderer.js +0 -373
  139. package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/LICENSE +0 -263
  140. package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/UPSTREAM.md +0 -26
  141. package/presets/clearai/template/skills/web-artifact/assets/vendor/elkjs/elk.bundled.js +0 -6605
  142. package/presets/clearai/template/skills/web-artifact/references/when-drawing-a-topology.md +0 -150
  143. package/presets/clearai/template/skills/web-artifact/references/when-the-page-must-work-offline.md +0 -62
  144. package/presets/clearai/template/skills/web-artifact/scripts/check_artifact.py +0 -167
  145. package/presets/clearai/template/skills/web-artifact/scripts/render_topology.js +0 -272
  146. package/presets/clearai/template/skills/what-if-oracle/LICENSE.txt +0 -5
  147. package/presets/clearai/template/skills/what-if-oracle/SKILL.md +0 -72
  148. package/presets/clearai/template/skills/what-if-oracle/references/scenario-templates.md +0 -154
@@ -1,199 +0,0 @@
1
- /**
2
- * ClearAI 的 `/` 命令:人侧的状态窗,外加一个呈审捷径。
3
- *
4
- * 为什么只读:权威账本只有一个写入者(clearai-kernel 的意图工具)。命令是**人**的界面——
5
- * 人不需要借命令改状态:改状态的动作都有专门的门(计划审阅卡、人门动词、面板按钮)。
6
- * 所以这四个命令(`goal` / `plan` / `evidence` / `worldline`)只从 `clearai` 读门面
7
- * 现算现渲染,一个字都不落账。
8
- *
9
- * 唯一的例外是 `/plan-review`,而且它也不写账:它把「请重新呈审」这句话结构化地
10
- * steer 给模型,真正的呈审与授权记号落账仍走模型侧的 `RequestPlanReview` 工具。
11
- * 为什么不直接在命令里弹审阅卡:授权记号(`plan/confirmed`)只能随工具结果的
12
- * `meta.mutations` 进日志,命令处理器没有这条通道——这不是限制,是权威边界
13
- * (test/authority-boundary.test.mjs 钉的就是它)。
14
- *
15
- * 数据从哪来:宿主半(ui/lib/index.js)提供的 `clearai` 门面——state/derive/view 都走它,
16
- * **不从 ui/lib import**:发行物里预设与 ui/ 的相对位置不一样,跨平面 import 装上就炸
17
- * (分层纪律与内核一致:预设平面与宿主平面互不依赖,共享逻辑各自实现或走服务)。
18
- * 从会话日志现折的,与面板读的是同一份,不存在「命令看到的是另一份状态」。
19
- */
20
-
21
- export const name = 'clearai-commands'
22
- export const inject = ['commands']
23
-
24
- /** 命令的注册形状,供 test/preset-composition.test.mjs 断言(名字即公共契约)。 */
25
- export const CLEARAI_COMMANDS = ['goal', 'plan', 'evidence', 'worldline', 'plan-review']
26
-
27
- const STEP_STATUS_LABEL = { open: '未交付', advanced: '已交付', void: '已作废' }
28
-
29
- /** 人门的引导语:人在 `/` 菜单里能做什么,取决于此刻门开在哪(收件箱就是门,由派生事实算出)。 */
30
- function gateHints(derived) {
31
- const hints = []
32
- if (derived.planConfirmationPending) hints.push('/plan-review 重新呈审计划')
33
- for (const item of derived.inbox ?? []) {
34
- if (item.kind === 'fork_adopt') hints.push(`世界线等你裁决:${item.summary}`)
35
- if (item.kind === 'skill_candidate') hints.push(`技能候选等你扶正:${item.summary}`)
36
- if (item.kind === 'provisional_review') hints.push(`有一个临时采纳待复核:${item.summary}`)
37
- if (item.kind === 'plan_blocked') hints.push(`计划触礁,等你指示:${item.summary}`)
38
- }
39
- return hints
40
- }
41
-
42
- export function apply(ctx) {
43
- const commands = ctx.get('commands')
44
- const clearai = () => ctx.get('clearai')
45
-
46
- /** 会话键:与内核同一口径(exec.agent.id → sessionId)。 */
47
- const sessionOf = (invocation) => String(invocation.agent?.id ?? '')
48
-
49
- const readState = (invocation) => {
50
- const facade = clearai()
51
- if (facade === undefined) return { error: 'ClearAI 内核不在这个会话里(命令挂上了,内核没挂上)。' }
52
- const sessionId = sessionOf(invocation)
53
- const state = facade.state(sessionId)
54
- return { sessionId, state, derived: facade.derive(sessionId) }
55
- }
56
-
57
- commands.register({
58
- name: 'goal',
59
- description: '当前认识论目标:主张、判据、候选假设与各自的状态(只读,从账本现算)',
60
- handler: (invocation) => {
61
- const { state, derived, error } = readState(invocation)
62
- if (error !== undefined) return { kind: 'error', text: error }
63
- if (state.goal === null) return { kind: 'success', text: '还没有立目标。让模型用 SetGoal 立一个(带判据与至少两条候选假设)。' }
64
- const lines = [
65
- `目标(v${state.goal.revision} · ${state.goal.status}):${state.goal.claim}`,
66
- `判据:${state.goal.done_criteria}`,
67
- '',
68
- `完成度(派生):${derived.progress === null ? '—' : `${Math.round(derived.progress * 100)}%`} · 阶段:${derived.phase ?? '—'}`,
69
- '',
70
- '候选假设:',
71
- ]
72
- for (const hypothesis of derived.hypotheses) {
73
- const marks = [`状态 ${hypothesis.status}`]
74
- if (hypothesis.supportedLevel !== null) marks.push(`支持到 ${hypothesis.supportedLevel}`)
75
- if (hypothesis.refutations > 0) marks.push(`推翻 ${hypothesis.refutations} 次`)
76
- if (hypothesis.inconclusive > 0) marks.push(`无法判定 ${hypothesis.inconclusive} 次`)
77
- lines.push(`- [${hypothesis.id}] ${hypothesis.claim}(${marks.join(' · ')})`)
78
- lines.push(` 推翻条件:${hypothesis.refute_when}`)
79
- }
80
- if (derived.hypotheses.length === 0) lines.push('(这条目标没带假设——它是在下限落地之前立的)')
81
- return { kind: 'success', text: lines.join('\n') }
82
- },
83
- })
84
-
85
- commands.register({
86
- name: 'plan',
87
- description: '活动计划:步骤状态与授权记号(只读,从账本现算)',
88
- handler: (invocation) => {
89
- const { state, derived, error } = readState(invocation)
90
- if (error !== undefined) return { kind: 'error', text: error }
91
- const plan = state.plans.find((candidate) => candidate.status === 'active') ?? null
92
- if (plan === null) {
93
- const closed = state.plans.length
94
- return { kind: 'success', text: closed === 0 ? '还没有计划。' : `当前没有活动计划(${closed} 份已收尾)。` }
95
- }
96
- const stamp = plan.confirmed_at !== null ? `已授权(${plan.confirmed_by === 'user' ? '人批准' : '按行为补写归属'} @ ${plan.confirmed_at})` : '未授权——系统不会自动续跑;显式推进时第一次交付会按事实记下归属'
97
- const lines = [
98
- `计划 ${plan.id}(${plan.steps.length} 步) · ${stamp}`,
99
- '',
100
- ...plan.steps.map((step, index) => {
101
- const head = `${index + 1}. [${STEP_STATUS_LABEL[step.status] ?? step.status}] ${step.id}: ${step.do}`
102
- const tail = step.status === 'void' ? `\n 作废缘由:${step.voidReason ?? '—'}` : ''
103
- return head + tail
104
- }),
105
- ]
106
- const hints = gateHints(derived)
107
- if (hints.length > 0) lines.push('', `此刻能做的:${hints.join(';')}`)
108
- return { kind: 'success', text: lines.join('\n') }
109
- },
110
- })
111
-
112
- commands.register({
113
- name: 'evidence',
114
- description: '证据面:评估卡裁决、进行中步骤的交付摘要(只读,从账本现算)',
115
- handler: (invocation) => {
116
- const { state, derived, error } = readState(invocation)
117
- if (error !== undefined) return { kind: 'error', text: error }
118
- const lines = []
119
- const audits = state.audits ?? []
120
- if (audits.length > 0) {
121
- lines.push('评估卡:')
122
- for (const audit of audits.slice(-12)) {
123
- const verdict = audit.verdict === null ? '裁决在飞' : (typeof audit.verdict === 'object' ? (audit.verdict.accepted === true ? 'accepted' : `not_accepted${audit.verdict.grade !== undefined ? `(${audit.verdict.grade})` : ''}`) : String(audit.verdict))
124
- lines.push(`- ${audit.step ?? '?'}:${verdict}`)
125
- }
126
- } else {
127
- lines.push('还没有评估卡。')
128
- }
129
- const plan = state.plans.find((candidate) => candidate.status === 'active') ?? null
130
- if (plan !== null) {
131
- const delivered = plan.steps.filter((step) => step.status === 'advanced')
132
- if (delivered.length > 0) {
133
- lines.push('', '已交付的步骤(结算单在 clear/evidence/):')
134
- for (const step of delivered) lines.push(`- ${step.id}: ${step.do}`)
135
- }
136
- }
137
- if ((state.facts ?? []).length > 0) {
138
- lines.push('', '已升格的事实:')
139
- for (const fact of state.facts.slice(-8)) lines.push(`- ${fact.text}`)
140
- }
141
- return { kind: 'success', text: lines.join('\n') }
142
- },
143
- })
144
-
145
- commands.register({
146
- name: 'worldline',
147
- description: '世界线:分叉、分支读数与终局(只读,从账本现算)',
148
- handler: (invocation) => {
149
- const { derived, error } = readState(invocation)
150
- if (error !== undefined) return { kind: 'error', text: error }
151
- const forks = derived.forks ?? []
152
- if (forks.length === 0) return { kind: 'success', text: '还没有分叉。真分歧(跑完才知道谁更好)出现时,模型会用 ForkPlan 开世界线。' }
153
- const lines = []
154
- for (const fork of forks) {
155
- const extra = fork.orphaned ? '(随步骤作古而终止)' : fork.phase === 'deciding' ? '(在等你的裁决——面板或人门卡)' : ''
156
- lines.push(`分叉 ${fork.id} [${fork.phase}]${extra}: ${fork.question}`)
157
- lines.push(` 尺子:${fork.decideBy?.metric ?? '—'}(取${fork.decideBy?.direction === 'min' ? '最小' : '最大'})`)
158
- for (const branch of fork.branches) {
159
- const flags = [branch.id === fork.recommended ? '推荐' : null, branch.failed ? '执行失败' : null, branch.unreturned ? '执行者未归' : null, branch.orphaned ? '孤儿' : null].filter((flag) => flag !== null).join(' · ')
160
- lines.push(` - ${branch.label}(${branch.status}${flags === '' ? '' : ` · ${flags}`}) 读数 ${branch.reading ?? '—'}`)
161
- }
162
- if (fork.merge !== null && fork.merge !== undefined) {
163
- const label = fork.branches.find((branch) => branch.id === fork.merge.branch)?.label ?? fork.merge.branch
164
- lines.push(` 终局:采纳「${label}」(${fork.merge.by === 'user' ? '人裁决' : '算术收敛'}${fork.merge.provisional === true ? ' · 临时采纳,待复核' : ''})`)
165
- }
166
- }
167
- return { kind: 'success', text: lines.join('\n') }
168
- },
169
- })
170
-
171
- commands.register({
172
- name: 'plan-review',
173
- description: '把当前计划重新呈给你审阅(原生审阅卡)。批准才会落授权记号',
174
- handler: (invocation) => {
175
- const { state, derived, error } = readState(invocation)
176
- if (error !== undefined) return { kind: 'error', text: error }
177
- const plan = state.plans.find((candidate) => candidate.status === 'active') ?? null
178
- if (plan === null) return { kind: 'error', text: '没有活动计划——无可呈审。' }
179
- if (derived.planConfirmationPending !== true) {
180
- return { kind: 'success', text: `这份计划已有授权(${plan.confirmed_by === 'user' ? '人批准' : '按行为记下的归属'}),不需要重呈。` }
181
- }
182
- /**
183
- * 呈审本身由模型侧的 RequestPlanReview 做:授权记号只能随工具结果的 meta.mutations
184
- * 落账,命令处理器没有那条通道(这是权威边界,不是缺功能)。所以这里把一句结构化的
185
- * 请求 steer 给模型——与人在输入框里打同一句话等价,只是免打字、带先决检查。
186
- */
187
- const message = {
188
- id: `clearai-cmd-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`,
189
- role: 'user',
190
- content: [{ type: 'text', text: '请用 RequestPlanReview 把当前计划重新呈给我审阅。' }],
191
- source: { kind: 'user' },
192
- }
193
- const agent = invocation.agent
194
- if (agent.status === 'running') agent.steer(message)
195
- else agent.followup(message)
196
- return { kind: 'success', text: '已让模型把计划重新呈给你审(RequestPlanReview)——审阅卡出来时,批准才会落授权记号。' }
197
- },
198
- })
199
- }
@@ -1,25 +0,0 @@
1
- # clear/knowledge — 领域知识与项目事实
2
-
3
- 本目录存放项目级的领域知识和已验证的事实。作为每次任务的高优先级事实源。
4
-
5
- ## 常见文件
6
-
7
- - `business_rules.md` — 业务规则与约束
8
- - `data_dictionary.md` — 数据字典与字段语义
9
- - `entity_mapping.md` — 实体映射与拓扑关系
10
- - `domain_facts.md` — 已验证的领域事实
11
-
12
- ## Fact 条目模板
13
-
14
- ```markdown
15
- ## Fact: <标题>
16
- - Statement: <事实陈述>
17
- - Evidence: <来源文件/实验结果/工具输出摘要>
18
- - Scope: <适用范围>
19
- - Last Verified: <YYYY-MM-DD>
20
- ```
21
-
22
- ## 写入时机
23
-
24
- 仅在经验经多次任务验证、上升为项目普遍事实时写入此处。
25
- 更新需谨慎,变更前应有明确的工具输出或实验结果作为证据。
@@ -1,34 +0,0 @@
1
- # clear/memory — 经验沉淀目录
2
-
3
- 本目录存放每个 Skill 在当前项目下的经验教训(Lessons)。按能力主题组织,不按日期切分。
4
-
5
- ## 文件命名规范
6
-
7
- `<skill_name>_lessons.md`,例如:
8
- - `data_cleaning_lessons.md`
9
- - `feature_engineering_lessons.md`
10
- - `model_training_lessons.md`
11
- - `troubleshooting.md`(通用故障排查经验)
12
-
13
- ## Lesson 条目模板
14
-
15
- ```markdown
16
- ## Lesson: <简短标题>
17
- - Context: <任务背景/触发条件>
18
- - Symptom: <现象>
19
- - Root Cause: <根因>
20
- - Fix: <采取动作>
21
- - Validation: <验证方法与结果>
22
- - Reuse Hint: <下次何时应优先应用>
23
- ```
24
-
25
- ## 写入时机
26
-
27
- - `ClosePlan` 前:若本次任务产生新经验(工具报错修复、边界条件发现、业务规则确认),必须追加到对应文件。
28
- - Compact 后摘要中出现 `### 待落地记忆 (Pending Lessons):` 段落时,在下次 `CreatePlan` 前落地写入。
29
-
30
- ## 晋升规则
31
-
32
- 满足以下任一条件,可将 Lesson 提升至 `clear/skills/*.md`:
33
- - 同类任务可直接复用,与具体数据弱相关
34
- - 具备明确的条件-动作-预期结果三元组
@@ -1,49 +0,0 @@
1
- <!-- clearai:constitution-schema=clearai.project.v1 -->
2
-
3
- # 项目章程
4
-
5
- 本文件回答三件事:**这个项目在探索什么问题;目前已经知道什么、还不知道什么;一个结论要满足什么条件才算可信。**
6
- 它只保存跨任务稳定的项目事实与验收门槛。单次任务的委托属于 Goal,执行步骤与证据属于 Plan,此处不重复。
7
- 未填写的条目请保留占位文字——占位就是「尚未确定」,不能被当成默认答案或完成证据。
8
-
9
- <!-- clearai:section=project-goal -->
10
- ## 1. 项目目标
11
-
12
- - **要回答的核心问题**:[用一句话写清本项目最终要回答什么问题、或验证什么命题]
13
- - **使用者与用途**:[谁会使用这里的结论,用来做什么]
14
- - **成功的样子**:[项目完成时应存在哪些交付物(报告 / 数据集 / 模型 / 应用),各自达到什么程度]
15
- - **当前阶段**:[资料理解 / 假设形成 / 数据验证 / 实验验证 / 结论沉淀 —— 随进展更新此行]
16
-
17
- <!-- clearai:section=background -->
18
- ## 2. 背景与已知事实
19
-
20
- > 只写已被证据支撑的事实,并注明来源;猜测与假设写到第 3 节或工作区的假设清单里。
21
-
22
- - **问题背景**:[这个问题为什么值得探索,此前已有哪些工作]
23
- - **已确认的事实**:[逐条列出,每条附来源(文献 / 数据文件 / 实验记录路径)]
24
- - **关键未知**:[目前明确不知道、需要本项目回答的点]
25
-
26
- <!-- clearai:section=constraints -->
27
- ## 3. 关键约束与假设
28
-
29
- - **资源约束**:[可用数据、算力、实验条件、时间预算]
30
- - **方法约束**:[必须使用 / 不得使用的方法、数据许可与伦理边界]
31
- - **工作假设**:[当前依赖但尚未验证的假设,逐条列出并标注验证计划]
32
-
33
- <!-- clearai:section=evidence -->
34
- ## 4. 证据与验收标准
35
-
36
- > 一个结论只有满足下面的门槛才能写进「已确认的事实」或最终交付物。
37
-
38
- - **证据分级**:[本项目认可哪些证据形态及其强弱次序,如:可复现实验 > 数据统计检验 > 文献佐证 > 推理论证]
39
- - **验收标准**:[每类交付物的通过条件;写成可检验的判据,而不是形容词]
40
- - **可复现要求**:[结论对应的数据、脚本、参数应存放在何处,他人如何复跑]
41
- - **升格门槛**:[达到哪一级(L0–L4)的支持证据且无推翻,假设即成为事实;默认 L3。各等级在本项目里具体指什么,见仓库 docs/verification-loop.md 第 3 节]
42
-
43
- <!-- clearai:section=status -->
44
- ## 5. 当前状态
45
-
46
- - **最近里程碑**:[最近完成并通过验收的一步及其证据位置]
47
- - **进行中**:[当前正在推进的工作与预期产出]
48
- - **已知风险 / 阻塞**:[可能推翻现有结论或阻塞进展的因素]
49
- - **变更记录**:[本章程的重要修订,一行一条:日期 + 改了什么 + 原因]
@@ -1,37 +0,0 @@
1
- # Skills 索引
2
-
3
- 本目录存放项目可用的 Skill。每个 Skill 一个子目录,入口为其中的 `SKILL.md`。
4
- 按需加载:先在此索引确认「该用哪个」,再打开对应 `SKILL.md` 获取完整方法。
5
-
6
- ## 方法学
7
-
8
- - `exploration-loop` — 探索方法学骨架:假设 → 便宜验证 → 昂贵验证的证据升格循环;开始任何未知问题探索前先读。
9
- - `scientific-brainstorming` — 开放式科研脑暴与发散创意;还没有具体观察、需要先扩大候选空间时用。
10
- - `hypothesis-generation` — 把观察/文献线索收敛成可证伪的竞争假设与验证计划。
11
- - `scientific-critical-thinking` — 评估证据可信度与偏倚;交叉验证检索结果、给来源分级时用。
12
- - `what-if-oracle` — 多分支情景推演(最好/最可能/最坏/二阶效应);方案变更或路线抉择前做压力测试。
13
-
14
- ## 调研与文献
15
-
16
- - `domain-presearch` — 领域背景快速预研;进入新问题域时先摸清全貌与关键玩家/流派。
17
- - `process-presearch` — 目标流程/系统的预研;需要先弄懂一条流程(实验、业务、自然过程)怎么运转时用。
18
- - `literature-review` — 系统性文献综述(多库检索、主题综合、引用核验)。
19
- - `paper-lookup` — 单篇论文定位与获取(DOI/标题/作者精确查找)。
20
- - `citation-management` — 引用元数据核验与 BibTeX 管理。
21
- - `process-understanding-extraction` — 从流程类资料中做可审计的理解抽取与制图(叙述定位、边界单元、拓扑骨架)。
22
-
23
- ## 数据与分析
24
-
25
- - `exploratory-data-analysis` — 首次拿到数据文件时的结构/质量/分布初探与 EDA 报告。
26
- - `data-qa-analysis` — 观测/实验数据的质量核查(来源清点、对齐、异常与可用性判定)。
27
- - `data-analysis` — 已了解结构后的深度分析:变量关联、机理对照、领域知识提取。
28
- - `statistical-analysis` — 假设的统计验证:选检验、查前提、出可审计结论。
29
- - `chart-diagram-qa` — 图表落盘后的视觉验收与中文标签检查。
30
-
31
- ## 制品与应用
32
-
33
- - `web-artifact` — 单文件自包含网页制品;把结果做成可双击打开、可标注回传的评审件。
34
-
35
- ## 元能力
36
-
37
- - `skill-creator` — 创建或改进 Skill 本身;沉淀新方法为可复用 Skill 时用。
@@ -1,43 +0,0 @@
1
- ---
2
- name: chart-diagram-qa
3
- description: |
4
- 【图表·视觉验收】matplotlib 落盘 lab/diagrams/ 后的 Chart QA 与 CJK 文字验收。适用:含中文标签的图表、信息图、PFD、截图 OCR。不适用:纯文本/代码文件(用 read);结构化文档(用 read)。
5
- version: 1.0
6
- metadata:
7
- tier: system
8
- origin: template
9
- ---
10
-
11
- # 图表与信息图视觉验收
12
-
13
- ## 流程
14
-
15
- ```
16
- setup_cjk(预防) → matplotlib(渲染) → lab/diagrams/*.png → read_image(检测)
17
- ```
18
-
19
- - **预防**:matplotlib 含中文时先 `setup_cjk()`(`lab/scripts/matplotlib_cjk.py`;代码模板见各 presearch `references/figure_code.md`)。
20
- - **检测**:`read_image`;`prompt` 必填且须具体,禁止 “describe this image”。
21
-
22
- ## 何时加载
23
-
24
- - 刚用 `bash` + matplotlib/seaborn 落盘 `lab/diagrams/`
25
- - 需验收中文标签、排查 □/乱码;若处理 PDF,必须先用 `read`,仅在其明确返回扫描/图片型 PDF 提示且正文为空后,才用 `read_image(page=...)` OCR
26
-
27
- ## 调用 read_image
28
-
29
- | 字段 | 要求 |
30
- |------|------|
31
- | `path` | workspace 相对路径,如 `lab/diagrams/{slug}_revenue_trend.png` |
32
- | `prompt` | 必填;Chart QA 以 `"Chart QA: …"` 开头,列出 transcribe/verify 项并附 **Expected** 标签(标题/轴/图例/实体名) |
33
-
34
- Chart QA / CJK 细则与示例句式见工具 schema 中 `read_image` 的 `prompt` 参数说明(与 TOOL_PROTOCOL「精准指令」互补,此处不重复清单)。
35
-
36
- ## 验收后
37
-
38
- | 结果 | 动作 |
39
- |------|------|
40
- | 全部可读 | 报告中引用 PNG,继续下游 |
41
- | □ / 乱码 / 缺字 | matplotlib:查 `setup_cjk()` 后重跑;版式问题:调 figsize/布局后重新生成 |
42
- | 布局截断 | 调 figsize、`bbox_inches='tight'` 或版式参数 |
43
- | 多张图 | 同一轮并行多个 `read_image`(不同 `path`) |
@@ -1,73 +0,0 @@
1
- ---
2
- name: citation-management
3
- description: |
4
- 【引用管理·BibTeX】检索论文元数据、DOI→BibTeX、校验与去重。适用:预研/综述报告文末引用统一、交付前引用准确性检查。不适用:全文综述撰写(用 literature-review);一般网页来源(用 web_search sources 标注)。
5
- license: MIT license
6
- metadata:
7
- version: 1.0-clearai
8
- skill-author: K-Dense Inc. (adapted for ClearAI)
9
- tier: system
10
- origin: template
11
- created_at: '2026-06-12T02:47:05.406842+00:00'
12
- ---
13
-
14
- # 引用管理 Skill(ClearAI 版)
15
-
16
- ## 使用边界
17
-
18
- - **适用**:构建/清洗 `references.bib`;验证 DOI/PMID;报告交付前引用去重与格式统一。
19
- - **不适用**:替代 `paper-lookup` 做大规模检索;非学术网页引用(用手动 `[N]` 列表)。
20
-
21
- ## ClearAI 工具与路径映射
22
-
23
- - 元数据获取 → `bash`(CrossRef/PubMed API,见 `scripts/` 若已复制)
24
- - BibTeX 库 → `lab/knowledge/references.bib`
25
- - 校验报告 → `lab/knowledge/citation_audit.md`
26
- - 正式报告引用 → `products/reports/*.md` 文末 `[N]` + bib 键对应
27
- - 经验回写 → `clear/memory/citation_management_lessons.md`
28
-
29
- ## 工作流
30
-
31
- ### 1. 收集待引用项
32
-
33
- 从 `literature-review`、`domain-presearch` 草稿提取 DOI/标题/URL。
34
-
35
- ### 2. 元数据解析
36
-
37
- - DOI → CrossRef(`curl https://api.crossref.org/works/{doi}`)
38
- - PMID → PubMed E-utilities
39
- - 无 DOI:用 `paper-lookup` 或 `web_search` 补全
40
-
41
- ### 3. 生成 BibTeX
42
-
43
- ```bibtex
44
- @article{key2024,
45
- title = {...},
46
- author = {...},
47
- journal = {...},
48
- year = {2024},
49
- doi = {...}
50
- }
51
- ```
52
-
53
- 写入 `lab/knowledge/references.bib`,键名规范:`AuthorYearKeyword`。
54
-
55
- ### 4. 校验
56
-
57
- - 作者/年份/期刊与原文一致
58
- - 重复键合并
59
- - 缺失 DOI 标注待补
60
-
61
- ### 5. 与报告对齐
62
-
63
- - Markdown 正文 `[N]` 与 bib 键一一映射
64
- - 交付前输出 `lab/knowledge/citation_audit.md`:通过/待修/删除
65
-
66
- ## 常用 bash 片段
67
-
68
- ```bash
69
- # CrossRef DOI lookup
70
- curl -s "https://api.crossref.org/works/10.XXXX/yyyy" | python -m json.tool
71
- ```
72
-
73
- 更多脚本见已复制 `scripts/` 目录(按需调整输出路径到 `lab/knowledge/`)。