v0.6: deprecate dr-translator/polisher agents, rewire /dr-finalize to Python pipeline
\u6765\u5b8c\u6210 v0.6 \u67b6\u6784\u53d8\u66f4\u7684\u6700\u540e\u4e00\u7247\u62fc\u56fe\uff1a - dr-translator.md / dr-polisher.md \u6807\u8bb0 [DEPRECATED v0.6]\uff0c\u6743\u9650\u5168\u90e8 deny\uff0c\u4fdd\u7559\u6587\u4ef6\u4f5c\u5386\u53f2\u53c2\u8003 - dr-editor-in-chief.md \u91cd\u6784\uff1a\u79fb\u9664 dr-translator/dr-polisher/dr-reporter \u7684 Task \u8c03\u7528\u6743\u9650\uff0c\u6539\u4e3a bash \u8c03 Python \u811a\u672c\uff1b\u65b0\u589e "uv run *" / "bash scripts/*" bash \u767d\u540d\u5355 - /dr-finalize command \u91cd\u5199\uff1a9 \u6b65\u6d41\u7a0b\uff08\u5408\u5e76\u82f1\u6587 \u2192 translate \u2192 build_glossary \u2192 apply_glossary \u2192 polish \u2192 build_report\uff09 - PLAN.md \u00a712 \u8865 v0.6 \u5b8c\u6574\u53d8\u66f4\u8bb0\u5f55\uff08\u6839\u56e0\u3001\u65b0\u589e\u811a\u672c\u3001PDF \u6a21\u677f\u4fee\u590d\u3001\u5b9e\u6d4b\u7ed3\u679c\u3001\u5df2\u77e5\u9650\u5236\u3001\u5f85\u529e\u4e8b\u9879\uff09 v0.6 \u6838\u5fc3\u4ef7\u503c\uff1a\u5f7b\u5e95\u89e3\u51b3 Phase 4 LLM agent output token \u8d85\u9650\u95ee\u9898\uff08dr-translator v0.5.2 \u591a\u8f6e\u5361\u6b7b\u7684\u6839\u56e0\uff09\uff0c\u540c\u65f6\u901a\u8fc7 build_glossary \u5f15\u5165\u4e8b\u5b9e\u6838\u67e5\u80fd\u529b\uff0c\u53d1\u73b0\u5e76\u81ea\u52a8\u4fee\u6b63\u4e86\u591a\u5904\u8f6f\u4e8b\u5b9e\u9519\u8bef\uff08Mabwell \u62fc\u5199\u3001\u516c\u53f8\u4e2d\u6587\u8bd1\u540d\u8bef\u7528\uff09\u3002 Co-authored-by: User <human>
This commit is contained in:
@@ -1,41 +1,95 @@
|
||||
---
|
||||
description: Phase 4 - 成稿。由 dr-editor-in-chief(Opus)入口,链路:合并英文 final_en → dr-translator 译中 → dr-polisher 润色去 AI 味 → dr-reporter 出 PDF+DOCX。用法:/dr-finalize [slug]
|
||||
description: Phase 4 - 成稿(v0.6)。dr-editor-in-chief 写 ES/Abstract/Glossary,然后调 Python 脚本链路:translate → build_glossary → apply_glossary → polish → build_report。用法:/dr-finalize [slug]
|
||||
agent: dr-editor-in-chief
|
||||
---
|
||||
|
||||
你是 dr-editor-in-chief。用户执行了 `/dr-finalize $ARGUMENTS`,进入 Phase 4 成稿链路。
|
||||
你是 dr-editor-in-chief。用户执行了 `/dr-finalize $ARGUMENTS`,进入 Phase 4 成稿链路(v0.6 架构)。
|
||||
|
||||
## 架构变更说明(v0.6)
|
||||
|
||||
**Phase 4 的翻译/润色/出稿已从 LLM agent 改为 Python 脚本**。原因:
|
||||
- LLM agent 一次性处理整篇报告(19k+ 词)会超 Sonnet output token 上限(~32k),不稳定
|
||||
- Python 脚本按 H2 section 切块循环调用 LLM,每块独立,100% 稳定,支持断点续传
|
||||
|
||||
你仍负责**创作性工作**:合并章节、写 Executive Summary / Abstract / Glossary。其余机械工作全部交给脚本。
|
||||
|
||||
## Step 1: 定位项目与健康检查
|
||||
|
||||
- 如果 `$ARGUMENTS` 非空:用该 slug
|
||||
- 为空:取最近项目
|
||||
- `$ARGUMENTS` 非空:用该 slug
|
||||
- 空:取最近项目
|
||||
|
||||
读取 `projects/<slug>/manifest.json`,验证:
|
||||
读取 `projects/<slug>/manifest.json`:
|
||||
- `phase2.status == "completed"`
|
||||
- `phase3.approved == true`(如 phase3 从未跑过,询问用户是否跳过审校直接出稿)
|
||||
- `phase3/critique.md` 存在且 Must-Fix 问题已清零
|
||||
- `phase3.approved == true`(如跳过审校,询问用户确认)
|
||||
|
||||
如果条件不满足,告知用户并停止。
|
||||
## Step 2: 合并英文稿 + 原创写作(LLM 工作)
|
||||
|
||||
## Step 2: 按 dr-editor-in-chief 自身工作流执行
|
||||
加载 skills:`mckinsey-method` / `output-hygiene` / `length-budget`。
|
||||
|
||||
完整按照 `.opencode/agents/dr-editor-in-chief.md` 中定义的 11 步工作流执行:
|
||||
按 `.opencode/agents/dr-editor-in-chief.md` §Step 3-7 的方式:
|
||||
1. 合并 `phase2/drafts/ch01.md...chN.md` → `phase4/final_en.md`
|
||||
2. 写 Executive Summary(800-1000 英文词,融合式 SCQA)
|
||||
3. 写 Abstract(500-600 英文词)
|
||||
4. 写 Glossary(双语对照表,按字母序)
|
||||
5. 插入占位符:
|
||||
- `## Table of Contents\n\n[TOC will be generated at final rendering.]`
|
||||
- `## References\n\n[REFERENCES will be filled by rendering step from sources.jsonl.]`
|
||||
|
||||
1. 健康检查
|
||||
2. 加载 skills(mckinsey-method, output-hygiene, length-budget, humanizer-cn)
|
||||
3. 合并英文 final_en.md(包括 Executive Summary / Abstract / Glossary 原创撰写)
|
||||
4. Executive Summary 写作(800-1000 英文词,融合式 SCQA)
|
||||
5. Abstract 写作(500-600 英文词,叙事式)
|
||||
6. Glossary 写作(双语对照)
|
||||
7. 合并章节(禁止改写,仅清理元数据泄漏)
|
||||
8. 委派 dr-translator → 生成 final_zh.md + glossary.json
|
||||
9. 委派 dr-polisher → 润色 final_zh.md(去 AI 味 + 卫生检查)
|
||||
10. 委派 dr-reporter → 生成 final.pdf + final.docx(强制回填 citations)
|
||||
11. 收官汇报
|
||||
**禁止**:
|
||||
- 改写 dr-analyst 写好的章节正文
|
||||
- 给每章强加 SCQA 或小节标题
|
||||
- 保留调度元数据(字数配额/研究员/quota 等)
|
||||
|
||||
## Step 3: 更新 manifest
|
||||
## Step 3: 翻译(Python 脚本)
|
||||
|
||||
```bash
|
||||
uv run python scripts/translate.py <slug>
|
||||
```
|
||||
|
||||
完成条件:`phase4/final_zh.md` 生成且字数 ≥ 目标字数的 90%。如未达标,`--force` 强制重跑。
|
||||
|
||||
## Step 4: 术语表核查(强烈推荐)
|
||||
|
||||
```bash
|
||||
uv run python scripts/build_glossary.py <slug> --workers 4
|
||||
```
|
||||
|
||||
完成后查看 `phase4/glossary.json`:
|
||||
- `confidence == "high"` 且 `issue` 非空的条目:说明发现了错误,需要回塑到正文
|
||||
- 关注公司名 / 机构名 / 产品名类,它们最容易有拼写错误
|
||||
|
||||
## Step 5: 应用术语修正(Python 脚本)
|
||||
|
||||
```bash
|
||||
# 先预览
|
||||
uv run python scripts/apply_glossary.py <slug> --dry-run
|
||||
|
||||
# 确认无误后应用
|
||||
uv run python scripts/apply_glossary.py <slug>
|
||||
```
|
||||
|
||||
这会把 glossary 中发现的拼写错误 / 错译直接替换进 `final_zh.md`。
|
||||
|
||||
## Step 6: 润色(Python 脚本)
|
||||
|
||||
```bash
|
||||
uv run python scripts/polish.py <slug>
|
||||
```
|
||||
|
||||
输出:`phase4/final_zh_polished.md`。查看 `phase4/polish_notes.jsonl` 了解模型标记的异常点。
|
||||
|
||||
## Step 7: 出稿(Python 脚本)
|
||||
|
||||
```bash
|
||||
uv run python scripts/build_report.py <slug>
|
||||
```
|
||||
|
||||
自动:
|
||||
- 按 `manifest.report_title` 命名输出(`<Title>.pdf` + `<Title>.docx`)
|
||||
- PDF 自动插 TOC + 从 `phase2/sources.jsonl` 生成参考文献
|
||||
|
||||
## Step 8: 更新 manifest
|
||||
|
||||
Phase 4 完成后更新:
|
||||
```json
|
||||
{
|
||||
"phase4": {
|
||||
@@ -44,36 +98,38 @@ Phase 4 完成后更新:
|
||||
"completed_at": "...",
|
||||
"word_count_en": X,
|
||||
"word_count_zh": X,
|
||||
"citations_count": X,
|
||||
"glossary_terms": X,
|
||||
"glossary_corrections_applied": X,
|
||||
"pages_pdf": X,
|
||||
"files": {
|
||||
"final_en_md": "projects/<slug>/phase4/final_en.md",
|
||||
"final_zh_md": "projects/<slug>/phase4/final_zh.md",
|
||||
"final_pdf": "projects/<slug>/phase4/final.pdf",
|
||||
"final_docx": "projects/<slug>/phase4/final.docx",
|
||||
"citations_md": "projects/<slug>/phase4/citations.md",
|
||||
"glossary_json": "projects/<slug>/phase4/glossary.json"
|
||||
"final_en_md": "phase4/final_en.md",
|
||||
"final_zh_md": "phase4/final_zh.md",
|
||||
"final_zh_polished_md": "phase4/final_zh_polished.md",
|
||||
"glossary_json": "phase4/glossary.json",
|
||||
"pdf": "phase4/<Title>.pdf",
|
||||
"docx": "phase4/<Title>.docx"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Step 4: 汇报
|
||||
## Step 9: 汇报
|
||||
|
||||
向用户展示最终产出清单。
|
||||
|
||||
---
|
||||
|
||||
## 关键提示
|
||||
|
||||
- **不要给每章强加 SCQA**(这是 v0.4 的错误,v0.5 重写)
|
||||
- **元数据清理是 dr-polisher 的事**,dr-editor-in-chief 只需在合并时不引入新的元数据泄漏
|
||||
- **参考文献回填是 dr-reporter 的事**,但 dr-editor-in-chief 在 final_en.md 里留占位符 `[To be filled by dr-reporter]`,提示后续步骤
|
||||
向用户展示:
|
||||
- 各阶段耗时和成本
|
||||
- glossary 核查发现的问题数 + 自动修复数
|
||||
- PDF 页数 / 文件大小
|
||||
- 如有 low-confidence 术语,提示人工复核
|
||||
|
||||
## 失败处理
|
||||
|
||||
如果任一 subagent 返回失败:
|
||||
- dr-translator 失败 → 检查 final_en.md 是否完整,重新委派
|
||||
- dr-polisher 卫生检查不通过 → 再跑一轮润色,最多 3 轮
|
||||
- dr-reporter 参考文献完整性校验失败 → 抛回排查 sources.jsonl 与 final.md 的引用一致性
|
||||
- translate.py 中断:直接重跑(断点续传)
|
||||
- build_glossary 大量失败:通常是代理/网络问题,降 workers 到 3 重跑
|
||||
- polish.py 某块失败:用 `--only N,M` 单独重跑
|
||||
- build_report 参考文献缺失:查看 warning 列表,补 sources.jsonl
|
||||
|
||||
每次重试都更新 manifest.phase4 的 retry_count 字段。
|
||||
## 关键提示(不变)
|
||||
|
||||
- **不要给每章强加 SCQA**(v0.4 老问题)
|
||||
- **元数据清理是合并阶段的事**,不要把章节 frontmatter 或 quota 带进 final_en.md
|
||||
- **Exa 在 macOS + Clash socks 代理下需要 `trust_env=False`**(已在 SearchClient 处理)
|
||||
|
||||
Reference in New Issue
Block a user