关于 paper-orchestra
paper-orchestra 是一项多 Agent 论文写作流程编排技能,可根据研究构想、实验日志和会议要求生成 AI 研究论文。它协调大纲、绘图、文献综述、写作、润色、校验和 LaTeX 编译,并保留工作区审计记录。
主要功能
- 01搭建并校验研究输入
- 02协调大纲与论文写作阶段
- 03并行执行绘图和文献综述
- 04检查引文及证据依据
- 05润色并编译最终论文
适用场景
- 01将研究笔记和实验日志整理成论文
- 02按会议指南准备投稿稿件
- 03生成图表和经核验的参考文献
- 04检查草稿论据并编译最终 PDF
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ ar9av/ paperorchestra --skill paper-orchestra安装后在 Claude Code 中输入/paper-orchestra确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/anti-leakage-prompt.mdhost-integration.mdio-contract.mdoutline-reconciliation.mdpaper-summary.mdpipeline.mdscripts/anti_leakage_check.pybuild_pdf.pycheck_idea_density.pycheck_tex_packages.pyclaim_evidence_gate.pydiff_outlines.pyinit_workspace.pytest_claim_evidence_gate.pyvalidate_consistency.pyvalidate_inputs.py详细介绍
paper-orchestra(Orchestrator)
PaperOrchestra 流水线的顶层驱动程序。请阅读本文档并按照以下步骤操作。详细提示词和规则位于各子技能的 SKILL.md 和 references/ 目录中——你(宿主 Agent)将在执行过程中加载这些内容。
来源论文:Song 等人,PaperOrchestra:用于自动撰写 AI 研究论文的多 Agent 框架,arXiv:2604.05018,2026 年。 https://arxiv.org/pdf/2604.05018
此技能的产物
完整的投稿包 P = (paper.tex, paper.pdf),写入 workspace/final/;此外,workspace/ 下还会保留完整的审计记录(大纲、图表、参考文献、草稿、润色工作日志、溯源快照)。
输入(论文中的 (I, E, T, G, F) 元组)
工作区必须包含:
| 文件 | 符号 | 必需 | 描述 |
|---|---|---|---|
workspace/inputs/idea.md | I | 是 | 创意摘要(稀疏或稠密版本——参见 references/io-contract.md) |
workspace/inputs/experimental_log.md | E | 是 | 实验日志:设置、原始数值数据、定性观察 |
workspace/inputs/template.tex | T | 是 | 目标会议的 LaTeX 模板(含 \section{...} 命令) |
workspace/inputs/conference_guidelines.md | G | 是 | 格式规则、页数限制、必需章节 |
workspace/inputs/figures/ | F | 否 | 可选的现有图表。若为空,绘图 Agent 将生成所有图表。 |
scripts/init_workspace.py 将创建此目录结构。流水线运行前,scripts/validate_inputs.py 将检查这些文件。
流水线(完整图示请阅读 references/pipeline.md)
Step 1: Outline ──▶ outline.json (1 LLM call)
Step 2: Plotting ─┐
├──▶ figures/*.png + captions.json (~20-30 calls)
Step 3: Lit Review ─┘ (~20-30 calls)
intro_relwork.tex + refs.bib
Step 4: Section Writing ──▶ drafts/paper.tex (1 LLM call)
Step 5: Content Refine ──▶ final/paper.tex + final/paper.pdf (~5-7 calls, ~3 iters)
步骤 2 和步骤 3 相互独立,在宿主支持并行子 Agent 时必须并行运行。若不支持并行,则先运行步骤 3(由于 Semantic Scholar 的速率限制,该步骤耗时更长),再运行步骤 2。
关键前置指令(只需阅读一次,始终遵循)
在任何会撰写论文内容(大纲、引言/相关工作、章节写作、润色)的 LLM 调用之前,必须先将 references/anti-leakage-prompt.md 中的防泄漏提示词添加到系统提示词开头。此内容原封不动地摘自论文附录 D.4,可防止预训练数据泄漏。论文为公平比较,在所有基线中统一应用该提示词;我们也会应用它,以忠实遵循论文方法,并确保生成的论文以用户输入为依据。
分步执行
0. 预检查
运行流水线前,按顺序执行以下质量检查:
# 1. Scaffold the workspace
python skills/paper-orchestra/scripts/init_workspace.py --out workspace/
# user drops their inputs into workspace/inputs/
# 2. Validate required files are present and well-formed
python skills/paper-orchestra/scripts/validate_inputs.py --workspace workspace/
# 3. Check input density — idea and experimental log must meet minimum thresholds
python skills/paper-orchestra/scripts/check_idea_density.py \
--idea workspace/inputs/idea.md \
--log workspace/inputs/experimental_log.md
# 4. Cross-validate consistency between idea and experimental log
python skills/paper-orchestra/scripts/validate_consistency.py \
--idea workspace/inputs/idea.md \
--log workspace/inputs/experimental_log.md
如果 validate_inputs.py 或 check_idea_density.py 失败(退出代码为 1 或 2),请停止并告知用户缺少什么或哪些内容未达到阈值——修复前不要继续。
validate_consistency.py 只会生成警告(退出代码 1 = WARN,不会阻止流程);请向用户报告警告,但继续执行。
因缺少输入而中止前,先检查聚合操作能否补齐这些输入:
| 输入状态 | 操作 |
|---|---|
idea.md 和 experimental_log.md 均存在且非空 | 继续执行步骤 1。 |
| 其中任一文件缺失或为空,且用户提到了一个目录 | 使用该目录作为 --search-roots 加载并运行 agent-research-aggregator,然后重新验证。 |
| 其中任一文件缺失或为空,且用户未提到目录 | 询问用户:“您的工作区缺少 idea.md / experimental_log.md。您是否有包含研究笔记或 Agent 历史记录的文件夹,供我进行聚合?如果有,请告诉我路径;或者将文件手动放入 workspace/inputs/。” |
如果聚合后验证仍然失败(例如缺少 template.tex 或 conference_guidelines.md),请停止并准确告知用户仍缺少哪些文件。
同时检查 TeX 安装情况(每个工作区检查一次,结果会缓存):
python skills/paper-orchestra/scripts/check_tex_packages.py \
--out workspace/tex_profile.json
章节撰写 Agent 会读取 tex_profile.json,以确定要使用哪些 LaTeX 模式(例如,使用 Figure~\ref{} 还是 \cref{},是否包含 \usepackage{microtype} 等)。这样可以避免编译时出现需要反复手动修改才能解决的软件包错误。
1. 大纲(步骤 1 — 调用 1 次大模型)
加载 skills/outline-agent/SKILL.md 并遵循其中的说明。输出:workspace/outline.json。
使用 python skills/outline-agent/scripts/validate_outline.py workspace/outline.json 进行验证。
如果验证失败,则停止流水线——所有后续 Agent 都依赖此架构。
2 ∥ 3. 绘图与文献综述(并行执行)
解析 outline.json。提取:
outline.plotting_plan→ 用于驱动步骤 2outline.intro_related_work_plan→ 用于驱动步骤 3
如果宿主支持并行子 Agent(Claude Code 的 Agent 工具可进行多次并发调用;Cursor 的并行 Agent;Antigravity 的工作池),则启动两个并发子任务:
- 子任务 A:加载
skills/plotting-agent/SKILL.md,执行绘图计划,为每个条目生成workspace/figures/<figure_id>.png,并生成workspace/figures/captions.json。 - 子任务 B:加载
skills/literature-review-agent/SKILL.md,执行研究策略,生成workspace/drafts/intro_relwork.tex和workspace/refs.bib。
如果宿主不支持并行子 Agent,则先运行子任务 B(由于 Semantic Scholar 的 QPS 限制,其实际耗时更长),再运行子任务 A。这些产物彼此独立,因此执行顺序不会影响正确性。
3.5. 大纲协调(步骤 3 完成后、步骤 4 开始前)
步骤 3(文献综述)生成 citation_pool.json 和 cross_verification_report.json 后,运行协调步骤。
加载 references/outline-reconciliation.md 并遵循其中的提示词。
输出:workspace/outline_reconciled.json。
验证并比较差异:
python skills/outline-agent/scripts/validate_outline.py workspace/outline_reconciled.json
python skills/paper-orchestra/scripts/diff_outlines.py \
--original workspace/outline.json \
--reconciled workspace/outline_reconciled.json \
--summary workspace/reconciliation_summary.md
如果验证失败,则在步骤 4 中回退使用 outline.json,并警告用户。
向用户展示 reconciliation_summary.md(即使没有任何更改也要展示——这可以确认大纲与实际文献相符)。
跳过条件: 引文池为空、步骤 3 失败,或步骤 2 仍在运行且宿主无法并发发起其他调用。完整的跳过条件请参阅 references/outline-reconciliation.md。
4. 撰写章节(步骤 4 — 单次多模态 LLM 调用)
加载 skills/section-writing-agent/SKILL.md 并遵循其中的说明。这是论文中的单次调用(附录 B:“Section Writing Agent (1 call)”)——不要按章节拆分。Agent 会接收:
outline_reconciled.json(如果存在则使用;否则回退到outline.json)idea.md、experimental_log.mdintro_relwork.tex(已在步骤 3 中填写——原样保留)refs.bib(引用映射)conference_guidelines.mdresearch_brief.md(如果存在——阅读 §1–§3,了解累积的流水线上下文)workspace/figures/中的实际图像文件(多模态输入)
输出:workspace/drafts/paper.tex(完整的 LaTeX 文档)。
然后运行确定性检查:
python skills/section-writing-agent/scripts/orphan_cite_gate.py workspace/drafts/paper.tex workspace/refs.bib
python skills/section-writing-agent/scripts/latex_sanity.py workspace/drafts/paper.tex
python skills/paper-orchestra/scripts/anti_leakage_check.py workspace/drafts/paper.tex
python skills/paper-orchestra/scripts/claim_evidence_gate.py \
--paper workspace/drafts/paper.tex \
--log workspace/inputs/experimental_log.md \
--out workspace/claim_evidence_report.json
claim_evidence_gate.py 是一个 WARN 检查(退出码为 1 表示存在警告,不会强制停止)。
向用户报告缺乏依据的主张数量。内容优化 Agent 会在步骤 5 中处理这些问题。
如果任一检查未通过,宿主 Agent 必须先修复问题(根据检查的错误报告重新提示撰写步骤),然后才能继续。
5. 内容优化(步骤 5 — 约 3 轮迭代,约 5–7 次调用)
加载 skills/content-refinement-agent/SKILL.md 并遵循其中的说明。该技能根据 halt-rules.md 中的严格停止规则实现循环。维护 workspace/refinement/worklog.json,并将每轮迭代快照保存到 workspace/refinement/iter<N>/。
停止条件(满足任意一项即停止循环,并接受当前最佳快照):
- 迭代次数达到上限(默认值为 3,参见
halt-rules.md)。 - 模拟审稿人的总评分低于上一轮 → 回退到上一轮快照并停止。
- 总评分持平,但至少一个子维度评分下降,且没有其他维度的提升予以补偿(子维度净变化为负)→ 回退并停止。
- 审稿人未提出新的可操作改进点。
将接受的快照复制到 workspace/final/paper.tex。
6. 编译并完成定稿
cd workspace/final && latexmk -pdf paper.tex
然后编写 workspace/provenance.json,记录输入文件哈希值、大纲哈希值、引用哈希值、图像哈希值,以及最终 tex/pdf 哈希值(辅助脚本:如需一次性完成,可使用编排脚本目录中的 scripts/snapshot.py;否则由宿主 Agent 内联计算哈希值)。
向用户报告:workspace/final/paper.pdf 的路径、已撰写章节的简要摘要、引用数量、已完成的优化迭代次数,以及流水线中途未通过的任何检查。
工作区布局
参见 references/io-contract.md。概要:
workspace/
├── inputs/ # user-provided
│ ├── idea.md
│ ├── experimental_log.md
│ ├── template.tex
│ ├── conference_guidelines.md
│ └── figures/ # optional pre-existing figures
├── outline.json # Step 1 output
├── figures/ # Step 2 output
│ ├── <figure_id>.png
│ └── captions.json
├── refs.bib # Step 3 output
├── drafts/ # Step 3 + Step 4 output
│ ├── intro_relwork.tex
│ └── paper.tex
├── refinement/ # Step 5 working dir
│ ├── worklog.json
│ ├── iter1/
│ ├── iter2/
│ └── iter3/
├── final/ # accepted snapshot + compiled PDF
│ ├── paper.tex
│ └── paper.pdf
└── provenance.json # input/output hashes for reproducibility
成本预算(摘自论文附录 B)
总计:每篇论文约 60–70 次 LLM 调用;按论文中的配置,耗时约 40 分钟。 预算明细:
| 步骤 | 调用次数 |
|---|---|
| 大纲 | 1 |
| 绘图 | 约 20–30 |
| 文献综述 | 约 20–30 |
| 撰写章节 | 1 |
| 内容优化 | 约 5–7 |
宿主集成
有关各宿主的调用详情(Claude Code、Cursor、Antigravity、Cline、Aider、OpenCode),请参见 references/host-integration.md。
资源
references/pipeline.md— 完整的分步流程 + 并行规则 + 停止规则references/io-contract.md— 工作区布局、输入文件架构references/anti-leakage-prompt.md— App. D.4 的原文,每次写作调用前都要附加references/paper-summary.md— 对 arXiv:2604.05018 的 1 页提炼references/host-integration.md— 各宿主的调用指南references/outline-reconciliation.md— 新增 第 3.5 步大纲协调协议(受 AutoSci 启发)scripts/init_workspace.py— 创建工作区目录树scripts/validate_inputs.py— 运行前验证 (I, E, T, G)scripts/anti_leakage_check.py— 搜索草稿中泄露的作者姓名、电子邮件/affilsscripts/claim_evidence_gate.py— 新增 警告门:验证草稿中的数字声明是否有 experimental_log.md 支持scripts/diff_outlines.py— 新增 比较原始大纲与协调后的大纲;写入 reconciliation_summary.mdskills/shared/research_brief_template.md— 新增 workspace/research_brief.md 的架构(累积跨 Agent 上下文)