v0.5: deep quality refactor (P0+P1+P2)

- Split dr-chief-editor (Phase 3 read-only) vs new dr-editor-in-chief (Opus, Phase 4 lead)
- New dr-translator (en->zh) and new humanizer-cn / output-hygiene / en-zh-translation skills
- Switch to English working language (Phase 2-3), final Chinese translation (Phase 4)
- /dr-init: add report title proposals + word budget mode
- /dr-frame: bilingual framework
- /dr-finalize: new chain editor->translator->polisher->reporter
- report-template.py: widows/orphans/keepWithNext, 3-color hierarchy, confidentiality banner
- dr-reporter: mandatory citations backfill + output hygiene check
- dr-pm: batch-level context compression via manifest.batches_summary
- mckinsey-method: SCQA only for Executive Summary + chapter intros (no explicit labels)
- length-budget: 4 word-budget modes + en/zh 1:1.4 ratio
This commit is contained in:
kai
2026-04-21 13:02:54 +08:00
parent 4a38f6bed1
commit a092af4398
20 changed files with 3376 additions and 1246 deletions
+159 -89
View File
@@ -1,144 +1,214 @@
---
description: Phase 1 - 触发 dr-plan 进行深度初扫并生成 8-15 章研究框架。完成后暂停等用户确认。用法:/dr-frame [slug]slug 可省略则从最近项目读取
description: Phase 1 - 触发 dr-plan 进行深度初扫并生成双语研究框架(中文大纲 + 英文研究思路)。完成后暂停等用户确认。用法:/dr-frame [slug]
agent: dr-plan
subtask: false
---
你是 dr-plan。用户执行了 `/dr-frame $ARGUMENTS`需要你驱动 Phase 1 的框架规划。
你是 dr-plan。用户执行了 `/dr-frame $ARGUMENTS`,驱动 Phase 1 的框架规划。
## 执行步骤
## Step 1: 定位项目
### 步骤 1:定位项目
- 如果 `$ARGUMENTS` 非空:用该 slug
- 为空:`ls -t projects/*/manifest.json | head -1` 找最近项目
- 项目不存在:报错"请先 /dr-init 初始化项目"
- 如果 `$ARGUMENTS` 非空:用户指定了 slug,读 `projects/$ARGUMENTS/manifest.json`
- 如果 `$ARGUMENTS` 为空:
1. `ls -t projects/*/manifest.json` 找最近修改的
2. 读其 manifest.json
- 如果 `projects/` 不存在或空:报错"请先 /dr-init 初始化项目"
## Step 2: 前置检查
### 步骤 2:前置检查
- `phase1.status` 必须是 `interview_done`(访谈完成但未生成框架)
- `target_words` 必须存在且合理
- `phase1.status` 必须是 `interview_done`
- `target_words_zh``target_words_en` 必须都存在
- `core_questions` 必须非空
- 任何检查不通过:回报用户"需要先完善访谈",停止
- `report_title` 必须非空(v0.5 新增检查)
### 步骤 3:加载 Skills
任一检查不通过 → 回报用户"访谈不完整",停止。
必须加载以下 skill(用 skill 工具):
## Step 3: 加载 Skills
必读:
1. `search-strategy` — 检索策略
2. `source-quality` — 信源评级
3. `length-budget` — 字数配额算法
4. `mckinsey-method`(如已创建;MVP 阶段可能暂无,跳过即可)
3. `length-budget` — 字数配额(用英文词数为基准)
4. `mckinsey-method` — 结构方法论
5. `humanizer-cn` — 避免 AI 套路
### 步骤 4并行初扫(委派 dr-searcher
## Step 4: 并行初扫(委派 dr-searcher
基于 `core_questions``topic`把主题拆成 3-4 个**互补的关键词组**,每组委派一个 `dr-searcher` 并行执行
把主题拆成 3-4 个互补的关键词组,每组一个 dr-searcher Task
关键词组示例(以 "GLP-1 减重药物市场" 为例):
- 组 A:科学机制(MOA、PK/PD、靶点生物学)
- 组 B:临床与监管(Phase III 数据、FDA/NMPA 审批、适应症拓展)
-C:市场与竞争(市场规模、CAGR、头部厂商、管线梯队)
-D:产业链与风险(API 供应、CDMO、副作用、支付支持)
**在同一条消息里发多个 Task 调用**(并行),不要串行等。
关键词组示例(以 "自研 O-糖苷酶立项" 为例):
-AScientific mechanism (GH101 family, endoglycosidase mechanism, Core 1/3 activity)
-BClinical and regulatory (FDA/NMPA disclosures, clinical trial registries)
- 组 CMarket and competition (market size, CAGR, competitor analysis)
- 组 DIP and supply chain (USPTO/EPO patents, CDMO capacity, supply risks)
Task 模板:
委派模板(通过 Task 工具):
```
description: "初扫关键词组 <A> - <类别>"
description: "Initial scan keyword group A - <category>"
prompt: |
你是 dr-searcher。对主题"<topic>"的**<类别>**方向做 Phase 1 初扫。
You are dr-searcher. Conduct Phase 1 initial scan for the topic "<topic>", focus area: <category>.
必读 skillsearch-strategy, source-quality
Required skills: search-strategy, source-quality
任务:
1. Tavily + Brave + Exa 各做 1 轮检索(共 3 轮)
2. 中英双语关键词各查 1 次
3. 返回 10-20 Tier 1-2 信源(评分≥6),排除 Tier 4 和黑名单
4. 对每条信源写 1-2 句提纲
5. 最后 200 字总结这个方向的核心发现
Tasks:
1. 3 rounds of search: Tavily + Brave + Exa
2. Both English and Chinese keywords
3. Return 10-20 Tier 1-2 sources (score ≥6), exclude Tier 4 and blacklist
4. 1-2 sentence outline per source
5. 200-word summary of this direction's core findings (in English)
产出格式(Markdown):
## 关键词组 <A><类别>
### 使用的关键词
### 初扫信源(≥10 条,Tier 1-2
### 方向小结(200 字)
Output format (Markdown):
## Keyword Group <A>: <category>
### Keywords Used
- English: ...
- Chinese: ...
### Initial Sources (≥10, Tier 1-2)
1. [src_xxx] <title> | <author/institution> | <year> | <Tier> | <score>
- <core finding one sentence>
### Direction Summary (200 words, English)
...
不要写入文件,直接把 markdown 返回给调用者。
Return as markdown directly, don't write to files.
```
**关键** 3-4 个 Task 工具调用并行发出去(在同一条消息里),不要串行等
**硬限制**一次性并行发 3-4 个 Task,不要分批
### 步骤 5汇总初扫结果
## Step 5: 汇总初扫结果
收到 4 个 dr-searcher 返回后:
1. 汇总所有信源到一份 initial-scan.md
2. 去重(同一论文 / 同一 URL
3. 写入 `projects/<slug>/phase1/initial-scan.md`
收到 3-4 个 dr-searcher 返回后:
1. 汇总`projects/<slug>/phase1/initial-scan.md`(中英双语,按组分节)
2. 去重
3. 按 score 排序
### 步骤 6:生成框架
## Step 6: 生成双语框架(v0.5 关键升级)
**这是你最核心的创造性工作**。基于初扫结果:
基于初扫结果,生成 `projects/<slug>/phase1/framework.md`
1. **发散**先列 15-20 个可能的 chapter 候选(用列表思维,不要先收敛)
2. **归类**:按 MECE 原则合并同类,剪掉边缘
3. **收敛到 8-15 章**
4. **字数配额**:按 `length-budget` skill 的算法,给每章分字数
5. **标题观点化**:每个 chapter 和 section 的标题必须是**一个判断**,而非"概述/现状/背景"
- ❌ "第 2 章 GLP-1 的研究现状"
- ✅ "第 2 章 GLP-1 正在经历从降糖药到体重管理平台的结构性跃迁"
6. **研究思路**:每个 section 下标注核心问题、初步假设、预期信源
7. **替代框架**:提供至少 2 个备选切法(不同视角,如"按技术路线"vs"按竞争格局"
**结构**
- **顶部元信息**:中文摘要(研究类型、目标字数、核心问题等)
- **全局论点 Central Thesis**:一句话中英双语
- **章节大纲**
- 每章用**双语标题**(中文标题 + 英文标题)
- 字数配额按英文词数(en_words),括号里附中文字数预估
- 每节的研究思路用英文写(因为 Phase 2 dr-analyst 用英文工作)
- **替代框架**:至少 2 个备选切法
写入 `projects/<slug>/phase1/framework.md`,格式见 dr-plan.md agent 定义中的"输出格式约定"。
### framework.md 模板
### 步骤 7:更新 manifest
```markdown
# <报告主标题>
修改 `projects/<slug>/manifest.json`
```
phase1.status = "framework_generated"
phase1.framework_path = "projects/<slug>/phase1/framework.md"
phase1.chapter_count = <章节数>
phase1.chapter_quotas = [<每章配额>]
**副标题**<报告副标题>
## 元信息
- 研究类型:<type>
- 字数模式:<word_budget_mode>
- 目标字数:<target_words_en> EN / <target_words_zh> ZH
- 核心受众:<audience>
- 时间范围:<time_range>
- 地理范围:<geography>
- 核心问题(中文):
1. ...
2. ...
- Core Questions (English):
1. ...
2. ...
- 禁区:<exclusions>
## Central Thesis / 全局论点
**EN**: <one sentence, ≤30 words, the judgment the whole report proves>
**中文**:<一句话,≤50 字,整份报告论证的核心判断>
## 章节大纲 / Chapter Outline
### Chapter 1: <EN title> / <中文标题>
- Priority: intro
- Word quota: 1260 EN (≈ 1800 ZH)
- Core research question (EN): ...
- Preliminary hypothesis (EN): ...
- Expected sources: ...
- **1.1** <EN section title> / <中文>
- Research thinking (EN): ...
- **1.2** <EN section title> / <中文>
- Research thinking (EN): ...
### Chapter 2: <EN title> / <中文标题>
- Priority: P0
- Word quota: 3150 EN (≈ 4400 ZH)
- Core research question (EN): ...
- **2.1** <...>
...
## 替代框架 / Alternative Frameworks
> 如果用户不接受主方案:
### Alternative A: 按技术路线组织 (Technology-path organization)
<3-5 章大纲,双语简述>
### Alternative B: 按竞争对象分章 (Competitor-focused organization)
<3-5 章大纲,双语简述>
## 预计风险与依赖
- 关键信源可获取性风险
- 哪些章节可能因数据缺失降级
```
### 步骤 8:暂停等确认
## Step 7: 更新 manifest
```json
{
"phase1": {
"status": "framework_generated",
"framework_path": "projects/<slug>/phase1/framework.md",
"chapter_count": N,
"chapter_quotas_en": [
{"index": 1, "title_en": "...", "title_zh": "...", "en_words": 1260, "priority": "intro"},
{"index": 2, "title_en": "...", "title_zh": "...", "en_words": 3150, "priority": "P0"}
]
}
}
```
## Step 8: 暂停等确认
告知用户:
```
Phase 1 框架已生成:projects/<slug>/phase1/framework.md
📊 摘要:
- 总字数目标:X 字
摘要:
- 报告主标题:<report_title>
- 副标题:<report_subtitle>
- 目标:<target_words_en> EN words / <target_words_zh> 中文字
- 章节数:N
- 全局论点:<central thesis>
- 替代框架:已提供 2 个备选切法
- 全局论点:<Central Thesis EN/中文>
- 替代框架:2 个
请审核 framework.md,然后:
✅ 满意 → 在对话中回复"确认框架",我会把 manifest.phase1.approved 置为 true
✏️ 需要修改 → 直接告诉我改什么(如"第 5 章要拆成机制和临床两块")
🔄 换视角 → 让我切换到备选框架 BC
✅ 满意 → 回复"确认框架"
✏️ 修改 → 告诉我改什么(如"第 5 章要拆成机制和临床两块")
🔄 换视角 → 切换到备选框架 AB
```
**然后停下来等用户反馈**,不要自动进入 Phase 2
**停下来等用户反馈**
---
## 用户确认后
## 用户确认后的处理
如果用户回复"确认框架"(或类似同意表达):
如果用户回复"确认框架":
1. 更新 `manifest.phase1.approved = true`
2. 更新 `manifest.phase1.approved_at = <ISO 时间>`
3. 告知:"Phase 1 完成,可运行 /dr-research 进入 Phase 2 深度研究。"
如果用户要改:
- 局部改:直接 edit framework.md
- 大改:重新跑步骤 6
- 换视角:把备选框架换到主位置
3. 告知:"Phase 1 完成。下一步:/dr-research 进入 Phase 2 英文深研。"
---
## 禁止事项
-不要跳过步骤 4 的并行初扫直接凭经验写框架
-不要一次委派 > 4 个 searcherAPI 限流风险
-不要写完 framework 就自动跑 /dr-research
- 不要在 framework.md 里写整章的正文内容(那是 Phase 2 的事
-跳过 Step 4 的并行初扫直接凭经验写框架
- ❌ 一次委派 > 4 个 searcherAPI 限流)
- ❌ 写完 framework 就自动跑 /dr-research
- ❌ framework 中用中文写研究思路(Phase 2 是英文工作,研究思路也用英文写
- ❌ 章节标题不给双语对照