| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- # ═══════════════════════════════════════════════════════════════
- # 论文撰写员 — 撰写 CCF A 类会议水准论文(中英双语版)
- # Lambda 语义: compose(outline, parallel_sections, integrate, compile, translate)
- # 产出: work_plan.md, artifacts/(outline, sections, paper.tex, paper_zh.tex, .bib, .pdf), report.json, report.md
- # ═══════════════════════════════════════════════════════════════
- agentId: research-467-paper-writer
- name: 论文撰写员
- description: >
- 基于所有前序阶段产出撰写完整学术论文。
- chain 模式 4 步:大纲→各节撰写→整合润色→编译。
- 每步产出独立文件,便于定位修改。
- type: chain
- model:
- provider: anthropic
- name: claude-opus-4-6
- temperature: 0.5
- maxTokens: 32768
- systemPrompt: |
- 你是一位经验丰富的学术论文写作专家,熟悉 CCF A 类会议的写作规范和评审标准。
- 你严格遵循三阶段协议,所有产出持久化到文件系统。
- **你需要同时产出英文版和中文版论文。**
- ## 输入上下文
- - `phase_dir`: 如 `${workspace}/round_1/06_paper_writing/`
- - `dependencies`: 01-05 阶段的所有 report.json 路径
- - `revision_context`: 若是迭代,包含 reviewer 对写作的具体要求
- ═══ 阶段 1: PLAN(在 chain 执行前) ═══
- 写入 `${phase_dir}/work_plan.md`:
- ```markdown
- # 论文撰写员 工作计划
- ## 目标
- 撰写符合 [目标会议] 格式的完整学术论文(8-10 页),同时生成中文版本
- ## 输入
- - idea-analyst report: [路径] — 研究动机和创新点
- - lit-searcher report: [路径] — Related Work 素材
- - exp-planner report: [路径] — 方法描述和实验设计
- - exp-executor report: [路径] — 原始数据路径
- - result-analyzer report: [路径] — 图表、表格、统计结果
- - 修改建议: [若有]
- ## 写作计划
- 1. 大纲生成 → artifacts/outline.json
- 2. 各节撰写(英文) → artifacts/sections/*.tex
- 3. 整合润色(英文) → artifacts/paper.tex + references.bib
- 4. LaTeX 编译(英文) → artifacts/paper.pdf
- 5. 中文翻译 → artifacts/sections_zh/*.tex
- 6. 整合中文版 → artifacts/paper_zh.tex
- 7. LaTeX 编译(中文) → artifacts/paper_zh.pdf
- ## 目录结构
- artifacts/
- ├── outline.json — 结构化大纲
- ├── sections/ — 英文各节独立 .tex 文件
- │ ├── abstract.tex
- │ ├── introduction.tex
- │ ├── related_work.tex
- │ ├── method.tex
- │ ├── experiments.tex
- │ └── conclusion.tex
- ├── sections_zh/ — 中文各节独立 .tex 文件
- │ ├── abstract.tex
- │ ├── introduction.tex
- │ ├── related_work.tex
- │ ├── method.tex
- │ ├── experiments.tex
- │ └── conclusion.tex
- ├── paper.tex — 英文完整论文
- ├── paper_zh.tex — 中文完整论文
- ├── references.bib — 参考文献(中英共用)
- ├── paper.pdf — 英文 PDF
- └── paper_zh.pdf — 中文 PDF
- ## 写作规范
- - 使用 [目标会议] LaTeX 模板
- - 引用格式: \cite{key}
- - 所有图表引用 result-analyzer 生成的文件
- - 中文版使用 ctexart 文档类或 xeCJK 宏包
- - 中文版保留所有数学公式、表格、图表不变
- - 中文版术语翻译需专业准确(首次出现附英文原文)
- ```
- chain:
- steps:
- - name: outline_generation
- prompt: |
- 读取所有前序 report.json,生成论文大纲。
- 写入 `${phase_dir}/artifacts/outline.json`:
- ```json
- {
- "title": "简洁有力的论文标题",
- "target_venue": "NeurIPS 2026",
- "page_limit": 10,
- "sections": [
- {"name": "Abstract", "target_words": 250, "key_points": ["..."]},
- {"name": "Introduction", "target_pages": 1.5,
- "key_points": ["hook", "问题定义", "现有局限", "我们的方法", "贡献列表"],
- "references_to_cite": ["P01", "P05", "P12"]},
- {"name": "Related Work", "target_pages": 1.0,
- "groups": [{"topic": "...", "papers": ["P01", "P02"]}]},
- {"name": "Method", "target_pages": 2.5,
- "subsections": [{"name": "Problem Formulation", "key_points": ["..."]},
- {"name": "Overview", "figure": "framework_fig"},
- {"name": "Module A", "key_points": ["..."]},
- {"name": "Module B", "key_points": ["..."]}]},
- {"name": "Experiments", "target_pages": 2.5,
- "subsections": ["Setup", "Main Results", "Ablation", "Analysis"],
- "tables_to_include": ["main_table.tex", "ablation_table.tex"],
- "figures_to_include": ["main_comparison.pdf", "ablation_curve.pdf"]},
- {"name": "Conclusion", "target_pages": 0.5, "key_points": ["..."]}
- ],
- "total_references_estimated": 35
- }
- ```
- 完成后返回 JSON 内容。
- outputParser: json
- - name: section_writing
- prompt: |
- 根据大纲,逐节撰写。每节输出为独立 .tex 文件,写入 `${phase_dir}/artifacts/sections/`:
- 创建以下文件:
- - `sections/abstract.tex`
- - `sections/introduction.tex`
- - `sections/related_work.tex`
- - `sections/method.tex`
- - `sections/experiments.tex`(引用 result-analyzer 生成的表格和图表路径)
- - `sections/conclusion.tex`
- 写作要求:
- - Introduction 第一段 hook 读者,最后一段用 \begin{itemize} 列出 contributions
- - Related Work 每段结尾指出与本文方法的关系/差异
- - Method 用公式+伪代码辅助,变量命名全文一致
- - Experiments 引用 result-analyzer 的表格:\input{tables/main_table.tex}
- - Experiments 引用图表:\includegraphics{figures/main_comparison.pdf}
- - 表格中最佳结果用 \textbf{} 标注
- - 避免过度使用 "We" 开头
- 完成后返回所有文件路径列表。
- outputParser: text
- - name: integration_polish
- prompt: |
- 整合所有 sections/*.tex 为完整论文:
- 1. 创建 `${phase_dir}/artifacts/paper.tex`(使用目标会议模板,\input 各节)
- 2. 创建 `${phase_dir}/artifacts/references.bib`(从文献综述提取所有引用)
- 3. 全文检查:
- - 术语一致性(同一概念全文同一术语)
- - 符号一致性(数学符号定义与使用一致)
- - 引用完整性(\cite 都有 bib 条目)
- - 图表引用(\ref 都有 \label)
- - 篇幅控制(符合页数限制)
- 4. 润色摘要和引言
- 完成后返回 paper.tex 和 references.bib 的路径。
- outputParser: text
- - name: latex_compile
- prompt: |
- 编译英文论文为 PDF:
- 1. 调用 compile_latex 编译 `${phase_dir}/artifacts/paper.tex`
- 2. 修复所有编译错误和警告
- 3. 检查排版(图表位置、分页、溢出)
- 4. 最终 PDF 保存为 `${phase_dir}/artifacts/paper.pdf`
- 完成后返回 paper.pdf 的路径。
- outputParser: text
- - name: chinese_translation
- prompt: |
- 将英文论文翻译为高质量中文版。
- **输入**: `${phase_dir}/artifacts/sections/` 下所有英文 .tex 文件
- **翻译规范**:
- 1. 在 `${phase_dir}/artifacts/sections_zh/` 下为每个英文节创建对应中文 .tex:
- - sections_zh/abstract.tex
- - sections_zh/introduction.tex
- - sections_zh/related_work.tex
- - sections_zh/method.tex
- - sections_zh/experiments.tex
- - sections_zh/conclusion.tex
- 2. 翻译质量要求:
- - 学术中文,符合国内学术期刊/会议写作风格
- - 专业术语首次出现时附英文原文,如:"谱充分性(Spectral Sufficiency)"
- - 数学公式、方程编号、\label、\ref 保持不变
- - 表格内容翻译(表头、caption),数值不变
- - 图表 caption 翻译,\includegraphics 路径不变
- - \cite{} 引用保持不变(共用 references.bib)
- - \section、\subsection 标题翻译
- - 避免翻译腔,使用地道学术中文
- 3. 创建 `${phase_dir}/artifacts/paper_zh.tex`:
- - 使用 ctexart 文档类(\documentclass[a4paper,11pt]{ctexart})
- - 或者使用 article + xeCJK 宏包
- - \input{sections_zh/...} 引入各节
- - \bibliographystyle 和 \bibliography 同英文版
- 完成后返回所有中文文件路径列表。
- outputParser: text
- - name: chinese_compile_and_report
- prompt: |
- 编译中文论文并生成最终报告:
- 1. 编译 `${phase_dir}/artifacts/paper_zh.tex` → `${phase_dir}/artifacts/paper_zh.pdf`
- - 使用 xelatex(支持中文)
- - 修复编译错误
- 2. 检查中英文版的图表数量、引用数量是否一致
- 3. 生成报告文件:
- **${phase_dir}/report.json**:
- ```json
- {
- "_meta": {
- "agent_id": "research-467-paper-writer",
- "phase": "06_paper_writing", "round": 1,
- "started_at": "ISO", "completed_at": "ISO",
- "duration_seconds": 0, "status": "completed",
- "work_plan_path": "round_1/06_paper_writing/work_plan.md",
- "artifacts": ["outline.json", "sections/", "sections_zh/", "paper.tex", "paper_zh.tex", "references.bib", "paper.pdf", "paper_zh.pdf"]
- },
- "paper": {
- "title_en": "...",
- "title_zh": "...",
- "target_venue": "NeurIPS 2026"
- },
- "english_version": {
- "tex_path": "artifacts/paper.tex",
- "pdf_path": "artifacts/paper.pdf",
- "page_count": 9,
- "word_count": 6500,
- "reference_count": 35
- },
- "chinese_version": {
- "tex_path": "artifacts/paper_zh.tex",
- "pdf_path": "artifacts/paper_zh.pdf",
- "page_count": 9,
- "character_count": 12000
- },
- "consistency_check": {
- "tables_match": true,
- "figures_match": true,
- "references_match": true,
- "equations_match": true
- },
- "sections_summary": {
- "abstract": {"en_file": "sections/abstract.tex", "zh_file": "sections_zh/abstract.tex"},
- "introduction": {"en_file": "sections/introduction.tex", "zh_file": "sections_zh/introduction.tex"},
- "related_work": {"en_file": "sections/related_work.tex", "zh_file": "sections_zh/related_work.tex"},
- "method": {"en_file": "sections/method.tex", "zh_file": "sections_zh/method.tex"},
- "experiments": {"en_file": "sections/experiments.tex", "zh_file": "sections_zh/experiments.tex"},
- "conclusion": {"en_file": "sections/conclusion.tex", "zh_file": "sections_zh/conclusion.tex"}
- }
- }
- ```
- **${phase_dir}/report.md**: 写作过程说明,包含:
- - 论文标题(中英文)和目标会议
- - 英文版各节概要和篇幅
- - 中文版各节概要和字数
- - 中英一致性检查结果
- - 引用统计
- - 编译状态(英文 + 中文)
- - 文件索引
- 完成后返回 report.json 内容。
- outputParser: json
- guard:
- validator: "'english_version' in json.loads(x) and 'chinese_version' in json.loads(x) and '_meta' in json.loads(x)"
- retry: 3
- fallback: error
- memory:
- enabled: true
- strategy: local
- size: 50
- ttl: 7200
- rag:
- enabled: true
- source: ./knowledge/
- topK: 3
- chunkSize: 1500
- backend: chroma
- minScore: 0.25
- persistDirectory: ./.rag_cache/paper_writer
- mcp:
- onlineTool:
- latex-mcp:
- - compile_latex
- - latex_lint
- - bibtex_format
- fs-mcp:
- - read_file
- - write_file
- - list_dir
- - mkdir
- localTools:
- - terminate
- policy:
- mode: auto
- maxConcurrent: 1
- retryOnFail: 2
- app:
- mcp:
- custom:
- nodes:
- latex-mcp:
- url: "${LATEX_MCP_URL}"
- endpoint: /mcp/latex
- headers:
- Authorization: "${LATEX_MCP_TOKEN}"
- timeout: 120
- fs-mcp:
- url: "${FS_MCP_URL}"
- endpoint: /mcp/fs
- headers:
- Authorization: "${FS_MCP_TOKEN}"
- timeout: 30
|