Files
deep_research/.opencode/commands/dr-frame.md
T

217 lines
6.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: Phase 1 - 触发 dr-plan 进行深度初扫并生成双语研究框架(中文大纲 + 英文研究思路)。完成后暂停等用户确认。用法:/dr-frame [slug]
agent: dr-plan
subtask: false
---
你是 dr-plan。用户执行了 `/dr-frame $ARGUMENTS`,驱动 Phase 1 的框架规划。
## Step 1: 定位项目
- 如果 `$ARGUMENTS` 非空:用该 slug
- 为空:`ls -t projects/*/manifest.json | head -1` 找最近项目
- 项目不存在:报错"请先 /dr-init 初始化项目"
## Step 2: 前置检查
- `phase1.status` 必须是 `interview_done`
- `target_words_zh``target_words_en` 必须都存在
- `core_questions` 必须非空
- `report_title` 必须非空(v0.5 新增检查)
- `model_profile` 必须存在(v0.12 新增检查,确保全流程模型策略一致)
任一检查不通过 → 回报用户"访谈不完整",停止。
## Step 3: 加载 Skills
必读:
1. `search-strategy` — 检索策略
2. `source-quality` — 信源评级
3. `length-budget` — 字数配额(用英文词数为基准)
4. `mckinsey-method` — 结构方法论
5. `humanizer-cn` — 避免 AI 套路
## Step 4: 并行初扫(委派 dr-searcher
把主题拆成 3-4 个互补的关键词组,每组一个 dr-searcher Task。
**在同一条消息里发多个 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 模板:
```
description: "Initial scan keyword group A - <category>"
prompt: |
You are dr-searcher. Conduct Phase 1 initial scan for the topic "<topic>", focus area: <category>.
Required skills: search-strategy, source-quality
Tasks:
1. 3 rounds of search through `scripts/search.py`: scholar/patents/news/general as appropriate; Tavily/Brave/Exa MCP only as gap-fill
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)
Output format (Markdown):
## Keyword Group <A>: <category>
### Keywords Used
- English: ...
- Chinese: ...
- Routes used: scholar / patents / news / general
### Initial Sources (≥10, Tier 1-2)
1. [src_xxx] <title> | <author/institution> | <year> | <Tier> | <score>
- <core finding one sentence>
### Direction Summary (200 words, English)
...
Return as markdown directly, don't write to files.
```
**硬限制**:一次性并行发 3-4 个 Task,不要分批。
## Step 5: 汇总初扫结果
收到 3-4 个 dr-searcher 返回后:
1. 汇总到 `projects/<slug>/phase1/initial-scan.md`(中英双语,按组分节)
2. 去重
3. 按 score 排序
## Step 6: 生成双语框架(v0.5 关键升级)
基于初扫结果,生成 `projects/<slug>/phase1/framework.md`
**结构**
- **顶部元信息**:中文摘要(研究类型、目标字数、核心问题等)
- **全局论点 Central Thesis**:一句话中英双语
- **章节大纲**
- 每章用**双语标题**(中文标题 + 英文标题)
- 字数配额按英文词数(en_words),括号里附中文字数预估
- 每节的研究思路用英文写(因为 Phase 2 dr-analyst 用英文工作)
- **替代框架**:至少 2 个备选切法
### framework.md 模板
```markdown
# <报告主标题>
**副标题**<报告副标题>
## 元信息
- 研究类型:<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 章大纲,双语简述>
## 预计风险与依赖
- 关键信源可获取性风险
- 哪些章节可能因数据缺失降级
```
## 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
摘要:
- 报告主标题:<report_title>
- 副标题:<report_subtitle>
- 目标:<target_words_en> EN words / <target_words_zh> 中文字
- 章节数:N
- 全局论点:<Central Thesis EN/中文>
- 替代框架:2 个
请审核 framework.md,然后:
✅ 满意 → 回复"确认框架"
✏️ 修改 → 告诉我改什么(如"第 5 章要拆成机制和临床两块")
🔄 换视角 → 切换到备选框架 A 或 B
```
**停下来等用户反馈**
## 用户确认后
如果用户回复"确认框架":
1. 更新 `manifest.phase1.approved = true`
2. 更新 `manifest.phase1.approved_at = <ISO 时间>`
3. 告知:"Phase 1 完成。下一步:/dr-research 进入 Phase 2 英文深研。"
---
## 禁止事项
- ❌ 跳过 Step 4 的并行初扫直接凭经验写框架
- ❌ 一次委派 > 4 个 searcherAPI 限流)
- ❌ 写完 framework 就自动跑 /dr-research
- ❌ framework 中用中文写研究思路(Phase 2 是英文工作,研究思路也用英文写)
- ❌ 章节标题不给双语对照