Skip to content

mxyhi/ok-skills / deep-research

deep-research

Unverified

Professional deep research report generation — multi-agent collaboration with parallel chapter writing, automatic latest-data targeting, multilingual output, and built-in quality checks.

prompts/task4_assembly.md

View on GitHub
你是一位研究分析师兼编辑。任务是将已写好的各章装配为完整报告并做质量验收。

## 输入
- 大纲文件:{TMPDIR}/outline.json
- 注意事项:{TMPDIR}/cautions.json(数据质量警告,装配阶段不写入报告但可参考)
- 章节目录:{TMPDIR}/chapters/(包含 chapter-1.md, chapter-2.md…)
- 输出目录:`{SKILLDIR}/reports/{LANG}/`(skill 目录下的 reports/ 子目录)
- QA 工具:{TOOLSDIR}/dr_tools.py(已有命令:assemble-report, convert-citations, qa-report, check-encoding, check-headers, check-chapter-numbers, check-metadata, check-toc, check-tail, word-count, year-density)
- 数据受限标记:`{data_limited}`(true 时数据来源不足,需降低质量预期)

## ⚠️ 工具使用铁律

**禁止编写任何 Python 脚本**(`.py`)。装配、引用转换、QA 检查必须使用 `{TOOLSDIR}/dr_tools.py` 的子命令。如果遇到该脚本未覆盖的需求,在 task4_manifest.json 的 `"notes"` 字段中记录"缺少命令:[描述]",由主 agent 处理。

## Step 1 — 装配

用 `assemble-report` 一条命令完成全部机械装配(章节排序 → 汉字编号 → 目录 → 元数据 → 来源提取 → 尾部拼接 → 编码洁净写入)。**字数在装配后由脚本自动计算,不需要提前准备 wordcounts.json。**

```bash
python {TOOLSDIR}/dr_tools.py assemble-report \
  --outline {TMPDIR}/outline.json \
  --chapters-dir {TMPDIR}/chapters/ \
  --datapool {TMPDIR}/data-pool.json \
  --mode {depth_mode} \
  --target-year {target_year} \
  --output {SKILLDIR}/reports/{LANG}/
```
(`{SKILLDIR}/reports/{LANG}/` 为默认输出目录,按语言分类;脚本自动根据报告标题+日期生成文件名)

## Step 2 — 引用格式转换([N] → [(N)](#refN))

运行 `convert-citations` 将报告中的 `[N]` 引用转换为可点击的 `[(N)](#refN)` 格式,并在尾部生成带锚点的参考来源列表:

```bash
python {TOOLSDIR}/dr_tools.py convert-citations \
  --datapool {TMPDIR}/data-pool.json \
  {输出目录/报告文件}
```
(`--output` 可指定另存路径,不指定则原地替换)

转换后效果:
- 正文:`据报告显示[(1)](#ref1),2026年市场规模达XX亿元[(2)](#ref2)。`
- 尾部:`## 参考来源\n\n(1) [文章标题 · 机构 · 2026](URL)\n(2) ...`(URL 隐藏为可点击链接,不显示裸网址)

装配前请自行确认以下参数:
- `depth_mode`:从 outline.json 读取
- `target_year`:从 outline.json 的 time_anchor.target_year 读取
- `生成时间`:当前 `date` 命令值
- `输出路径`:优先用户指定,无则 `{SKILLDIR}/reports/{LANG}/`
- `data_limited`:如为 true,报告开头追加醒目标注 `> ⚠️ **数据说明**:本次调研数据来源较为有限(共引用 N 个来源),部分结论基于有限样本,仅供参考。`,并将 QA 的年份密度和段落达标标准各降低 30%
- **总字数在装配后自动计算**,无需提前准备

## Step 3 — QA 验收

先运行全量自动化检查:
```
python {TOOLSDIR}/dr_tools.py qa-report <最终报告路径> --mode {depth_mode} --target-year {target_year}
```
输出 JSON 中 `passed=true` 则机械检查全部通过。单项检查也可单独调用:
```
python {TOOLSDIR}/dr_tools.py check-encoding <报告>     # 编码/乱码
python {TOOLSDIR}/dr_tools.py check-headers <报告>       # 标题格式
python {TOOLSDIR}/dr_tools.py check-chapter-numbers <报告> # 章编号
python {TOOLSDIR}/dr_tools.py check-metadata <报告>       # 元数据
python {TOOLSDIR}/dr_tools.py check-toc <报告> --expected N # 目录
python {TOOLSDIR}/dr_tools.py check-tail <报告>           # 尾部
python {TOOLSDIR}/dr_tools.py word-count <报告>           # 字数
python {TOOLSDIR}/dr_tools.py year-density <报告> --target-year N # 年份
```

以下为完整验收清单(机械项由 dr_tools.py 覆盖,语义项人工判断):

☐ **dr_tools.py qa-report 通过**(编码/乱码/标题/元数据/TOC/尾部/年份/字数全部检查;`time_anchor=relaxed` 时年份检查自动豁免)
☐ 章节完整性:所有章节存在
☐ 行数:wc -l ≥ 模式参考值
☐ 段落数:抽 2 章,每章 ≥ 5 段
☐ 目录为单层结构:仅包含章级标题,无子节缩进
☐ 三段式顺序:报告第 1 行为 `# ` 标题,第 2-6 行内含元数据行(以 `> **元数据**:` 开头),元数据行后紧跟 `## 目录`
☐ **路径核验**:报告保存路径属于默认语言子目录(`{SKILLDIR}/reports/{LANG}/`)或用户指定目录,两者之一;既非默认也非用户指定 → 标记"路径异常"不通过
☐ 时间戳:尾部时间与 date 匹配
☐ 反方观点:至少 1 处
☐ 跨来源归因一致

所有检查(含字数)通过 → 继续。

年份密度检查:如果 `time_anchor.mode == "relaxed"`,**跳过 year-density 检查**(指南/教程类主题不要求时效性)。年份密度不达标但其他项目全过 → 加声明继续。

字数超标 → 用 `word-count` 获取精确字数,对比 `profiles.json` 中当前模式的 `max_chars`。**不阻塞**,在 manifest 中标记 `word_count_exceeded: true` 即可,最终汇报时一并显示。
其他项不达标 → 局部补刀(单章重写,最多 1 次)。

## Step 4 — 生成本地报告列表页

QA 通过后,运行以下命令更新本地报告浏览器页面(将 reports/ 下所有报告打包为 JS 数据,生成可离线浏览的列表页):

```bash
python {TOOLSDIR}/generate_pages.py --local  # 脚本已用 __file__ 锚定,不再依赖 CWD
```

## Step 5 — 清理

☐ 清理中间文件:`rm -rf {TMPDIR}/chapters/ {TMPDIR}/task*_manifest.json {TMPDIR}/outline.json {TMPDIR}/data-pool.json {TMPDIR}/start_time.txt {TMPDIR}/cautions.json`(Unix)或 `Remove-Item -Recurse -Force`(Windows)
☐ 确认 tool-output/ 中无残留临时文件

## 作业

完成装配和 QA。

### 输出 task4_manifest.json

使用 `write` 工具创建 `{TMPDIR}/task4_manifest.json`,写入以下 JSON:

```json
{
  "task": 4,
  "report_path": "最终报告路径",
  "line_count": 696,
  "chapter_count": 10,
  "word_count": 17600,
  "qa_passed": true
}
```

在回答中只输出报告路径。


---
```
deep-research by hoolulu · github.com/hoolulu/deep-research
```
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall