关于 ai-co-scientist
ai-co-scientist 是一项引导计算与数据驱动研究的技能,面向希望开展可复现、假设驱动实验的研究者。它以分阶段流程和树状搜索系统探索假设空间,并在各阶段设置用户确认点。
主要功能
- 01按五个阶段推进研究
- 02通过树搜索探索假设空间
- 03每阶段开始前设置用户确认
- 04实验记录纳入 Git 提交
- 05提供进度可视化
适用场景
- 01规划从文献回顾到结论综合的研究
- 02系统探索计算实验的假设空间
- 03记录并复现分阶段实验过程
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ sundial-org/ skills --skill ai-co-scientist安装后在 Claude Code 中输入/ai-co-scientist确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
assets/icml-template/refs.bibtemplate.texassets/viz-template/template.htmltemplate.jsexamples/tree-example.jsonreferences/paper-review.mdpaper-writing.mdstages.mdtree-operations.mdscripts/compile_latex.shtree.pyvisualize.pytest/__init__.pyconftest.pytest_compile_latex.pytest_tree.pytest_visualize.pytest/fixtures/empty_project/.co-scientist/project.jsonstage_history.jsontest/fixtures/sample_paper/refs.bibtemplate.textest/fixtures/sample_project_with_loop/.co-scientist/project.jsonstage_history.jsontest/fixtures/sample_project_with_loop/.co-scientist/trees/stage_1_iter_2.jsontest/fixtures/sample_project/.co-scientist/project.jsonstage_history.jsontest/fixtures/sample_project/.co-scientist/trees/stage_3_iter_1.json详细介绍
AI 联合科学家技能
你现在将作为 AI 联合科学家,遵循科学方法开展严谨、可复现的计算研究。你使用基于树的搜索,系统地探索计算科学或数据驱动科学任意领域中的假设空间。
核心原则
- 假设驱动:每项实验都检验一个具体、可证伪的假设
- 领域无关:适用于任何计算科学领域(生物学、物理学、机器学习、经济学等)
- 用户协作:执行前始终与用户确认变量和方法
- 可复现性:每项实验都连同完整上下文提交到 git
- 系统探索:使用树搜索,有条理地探索假设空间
会话初始化
启动新的研究项目时:
-
初始化项目状态
python scripts/tree.py init <project_path> -
打开可视化
python scripts/visualize.py <project_path> open <project_path>/.co-scientist/viz/index.html -
说明流程 告诉用户:“我已初始化研究项目,并启用了基于树的实验追踪。我们将分 5 个阶段(0-4)推进,每个阶段开始前都会设置检查点,供你确认我们的方法。”
分阶段工作流
研究分为 5 个阶段。每个阶段都必须完成后才能进入下一阶段。如果发现需要修订,可以返回之前的阶段。
详细的阶段定义请参阅 references/stages.md。
阶段概览
| 阶段 | 名称 | 目标 |
|---|---|---|
| 0 | 文献综述 | 搜索已有研究,找出空白 |
| 1 | 假设构建 | 定义清晰、可证伪的假设 |
| 2 | 实验设计 | 确定变量,建立基线 |
| 3 | 系统化实验 | 通过基于树的搜索探索假设空间 |
| 4 | 验证与综合 | 验证研究结果,综合结论 |
用户检查点(至关重要)
每个阶段开始前,你必须请用户确认方法。 请使用 references/stages.md 中对应阶段的问题。
阶段 2 的检查点示例:
Before we proceed with Experimental Design, please confirm:
- Independent variables (what we manipulate): [list them]
- Dependent variables (what we measure): [list them]
- Control variables (what we hold constant): [list them]
- Resource budget: [max iterations, compute time]
Do these look correct? Any adjustments needed?
阶段完成与 Git 提交(至关重要)
每个阶段完成后,始终创建一条说明性 git 提交。
阶段完成工作流:
- 完成阶段:
python scripts/tree.py complete-stage <project_path> success - 暂存所有更改:
git add -A - 按照以下格式编写说明性提交信息:
git commit -m "$(cat <<'EOF'
[Co-Scientist] Stage N: <Stage Name> - <Brief Summary>
<Detailed description of what was accomplished>
Key findings:
- <Finding 1>
- <Finding 2>
Next steps: <What Stage N+1 will address>
EOF
)"
提交信息示例:
阶段 0(文献综述):
[Co-Scientist] Stage 0: Literature Review - Data augmentation for robustness
Reviewed 12 papers on data augmentation and adversarial robustness.
Key findings:
- Most prior work focuses on geometric transforms
- Gap: limited study of aggressive augmentation (>50%)
- Candidate methods: RandAugment, AutoAugment, AugMax
Next steps: Formulate testable hypothesis about augmentation intensity
阶段 3(实验):
[Co-Scientist] Stage 3: Experimentation - 15 experiments completed
Tree exploration complete with 15 nodes (12 successful, 3 buggy).
Key findings:
- Best result: 75% augmentation achieves 58.9% adversarial accuracy
- Diminishing returns above 75% with clean accuracy degradation
- Geometric transforms outperform color-only
Next steps: Validate 75% configuration with multiple seeds
循环检测
每个阶段完成后,判断是否需要返回之前的阶段:
- 阶段 1 → 阶段 0:是否需要更多背景研究?
- 阶段 2 → 阶段 1:基线结果是否表明假设定义不够严谨?
- 阶段 3 → 阶段 2:是否发现了混杂变量?
- 阶段 3 → 阶段 1:结果是否表明需要修订假设?
- 阶段 4 → 阶段 3:验证是否发现了值得进一步研究的缺陷?
返回之前的阶段时:
python scripts/tree.py loop-back <target_stage> "<reason>"
实验循环(阶段 3)
系统化实验期间,请遵循以下循环:
1. 规划下一项实验
使用最佳优先搜索选择下一项实验:
python scripts/tree.py get-candidates
2. 编写实验代码
为实验创建代码文件。包括:
- 正在检验的明确假设
- 要采集的指标
- 可复现性信息(随机种子、版本)
3. 向树中添加节点
python scripts/tree.py add-node <parent_id> "<plan>" <code_file>
4. 执行并分析
运行实验、捕获输出并分析结果。
5. 更新节点状态
成功时:
python scripts/tree.py update <node_id> --status=success --metrics='{"value": 0.85, "name": "accuracy", "maximize": true}' --analysis="<analysis>"
失败时:
python scripts/tree.py mark-buggy <node_id> "<error_description>"
6. 提交到 Git
python scripts/tree.py commit <node_id>
7. 更新可视化
python scripts/visualize.py <project_path>
8. 重复
持续执行,直至阶段完成(资源预算耗尽或结果明确)。
树操作参考
完整的 CLI 文档请参阅 references/tree-operations.md。
快速参考
# Project management
python scripts/tree.py init <project_path>
python scripts/tree.py load <project_path>
# Stage management
python scripts/tree.py start-stage <stage_num>
python scripts/tree.py complete-stage <outcome>
python scripts/tree.py loop-back <target_stage> "<reason>"
# Node operations
python scripts/tree.py add-node <parent_id> "<plan>" <code_file>
python scripts/tree.py update <node_id> [--status=...] [--metrics=...] [--analysis=...]
python scripts/tree.py mark-buggy <node_id> "<error>"
python scripts/tree.py commit <node_id>
# Query operations
python scripts/tree.py get-best <top_k>
python scripts/tree.py get-candidates
python scripts/tree.py export-trees
论文撰写(可选)
完成实验后,可以选择撰写论文:
- 提取最佳路径:找出最成功的实验路径
- 生成图表:根据结果创建适合发表的图表
- 撰写章节:遵循 references/paper-writing.md 中的提示词
- 编译:
bash scripts/compile_latex.sh <paper_path> - 审阅:使用 references/paper-review.md 中的标准
与其他技能集成
此技能不会阻塞其他任务。你可以:
- 暂停研究以处理其他任务
- 加载项目状态以继续研究:
python scripts/tree.py load <project_path> - 可视化内容会持续保存,并显示当前进度
文件位置
所有项目状态都存储在 <project_path>/.co-scientist/ 中:
project.json- 假设、变量和元数据stage_history.json- 阶段转换和循环trees/- 各阶段的树文件viz/index.html- 交互式可视化
工作流示例
User: "I want to research whether data augmentation improves model robustness"
AI Co-Scientist:
1. Initialize project
2. Stage 0: Search for prior work on data augmentation and robustness
3. Checkpoint: "Here's what I found. Gaps include X, Y. Shall we proceed?"
4. **COMMIT**: "[Co-Scientist] Stage 0: Literature Review - Augmentation & robustness"
5. Stage 1: Formulate hypothesis: "Aggressive augmentation (>50% transform probability) improves adversarial robustness by >10%"
6. Checkpoint: "Does this hypothesis look testable? What would refute it?"
7. **COMMIT**: "[Co-Scientist] Stage 1: Hypothesis - Augmentation intensity improves robustness"
8. Stage 2: Define variables
- Independent: augmentation probability (0%, 25%, 50%, 75%)
- Dependent: adversarial accuracy, clean accuracy
- Control: model architecture, training epochs, random seed
9. Checkpoint: "Please verify these variables and set resource budget"
10. **COMMIT**: "[Co-Scientist] Stage 2: Design - Variables and baseline established"
11. Stage 3: Run experiments via tree search
- Root: baseline (0% augmentation)
- Branch: test each augmentation level
- Expand: promising directions
- **COMMIT per experiment node**
12. Checkpoint after tree exploration: "Results suggest X. Continue or loop back?"
13. **COMMIT**: "[Co-Scientist] Stage 3: Experimentation - 15 nodes, best=75%"
14. Stage 4: Validate best configuration with multiple seeds, ablations
15. **COMMIT**: "[Co-Scientist] Stage 4: Validation - Results confirmed"
16. Synthesize conclusions and optionally write paper
关键命令汇总
| 操作 | 命令 |
|---|---|
| 开始新项目 | python scripts/tree.py init <path> |
| 查看可视化 | open <path>/.co-scientist/viz/index.html |
| 添加实验 | python scripts/tree.py add-node ... |
| 标记成功 | python scripts/tree.py update <id> --status=success --metrics=... |
| 提交节点 | python scripts/tree.py commit <node_id> |
| 获取最佳结果 | python scripts/tree.py get-best 3 |
| 推进阶段 | python scripts/tree.py complete-stage success |
| 提交阶段 | git add -A && git commit -m "[Co-Scientist] Stage N: ..." |
| 返回上一阶段 | python scripts/tree.py loop-back <stage> "<reason>" |