v0.20.4 refine antigravity research skills

This commit is contained in:
Deep Research System
2026-05-07 13:43:04 +08:00
parent 4ab502df91
commit a0f1144f6c
14 changed files with 782 additions and 326 deletions
@@ -16,19 +16,20 @@ The Deep Research method still comes from this repo:
- Follow `AGENTS.md` for evidence, source tiers, word budgets, pause points, and output hygiene.
- Load project skills from `.agents/skills/*` as needed.
- Write all artifacts under `projects/<slug>/`.
- Keep claims traceable to source IDs in `sources.jsonl`.
- Keep claims traceable through search receipts, source IDs, and `claims_ledger.jsonl`.
## Anti-Hallucination Contract
This project treats Gemini-family research as high risk for false confidence. Follow these rules mechanically:
1. No tool receipt, no search claim. Do not write "I searched", "confirmed", "official data shows", or similar unless the tool call happened and is recorded.
2. No source ID, no factual claim. Every concrete fact needs a `source_id`.
2. No source ID, no factual claim. Every concrete fact needs a `source_id` and claim-ledger entry.
3. Search snippets are leads, not evidence. Open the original paper, filing, registry, patent, guideline, or company disclosure before citing.
4. Failed access is a finding. Write that the source could not be opened; do not infer exact numbers from inaccessible pages.
5. Log all searches in `phaseX/search_log.md` or `phaseX/search_log.jsonl`.
6. Keep an `unsupported_claims` list. It is better to expose uncertainty than to make the report look complete.
7. Before finishing each phase, sample at least 10 factual claims and verify that each has a source ID and opened source.
7. Keep `continuation_state.json` current so a resumed Antigravity session can continue from artifacts, not chat memory.
8. Before finishing each phase, sample at least 10 factual claims and verify that each has a source ID, opened source, evidence locator, and claim-ledger record.
## Antigravity Model Plan
@@ -64,32 +65,39 @@ uv run python scripts/dr.py finalize <slug> --no-pdf --no-docx
## Native Runbook
1. Open the repository root in Antigravity.
2. Start with Gemini 3 Flash as Research Manager. Load `.agents/agents.md`, this skill, `AGENTS.md`, `mckinsey-method`, `search-strategy`, `source-quality`, `evidence-table`, `citation-manager`, `length-budget`, and `output-hygiene`.
2. Start with Gemini 3 Flash as Research Manager. Load `.agents/agents.md`, this skill, `AGENTS.md`, `method-selection`, `search-strategy`, `source-quality`, `evidence-table`, `research-quality-gates`, `citation-manager`, `length-budget`, and `output-hygiene`.
3. Create or confirm `projects/<slug>/` and the phase folders. Use Python `init` only for scaffolding if helpful.
4. Phase 0-1: ask the user to switch to Claude Opus 4.6 (Thinking). Produce:
- `phase1/material_brief.md`
- `phase1/framework.md`
- `phase1/method_decision.md`
- `phase1/research_brief.md`
- `phase1/research_brief.json`
- `phase1/search_log.md`
- `phase1/assumptions.md`
- `phase1/unsupported_claims.md`
5. Pause for user confirmation.
6. Phase 2: ask the user to switch to Gemini 3.1 Pro (Low). Build evidence packets and chapter drafts without Python model workers:
- `phase2/task_cards.json`
- `phase2/packets/*.json`
- `phase2/search_log.jsonl`
- `phase2/sources.jsonl`
- `phase2/rejected_sources.jsonl`
- `phase2/claims_ledger.jsonl`
- `phase2/coverage_matrix.md`
- `phase2/packets/*.json`
- `phase2/chapter_briefs/*.json`
- `phase2/compressed_findings/*.json`
- `phase2/drafts/chXX.md`
- `phase2/search_log.jsonl`
- `phase2/unsupported_claims.md`
7. Phase 3: ask the user to switch to Gemini 3.1 Pro (High). Produce `phase3/critique.md`, with explicit go/rework/fail decision and a source-audit table for at least 10 core facts.
If a claim lacks support, use delta retrieval: write the gap, run targeted searches, update sources and the claim ledger, then either verify or visibly caveat the claim.
7. Phase 3: ask the user to switch to Gemini 3.1 Pro (High). Produce `phase3/critique.md`, with explicit go/rework/fail decision, claim-ledger audit, contradiction audit, and a source-audit table for at least 10 core facts.
8. Pause for user decision.
9. Phase 4: ask the user to switch to Claude Opus 4.6 (Thinking). Produce `phase4/final_zh.md`, `phase4/editorial_notes.md`, and `phase4/final_fact_check.md`. Use deterministic renderers afterward for PDF/DOCX.
9. Phase 4: ask the user to switch to Claude Opus 4.6 (Thinking). Produce `phase4/final_zh.md`, `phase4/editorial_notes.md`, and `phase4/final_fact_check.md`. New facts require new receipts and claim-ledger rows. Use deterministic renderers afterward for PDF/DOCX.
## Search Strategy
+45
View File
@@ -9,6 +9,51 @@ description: 证据矩阵规范。规定每条核心结论必须有对应的证
**每条结论必须可追溯**。报告中每一个有 [src_xxx] 标注的观点,都必须在对应章节的 evidence 文件中有一行记录。
Antigravity native 模式下,证据不能只停留在模型上下文或章节草稿里。除章节 evidence markdown 外,还必须维护机器可审计的 claim ledger,让 Phase 3/4 可以逐条核验。
---
## Antigravity Native 证据落盘
Phase 2 必须至少维护以下文件:
- `projects/<slug>/phase2/search_log.jsonl`:检索、打开、抽取的回执
- `projects/<slug>/phase2/sources.jsonl`:稳定 source registry
- `projects/<slug>/phase2/claims_ledger.jsonl`:原子 claim 台账
- `projects/<slug>/phase2/coverage_matrix.md`:章节/任务覆盖矩阵
- `projects/<slug>/phase2/unsupported_claims.md`:未证实或仅弱证据支持的观点
`claims_ledger.jsonl` 每行必须是一个原子事实或判断,字段至少包括:
```json
{
"claim_id": "ch03_C012",
"chapter": "ch03",
"claim_type": "fact|trend|comparison|causal|forecast|recommendation",
"claim": "...",
"supporting_source_ids": ["src_042", "src_087"],
"counter_source_ids": ["src_103"],
"evidence_spans": [
{
"source_id": "src_042",
"locator": "Table 2",
"summary": "..."
}
],
"confidence": "high|medium|low|unsupported",
"verification_status": "verified|partially_verified|conflicted|unsupported",
"needs_delta_retrieve": false,
"visible_caveat_required": false
}
```
正文、章节 evidence markdown、`claims_ledger.jsonl` 三者必须能互相对上:
- 正文的 `Cxx/Fxx/Txx` ID 必须在 evidence markdown 和 `claims_ledger.jsonl` 中存在;
- `claims_ledger.jsonl``verification_status=unsupported` 的 claim 必须进入 `unsupported_claims.md`
- `needs_delta_retrieve=true` 的 claim 必须补做定向检索,或在正文显式降级;
- Phase 4 不得新增未进入 claim ledger 的事实。
---
## 证据矩阵文件格式
+157
View File
@@ -0,0 +1,157 @@
---
name: method-selection
description: Selects the appropriate research framework and analytical tools for biomedical, market, investment, CMC/GMP, clinical, R&D, BD, and management consulting topics instead of defaulting to MECE or McKinsey-style framing.
---
# Method Selection
Use this skill before Phase 0-1 framing and whenever the user changes the report purpose.
## Principle
Do not default to McKinsey/MECE. MECE, SCQA, and pyramid writing are useful communication tools, not universal research methods.
Select the method based on:
- report purpose
- audience
- decision to support
- available materials
- evidence type
- regulatory or scientific risk
- output format
## Method Router
### Market, investment, or commercial strategy
Use when the user asks about market opportunity, competition, investment thesis, BD opportunity, pricing, or commercialization.
Methods and tools:
- market sizing: TAM/SAM/SOM, bottom-up demand model, volume-price bridge
- competitive landscape: segmentation, product differentiation, launch timing, share shifts
- value chain: upstream supply, manufacturing bottlenecks, channel economics
- investment: thesis tree, scenario analysis, sensitivity analysis, risk-adjusted NPV where feasible
- transaction/BD: deal comps, licensing terms, patent cliff, strategic fit
Outputs:
- market map
- competitor table
- assumptions ledger
- upside/base/downside scenarios
### Clinical, translational, or evidence review
Use when the topic is efficacy, safety, trial design, disease area, standard of care, biomarker, or clinical development.
Methods and tools:
- PICO or PICOTS framing
- evidence hierarchy
- endpoint and comparator analysis
- trial design critique
- TPP and go/no-go criteria
- benefit-risk assessment
Outputs:
- clinical evidence matrix
- trial landscape
- endpoint comparability table
- evidence gaps and patient-selection risks
### CMC, GMP, quality, or manufacturing operations
Use when the topic involves process development, tech transfer, validation, inspection readiness, deviations, CAPA, sterility assurance, supply chain, or manufacturing risk.
Methods and tools:
- ICH / FDA / EMA / NMPA regulatory baseline mapping
- gap assessment
- FMEA or risk matrix
- process validation lifecycle
- control strategy mapping
- deviation/CAPA effectiveness review
- data integrity assessment
Outputs:
- gap register
- risk heatmap
- CAPA prioritization
- control strategy map
- readiness scorecard
### R&D feasibility or technology assessment
Use when the topic asks whether a technology, target, modality, platform, assay, or process is feasible.
Methods and tools:
- technology readiness level
- critical path analysis
- mechanism and modality fit
- experiment roadmap
- scale-up risk assessment
- IP and freedom-to-operate screening
Outputs:
- feasibility scorecard
- key experiments
- kill criteria
- technical risk register
### Management, organization, or operating model
Use when the topic involves organization, governance, operating cadence, capability building, performance management, or transformation.
Methods and tools:
- issue tree
- operating model design
- RACI / decision rights
- KPI tree
- process maturity assessment
- change management roadmap
Outputs:
- operating model options
- capability gap assessment
- implementation roadmap
- KPI and governance model
### Policy, regulation, or access environment
Use when the topic asks about policy, reimbursement, regulatory pathways, pricing access, or regional rules.
Methods and tools:
- policy timeline
- stakeholder map
- regulatory pathway comparison
- access and reimbursement framework
- scenario analysis by jurisdiction
Outputs:
- jurisdiction comparison
- policy impact map
- regulatory milestone table
- access risks
## Phase 0-1 Output Requirements
Write a method decision note in `phase1/research_brief.md`:
- selected method
- why it fits
- methods rejected and why
- evidence types needed
- search routes
- expected output artifacts
If the topic spans multiple scenarios, combine methods explicitly and define which chapters use which method.
@@ -0,0 +1,212 @@
---
name: research-quality-gates
description: Applies stage gates for Antigravity-native Deep Research: search receipts, source access, claims ledger, triangulation, contradiction search, continuation state, and final assembly checks.
---
# Research Quality Gates
Use this skill after every phase boundary and before any user-facing "done" claim. It is designed for Antigravity-native runs where model work happens inside Antigravity, while this repository provides the evidence discipline.
## Core Principle
Evidence must persist outside the model context. A claim is not verified because the model remembers it, summarized it, or saw it in a search snippet. It is verified only when the artifact trail contains:
1. a search receipt,
2. an opened original source or explicit access failure,
3. a registered `source_id`,
4. an evidence span or data locator,
5. a claim-ledger record linking the claim to supporting and counter evidence.
## Required Artifacts
Create these files when the relevant phase begins. Empty files are acceptable at creation time, but they must be populated before the phase gate passes.
| Phase | Artifact | Purpose |
|---|---|---|
| Phase 1 | `phase1/method_decision.md` | Selected method, rejected methods, evidence types, and search routes. |
| Phase 1 | `phase1/assumptions.md` | Material assumptions and scope assumptions that need validation. |
| Phase 2 | `phase2/search_log.jsonl` | One row per search/open/extract action. |
| Phase 2 | `phase2/sources.jsonl` | Stable source registry with scores and tiers. |
| Phase 2 | `phase2/rejected_sources.jsonl` | Rejected or low-quality sources with reasons. |
| Phase 2 | `phase2/claims_ledger.jsonl` | Atomic factual and analytical claims with verification status. |
| Phase 2 | `phase2/coverage_matrix.md` | Coverage of questions, chapters, methods, and evidence gaps. |
| Phase 2 | `phase2/unsupported_claims.md` | Claims that could not be verified or need user-visible caveats. |
| All phases | `continuation_state.json` | Current phase, completed sections, artifact paths, open gaps, and next actions. |
| Phase 4 | `phase4/final_fact_check.md` | Final audit showing each core fact exists in the verified claim ledger. |
## Search Receipt Gate
Every search or retrieval action must write a row to `search_log.jsonl`.
Required fields:
```json
{
"receipt_id": "srch_0001",
"timestamp": "YYYY-MM-DDTHH:MM:SSZ",
"tool": "search-cli|browser|project-search|other",
"mode": "academic|scholar|patents|news|extract|general|deep",
"query_or_url": "...",
"purpose": "which task/card/chapter this supports",
"result_count": 10,
"opened_urls": ["https://..."],
"status": "ok|partial|failed",
"failure_reason": null
}
```
Gate fails if a model says it searched, confirmed, checked, extracted, opened, or verified a fact without a corresponding receipt.
## Source Access Gate
For any source used as evidence, `sources.jsonl` must record access status.
Required additional fields:
```json
{
"id": "src_042",
"search_receipt_ids": ["srch_0001"],
"raw_url": "https://...",
"canonical_url": "https://...",
"title": "...",
"publication_date": "YYYY-MM-DD",
"source_type": "paper|regulator|trial_registry|patent|filing|database|consulting|media|other",
"tier": 1,
"score": 8.6,
"access_status": "opened_original|opened_abstract|paywalled|failed|snippet_only",
"evidence_locator": "page/table/section/trial id/patent claim",
"independence_cluster": "cluster_...",
"notes": "..."
}
```
`snippet_only` sources cannot support final claims. Paywalled or abstract-only sources can be used only with a visible caveat or a second opened source that carries the same fact.
## Claim Ledger Gate
Each chapter draft must be backed by `claims_ledger.jsonl`. Store atomic claims, not paragraphs.
Required fields:
```json
{
"claim_id": "ch03_C012",
"chapter": "ch03",
"claim_type": "fact|trend|comparison|causal|forecast|recommendation",
"claim": "...",
"supporting_source_ids": ["src_042", "src_087"],
"counter_source_ids": ["src_103"],
"evidence_spans": [
{
"source_id": "src_042",
"locator": "Table 2",
"summary": "..."
}
],
"independence_clusters": ["cluster_a", "cluster_b"],
"confidence": "high|medium|low|unsupported",
"verification_status": "verified|partially_verified|conflicted|unsupported",
"needs_delta_retrieve": false,
"visible_caveat_required": false
}
```
Gate fails if:
- a core claim has fewer than 2 independent Tier 1-2 supporting sources;
- a claim has source IDs but no evidence locator;
- supporting sources all come from the same independence cluster;
- a conflicted or unsupported claim is written as a settled conclusion.
## Triangulation Gate
Counting URLs is not enough. Sources are independent only when they do not trace back to the same press release, same trial registry entry, same company deck, same sell-side note, or same syndicated article.
For core conclusions, require at least two of these source families where available:
- regulator / official registry,
- peer-reviewed paper or systematic review,
- company filing / annual report / exchange disclosure,
- patent or legal record,
- independent database,
- reputable industry or consulting report,
- independent expert or professional media analysis.
If a field has only one source family available, mark the limitation explicitly in `unsupported_claims.md` and in the report limitations section.
## Contradiction Gate
Every chapter requires at least one deliberate counter-search or falsification pass. Record it in `search_log.jsonl` and summarize it in the chapter brief.
Minimum counter-evidence record:
```json
{
"claim_id": "ch03_C012",
"counter_query": "...",
"counter_source_ids": ["src_103"],
"result": "none_found|weak_counter|material_counter",
"impact": "keep|qualify|rewrite|delete"
}
```
Gate fails if the chapter contains no counter-evidence section, no counter-search receipt, or no decision about how contradictions affected the draft.
## Coverage Gate
Before drafting, create `phase2/coverage_matrix.md` with one row per chapter/task axis:
| Chapter | Method | Core Question | Required Evidence | Found Evidence | Gaps | Decision |
|---|---|---|---|---|---|---|
Gate fails if a chapter is drafted while its method, required evidence, or gaps are blank.
## Delta-Retrieve Protocol
When a gap appears, do not patch it from memory. Create a targeted delta task:
1. write the gap in `coverage_matrix.md` or `claims_ledger.jsonl`;
2. run 1-3 targeted searches with explicit query purpose;
3. register any usable sources;
4. update the relevant claim record;
5. if still unsupported, keep the caveat visible.
Delta retrieval is mandatory when Phase 3 finds a critical evidence gap.
## Continuation Protocol
For long reports or interrupted runs, keep `projects/<slug>/continuation_state.json` current.
Minimum fields:
```json
{
"version": "0.20",
"slug": "...",
"current_phase": "phase2",
"active_model": "Gemini 3.1 Pro (Low)",
"completed_artifacts": ["phase2/task_cards.json"],
"open_gates": ["claim_ledger_gate"],
"artifact_paths": {
"sources": "phase2/sources.jsonl",
"claims": "phase2/claims_ledger.jsonl",
"search_log": "phase2/search_log.jsonl"
},
"open_questions": [],
"next_actions": []
}
```
Before resuming a project, read this state and the latest artifacts. Do not rely on chat history alone.
## Final Assembly Gate
Phase 4 must prove that final facts are a subset of verified claims:
- Sample at least 20 high-impact facts or all core claims, whichever is smaller.
- For each sampled fact, record `claim_id`, `source_ids`, verification status, and final wording decision in `phase4/final_fact_check.md`.
- New facts introduced during editing require new search receipts and claim-ledger records.
- Delete or caveat any unsupported factual claim before rendering PDF/DOCX.
Do not render final deliverables until the final assembly gate passes.
+55 -6
View File
@@ -78,7 +78,52 @@ description: 信源质量评分系统(0-10 分制)与黑名单机制。规
---
## 三、黑名单(直接拒绝入库)
## 三、检索回执与原文访问
Gemini / Antigravity 模式下,信源质量评分必须和检索回执绑定。任何来源进入 `sources.jsonl` 前,必须能追溯到 `search_log.jsonl` 中的至少一条记录。
### search_log.jsonl 最低字段
```json
{
"receipt_id": "srch_0001",
"timestamp": "YYYY-MM-DDTHH:MM:SSZ",
"tool": "search-cli|browser|project-search|other",
"mode": "academic|scholar|patents|news|extract|general|deep",
"query_or_url": "...",
"purpose": "which task/card/chapter this supports",
"result_count": 10,
"opened_urls": ["https://..."],
"status": "ok|partial|failed",
"failure_reason": null
}
```
### sources.jsonl 追加字段
```json
{
"id": "src_042",
"search_receipt_ids": ["srch_0001"],
"raw_url": "https://...",
"canonical_url": "https://...",
"source_type": "paper|regulator|trial_registry|patent|filing|database|consulting|media|other",
"access_status": "opened_original|opened_abstract|paywalled|failed|snippet_only",
"evidence_locator": "page/table/section/trial id/patent claim",
"independence_cluster": "cluster_..."
}
```
硬规则:
- `snippet_only` 只能作为发现线索,不能支撑正文事实。
- `failed` 必须保留失败原因,不能根据标题或搜索摘要推断具体数据。
- `paywalled` / `opened_abstract` 可以用于发现方向,但核心结论还需要至少一个可打开原文或官方记录支撑。
- 同一公司新闻稿、同一试验登记、同一专利族、同一券商报告转载链,必须归入同一个 `independence_cluster`
---
## 四、黑名单(直接拒绝入库)
以下信源**无论评分多少都禁用**
@@ -112,7 +157,7 @@ description: 信源质量评分系统(0-10 分制)与黑名单机制。规
---
## 、利益冲突检测要点
## 、利益冲突检测要点
### 常见利益冲突场景
- 药企赞助的 RCT 对自家产品评价极高 → 查对比剂、盲法、样本量
@@ -130,7 +175,7 @@ description: 信源质量评分系统(0-10 分制)与黑名单机制。规
---
## 、评分执行流程(伪代码)
## 、评分执行流程(伪代码)
```
for each candidate_source in search_results:
@@ -162,7 +207,7 @@ for each candidate_source in search_results:
---
## 、输出字段(写入 sources.jsonl
## 、输出字段(写入 sources.jsonl
```jsonl
{
@@ -177,12 +222,16 @@ for each candidate_source in search_results:
"conflict_of_interest": null,
"blacklist_checked": true,
"retraction_checked": true,
"search_receipt_ids": ["srch_0001"],
"access_status": "opened_original",
"evidence_locator": "Table 2",
"independence_cluster": "cluster_trial_001",
"notes": "NEJM 2025 原文,RCT 独立研究"
}
```
---
## 、审计留痕
## 、审计留痕
所有被**拒绝**的信源,也要写入 `projects/<slug>/phase2/rejected-sources.jsonl`(注明原因)。这是事后复盘的关键,不要静默丢弃。
所有被**拒绝**的信源,也要写入 `projects/<slug>/phase2/rejected_sources.jsonl`(注明原因、对应 `receipt_id`、拒绝规则)。这是事后复盘的关键,不要静默丢弃。