release: v0.20 Codex-ready skill-driven core

This commit is contained in:
kai
2026-05-07 08:21:28 +08:00
parent 0644a68ecc
commit 68e45bcf41
45 changed files with 3005 additions and 157 deletions
+2
View File
@@ -25,6 +25,7 @@ Deep Research is driven by the repository Python core, not by chat context. Trea
6. Run Phase 2 with file-backed task cards and packets:
`uv run python scripts/dr.py research <slug> --workers 6 --execute-packets --allow-search-fallback`
7. Build briefs and chapters only from persisted packets:
`uv run python scripts/dr.py sources cache <slug> --limit 50`
`uv run python scripts/dr.py research <slug> --build-briefs`
`uv run python scripts/dr.py research <slug> --assemble-chapters --workers 4`
8. Review and finalize through Python:
@@ -37,6 +38,7 @@ Deep Research is driven by the repository Python core, not by chat context. Trea
- Do not invent evidence when model/API access fails. Stop at the last durable artifact and report the exact blocker.
- Phase 2 concurrency must use task cards and packet files, not platform subagents as the default mechanism.
- Search must use the project Python gateway (`scripts/search.py` / `scripts.lib.search_client`) by default. Do not use Tavily MCP, browser MCP, or platform-native web search in subagents unless the user explicitly requests that escape hatch.
- Key Tier 1-2 sources such as ICH Q9/Q10, EU GMP Annex 1, FDA guidance/warning letters, EMA/NMPA/WHO pages, and pharmacopeia materials should be cached as local Markdown snapshots under `phase2/source_cache/` before chapter assembly.
- User materials are starting evidence, not final truth. Cross-check against authoritative sources such as NMPA, FDA, EMA, ICH, WHO, pharmacopeias, and recognized best-practice references.
- For GMP/quality/operations diagnosis, prefer `--method gmp_quality_operations_diagnosis`.
- Chapter drafts are not acceptable if they merely summarize principles. Each section must turn evidence into concrete findings, risk implications, and整改动作;otherwise return to Phase 2 enrichment.
+11 -2
View File
@@ -15,6 +15,7 @@ Run searches from the repository root:
```bash
uv run python scripts/search.py "<query>" --route general --json --trace
uv run python scripts/search.py "<query>" --route evidence --json --trace
uv run python scripts/search.py "<query>" --route scholar --year-low 2020 --json --trace
uv run python scripts/search.py "<query>" --route news --time-range y --json --trace
uv run python scripts/search.py "<query>" --route patents --json --trace
@@ -29,12 +30,19 @@ UV_CACHE_DIR=/private/tmp/deep_research_uv_cache uv run python scripts/search.py
## Routing
- `general`: Exa first, Tavily fallback.
- `scholar`: Serper Scholar first; use for papers, guidelines, and technical literature.
- `general`: Tavily first, Exa fallback, Brave fallback; use for broad discovery and gap filling.
- `evidence`: Exa highlights first, Tavily fallback, Brave fallback; use when a task card needs concise, source-level candidate evidence for an evidence packet.
- `scholar`: Serper Scholar first; use for papers, reviews, technical literature, and academic validation only.
- `news`: Serper News first; use for recent industry/current information.
- `patents`: Serper Google Patents first.
- `biomed_literature`: scholar plus general discovery.
Serper is not the default general web search source. Keep it mainly for Scholar, Google Patents, News, and targeted `site:` searches where Google coverage matters.
Tavily Research is a phase-level scan tool, not a packet-writing shortcut. Use it for Phase 1 initial landscape scans, Phase 2 gap-fill after a chapter is thin, or Phase 3回炉补证据;its output must be saved, source-scored, deduplicated, and converted into candidate evidence before citation.
Exa is the preferred controlled evidence discovery route for agents because it can return short highlights/text per URL. Treat Exa hits as candidate sources unless the URL itself is an original Tier 1-2 source.
API keys are loaded from `secrets.env` by `scripts/search.py`; do not ask the user to authorize MCP calls when the env keys are available.
## Subagent Protocol
@@ -45,6 +53,7 @@ For evidence packets:
2. Use search hits only as candidate sources; whenever possible, cite the original regulator, guideline, paper, or official document.
3. Put every used source in `sources` with `id`, `title`, `url`, `tier`, and `score`.
4. Do not write a final chapter during search; produce structured evidence only.
5. For repeatedly used Tier 1-2 sources, run `uv run python scripts/dr.py sources cache <project>` so later phases can cite a local Markdown snapshot rather than only a URL.
For chapter assembly:
+76
View File
@@ -0,0 +1,76 @@
---
name: search-strategy
description: 生物医药深度研究的统一检索策略。规定信源优先级、检索轮次、关键词构造、API 路由,以及何时切换到专业信源。所有做信息收集的 worker/agent 必须加载此技能。
---
# Search Strategy
## Core Rule
Do not send Chinese chapter titles, interview paragraphs, or full task-card text directly to search APIs. For formal search, first convert the task into short English query terms plus axis terms, then add source/domain constraints when useful.
## Query Construction
Build every query from three parts:
- `entity/domain`: the object or field, such as `pharmaceutical`, `biologics`, `sterile drug`, `CDMO`, `quality system`.
- `axis`: the research axis, such as `CAPA deviation change control`, `aseptic processing process validation PPQ`, `quality metrics management review`.
- `evidence type`: the evidence to retrieve, such as `Warning Letter`, `meeting materials`, `guidance`, `systematic review`, `patent`, `best practices`.
Default English query length is 5-12 keywords. Chinese terms are useful for NMPA, local industry sources, and internal-material matching, but Chinese long sentences must not be the default query form.
For route-specific searches, do not append the original Chinese chapter title after the English query. If chapter context is needed, map the chapter to short English concept terms first, such as `commercial readiness phase gate`, `aseptic processing`, `quality metrics management review`, or `CAPA effectiveness check`.
## Route Patterns
- `fda`: use `site:fda.gov` plus `Warning Letter`, `inspection`, `enforcement`, `meeting materials`, or `meeting minutes`, then add the axis terms.
- `scholar`: use technical/scientific terms plus `review`, `validation`, `risk management`, `quality system`, or disease/mechanism terms.
- `evidence`: use Exa highlights for controlled evidence discovery when a packet needs concise source-level excerpts; still trace important hits back to original Tier 1-2 sources.
- `patents`: use technology route plus material, target, process, formulation, device, or manufacturing terms.
- `news`: use company/industry plus event type and recency terms.
- `general`: use Tavily/Exa/Brave for discovery and gap filling; trace useful hits back to Tier 1-2 original sources before citing. Do not route generic web discovery through Serper by default.
- `tavily_research` conceptually means a phase-level scan, not a normal packet route. Save the research result, score/deduplicate sources, then convert it into candidate evidence before writing claims.
## GMP/FDA Examples
Bad query:
```text
围绕《审计发现应先转化为商业化阶段门缺口,而不是停留在风险项计数》从质量体系角度提炼可证伪的核心结论
```
Good queries:
```text
site:fda.gov "Warning Letter" CGMP CAPA deviation change control data integrity pharmaceutical
site:fda.gov "meeting materials" "pharmaceutical quality" "quality metrics"
site:fda.gov/inspections-compliance-enforcement-and-criminal-investigations "Warning Letter" aseptic processing process validation
```
## Source Priority
- Tier 1: regulator, guideline, pharmacopeia, primary literature, trial registry, patent original, company filing.
- Tier 2: systematic review, recognized consulting or industry association report, professional database/media.
- Tier 3: conference abstract, broker report, preprint, vendor white paper.
- Tier 4: generic web search result; discovery only, not conclusion support.
## Four-Round Search Discipline
1. Tier 1 direct hit: regulator, PubMed/Scholar, trial registry, patent original, or official filing.
2. Tier 2 synthesis: recognized review, guideline interpretation, consulting/association report.
3. Counter-evidence: limitations, failures, enforcement actions, contradictory interpretations.
4. Gap fill: Exa evidence discovery or Tavily/Brave general discovery, then trace back to original sources. Use Serper here only for Google-specific needs such as `site:` targeting, Scholar, Patents, or News.
## Tavily Research vs Exa Evidence
- Tavily Research is best for Phase 1 initial landscape scans, thin-chapter补证据, and Phase 3回炉. Prompt in English, specify source priority, counter-evidence, and structured output. Do not cite its synthesized prose directly.
- Exa evidence discovery is best for Phase 2 packet work because highlights/text are compact enough for source-quality scoring and evidence-table mapping.
- Serper remains preferred for Scholar, Google Patents, News, and Google-specific `site:` targeting.
- Brave remains a cross-check and mixed-language fallback, not the first evidence route.
## Required Packet Behavior
- Put search keywords or route notes in `raw_quotes_or_notes` when evidence is weak or no suitable source was found.
- FDA/GMP tasks must explicitly check Warning Letters, inspection/enforcement pages, and meeting materials/minutes.
- Do not cite search snippets as final evidence when an original regulator, guideline, paper, or official PDF can be reached.
- If the candidate sources are not sufficient, stop and record the gap in `open_questions` instead of writing generic prose.