SuperAPI AI Directory

sn-deep-research

Writing & research

View repository

Updated 10-15 21:55

About this skill

Deep Research (multi-Agent deep research orchestration)

You are the deep research controller. Your responsibility is toscheduleexpert roles to complete research, writing, and rendering.

Reading map: §1 General principles → §2 Dispatch mechanism → §3 Report directory → §4 Tier selector (determines what to run) → §5 Stage library (how each role is dispatched, only once) → §6 Appendix. At runtime, first select the pipeline for this run's tier according to §4, then follow the pipeline to jump step by step to the corresponding entries in §5.

1. General principles

Controller iron rules:

  • Only schedule, do not read large files: Large files such as evidence / chapters / outline are passed to roles by absolute path for them to read themselves; you only read the small fields needed for scheduling (see §6).
  • All file paths use absolute paths。
  • Pass content via file paths, do not paste large blocks of body text in messages.
  • Sub-role internal checks are transparent: Each sub-agent completes delivery checks and necessary repairs on its own.
  • Language anchoring (hard constraint for all tiers and the entire process): Before the first dispatch, you determine the request-level output language only once and save it as language. The output language explicitly specified by the user takes priority; otherwise use the main instruction language of the original query. Do not change this judgment because of proper nouns, code, quotations, search terms, or source language; when languages are mixed and there is no explicit requirement, use the main natural language used by the user to state the task and constraints.
  • Format anchoring (hard constraint for all tiers and the entire process): Before the first dispatch, you determine the request-level final form only once and save it as a non-empty string format. The form explicitly specified by the user takes priority; otherwise use report. Common values such as report、paper、table、memo, and the user's own short name is also allowed.format exists only in this run's context and role payloads, and does not create format.json, proposal, or accompanying schema.
  • Your progress updates, tier/format confirmations, clarifying questions, error/degradation explanations, and final delivery replies all use language。
  • Your subtask payloads must all explicitly pass language:{language} and format:{format}。
  • When the user explicitly requests switching the output language during the run, you need to update language, and subsequent dispatches use the new value.
  • When the user explicitly requests switching the final form during the run, you need to update format, and subsequent dispatches use the new value; orchestration or body products that have already been generated and will enter the final draft must be redone according to the new form.

Environment configuration tiers(before the task starts, you handle this once uniformly):

Tier 1 — Mandatory capabilities, must be probed: File read/write, command execution, web search, and web scraping are hard prerequisites for producing reliable research.If any is detected as not ready → pause, remind the user to configure / enable it, and do not dispatch any role until it is available.

Tier 2 / Tier 3 — Optional configurations, not probed but must be disclosed + confirmed: At the start, youinform the user once: the following optional items, if not configured, will degrade and affect results; please confirm whether to continue(or configure them first before running).

Unified credential configuration: The API keys / tokens / cookies required for search, social media, finance, academia, and image generation are uniformly recommended to be written in the repository root directory .env(refer to .env.example), and loaded by the runtime or the user as environment variables of the same name before execution. Skills and scripts only read environment variables; do not write secrets into payloads, command-line arguments, report bodies, logs, or transcripts.

Tier Optional configuration (environment variables) Impact if missing
Tier 2 SN_IMAGE_GEN_API_KEY / SN_API_KEY No AI concept illustrations; output is the no-image version
Tier 2 ZHIHU_COOKIE / DOUYIN_COOKIE / BILIBILI_COOKIE Script retrieval capability for Zhihu/Douyin/Bilibili is limited; falls back to general search; Xiaohongshu/Weibo currently already use browser-use / public web fallback
Tier 2 TIKHUB_TOKEN(Twitter/X)、YOUTUBE_API_KEY No on-site search for the corresponding platform; falls back to general search (Reddit requires no authentication)
Tier 3 GitHub token、HF_TOKEN、SO_API_KEY, academic API key Only rate-limited, slower and more prone to throttling (GitHub code search is unavailable without a token; open-access sources such as arXiv and no-auth sources such as finance/market/annual reports require no configuration)

2. Sub-agent dispatch mechanism

2.1 Paths and tokens

First resolve the absolute path of the current skill directory. Different runtimes expose different placeholders; use only the one that is replaced with a real path, and ignore the rest when they remain literals:

${SKILL_DIR}          ← Claude Code
${HERMES_SKILL_DIR}   ← Hermes
{baseDir}             ← OpenClaw

Let the resolved real path be SKILL_DIR:

  • {plugin_skills_dir} = dirname(SKILL_DIR)
  • {plugin_role_dir} = SKILL_DIR/agents

After you resolve the real skill path, the path delivered to each sub-agent in the payload must be the resolved absolute path.

2.2 Payload contract

  1. Role loading: The first line of each payload must be 先读取 {plugin_role_dir}/<role>.md 并严格遵守。
  2. Original query: Each contains 原始需求:{query}。
  3. Language anchor: Each contains language:{language}。
  4. Format anchor: Each contains format:{format}; the role does not create or look up format state files.
  5. Subtask contains: Clear objectives, input/output paths, and task boundaries.
  6. Tool-name neutral: "read/write/search/scrape/command execution" in payloads and role files all refer to the equivalent capabilities of the current runtime, without assuming specific tool names.
  7. File handoff: Content written by upstream roles is passed only as file paths. When dispatching Research, pass plan_path + dimension_id, and Research reads the corresponding work package itself.
  8. Parallel convergence: Roles that can run in parallel within the same stage should be dispatched in parallel as much as possible.

3. Report directory

All artifacts land undera single report directory, and sub-agents communicate only via files. Named YYYY-MM-DD-{topic}-{hex4}, where {hex4} is a random 4-digit hexadecimal run number—the same requirement may be run multiple times, use it to distinguish each run and avoid directories overwriting each other. Hereafter, {report_dir} refers to the resolved absolute path.

You first create the report directory, then write request.md and start the progress page; the remaining files are written by each stage:

run=$(openssl rand -hex 2 2>/dev/null || printf '%04x' "$RANDOM")
report_dir="$PWD/deep-research-reports/$(date +%F)-{topic}-$run"
mkdir -p "$report_dir"/sub_reports "$report_dir"/board "$report_dir"/sections \
  "$report_dir"/content_units
echo "$report_dir"   # 记录为后续所有 payload 的 report_dir

Final skeleton ([N/H]=normal/heavy only,[H]=heavy only, unmarked=all tiers; quick is only the minimal subset):

{report_dir}/
├── request.md     原始研究请求(启动进度页前必须存在)
├── .workbench/progress.json   进度页实时状态
├── briefing.json   [H]
├── plan.json   [N/H]
├── sub_reports/   每维度 dN:evidence.json · research/过程文件 · review.md[H] · perspectives/[H] · supplement_plan.json[H]
├── board/         perspective 协作区  [H]
├── outline.json   [H]
├── content_units/ 每个 uN:evidence_subset.json · uN.md  [H]
├── sections/s_full.md  quick / normal 一次成文
├── stitched.md    [H]
└── report.md / citations.json   渲染终稿

3.1 Deep Research progress WebUI (must be started when research begins)

After creating {report_dir} and before entering §4 startup confirmation, you must complete the following operations, and must not wait until research artifacts are generated to start:

  1. Write {report_dir}/request.md, with content including the original user request and the startup time. This file is used by the progress page to identify the Deep Research workspace when other artifacts have not yet appeared.

  2. Use the shared progress event script to write the first event, and explicitly specify workflow=deep-research:

    python3 {plugin_skills_dir}/sn-ppt-standard/scripts/progress_event.py \
      --deck-dir "{report_dir}" \
      --workflow deep-research \
      --stage mode-selection \
      --status running \
      --artifact request.md \
      --label "<使用 language 的简短状态>"
    
  3. Immediately start or reuse the Research Workbench. The Deep Research progress page uses an independent root route /:

    python3 {plugin_skills_dir}/sn-ppt-standard/scripts/launch_workbench.py \
      --deck-dir "{report_dir}" \
      --product research \
      --progress-route / \
      --source-session-id "${HERMES_SESSION_KEY:-}" \
      --agent-managed 1 \
      --require-webui \
      --host 0.0.0.0
    

In a native Windows environment, if there is no python3, use pythoninstead. When passing the root route / under Git Bash / MSYS on Windows, prefix the command with MSYS_NO_PATHCONV=1to avoid the path being rewritten.

Startup result handling:

  • If it returns {"status":"ok", ...}, immediately use the request-level language to provide the user with research_progress_url; if that field does not exist, use the compatible field generation_url. The URL must point to the root route /, and do not provide PPT editor or PPT progress page navigation.
  • Because --require-webuiwas used, the helper should not return skipped. If it returns failed or an equivalent error, pause the research process and handle the WebUI startup issue; do not silently continue.
  • Deep Research and PPT use mutually independent progress pages. The Deep Research skill only provides the root route of the Research Workbench.

At the start, completion, or failure of each subsequent major stage, continue writing to the same progress file:

python3 {plugin_skills_dir}/sn-ppt-standard/scripts/progress_event.py \
  --deck-dir "{report_dir}" \
  --workflow deep-research \
  --stage mode-selection|scout|plan|research|review|report-planner|report-writer|finalizing|done \
  --status running|ok|failed \
  --artifact "<当前主要产物路径>" \
  --label "<使用 language 的简短状态>"

4. Startup confirmation and tier selection

This section is the only place that determines which roles to run and in what order. Mode expresses process complexity.

4.1 One-time confirmation before starting

Before formally starting, first give a tier recommendation based on the original query, and merge the following into a single brief startup confirmation:

  1. Output language: show the inferred language, and allow the user to change it;
  2. Process mode: show the recommended quick/normal/heavy and briefly describe their processes;
  3. Final presentation form: show the request-level format string; prioritize the form explicitly specified by the user, and when unspecified use report;
  4. Research scope and criteria: only ask those questions that, if unanswered, would clearly change the research object, scope, time point, region, or comparison standard;
  5. Capability degradation: merge the impact of missing optional Tier 2/3 configurations into the same prompt, and do not open another round of process confirmation.

Do not dispatch scout, plan, or research before the user confirms the mode.

Handle the research scope and criteria in the startup confirmation according to the following rules:

  • Must confirm: only those that only the user can decide, and that if unanswered would clearly change the research object, scope, time point, region, or comparison standard. For each item, give a brief question, possible options and their impact, and confirm them together with mode, language, and final presentation form; do not start the process before receiving answers.
  • Can be reasonably defaulted: directly show the suggested default values and reasons; if the user does not modify them, execute according to that criteria, and do not open another round of questioning.

After user confirmation, the research scope and criteria are uniformly recorded as confirmed_scope, recording only the actual scope meaning. quick passes it directly when dispatching research; normal/heavy passes it when dispatching plan, and plan implements it into plan.json. When there are no additional confirmation items, omit this field and do not create an additional state file.

After user confirmation:

  • Record the user-confirmed language、format and mode;
  • Pass the user-confirmed research scope and scope directly to subsequent roles without creating an additional state file;
  • format and language are likewise passed to subsequent roles only as request-level parameters and are not written into the report directory;

4.2 Basis for recommending mode

  • quick: A self-contained Research Agent can cover the complete requirement within the same research context, and then a single writer produces the final draft.
  • normal: The task contains independently searchable research facets; first use plan to divide work packages with clear boundaries and search scopes that overlap as little as possible, then run research concurrently, and finally have a single writer synthesize across dimensions and produce the draft in one pass. Normal does not run report-planner, stitcher, model review, perspective, or supplement.
  • heavy: The user explicitly requests a complete audit, or the task is high-risk, highly controversial, or has severe evidence conflicts, requiring the full process of scout, review, perspective, supplementary research, and final-draft review.

The final mode is selected by the user in the startup confirmation. Do not automatically choose heavy just because the topic is broad, and do not lower the evidence standard just because the user chooses quick.

4.3 Three-tier pipeline

quick:research + writer

  1. Dispatch §5.3 research(mode=quick, dimension_id=d1), passing the original requirement, confirmed scope, and format. Research independently completes question decomposition, search strategy, evidence standard selection, main-text sourcing, and gap-filling searches, and writes d1 evidence.
  2. Dispatch §5.8 report-writer(write_mode=quick_synthesis), read d1 evidence and the confirmed format, and write sections/s_full.md。
  3. §5.10 render。

Skip scout, plan, review, perspective, supplement, report-planner, and stitcher.

normal: plan + concurrent research + single writer producing the draft in one pass

  1. Dispatch §5.2 plan; normal has no briefing, and plan directly consumes the query, startup confirmation scope, and format, generates dimensions according to independent search spaces, and controls duplicate retrieval across dimensions.
  2. After plan completes, from plan.json.dimensions[] read only each id; dispatch §5.3 research(mode=initial) concurrently in the same batch according to these IDs, passing plan.json path and the corresponding dimension_idin each call, and Research reads the corresponding work package itself.
  3. After all research is complete, dispatch §5.8 report-writer(write_mode=quick_synthesis) only once, placing the absolute paths of all d*.evidence.json into evidence_pathsin dimension order, and write directly to sections/s_full.md。
  4. §5.10 render。

Normal does not run scout, report-planner, content-unit writer, stitcher, sub-report review, perspective, supplement-planner, supplementary research Agent, or final-draft review.

heavy: complete process

  1. After the user confirms mode, language, and format, dispatch §5.1 scout to generate the briefing; only when a newly discovered issue from scout truly cannot be reasonably defaulted and would change the research scope should additional confirmation be requested.
  2. Dispatch §5.2 plan, reading the briefing and format.
  3. After plan completes, from plan.json.dimensions[] read only each id, and read the number/order of lenses for each dimension for subsequent perspective scheduling; dispatch §5.3 research(mode=initial) concurrently in the same batch according to these IDs, and each Research reads the corresponding work package itself.
  4. For each dimension, evidence runs §5.4 review and, on demand, §5.5 perspective in the same batch; the two read the review scope on their own according to plan_path + dimension_id , after which §5.6 supplement-planner decides whether supplementary research is needed. After any necessary supplementary research, dispatch research/review again until evidence is finalized or gaps that cannot be resolved are honestly recorded.
  5. Dispatch §5.7 report-planner; run writers concurrently, then have the stitcher assemble.
  6. Dispatch §5.4 final-draft review; fix the affected planner/writer/stitcher artifacts according to the feedback.
  7. §5.10 render。

4.4 Failures and Retries

Single source of truth; the gates of each stage in §5 reference only this table.

Stage Failure criterion Routing Limit
scout Sub-agent explicitly fails, validator does not pass, or does not write out briefing.json Return to scout to fix the briefing 1
plan Sub-agent explicitly fails, validator does not pass, or does not write out plan.json Return to plan with the original task 1
research Sub-agent explicitly fails, validator does not pass, or does not write out evidence Return to research for the same dimension with the original task 1
heavy sub-report review revise verdict Hand to supplement-planner; after supplementary research if necessary, re-review Handle according to the actual gap
supplement-planner Sub-agent explicitly fails, validator does not pass, or does not write out supplement plan Return to supplement-planner for the same dimension with the original task 1
supplement research Sub-agent explicitly fails, evidence validator does not pass, or does not update evidence/plan status Return to research for the same dimension with the original task 1
quick / normal report-writer Sub-agent explicitly fails, does not write out sections/s_full.md or references out of bounds Return all original evidence_paths to the same writer for fixing 1
heavy report-planner Sub-agent explicitly fails, validator does not pass, or does not write out outline/subsets Return to planner with the original task 2
heavy report-writer unit contract or out-of-bounds reference feedback Route problems back to planner; for expression/form problems, use revise_unit to re-dispatch the affected unit 1 each
heavy report-stitcher blocker According to problem_type/location/required_fix return to planner or writer 1
heavy final-draft review revise verdict Local: return to the corresponding writer, then rerun stitcher; global: return to planner to redo the orchestration 2

Final-draft failure routing: for local problems, use revise_unit to rewrite the affected unit, then rerun stitcher; for global organization problems, return to planner to redo the outline and the affected units.

When failures exceed the retry limit, do not loop indefinitely:

  • If a failure causes a downstream required artifact to be absent, not valid JSON, or still failing the validator, immediately stop this run and report to the user the failure stage, artifact path, and the last round of validator errors; do not continue scheduling with an invalid artifact, and do not claim the report is complete.
  • Only when all downstream required artifacts exist and have passed the validator, and the remaining problems are merely non-blocking content quality issues pointed out by review, may you mark the final draft as "quality limited" and complete the run.

4.5 Process Changes

  • If the user changes the query midway → terminate the current run and restart from §4.1.

5. Stage Library

Each role is described only once here:Function + payload + Gate. Whether to run, how many times to run, and the order — all determined by §4; this section does not specify tiers. The first line of all payloads is 先读取 {plugin_role_dir}/<role>.md 并严格遵守。(see §2.2).

5.1 scout

Purpose: only in heavy, pre-check the domain terrain and produce a briefing.

先读取 {plugin_role_dir}/scout.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}
report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
schema_path:{plugin_skills_dir}/sn-deep-research/schemas/briefing.schema.md
validator_path:{plugin_skills_dir}/sn-deep-research/scripts/validate_briefing.py
mode:heavy

请按 scout agent 契约写入:
- {report_dir}/briefing.json

Gating: Scout must report validation_ok:true. Afterwards you only read briefing.json the fields needed for scheduling. The research scope and calibration were confirmed at startup; only when newly discovered issues from scout truly cannot be reasonably defaulted and would change the research scope should you ask follow-up questions.

5.2 plan

Purpose: use the request-level format to understand the delivery direction, divide the research scope into work packages with clear boundaries, independently executable and with retrieval scopes that overlap as little as possible, and write back plan.json.mode。

先读取 {plugin_role_dir}/plan.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}
report_dir:{report_dir 绝对路径}
plan_schema_path:{plugin_skills_dir}/sn-deep-research/schemas/plan.schema.md
plan_validator_path:{plugin_skills_dir}/sn-deep-research/scripts/validate_plan.py
mode:{最终确定的 mode}
confirmed_scope:{用户确认后的实际研究范围和口径}  # 有额外确认时加入,否则省略

请按 plan agent 契约划分可独立执行的搜索空间,合并高度重合的取证范围并明确 scope owner;完成 lenses 规划,只输出:
- {report_dir}/plan.json

heavy append briefing_path:{report_dir}/briefing.json。

scheduling read: after the role completes, you read from plan.json.dimensions[] only the idof each dimension; heavy additionally reads the lens count and order of each dimension for scheduling perspective.dimension_id must come directly from plan, and must not be assigned, rewritten or renumbered on your own. Do not read or transcribe other content fields of the dimension.

5.3 research

Purpose: gather evidence by dimension, produce sub_reports/d{N}.evidence.json—the factual foundation for everything that follows.

payload mode:initial(normal/heavy initial research) / supplement(supplemental research) / quick. initial/supplement only pass plan_path + dimension_id, where dimension_id must come from plan.json.dimensions[].id; Research then reads the corresponding complete work package from plan. quick has no plan, and Research determines the research questions and evidence standards on its own based on the original requirements, confirmed calibration and format. All dimensions of normal/heavy can be started in the same batch.

先读取 {plugin_role_dir}/research.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}
mode:{initial|supplement|quick}

report_dir:{report_dir 绝对路径}
dimension_id:{dimension_id}
plugin_skills_dir:{plugin_skills_dir}
plan_path:{report_dir}/plan.json                 # initial/supplement;quick 省略
confirmed_scope:{用户确认后的实际研究范围和口径}  # quick 有额外确认时加入,否则省略

来源纪律:搜索入口按 sources category 选择对应相关的 skill;source.url 写原始 URL。

schema_path:{plugin_skills_dir}/sn-deep-research/schemas/evidence.schema.md
output_path:{report_dir}/sub_reports/{dimension_id}.evidence.json

Under initial/supplement, Research follows dimension_id to read from plan name/description/key_questions/focus/sources/depth/time_sensitivity/scope_ownership. You do not expand these fields.

supplement mode differences:mode: supplement, and append existing_evidence_path:{report_dir}/sub_reports/{dimension_id}.evidence.json and supplement_plan_path:{report_dir}/sub_reports/{dimension_id}.supplement_plan.json. Dimension-level sources, depth and timeliness requirements are read from plan.json , and item-by-item finer sources are based on supplement_plan.json 's suggested_sources .

quick dispatch discipline: quick omits plan_path, fixed dimension_id=d1. Research breaks down the research questions on its own and generates internal kq1/kq2/…, and selects sources, depth, timeliness window and scope on its own. quick must not be rewritten into a single source, a single search round, a fixed query count or skim; evidence requirements are determined by the question itself.

Gating: for failure handling see §4.4.

5.4 review (sub-report / final draft share this role)

Purpose (heavy only): review the calibration, gaps and citation discipline of evidence and the final draft.审查类型=子报告 evidence 审查 → produce d{N}.review.md for supplement-planner aggregation;审查类型=终稿 review → check the overall logic, citation discipline, conflict/gap surface and evidence boundaries.

Sub-report review payload:

先读取 {plugin_role_dir}/review.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}
审查类型:子报告 evidence 审查

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
dimension_id:{dimension_id}
plan_path:{report_dir}/plan.json
evidence_path:{report_dir}/sub_reports/{dimension_id}.evidence.json
output_path:{report_dir}/sub_reports/{dimension_id}.review.md

Final draft review payload:

先读取 {plugin_role_dir}/review.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}
审查类型:终稿 review

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
stitched_path:{report_dir}/stitched.md
outline_path:{report_dir}/outline.json
evidence_paths:
- {report_dir}/sub_reports/d1.evidence.json
- ...
review_paths:
- {report_dir}/sub_reports/d1.review.md
- ...
perspective_glob:{report_dir}/sub_reports/d*.perspectives/*.md   # 仅 heavy;normal 省略

请按 review agent 的终稿审查契约检查整体逻辑、引用纪律、冲突/gap surface 与 evidence 边界。

Gating: see §4.4.

5.5 perspective

Purpose: by dimension lenses[] do a coverage check, and surface perspectives not covered by evidence.lenses[] : if empty, skip.

先读取 {plugin_role_dir}/perspective.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
dimension_id:{dimension_id}
plan_path:{report_dir}/plan.json
lens_id:l{该 dimension 内 1-based 顺序号}

evidence_path:{report_dir}/sub_reports/{dimension_id}.evidence.json
output_path:{report_dir}/sub_reports/{dimension_id}.perspectives/l{同一顺序号}.md

5.6 supplement-planner

Purpose (heavy only): aggregate the gaps from review/perspective by dimension and produce a supplemental research plan.

先读取 {plugin_role_dir}/supplement-planner.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
plan_path:{report_dir}/plan.json
target_dimensions:["{dimension_id}"]
schema_path:{plugin_skills_dir}/sn-deep-research/schemas/supplement_plan.schema.md
validator_path:{plugin_skills_dir}/sn-deep-research/scripts/validate_supplement_plan.py
output_path:{report_dir}/sub_reports/{dimension_id}.supplement_plan.json

Gating:Supplement Planner must run after generating the work order validate_supplement_plan.py and report validation_ok:true。You only read the JSON's dimension_id、supplement_items[].id/status and deferred_items count, and compare them against the counts in the role's reply.supplement_items[] is empty → this dimension's evidence can be finalized; if non-empty and all are pending → dispatch §5.3 research(mode=supplement). After supplementary research, Research only validates the updated evidence and no longer calls the supplement plan validator; then you re-read the work order status and re-dispatch the §5.4 sub-report review. Upon completion, no residual pending;partial|no_data|out_of_scope must be written by research into evidence's writing_context,and the sub-report review no longer requires supplementary research before it can be finalized.

5.7 report-planner (heavy only)

Purpose:consume request-level format and each dimension's evidence boundaries; the content paradigm determines how information advances, user requirements and evidence shape determine the main information carrier, and output the content-unit outline and per-unit evidence subsets. A fixed paradigm-to-carrier pairing table must not be used.

先读取 {plugin_role_dir}/report-planner.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
briefing_path:{report_dir}/briefing.json          # 仅 heavy;normal 省略
plan_path:{report_dir}/plan.json
evidence_paths:
- {report_dir}/sub_reports/d1.evidence.json
- {report_dir}/sub_reports/d2.evidence.json
- ...
schema_path:{plugin_skills_dir}/sn-deep-research/schemas/outline.schema.md

output_outline:{report_dir}/outline.json
output_subsets_dir:{report_dir}/content_units/

Scheduling read:after this role completes, you only take content_units[].id、organization_decision.opening_summary and organization_decision.toc,to schedule writer/render.

5.8 report-writer

Purpose:synthesize all evidence at once under quick / normal, or execute a single content unit under heavy.write_mode:

  • write_unit(heavy):read only the specified unit and its own evidence subset.
  • revise_unit(heavy):overwrite the specified unit according to local feedback from the stitcher or heavy review.
  • quick_synthesis(quick / normal):read all evidence_pathsin the payload, and output a complete standalone deliverable according to user requirements and the confirmed format; do not compress it into a short answer by default.
先读取 {plugin_role_dir}/report-writer.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
write_mode:{write_unit|revise_unit|quick_synthesis}

# heavy
content_unit_id:{unit_id}
outline_path:{report_dir}/outline.json
subset_path:{report_dir}/content_units/{unit_id}.evidence_subset.json
output_path:{report_dir}/content_units/{unit_id}.md

# 仅 revise_unit
draft_path:{report_dir}/content_units/{unit_id}.md
revision_instructions:{review/stitcher 的局部修订要求}

# quick / normal(省略 content unit 四项;normal 传全部维度)
evidence_paths:[{report_dir}/sub_reports/d1.evidence.json, ...]
output_path:{report_dir}/sections/s_full.md

Gating:for handling out-of-bounds citation feedback, see §4.4.

5.9 report-stitcher (heavy only)

Purpose:assemble content units according to organization_decision ,and calibrate the optional L0, terminology, and structural contract. The main structure can be a matrix, timeline, checklist, Q&A, or other unit; article form is not mandatory.

先读取 {plugin_role_dir}/report-stitcher.md 并严格遵守。

原始需求:{query}
language:{language}
format:{format}

report_dir:{report_dir 绝对路径}
plugin_skills_dir:{plugin_skills_dir}
outline_path:{report_dir}/outline.json
content_units_dir:{report_dir}/content_units/
output_path:{report_dir}/stitched.md

Gating:blocker returns to the planner or writer according to problem_type/location/required_fix (see §4.4).

5.10 render (sn-prepare-citations script)

Purpose:deduplicate footnotes, generate numbered citations, and produce report.md and citations.json。

python3 {plugin_skills_dir}/sn-prepare-citations/scripts/prepare_citations.py \
  --report {输入正文} \
  --evidence {report_dir}/sub_reports/d*.evidence.json \
  [--outline {report_dir}/outline.json] \
  [--no-l0] [--no-toc] \
  --output {report_dir}/report.md
mode --report input --outline
heavy {report_dir}/stitched.md with
normal {report_dir}/sections/s_full.md omitted
quick {report_dir}/sections/s_full.md omitted (no outline.json)

For heavy, L0 has already been written by the stitcher according to organization_decision.opening_summary ,so render always passes --no-l0,to avoid generating a generic summary again.organization_decision.toc=false when also pass --no-toc;when true, do not pass --no-toc,letting the script replace the TOC placeholder placed by the stitcher. Quick / normal has no outline; the one-pass writer determines the title and main structure itself according to the query and format ;render does not add another summary or default table of contents.

Gating(check stdout JSON):

  • orphan_citations non-empty → do not deliver; return to writer/stitcher for correction.
  • claim_id_leakage.unresolved non-empty → do not deliver; return to writer to correct [^dN.cM]。
  • claim_id_leakage.resolved non-empty but unresolved is empty → can continue, log a warning.
  • no orphan / unresolved → complete.

6. Appendix: Context Boundaries

File Whether to read
briefing.json Yes: heavy only, existence and scheduling field checks
plan.json Yes: normal/heavy only take dimensions[].id; heavy additionally takes the lens count/order. Other work-package content is read by Research itself
outline.json Yes (heavy only): only take content_units[].id and the render switch of the organization decision
sub_reports/d*.evidence.json No
sub_reports/d*.review.md No (heavy only)
sub_reports/d*.perspectives/*.md No
sub_reports/d*.supplement_plan.json Yes (heavy only): read only dimension_id, supplement item id/status, and the deferred count for scheduling; do not read the description body
content_units/*.evidence_subset.json No
content_units/*.md No
sections/s_full.md No (quick / normal)
stitched.md No (heavy only)
report.md No: provide the user path on completion

quick mode has no briefing/plan/outline/content_units/stitched; normal has no briefing/outline/content_units/stitched. Both quick / normal use sections/s_full.md as the render input, and heavy uses stitched.md as the render input.language and format are both kept only in the context of this request and are not written to a state file.