lhqezio/MegaResearcher

GitHub: lhqezio/MegaResearcher

一个基于 Claude Code 的多 Agent 研究集群插件,通过规范驱动的六阶段工作流将研究问题自动转化为经过对抗性验证的研究方向文档。

Stars: 0 | Forks: 0

# MegaResearcher [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-Plugin-orange)](https://github.com/lhqezio/MegaResearcher) [![Built on ml-intern](https://img.shields.io/badge/built%20on-ml--intern-yellow)](https://github.com/huggingface/ml-intern) [![Powered by superpowers](https://img.shields.io/badge/powered%20by-superpowers-purple)](https://github.com/obra/superpowers) 将一段式研究问题转化为**经过论证的研究方向**。 MegaResearcher 会分派一组由六个专业子 agent 组成的集群——文献侦察员、空白寻找者、假设锻造者、对抗性红队、评估设计师和综合者——由主会话中的 `executing-research-plan` 技能进行协调。最终结果是一份研究方向的文档,其中包含存活的假设、完整的实验设计、证伪标准,以及关于每个被否决的想法及其原因的透明审计轨迹。 ``` ┌──────────────────────────────────────────┐ Your spec ───▶ │ executing-research-plan (orchestrator) │ ───▶ output.md │ runs in the main session, dispatches │ │ │ workers in waves │ │ └──────────────────────────────────────────┘ │ │ │ ┌───────────────────────────┼───────────────────────────┐ │ ▼ ▼ ▼ │ literature-scout gap-finder hypothesis-smith │ │ │ │ │ └───────────┬───────────────┴───────────┬───────────────┘ │ ▼ ▼ │ red-team ◀──── critique loop ─────┐ │ │ │ │ │ revise (cap: 3 rounds) │ │ └────▶ hypothesis-smith ────────┘ │ │ │ ▼ APPROVE │ eval-designer │ │ │ ▼ │ synthesist ─────────────────────────────────────────────▶┘ ``` ## 为什么与众不同 | | 仅与 Claude 聊天 | 仅 ml-intern | MegaResearcher | |------------------------------------------|:--------------------:|:--------------:|:--------------:| | 阅读论文、数据集、代码 | ✓ | ✓ | ✓ | | 带有审查关卡且由规范驱动的工作流 | — | — | ✓ | | 并行专业 agent | — | — | ✓ | | 对抗性红队批判循环 | — | — | ✓ | | 强制执行证伪标准 | — | — | ✓ | | 被拒想法的审计轨迹 | — | — | ✓ | | 独立重新验证的引用 | — | partial | ✓ | | 跨集群的死循环检测 | — | ✓ | ✓ | 这不是“附带额外工具的 Claude”。这是一个单芯片上的研究实验室。 ## 您实际会得到什么 在针对已批准的计划运行 `/research-execute` 后,您的项目最终会得到: ``` docs/research/ ├── specs/ │ └── 2026-05-10-multimodal-fusion-spec.md ← your one-paragraph spec ├── plans/ │ └── 2026-05-10-multimodal-fusion-plan.md ← swarm decomposition └── runs/ └── 2026-05-10-1430-a3f9b2/ ├── output.md ← THE deliverable ├── swarm-state.yaml ← what happened, when ├── verification-report.md ← spot-checks + verdict ├── bibliography.md ← consolidated Phase 1 output ├── gaps.md ← consolidated Phase 2 output ├── literature-scout-1/ │ ├── output.md, manifest.yaml, verification.md ├── literature-scout-2/ ... ├── gap-finder-1/ ... ├── hypothesis-smith-1/ (with revision history if red-team kicked back) ├── red-team-1/ (verdict + objections + spot-checks) ├── eval-designer-1/ └── ... ``` 核心文件 `output.md` 是独立的,且可直接用于提案。它包括: - **执行摘要** — 问题、创新目标、主要发现、最终建议 - **存活的假设** — 每个假设都包含机制、带有量级的预测结果、证伪标准,以及完整的实验设计(数据集、基线、指标、决策规则、计算预算) - **被拒绝和否决的假设** — 附带否决每个假设的推理(强制透明化——隐藏拒绝会破坏集群的认知价值) - **我们未探索的内容** — 对规范中 YAGNI 边界的明确反思 - **建议的下一步行动** — 指定一个具体的假设,而不是“需要更多研究” ## 六个阶段 ``` Phase 1 literature-scout parallel, one per sub-topic in the plan Phase 2 gap-finder parallel, partitions the consolidated bibliography Phase 3 hypothesis-smith parallel, one per identified gap Phase 4 red-team CRITIQUE sequential per hypothesis, 3-revision cap (THIS is where novelty quality gets enforced) Phase 5 eval-designer parallel, one per surviving hypothesis Phase 6 synthesist single, composes the final research-direction doc ``` **阶段 4 是承重部分。** 每个假设都必须在独立 agent 的对抗性批判中存活下来,该 agent 会: - 重新运行文献查询,如果发现空白寻找者遗漏的现有工作,则拒绝该空白声明 - 抽查至少三个引用是否与实际论文相符(`hf_papers paper_details`) - 逐步攻击机制,要求为每一个因果声明提供引用 - 对最强的反面论点进行钢铁侠式的加强论证 - 测试证伪标准是否真的可以转化为一个有限的实验,还是它们只是无法证伪的空谈 - 为每个异议标记 `Critical | Important | Suggestion` 如果假设锻造者未能在 3 轮内满足红队的要求,该假设将被上报给您。如果它被完全否决,它会出现在审计轨迹中并附带给我们的教训——绝不会悄悄被丢弃。 ## 五步规范驱动链 ``` /research-init ↓ research-brainstorming → clarifies novelty target, modalities, constraints ↓ (wraps superpowers:brainstorming) writing-research-spec → produces docs/research/specs/--spec.md ↓ USER REVIEWS + APPROVES writing-research-plan → produces docs/research/plans/--plan.md ↓ (wraps superpowers:writing-plans + swarm decomposition) USER REVIEWS + APPROVES /research-execute ↓ [executing-research-plan skill runs the six phases] ↓ research-verification → evidence-based completion gate ↓ (wraps superpowers:verification-before-completion) output.md ready ``` 在头脑风暴和执行之间设有三个明确的用户审批关卡。没有悄无声息的 token 消耗。 ## 与 superpowers 的深度集成 MegaResearcher 硬性依赖于 [`superpowers`](https://github.com/obra/superpowers) 技能库,并将其技能作为运行时原语进行调用: | MegaResearcher 条目 | 调用的 superpowers 技能 | |----------------------------------|-----------------------------------------------| | `research-brainstorming` | `brainstorming` | | `writing-research-plan` | `writing-plans` | | `executing-research-plan` | `dispatching-parallel-agents` | | `executing-research-plan` 技能(主会话中的协调器) | `subagent-driven-development` | | `red-team` 工作器 | `receiving-code-review`(适配版) | | `eval-designer` + 工作器代码 | `test-driven-development` | | 任何编写代码的工作器 | `requesting-code-review` | | `research-verification` | `verification-before-completion` | | 并行基线实验 | `using-git-worktrees` | | 工作器遇到 bug | `systematic-debugging` | 结果:从经过实战检验的技能库中借鉴的严谨性,自动应用于每个研究产物。您无需为每个工作器选择是否使用 TDD;工作器自己知道该怎么做。 ## 捆绑内容 | | 数量 | 名称 | |---|---:|---| | **MCP 工具** | 9 | `hf_papers`, `hf_inspect_dataset`, `hf_docs_explore`, `hf_docs_fetch`, `hf_repo_files`, `github_examples`, `github_list_repos`, `github_read_file`, `web_search` | | **子 agent** | 6 | `literature-scout`, `gap-finder`, `hypothesis-smith`, `red-team`, `eval-designer`, `synthesist`(协调逻辑位于技能中,而非子 agent) | | **技能** | 5 | `research-brainstorming`, `writing-research-spec`, `writing-research-plan`, `executing-research-plan`, `research-verification` | | **斜杠命令** | 3 | `/research-init`, `/research-execute`, `/share-traces` | | **钩子** | 2 | PostToolUse 死循环检测器,SessionEnd 交互记录上传器 | | **内置上游** | — | [`huggingface/ml-intern`](https://github.com/huggingface/ml-intern),固定在已知良好的 SHA 上 | ## 快速开始 **前提条件:** Claude Code · `uv` · [`superpowers`](https://github.com/obra/superpowers) 插件 · Hugging Face token ``` # 1. Clone git clone https://github.com/lhqezio/MegaResearcher.git ~/MegaResearcher # 2. 安装 MCP server deps cd ~/MegaResearcher/mcp && uv sync # 3. Configure tokens (HF_TOKEN 必需,GITHUB_TOKEN 可选) cp .env.example .env && $EDITOR .env # 或者将它们设置在你的 shell (~/.zshrc) 中: # export HF_TOKEN="hf_..." # command -v gh >/dev/null && export GITHUB_TOKEN="$(gh auth token)" # 4. 接入 Claude Code (添加到 ~/.claude/settings.json) ``` ``` // ~/.claude/settings.json { "enabledPlugins": { "superpowers@claude-plugins-official": true, "megaresearcher@megaresearcher": true }, "extraKnownMarketplaces": { "megaresearcher": { "source": { "source": "directory", "path": "/Users/you/MegaResearcher" } } } } ``` 重启 Claude Code。然后在任何项目中: ``` /research-init multi-modal fusion architectures for ISR ``` 接下来,头脑风暴技能将接管一切。 ## 配置 | 变量 | 必填 | 用途 | |---|:---:|---| | `HF_TOKEN` | ✓ | HF API 访问权限——论文、数据集、文档、代码仓库文件 | | `GITHUB_TOKEN` | — | GitHub API 访问权限;若未提供,三个 GitHub 工具将显示清晰的错误提示 | | `ML_INTERN_TRACES_REPO` | — | 设置为 `/ml-intern-sessions` 以启用上传到私有 HF 数据集的会话交互记录 | | `ML_INTERN_TRACES_PRIVATE` | — | `true`(默认)或 `false`,用于控制交互记录数据集的可见性 | | `MEGARESEARCHER_MAX_PARALLEL` | — | 每个阶段的最大并行工作器数(默认 4);数值越高 = 速度越快 + token 消耗越多 | ## 仓库布局 ``` MegaResearcher/ ├── .claude-plugin/ │ ├── plugin.json # plugin manifest │ └── marketplace.json # directory-source marketplace metadata ├── .mcp.json # MCP server registration ├── agents/ # 7 subagent definitions (.md each) ├── skills/ # 5 skill definitions (one dir each) ├── commands/ # 3 slash command definitions ├── hooks/ # doom_loop.py + upload_traces.py + hooks.json ├── mcp/ # FastMCP server wrapping ml-intern │ ├── server.py │ ├── pyproject.toml │ └── .env.example ├── tools/ml-intern/ # vendored snapshot, pinned SHA in tools/ml-intern.sha ├── docs/architecture.md # contributor docs └── tests/ # smoke tests for hooks + MCP server ``` ## 设计理念 **审计轨迹是不可妥协的。** 每一个被否决的假设都会连同其带来的教训一起出现在综合者的最终文档中。隐藏的否决会破坏集群的认知价值。 **引用要么被验证,要么不存在。** 每个被引用的 arxiv ID 都会通过 `hf_papers paper_details` 进行验证。绝不编造引用。绝不。 **证伪标准是必需的。** 一个没有能够推翻它的有限实验的假设,就不叫假设——那是空谈。插件将拒绝推进它。 **预先注册决策规则。** 评估设计师必须事先声明什么结果构成支持,什么结果构成证伪。事后设定的阈值是那些看似合理实则错误的发现得以存活的原因。 **工作器各司其职。** 侦察员生成参考书目,锻造者构建假设,设计师设计实验,综合者进行整合——任何角色都不会越俎代庖。 ## 构建基础 - [**huggingface/ml-intern**](https://github.com/huggingface/ml-intern) — 提供底层研究工具(HF Papers、arxiv、数据集、文档、GitHub 代码搜索、网络搜索)、死循环检测器和会话交互记录上传管道。作为固定版本的快照内置。 - [**superpowers**](https://github.com/obra/superpowers) — 提供规范层:规范驱动的计划、并行 agent 调度、完成前验证、代码审查模式。硬性依赖。 - [**Claude Code**](https://claude.com/claude-code) — 运行时环境。 ## 许可证 Apache-2.0。内置的 `tools/ml-intern/` 保留其自身的 Apache-2.0 许可证——有关固定的上游提交,请参阅 [`tools/ml-intern/LICENSE`](tools/ml-intern/LICENSE) 和 [`tools/ml-intern.sha`](tools/ml-intern.sha)。
标签:AI工作流, AI研究助手, arXiv, Claude Code 插件, DLL 劫持, DNS解析, Hugging Face, MCP工具, Swarm, 假设生成, 可证伪性分析, 多智能体协作, 大语言模型, 学术研究, 实验设计, 开源项目, 提示词工程, 文献综述, 研究规划, 科学研究自动化, 策略决策点, 红队对抗评估, 群智协作, 自动化科研, 超级技能库, 逆向工具