From research-loop
Use when the user asks to record hypotheses, create experiment records, update research results, or maintain .research tree/dashboard state
How this skill is triggered — by the user, by Claude, or both
Slash command
/research-loop:hypothesis-treeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`.research/tree.md` 是假设树的单一真相源。本 skill 规定其格式、如何读取、如何在对话中按需写入。
.research/tree.md 是假设树的单一真相源。本 skill 规定其格式、如何读取、如何在对话中按需写入。
# Hypothesis Tree
## H1: <第一个一级假设内容>
Status: 待验
Evidence: (empty)
Children: H1.1, H1.2
### H1.1: <H1 的子假设>
Status: 进行中
Evidence: E001
Parent: H1
### H1.2: <H1 的另一子假设>
Status: 待验
Evidence: (empty)
Parent: H1
## H2: <第二个一级假设内容>
Status: 被推翻
Evidence: E002
| 状态 | 含义 |
|---|---|
| 待验 | 未开始验证 |
| 进行中 | 实验正在跑 |
| 被支持 | 至少一个实验支持, 无反对 |
| 被推翻 | 至少一个实验推翻 |
从 tree.md 提取活跃假设(Status=待验 或 进行中):
import re
def get_active_hypotheses(tree_content: str) -> list[dict]:
active = []
pattern = r'#{2,3} (H[\d.]+): (.+?)\nStatus: (待验|进行中)'
for match in re.finditer(pattern, tree_content, re.MULTILINE):
active.append({
'id': match.group(1),
'content': match.group(2),
'status': match.group(3)
})
return active
用 Edit tool 精确替换 Status 行, 不整文件重写:
# 将 H1 从 待验 改为 被支持
Edit(
file_path='.research/tree.md',
old_string='## H1: ...\nStatus: 待验',
new_string='## H1: ...\nStatus: 被支持'
)
将实验 ID 追加到 Evidence 行:
# 将 E003 追加到 H1 的 Evidence
Edit(
file_path='.research/tree.md',
old_string='## H1: ...\nStatus: 被支持\nEvidence: E001, E002',
new_string='## H1: ...\nStatus: 被支持\nEvidence: E001, E002, E003'
)
新假设 append 到文件末尾:
## H3: <新假设内容>
Status: 待验
Evidence: (empty)
子假设 append 在父假设段落内末尾(父假设 ## 块的末行之后, 下一个 ## 块之前).
原则: agent 不主动/不猜测/不自动后台写, 只在用户明确指示时写。
明确指示三种形式:
不触发写入(避免误判):
appendHypothesis(tree.md, 假设描述, 父节点)触发: 用户说 "记下这个假设: [描述]" 或 "把 X 加到假设树"
行为:
tree.md, 解析现有假设 ID 结构## HX: [用户提供的描述]
Status: 待验
Evidence: (empty)
updateDashboard)✓ 假设 HX 已记录到 tree.md
📝 Status: 待验
边界: 如果用户描述太模糊, agent 先帮忙提炼成一句话(50 字内), 征得用户确认后再写。
createExperimentRecord(实验描述, 关联假设)触发: 用户说 "帮我记录这次实验" 或 "创建实验记录 Exxx"
行为:
experiments/ 现有文件, 取最大编号 +1 → Exxxexperiments/Exxx.md 骨架:
# Exxx: [关联假设 ID] - [简短动作描述]
**Hypothesis**: [假设 ID] [假设文本, 从 tree.md 读取]
**Date**: [YYYY-MM-DD, 当天日期]
**Status**: 进行中
## 实验设计
**目标**: [用户描述或待补充]
**方法**: [待补充]
**预期**: [待补充]
## 执行记录
[待补充, 用户后续对话中逐步添加]
## 结果
[待实验完成后填写]
## 影响
[待结果出来后分析]
待验, 更新为 进行中(在 tree.md 里)✓ 实验记录 Exxx 已创建
📁 experiments/Exxx.md
💡 你可以随时对话让我更新其中的段落
边界: 骨架生成后, 用户可以手动编辑文件补充细节, 或在对话中说 "更新 E003 的执行记录, 加上 [内容]", agent 追加内容到对应段落。
updateExperimentResult(Exxx.md, 结果内容, 结论)触发: 用户说 "E003 的结果出来了, [数据], 结论是支持 H1"
行为:
experiments/Exxx.md, 定位 ## 结果 段## 结果
**数据**: [用户提供的 metrics / 观察]
**结论**: [支持/推翻/不确定] + [理由]
**Status** 字段: 进行中 → 已完成支持 或 推翻, 更新 tree.md 对应假设:
进行中 → 被支持 或 被推翻Exxx✓ E003 结果已记录
📊 结论: 支持 H1
🔄 假设树已更新: H1 → 被支持 (Evidence: E001, E003)
边界: 如果结论是 不确定, 假设 Status 保持 进行中(等更多实验)。
updateDashboard()(自动调用)触发: 其他三个操作调用, 或用户说 "刷新 DASHBOARD"
行为:
**Active** 行的数量和 **Last** 日期## Active Hypotheses 清单## Next Steps(如果用户对话中提到, 否则保持原样)边界: 这是"维护一致性"操作, 确保 DASHBOARD 始终反映 tree.md 真实状态。不需要用户单独触发, 其他写入操作自动调用。
所有写入操作必须:
位置: 把这三个函数实现在主 PI 的对话流程里, 或作为可复用的辅助脚本(scripts/helpers/*.sh), 不拆成独立子 agent。
语言:
scripts/helpers/append-hypothesis.sh 之类的脚本, SKILL 调用它校验:
npx claudepluginhub hamondyan/research-loopCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.