3 Commits
16 changed files with 1299 additions and 260 deletions
+88
View File
@@ -0,0 +1,88 @@
# Deep Research Agent Team
This file defines Antigravity roles only. Put persistent constraints in `.agents/rules/`, reusable capabilities in `.agents/skills/`, and phase sequencing in `.agents/workflows/`.
## Research Manager
Primary model: Gemini 3 Flash.
Purpose:
- Manage the task list, phase transitions, model switches, and approval gates.
- Load the relevant rules, skills, and workflow.
- Keep all artifacts under `projects/<slug>/`.
Must not:
- Perform deep reasoning that belongs to a phase specialist.
- Claim that search or verification happened without receipts.
- Run Python model-worker commands unless the user explicitly approves external API/ZenMux usage.
## Phase 0-1 Strategist
Primary model: Claude Opus 4.6 (Thinking).
Purpose:
- Interpret materials, audience, and decision purpose.
- Select the most appropriate research method or method mix.
- Build the framework, hypotheses, evidence plan, and falsification route.
Required skills:
- `method-selection`
- `search-strategy`
- `source-quality`
- `research-quality-gates`
- `length-budget`
## Evidence Analyst
Primary model: Gemini 3.1 Pro (Low).
Purpose:
- Execute task-card research.
- Maintain search logs and source ledgers.
- Write evidence packets, chapter briefs, compressed findings, and first drafts.
Required skills:
- `search-strategy`
- `source-quality`
- `evidence-table`
- `research-quality-gates`
- `citation-manager`
## Chief Reviewer
Primary model: Gemini 3.1 Pro (High).
Purpose:
- Audit method fit, logic, structure, evidence quality, counter-evidence, and unsupported claims.
- Produce a clear go / rework / fail decision.
Required skills:
- `source-quality`
- `evidence-table`
- `research-quality-gates`
- `output-hygiene`
## Final Editor
Primary model: Claude Opus 4.6 (Thinking).
Purpose:
- Produce the final Chinese report from approved drafts and verified sources.
- Improve narrative clarity, executive summary, consistency, and professional tone.
- Preserve source traceability and downgrade unsupported claims.
Required skills:
- `citation-manager`
- `research-quality-gates`
- `humanizer-cn`
- `output-hygiene`
@@ -0,0 +1,36 @@
# Deep Research Antigravity Rule
When operating this repository from Google Antigravity, use Antigravity as the primary Deep Research executor and use the repository as the method, artifact, and validation framework.
## Non-Negotiables
- Use Antigravity's model quota for main research work.
- Do not default to Python core model-worker commands such as `run`, `research --execute-packets`, or `research --assemble-chapters`, because they may route work through ZenMux/API credits.
- It is acceptable to write phase artifacts directly in Antigravity when following the project skills and evidence schema.
- Use `.agents/skills/antigravity-surface-adapter/SKILL.md` whenever the user asks for Antigravity usage, phase execution, model planning, or quota planning.
- Keep all research outputs under `projects/<slug>/`.
- Use Python scripts only for scaffolding, deterministic checks, citation/report rendering, status, and local material processing unless the user explicitly approves external model/API usage.
## Anti-Hallucination Contract
- No tool receipt, no search claim. The agent may not write that it has searched, checked, verified, or confirmed anything unless a search/browser/terminal/MCP tool call actually happened and the result is logged.
- No source ID, no factual claim. Every concrete fact in drafts must map to a `source_id` in `sources.jsonl` and a row in `claims_ledger.jsonl`, or be visibly marked as unverified.
- No snippet laundering. Search result snippets, AI summaries, and memory are only leads; they cannot support final claims.
- Failed access must be explicit. If a page, PDF, registry, patent, or filing cannot be opened, mark it as inaccessible and do not quote exact values from it.
- Each phase must maintain `phaseX/search_log.md` or `phaseX/search_log.jsonl`.
- Each evidence packet must include `search_receipts`, `sources`, `evidence_spans`, `counter_evidence`, and `unsupported_claims`.
- Phase 2 must maintain `claims_ledger.jsonl`, `coverage_matrix.md`, and `rejected_sources.jsonl`.
- Before resuming or handing off work, update `continuation_state.json`.
- When evidence is thin, write "该观点证据不足,待进一步验证" rather than smoothing over the gap.
## Quota Discipline
- Surface manager: Gemini 3 Flash.
- Phase 0-1: Claude Opus 4.6 (Thinking).
- Phase 2: Gemini 3.1 Pro (Low).
- Phase 3: Gemini 3.1 Pro (High), with fallback to another model only if quality is inadequate.
- Phase 4: Claude Opus 4.6 (Thinking).
## Pause Points
Pause after Phase 1 and Phase 3. Ask the user to confirm the framework or critique decision before moving to the next major phase.
@@ -0,0 +1,148 @@
---
name: antigravity-surface-adapter
description: Guides Google Antigravity to run Deep Research natively with Antigravity model quotas, while using this repository's skills, source standards, artifacts, and optional Python utilities for validation/rendering.
---
# Antigravity Deep Research Adapter
Use this skill when the user asks to run, plan, review, or finalize a Deep Research project from Google Antigravity.
## Core Rule
Antigravity is the research operator. Use Antigravity's own model selector and task execution to perform the research phases. Python core is an auxiliary toolbox for project scaffolding, deterministic checks, citation/report rendering, and status inspection; do not let it silently route the main research through ZenMux unless the user explicitly asks.
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 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` 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. 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
Roles are defined in `.agents/agents.md`. This skill only maps phase work to models:
| Phase | Model | Purpose |
|---|---|
| Surface management | Gemini 3 Flash | Read skills, maintain task list, move phase by phase, run light shell commands, collect artifacts. |
| Phase 0-1 | Claude Opus 4.6 (Thinking) | Material interpretation, strategic framing, research method choice, bold hypotheses, chapter architecture. |
| Phase 2 | Gemini 3.1 Pro (Low) | Evidence collection, chapter research packets, first-pass chapter drafts. |
| Phase 3 | Gemini 3.1 Pro (High) | Independent critique, counter-evidence review, logic and evidence gap analysis. |
| Phase 4 | Claude Opus 4.6 (Thinking) | Final Chinese editorial integration, executive summary, wording quality, final consistency pass. |
Gemini 3 Flash should remain the phase manager. It can ask the user to switch to the phase model before heavy thinking, then resume management after the phase artifact is written.
## Python Core Boundary
Use Python core only when it helps without taking over the research model budget:
- Good: scaffold folders, parse local materials, validate sources/citations, render PDF/DOCX, show status.
- Risky: `research --execute-packets`, `run`, or any command that calls model workers through `configs/models.yaml`.
- If a command would call model workers, ask the user first and state that it may use ZenMux/API credits instead of Antigravity quota.
Safe utility examples:
```bash
uv run python scripts/dr.py init "研究主题" --slug <slug> --method <method>
uv run python scripts/dr.py status <slug>
uv run python scripts/dr.py skills validate
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`, `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/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/unsupported_claims.md`
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`. New facts require new receipts and claim-ledger rows. Use deterministic renderers afterward for PDF/DOCX.
## Search Strategy
If the `search` CLI from `paperfoot/search-cli` is installed, prefer it as the Antigravity-native search front door:
```bash
search agent-info
search search -q "CRISPR clinical trial 2025" -m academic --json
search search -q "BRCA1 gene patent" -m patents --json
search search -q "FDA warning letter CAPA pharmaceutical" -m general --json
search search -q "biotech market update 2026" -m news --json
```
Useful modes for this repo: `academic`, `scholar`, `patents`, `news`, `deep`, `extract`, `similar`, and `general`.
Do not treat synthesized search answers as evidence. Every important claim still needs source IDs, tier rating, source score, and preferably original PDFs/pages or official records.
If `search` is not installed, use the existing project search tools or Antigravity browser, but keep the same source-tier discipline.
## Suggested Antigravity Permissions
Within this workspace, the user may allow:
- `read_file(<workspace>)`
- `write_file(<workspace>)`
- `command(uv run python scripts/)`
- `command(search)`
- `command(pandoc)`
Keep these as Ask/Deny unless the user explicitly allows them:
- writes outside the workspace
- global Antigravity/Gemini settings
- destructive git commands
- reading `secrets.env`
- broad downloads or package installs
## What To Report Back
Always report concrete artifact paths:
- `projects/<slug>/phase1/research_brief.md`
- `projects/<slug>/phase2/task_cards.json`
- `projects/<slug>/phase2/packet_errors/` if present
- `projects/<slug>/phase3/critique.md`
- `projects/<slug>/phase4/*.pdf` and `*.docx`
If a phase fails, report the failing artifact and the rework plan. Do not hide model switches, quota-sensitive steps, or missing evidence.
+45
View File
@@ -9,6 +9,51 @@ description: 证据矩阵规范。规定每条核心结论必须有对应的证
**每条结论必须可追溯**。报告中每一个有 [src_xxx] 标注的观点,都必须在对应章节的 evidence 文件中有一行记录。 **每条结论必须可追溯**。报告中每一个有 [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 对自家产品评价极高 → 查对比剂、盲法、样本量 - 药企赞助的 RCT 对自家产品评价极高 → 查对比剂、盲法、样本量
@@ -130,7 +175,7 @@ description: 信源质量评分系统(0-10 分制)与黑名单机制。规
--- ---
## 、评分执行流程(伪代码) ## 、评分执行流程(伪代码)
``` ```
for each candidate_source in search_results: for each candidate_source in search_results:
@@ -162,7 +207,7 @@ for each candidate_source in search_results:
--- ---
## 、输出字段(写入 sources.jsonl ## 、输出字段(写入 sources.jsonl
```jsonl ```jsonl
{ {
@@ -177,12 +222,16 @@ for each candidate_source in search_results:
"conflict_of_interest": null, "conflict_of_interest": null,
"blacklist_checked": true, "blacklist_checked": true,
"retraction_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 独立研究" "notes": "NEJM 2025 原文,RCT 独立研究"
} }
``` ```
--- ---
## 、审计留痕 ## 、审计留痕
所有被**拒绝**的信源,也要写入 `projects/<slug>/phase2/rejected-sources.jsonl`(注明原因)。这是事后复盘的关键,不要静默丢弃。 所有被**拒绝**的信源,也要写入 `projects/<slug>/phase2/rejected_sources.jsonl`(注明原因、对应 `receipt_id`、拒绝规则)。这是事后复盘的关键,不要静默丢弃。
+154
View File
@@ -0,0 +1,154 @@
---
description: Run native biomedical Deep Research in Antigravity using roles, rules, skills, workflows, source receipts, and explicit approval gates.
---
# Deep Research Native Workflow
Invoke as `/deep-research-native <topic or slug>`.
## Step 0: Load Operating Context
- Load `AGENTS.md`.
- Load `GEMINI.md`.
- Load `.agents/agents.md`.
- Load `.agents/rules/deep-research-antigravity.md`.
- Load `.agents/skills/antigravity-surface-adapter/SKILL.md`.
- Load `.agents/skills/method-selection/SKILL.md`.
- Load relevant quality skills: `search-strategy`, `source-quality`, `evidence-table`, `research-quality-gates`, `citation-manager`, `length-budget`, `output-hygiene`.
Gate: if the active model has not loaded the above files, stop and ask the user to restart or explicitly mention them.
## Step 1: Define The Research Problem
Act as Research Manager with Gemini 3 Flash.
Confirm:
- topic and slug
- report purpose
- target reader
- decision the report supports
- report type and expected length
- available input materials
- allowed search tools
- whether Python model-worker commands are forbidden or allowed
Create or confirm `projects/<slug>/` and phase folders. Create or update `projects/<slug>/continuation_state.json`. Use Python only for scaffolding if helpful.
Gate: do not continue if purpose, audience, and decision use are unclear.
## Step 2: Select Method
Ask the user to switch to Claude Opus 4.6 (Thinking).
Act as Phase 0-1 Strategist. Use `method-selection`.
Write a method decision note covering:
- selected method or method mix
- why it fits the scenario
- rejected methods and why
- evidence types required
- search routes by chapter or task axis
- expected artifacts
Save it as `phase1/method_decision.md` or embed the same content in `phase1/research_brief.md` with a clear heading.
Gate: do not default to McKinsey, MECE, or SCQA. Use them only when they fit the decision problem.
## Step 3: Phase 0-1 Framing
Still using Claude Opus 4.6 (Thinking), produce:
- `phase1/material_brief.md`
- `phase1/search_log.md`
- `phase1/method_decision.md`
- `phase1/assumptions.md`
- `phase1/framework.md`
- `phase1/research_brief.md`
- `phase1/research_brief.json`
- `phase1/unsupported_claims.md`
Rules:
- Hypotheses without evidence must be labeled as hypotheses.
- Every searched claim must have a search receipt.
- Each chapter must state method, core question, likely evidence, and falsification route.
Gate: pause for user approval before Phase 2.
## Step 4: Phase 2 Evidence And Drafting
Ask the user to switch to Gemini 3.1 Pro (Low).
Act as Evidence Analyst.
Produce:
- `phase2/task_cards.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/unsupported_claims.md`
Rules:
- No tool receipt, no search claim.
- No source ID, no factual claim.
- Search snippets and AI summaries are leads only.
- Every packet must include `search_receipts`, `sources`, `evidence_spans`, `counter_evidence`, and `unsupported_claims`.
- Every core claim must be represented in `claims_ledger.jsonl`.
- Every chapter must pass a counter-search or falsification pass.
- Evidence gaps trigger delta retrieval before drafting or visible caveats if still unresolved.
- Draft chapters only from approved chapter briefs and compressed findings.
Gate: run `research-quality-gates`. Do not move to Phase 3 if packet evidence is missing, claim-ledger records are incomplete, unsupported claims are hidden, source independence is not tracked, or counter-evidence is absent.
## Step 5: Phase 3 Review
Ask the user to switch to Gemini 3.1 Pro (High).
Act as Chief Reviewer.
Produce `phase3/critique.md` with:
- go / rework / fail decision
- structural critique
- method fit critique
- evidence gap list
- counter-evidence critique
- claim-ledger audit
- coverage matrix audit
- source-audit table for at least 10 core facts
- rework task list if needed
If the critique finds a critical evidence gap, create delta-retrieve tasks instead of asking Phase 4 to paper over the gap.
Gate: pause for user decision after critique.
## Step 6: Phase 4 Finalization
Ask the user to switch to Claude Opus 4.6 (Thinking).
Act as Final Editor.
Produce:
- `phase4/final_zh.md`
- `phase4/editorial_notes.md`
- `phase4/final_fact_check.md`
Rules:
- Do not introduce new facts unless new sources and search logs are added first.
- Final facts must be a subset of verified or explicitly caveated `claims_ledger.jsonl` rows.
- Downgrade or mark claims that remain unsupported.
- Use deterministic rendering tools afterward for PDF/DOCX.
Gate: final output must pass citation and unsupported-claim review before rendering.
+61 -219
View File
@@ -1,249 +1,91 @@
# AGENTS.md — 生物医药 Deep Research 系统规则 # AGENTS.md — Deep Research Cross-Tool Rules
> 本文件为跨平台项目级指令文件。CodexOpenCodeClaude Code、Antigravity、Gemini CLI 均应以本文件为运行规则。 This file is the shared, cross-tool instruction layer for Codex, OpenCode, Claude Code, Gemini CLI, and Antigravity.
> 所有平台 adapter / skill / command 必须遵循本文件定义的研究方法论、信源标准与输出规范。
--- Keep this file short. Do not put Antigravity roles, detailed workflows, or long skill manuals here.
## 1. 项目使命 ## Project
本项目通过**Python core + skills + 可选多模型角色**协作,以**麦肯锡、德勤等顶尖机构的研究方法**,对生物医药领域(研发、工艺、管理、投资)的指定主题进行深度研究,输出专业级报告(PDF + DOCX)。 Deep Research produces professional biomedical research reports for R&D, CMC/GMP, management, market, and investment topics.
本项目**不涉及业务代码开发**,所有"代码"都是为**研究流水线**服务(如 Python runtime、ReportLab/Quarto 模板、下载脚本、信源 API 调用)。 This repository is not an application codebase. Its code supports the research pipeline: Python runtime, search utilities, evidence schemas, citation checks, and PDF/DOCX rendering.
### 1.1 v0.20 架构原则 ## Instruction Layers
- `scripts/dr.py``scripts/runtime/*` 是核心编排真源;OpenCode、Codex、Claude Code、Antigravity、Gemini CLI 只是表层入口。 - Cross-tool baseline: `AGENTS.md`
- 模型选择以 `configs/models.yaml` 为准,由 Python runtime 解析 role/task 映射。 - Gemini / Antigravity override: `GEMINI.md`
- Skills 以 `.agents/skills` 为 canonical registryadapter skill 目录由 `uv run python scripts/dr.py skills sync` 同步。 - Antigravity roles: `.agents/agents.md`
- 默认工作链路为中文主写作;英文只保留在检索关键词、原文摘录、source title、DOI/URL 与来源笔记中。 - Antigravity strong rules: `.agents/rules/`
- Reusable skills: `.agents/skills/`
- Antigravity workflows: `.agents/workflows/`
- Implementation plan and changelog: `PLAN.md`
--- If instructions conflict, use the more specific layer. For Antigravity, `GEMINI.md` and `.agents/rules/` override this file.
## 2. 研究方法论(所有 agent 必须遵循) ## Operating Modes
### 2.1 麦肯锡核心原则 Python-core mode:
1. **研究方法适配场景**:MECE 是常用方法之一,但 GMP/CMC/管理咨询/研发立项等场景必须选择匹配框架 - Use `scripts/dr.py`, `scripts/runtime/**`, `configs/models.yaml`, and `.agents/skills`.
2. **SCQA 叙事**Situation → Complication → Question → Answer):每章节开头用此结构引入 - Platform agents should call the Python CLI rather than reimplement worker orchestration.
3. **金字塔原理**:结论先行,论据支撑,纵向深入,横向 MECE - Model routing is resolved by the Python runtime.
4. **"每个标题即一个观点"**:标题不能是"概述""现状"这类模糊词,必须包含判断
5. **So What? 自检**:每写完一段问自己"所以呢?",若无则删
### 2.2 证据铁律 Antigravity native mode:
- **每条结论至少 2 个独立 Tier 1-2 信源**佐证(见 §4 信源分级) - Use `.agents/agents.md`, `.agents/rules/`, `.agents/skills/`, and `.agents/workflows/`.
- 达不到则**必须在正文注明**"该观点仅有 X 个来源支持,待进一步验证" - Antigravity uses its own model quota for research execution.
- **反方证据优先**:每个 chapter 的研究必须主动搜索证伪性论点,不能只找支持证据 - Python scripts are auxiliary for scaffolding, local material processing, deterministic checks, citation/report rendering, and status.
- **数据可追溯**:所有数字、百分比、日期必须有来源 ID(如 `[src_042]` - Do not run Python model-worker commands such as `dr.py run`, `research --execute-packets`, or `research --assemble-chapters` unless the user explicitly approves external API/ZenMux usage.
### 2.3 字数配额(硬要求) ## Core Commands
| 报告类型 | 最小字数 | 建议章节数 |
|---|---|---|
| 综述类 | 10,000 字 | 8-10 章 |
| 研究类 | 30,000 字 | 10-12 章 |
| 投资报告 | 20,000 字 | 10-12 章 |
| 管理/工艺类 | 15,000-25,000 字 | 9-11 章 |
**字数分配原则**
- 每章字数差距不超过 ±30%(避免头重脚轻)
- 每 section 最少 800 字(不够则合并)
- 结论章不少于全文 10%
### 2.4 报告不能只谈结论
- 每个观点后必须紧跟**数据/事实/案例**佐证
- 禁止空洞形容词("巨大""快速""显著")不带数据
- 趋势判断必须给**量化依据**(年复合增长率、市场规模、成功率等)
---
## 3. Phase 工作流(4 阶段)
### Phase 1:框架规划
- **驱动命令**`uv run python scripts/dr.py init <topic>``uv run python scripts/dr.py frame <slug>``/dr-init``/dr-frame` 只是薄封装)
- **主导入口**Python core 生成项目骨架与 frameworkdr-plan 可作为表层访谈增强
- **产出**`phase1/material_brief.md` + `phase1/framework.md` + `phase1/research_brief.md/json`
- **暂停点**:用户确认材料解读、研究方法、任务切分、检索策略和章节框架
- **硬规则**clarification 不只是问范围;必须固化报告用途、基调、成功标准、任务拆分、每个任务轴的 prompt/skills/search route,让低成本 worker 也能独立执行
### Phase 2:深度研究
- **驱动命令**`uv run python scripts/dr.py research <slug> --workers 6`
- **主导入口**Python core 生成 task cards 并控制并发
- **产出**`phase2/task_cards.json` + `packets/*.json` + `sources.jsonl` + `chapter_briefs/*.json` + `compressed_findings/*.json` + `drafts/chXX.md`
- **不暂停**:全自动跑完
- **防碎片化规则**:并发 worker 只写 evidence packet`--build-briefs` 必须先收束为 chapter brief 和 compressed finding;章节正文必须从 compressed finding 写,不得把 packet 按顺序拼贴成报告
### Phase 3:总编审校
- **驱动命令**`uv run python scripts/dr.py review <slug>``/dr-review` 只是薄封装)
- **主导入口**Python core deterministic reviewdr-chief-editor/Gemini 可作为后续深度审校增强
- **产出**`projects/<slug>/phase3/critique.md`
- **暂停点**:用户决策(修正 / 回炉 phase2 / 整体重来)
### Phase 4:成稿
- **驱动命令**`uv run python scripts/dr.py finalize <slug>`
- **主导入口**Python core 中文原生成稿;OpenCode/Codex/Claude Code 只调用 CLI
- **默认链路**final_zh.md → glossary/check(optional) → polish(optional) → citation_check → build_report
- **兼容链路**:仅显式 `--legacy-translate` 时使用 final_en.md → translate → polish
- **产出**`phase4/final_zh.md` + `phase4/final_zh_polished.md`(可选)+ `phase4/*.pdf` + `phase4/*.docx`
---
## 4. 信源分级(Tier 系统)
### Tier 1 — 一级信源(优先使用,评分权重 × 1.2)
- **一手学术文献**PubMed、Cochrane、顶刊原文(NEJM / Lancet / Nature / Science / Cell / JAMA
- **监管机构公告**FDA、EMA、NMPA、PMDA 官网及 openFDA
- **临床试验注册**ClinicalTrials.gov、ChiCTR
- **专利原文**USPTO、EPO、CNIPA、Google Patents
- **上市公司披露**SEC 10-K/10-Q、招股书、交易所年报
### Tier 2 — 二级信源(可用,标准权重)
- **权威咨询报告**:麦肯锡、BCG、德勤、IQVIA、EvaluatePharma、弗若斯特沙利文
- **学术综述**:系统综述(Systematic Review)、Meta 分析
- **行业协会**PhRMA、BIO、中国医药工业协会
- **专业数据库**Wind、东方财富、同花顺(金融侧)
- **专业媒体**BioSpace、Endpoints News、FiercePharma、医药魔方、Insight 数据库
### Tier 3 — 三级信源(辅助,不得作为唯一支撑)
- **预印本**bioRxiv、medRxiv(需标注"未经同行评审")
- **券商研报**:中金、中信、高盛生物医药团队(需注意利益冲突)
- **会议摘要**AACR、ASCO、ASH 会议摘要(数据可能未完整发表)
- **企业白皮书**(注明来源,降权使用)
### Tier 4 — 四级信源(仅做发现入口)
- Tavily / Brave / Exa 通用搜索返回的**普通网页**
- 一般新闻报道
- Wikipedia(**只做术语理解入口,结论不得引用**)
### 黑名单(禁用)
- 纯新闻聚合站(百家号、头条号、部分自媒体公众号)
- 未署名作者的行业博客
- 被 Retraction Watch 标记为撤稿的论文
- 明显软文/PR 稿(如"某某 CEO 表示..."而无实质数据)
- 超过 5 年的综述(除机制类研究可放宽)
### 信源评分(0-10
每个进入 `sources.jsonl` 的信源必须打分,维度:
- 权威性(期刊 IF、机构排名)0-3
- 时效性(≤3 年满分,每老 1 年 -0.5) 0-2
- 一手性(一手 > 综述 > 二次解读) 0-2
- 可验证性(有 DOI / URL / 原始数据) 0-2
- 利益冲突(厂商自发 -1 0-1
**硬规则**:评分 < 5 的信源不得作为结论唯一支撑。
---
## 5. Python Role / Task 模型
平台 agent 文件只保留兼容和展示意义;真实角色、任务类型、模型、温度、并发上限以 Python runtime 为准。
查看当前模型配置:
```bash ```bash
uv run python scripts/dr.py models --profile medium uv run python scripts/dr.py init "研究主题" --slug <slug> --method <method>
uv run python scripts/dr.py models --profile medium --json uv run python scripts/dr.py frame <slug>
uv run python scripts/dr.py methods list uv run python scripts/dr.py research <slug> --workers 6 --execute-packets
uv run python scripts/dr.py review <slug>
uv run python scripts/dr.py finalize <slug>
uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace --dry-run
``` ```
核心任务类型: ## Research Integrity
| Task type | 默认角色 | 用途 | - No fabricated data, URLs, DOIs, clinical results, regulatory status, patents, or market figures.
|---|---|---| - No factual claim without a source ID or a clearly marked "to verify" status.
| `source_discovery` | `dr_searcher` | 轻量信源发现 | - No claim that a search or verification was performed unless there is a real tool receipt or search log.
| `evidence_packet` | `dr_analyst` | task card → evidence packet | - Search snippets, AI summaries, and model memory are discovery leads, not final evidence.
| `chapter_assembly` | `dr_analyst` | chapter brief → 中文章节 | - Every major conclusion needs at least two independent Tier 1-2 sources. If not available, downgrade and mark uncertainty.
| `counter_verification` | `dr_verifier` | 反方证据与交叉模型验证 | - Counter-evidence is mandatory. Do not collect only supporting evidence.
| `phase3_review` | `dr_chief_editor` | 总编审校 | - Wikipedia is allowed for orientation only and must not support final conclusions.
| `final_editorial` | `dr_editor_in_chief` | 中文终稿统稿 | - Use Chinese for formal report writing. English may remain in search keywords, titles, DOI/URL, original excerpts, and raw notes.
| `report_render` | `dr_reporter` | PDF/DOCX 渲染 |
默认策略: ## Method Selection
- Codex/GPT 系列适合代码、schema、回归、review。 Do not default to McKinsey/MECE for every topic.
- Claude/Opus/Sonnet 适合长文结构、中文表达、访谈增强。
- Gemini 适合长上下文审校、多模态材料、替代框架评估。
- ZenMux 混合模型仍由 `configs/models.yaml` 统一管理,平台当前会话模型不得覆盖 Python role/task 映射。
## 6. Platform Adapter 调用方式 Choose the research method and tools based on the user's scenario. Use `.agents/skills/method-selection/SKILL.md` for Antigravity native work and `configs/research_methods.yaml` for Python-core mode.
详见 `docs/platform-adapters.md`。摘要如下: ## Source Quality
| Platform | 项目指令/命令位置 | 推荐调用 | Detailed scoring belongs in `.agents/skills/source-quality/SKILL.md`.
|---|---|---|
| OpenCode | `.opencode/commands/*.md` | `/dr-run <slug-or-topic>` |
| Codex | `AGENTS.md` + `$CODEX_HOME` adapter(由 `scripts/deploy_adapters.py codex` 部署) | `uv run python scripts/dr.py ...``codex exec "$(uv run python scripts/dr.py prompt dr-run '<topic>')"` |
| Claude Code | `.claude/skills/*/SKILL.md` | `/dr-run <slug-or-topic>` |
| Gemini CLI | `GEMINI.md` + `.gemini/commands/dr/*.toml` | `/dr:run <slug-or-topic>` |
| Antigravity | 打开仓库后由 Agent Manager 运行终端命令 | 要求 agent 运行 `uv run python scripts/dr.py ...` |
跨平台硬规则: Baseline tiers:
- 平台只做 surface adapter,不承载核心调度。 - Tier 1: original academic papers, systematic reviews where appropriate, regulator documents, clinical trial registries, patents, company filings.
- 不在平台 prompt 中手工并发写章节。 - Tier 2: authoritative consulting/industry reports, industry associations, reputable professional media and databases.
- 不把平台 subagent 当默认并发机制。 - Tier 3: preprints, conference abstracts, brokerage research, company white papers. Use with caution.
- 真实并发由 `scripts/runtime/workers.py` 的 worker pool 执行。 - Tier 4: general web pages, ordinary news, Wikipedia. Discovery only.
- 真实模型选择由 `configs/models.yaml``scripts/runtime/roles.py` 执行。
- 信息检索默认走 `scripts/search.py` / `SearchClient` / `search-gateway` skill;不得把 Tavily MCP、browser MCP 或平台 web search 作为默认路径,除非用户明确授权。
- 搜索路由必须按任务类型选择:`evidence`=Exa highlights 受控证据发现,`fda/scholar/patents/news`=专用信源路径,`general`=宽泛发现和兜底;Tavily Research 只能作为阶段性 scan/enrichment/rework 输入,不能直接替代 evidence packet 或章节正文。
--- ## Safety
## 7. 目录约定 - Keep API keys only in `secrets.env`; never hardcode or commit secrets.
- Do not read or expose secrets unless the user explicitly asks.
- Do not overwrite user settings or existing workspace rule/skill/workflow files unless the user asks for `--force`.
- Do not run destructive git commands such as `git reset --hard`, `git clean`, or broad file deletion without explicit approval.
- Do not write outside the current workspace unless the user explicitly approves.
- 每个研究主题放在 `projects/<topic-slug>/`slug 用小写+连字符,如 `glp1-r-agonist-market-2026` ## Change Management
- 所有中间产物(drafts、evidence、sources.jsonl)均为 Markdown 或 JSONL,便于 diff 与版本控制
- `archive/` 存放已完成或废弃的研究,不再主动维护
--- - Treat `AGENTS.md`, `GEMINI.md`, `.agents/**`, and `PLAN.md` as production configuration.
- Keep root rules short. Move roles to `.agents/agents.md`, constraints to `.agents/rules`, capabilities to `.agents/skills`, and phase sequencing to `.agents/workflows`.
## 8. 安全与权限 - When changing runtime rules or adapter behavior, update `PLAN.md` changelog.
- API 密钥**只存** `secrets.env`(已入 gitignore),禁止硬编码到任何 agent/skill/command
- 字体文件(~140MB)不入 git,通过 `download-fonts.sh` 获取
- `bash` 权限默认 `ask`,仅允许 `python *` / `pandoc *` / `ls *` / `cat *` / `curl *` 自动执行
---
## 9. 如何判断是否走了 Python Core
不要用“平台是否 spawn subagent”作为成功标准。v0.20 的验证锚点是 Python runtime 产物:
1. `uv run python scripts/dr.py status <slug>` 能看到 phase 状态。
2. Phase 2 存在 `phase2/task_cards.json`
3. Phase 1 存在 `phase1/research_brief.md``phase1/research_brief.json`
4. `--execute-packets` 后存在 `phase2/packets/*.json` 和必要时的 `phase2/packet_errors/*.json`
5. `--build-briefs` 后存在 `phase2/chapter_briefs/*.json``phase2/compressed_findings/*.json`
6. `--assemble-chapters` 后存在 `phase2/drafts/chXX.md` 和必要时的 `phase2/chapter_errors/*.json`
7. `scripts/v020_regression.py` 输出 `v0.20 regression PASS`
---
## 10. 禁止事项(negative instructions
所有 agent 均禁止:
1. ❌ 引用 Wikipedia 作为结论支撑(仅做术语理解)
2. ❌ 在缺乏 2 个独立信源时仍给出绝对化结论
3. ❌ 使用"据报道""有专家认为"等未指明来源的表述
4. ❌ 编造或虚构数据、URL、DOI
5. ❌ 写空洞的套话("随着科技的发展""在大数据时代"
6. ❌ 忽略反方观点,只收集支持证据
7. ❌ 对输出字数"打折"(综述 <10000 字、研究 <30000 字必须返工)
8. ❌ 在正文中使用未在术语表中定义的专业缩写(首次出现需全称+缩写)
---
## 11. 变更管理
- 本文件与 `PLAN.md` 是**双核**:PLAN.md 管实施进度与架构,AGENTS.md 管运行时规则
- 修改本文件需同步更新 PLAN.md 的"变更记录"段
- 所有 agent/skill 新增或重大调整必须在 PLAN.md §8 清单中标记完成状态
+30 -14
View File
@@ -1,18 +1,34 @@
# Gemini CLI Project Instructions # GEMINI.md — Gemini / Antigravity Overrides
This repository is Deep Research v0.20. This file has higher priority than `AGENTS.md` for Gemini CLI and Antigravity.
- Python core is the source of truth: `scripts/dr.py`, `scripts/runtime/**`, `configs/models.yaml`, `.agents/skills`. ## Load The Right Layer
- Gemini CLI is a surface adapter. Do not perform core orchestration in the chat thread.
- Use `.gemini/commands/dr/*.toml` commands or run `uv run python scripts/dr.py ...` directly.
- Keep formal research outputs Chinese-first. Search keywords, source titles, excerpts, DOI/URL and raw notes may remain English.
- Do not modify `projects/**` unless the user is intentionally running a research project.
Typical commands: - Shared baseline: `AGENTS.md`
- Antigravity roles: `.agents/agents.md`
- Strong research rules: `.agents/rules/`
- Skills: `.agents/skills/`
- Workflows: `.agents/workflows/`
```bash For Antigravity native research, load `.agents/agents.md`, `.agents/rules/deep-research-antigravity.md`, `.agents/skills/antigravity-surface-adapter/SKILL.md`, `.agents/skills/method-selection/SKILL.md`, `.agents/skills/research-quality-gates/SKILL.md`, and `.agents/workflows/deep-research-native.md`.
uv run python scripts/dr.py run "研究主题" --slug <slug> --method mckinsey_market
uv run python scripts/dr.py research <slug> --workers 6 --execute-packets Use `/memory show` or `/memory refresh` in Gemini CLI when the loaded context may be stale.
uv run python scripts/dr.py review <slug>
uv run python scripts/dr.py finalize <slug> ## Gemini Failure Modes
```
Treat Gemini-family models as high risk for false certainty in research.
- Never say "searched", "verified", "confirmed", "officially shows", or "according to source" unless a real tool call happened in this session or phase and the result is logged.
- Do not use model memory, snippets, or AI summaries as evidence.
- Every concrete fact needs a `source_id`, claim-ledger row, or a clear "to verify" label.
- If the original source cannot be opened, write "未能访问原文,仅作为发现线索" and do not extract exact values from it.
- Keep `search_log.jsonl`, `claims_ledger.jsonl`, and `continuation_state.json` current in Antigravity native runs.
- Prefer "未找到足够证据" over filling gaps.
## Platform Boundary
Gemini CLI normally uses Python-core mode through `.gemini/commands/dr/*.toml` or `uv run python scripts/dr.py ...`.
Antigravity is different: use native mode and its model quota for research execution. Python scripts are auxiliary unless the user explicitly approves Python model-worker/API usage.
Do not modify `projects/**` unless the user is intentionally running a research project.
+77 -2
View File
@@ -1,7 +1,7 @@
# Deep Research 系统方案(Python Core + 多平台 Adapter # Deep Research 系统方案(Python Core + 多平台 Adapter
> 本文件是整套方案的**单一真实源**,中断后续接时从此文件恢复上下文。 > 本文件是整套方案的**单一真实源**,中断后续接时从此文件恢复上下文。
> 最后更新:2026-05-05 > 最后更新:2026-05-07
> 实施阶段:v0.20 — Skill-driven Python core 重构 > 实施阶段:v0.20 — Skill-driven Python core 重构
--- ---
@@ -35,6 +35,7 @@
| 交互节奏 | Phase 1 末、Phase 3 末强制确认 | | 交互节奏 | Phase 1 末、Phase 3 末强制确认 |
| 并发执行 | Python task-card worker pool(平台 subagent 仅作可选表层能力) | | 并发执行 | Python task-card worker pool(平台 subagent 仅作可选表层能力) |
| 中文字体 | **思源宋体 + 思源黑体 + 霞鹜文楷**,通过 `download-fonts.sh` 自动拉取 | | 中文字体 | **思源宋体 + 思源黑体 + 霞鹜文楷**,通过 `download-fonts.sh` 自动拉取 |
| Antigravity 适配 | 使用 `.agents/rules` + `.agents/skills` 指导 Antigravity 原生执行 Deep ResearchGemini Flash 管流程,Opus/Gemini Pro 分 phase 执行,Python core 退为辅助工具 |
--- ---
@@ -59,6 +60,19 @@
**Cache 行为**Claude 走 `@ai-sdk/anthropic` 会自动打 `cache_control` 断点,zenmux 的 Anthropic 端点完整支持 4 种 cache 模式。Opus 4.7 cache read 价格仅 0.5 USD/M tokens(对比输入价 25 USD/M,节省 98%)。验证方法见 `AGENTS.md` §6.5。 **Cache 行为**Claude 走 `@ai-sdk/anthropic` 会自动打 `cache_control` 断点,zenmux 的 Anthropic 端点完整支持 4 种 cache 模式。Opus 4.7 cache read 价格仅 0.5 USD/M tokens(对比输入价 25 USD/M,节省 98%)。验证方法见 `AGENTS.md` §6.5。
### 2.1 Antigravity 原生模型策略
Antigravity 当前可选 models 包括 Gemini 3.1 Pro (High/Low)、Gemini 3 Flash、Claude Sonnet 4.6 (Thinking)、Claude Opus 4.6 (Thinking) 与 GPT-OSS 120B。Codex 使用经验显示,若 Antigravity 仍默认调用 Python core model workers,研究主流程容易回到 ZenMux,并且 packet/chapter assembly 有碎片化风险。因此 Antigravity 采用 native 模式:用 skill 指导 Antigravity 自身模型按 phase 写产物,Python core 只负责脚手架、确定性校验、引用和出稿。
默认策略:
- Surface managerGemini 3 Flash,负责读 skill、维护 task list、推进 phase、跑轻量命令和收集 artifact。
- Phase 0-1Claude Opus 4.6 (Thinking),负责材料解读、研究方法选择、大胆假设、章节架构和成功标准。
- Phase 2Gemini 3.1 Pro (Low),负责证据包、反方证据、chapter brief、初稿,优先追求速度和可控成本。
- Phase 3Gemini 3.1 Pro (High),先做总编审校和证伪;若质量不足,再人工决定是否换模型复核。
- Phase 4Claude Opus 4.6 (Thinking),负责最终中文统稿、Executive Summary、表达质量和交付一致性。
- Python core 禁止默认接管 `run/research --execute-packets/assemble-chapters`;只有用户明确授权外部模型/API 消耗时才运行。
--- ---
## 3. 完整架构 ## 3. 完整架构
@@ -69,7 +83,7 @@ v0.20 后,核心编排从平台 prompt 迁移到项目自有 Python runtime
- `scripts/dr.py` 是稳定入口:`init``frame``run``research``review``finalize``skills``models` - `scripts/dr.py` 是稳定入口:`init``frame``run``research``review``finalize``skills``models`
- `scripts/runtime/*` 负责 role/task 模型解析、skill registry、task cards、packet schema、manifest 更新。 - `scripts/runtime/*` 负责 role/task 模型解析、skill registry、task cards、packet schema、manifest 更新。
- `.agents/skills` 是 canonical skill registry`.opencode/skills` 等 adapter 目录由 `dr.py skills sync` 生成。 - `.agents/skills` 是 canonical skill registry,也是 Antigravity 默认 workspace skill 目录`.opencode/skills` 等 adapter 目录由 `dr.py skills sync` 生成。
- OpenCode/Codex/Claude Code 只作为 surface adapter,调用 Python CLI,不再承载默认并发调度。 - OpenCode/Codex/Claude Code 只作为 surface adapter,调用 Python CLI,不再承载默认并发调度。
- Phase 2 默认生成 `phase2/task_cards.json``phase2/packets/*.json`,减少长上下文传递。 - Phase 2 默认生成 `phase2/task_cards.json``phase2/packets/*.json`,减少长上下文传递。
- Phase 2 在正式写章前生成 `phase2/chapter_briefs/*.json`,先把并发证据收束为章节主线,降低碎片化。 - Phase 2 在正式写章前生成 `phase2/chapter_briefs/*.json`,先把并发证据收束为章节主线,降低碎片化。
@@ -78,6 +92,7 @@ v0.20 后,核心编排从平台 prompt 迁移到项目自有 Python runtime
- Phase 4 默认中文原生:`final_zh.md -> build_report`legacy 英译中链路仅由 `--legacy-translate` 显式启用。 - Phase 4 默认中文原生:`final_zh.md -> build_report`legacy 英译中链路仅由 `--legacy-translate` 显式启用。
- Phase 1 必须选择 `research_method`,由 `configs/research_methods.yaml` 决定框架方法和 Phase 2 task axesMECE 不再是唯一默认。 - Phase 1 必须选择 `research_method`,由 `configs/research_methods.yaml` 决定框架方法和 Phase 2 task axesMECE 不再是唯一默认。
- 用户提供资料入口已支持 `input_materials` / `phase0/inputs` / `phase0/extracted`PDF 文本抽取与 FireRed OCR 扫描件识别已先行落地,DOCX/PPTX/表格结构化继续放入 v0.21。 - 用户提供资料入口已支持 `input_materials` / `phase0/inputs` / `phase0/extracted`PDF 文本抽取与 FireRed OCR 扫描件识别已先行落地,DOCX/PPTX/表格结构化继续放入 v0.21。
- Antigravity 入口已落地:`.agents/rules/deep-research-antigravity.md` 约束其优先使用 Antigravity 模型配额,`.agents/skills/antigravity-surface-adapter` 提供 native runbook、模型切换和搜索策略。
``` ```
┌─────────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────────┐
@@ -715,3 +730,63 @@ OpenCode 的坑:如果只是在主会话里装样子地写"让 X agent 做"
- `scripts/runtime/tasks.py``evidence` 纳入合法 search route,并更新主要 task axes 的默认路由。 - `scripts/runtime/tasks.py``evidence` 纳入合法 search route,并更新主要 task axes 的默认路由。
- `scripts/runtime/workers.py``ProjectSearchProvider` 支持 `evidence` route。 - `scripts/runtime/workers.py``ProjectSearchProvider` 支持 `evidence` route。
- `skills/search-gateway``skills/search-strategy``docs/search-playbook.md``README.md``AGENTS.md` 同步记录搜索分工,避免后续又回到 Tavily MCP 或中文长句搜索。 - `skills/search-gateway``skills/search-strategy``docs/search-playbook.md``README.md``AGENTS.md` 同步记录搜索分工,避免后续又回到 Tavily MCP 或中文长句搜索。
- 2026-05-07 v0.20.1 Antigravity native adapter**用 Antigravity 模型配额执行研究**
**设计结论**
- Antigravity 官方机制以 `.agents/skills``.agents/rules`、Rules/Workflows、Task Groups 和 browser subagent 为核心;本项目在 Antigravity 中采用 skill-driven native research,而不是默认调用 Python core model workers。
- `AGENTS.md` 继续作为跨平台总规则;Antigravity 专项约束放到 workspace rule 和 skill,避免引入非官方 SOUL.md 作为项目真源。
- Opus 额度有限但大局观强,优先用于 Phase 0-1 和 Phase 4Gemini 3 Flash 做流程管理,Gemini 3.1 Pro Low/High 分别用于 Phase 2/3。
- `paperfoot/search-cli` 可作为 Antigravity 原生检索前台:多 provider、14 modes、JSON/exit code 友好;但不得替代本项目 source tier 与 source-quality 评分。
**已落地**
- 新增 `.agents/skills/antigravity-surface-adapter/SKILL.md`,定义 Antigravity native runbook、pause points、artifact 汇报、模型切换表和 `search-cli` 使用建议。
- 新增 `.agents/rules/deep-research-antigravity.md`,要求 Antigravity 优先使用自身模型配额,Python core 只做脚手架、确定性校验、引用和出稿。
- 撤回 `configs/models.yaml` 中 Antigravity 专用 ZenMux profile,避免误导主流程继续走 Python/ZenMux。
- `docs/platform-adapters.md``README.md`、测试用例同步更新。
- 2026-05-07 v0.20.2 Antigravity/Gemini research integrity hardening**反幻觉、反假搜索、workflow gates**
**设计结论**
- Gemini/Gemini CLI/Antigravity 在 deep research 中必须默认视为高幻觉风险模型;项目规则要把"诚实暴露不确定性"写成硬门槛,而不是依赖模型自觉。
- `GEMINI.md` 适合放短而硬的项目级行为约束,并通过层级 context 与 imports 承接 `AGENTS.md`
- Antigravity `rules` 适合放 Always-On 约束;`workflows` 适合固化 Phase 0-4 执行顺序、人工暂停点和质量 gates。
- Claude/Claude Code 最佳实践可借鉴:根指令要短、具体、可执行,长流程拆到 rules/skills/workflows,避免巨型上下文降低遵从性。
**已落地**
- 初版曾在 `AGENTS.md` 中加入 Antigravity native 例外、检索回执、source_id、search_log、unsupported_claims 等反幻觉硬规则;v0.20.3/v0.20.4 已将这些内容迁入 `.agents/rules``.agents/skills``.agents/workflows`
- `GEMINI.md` 重写为短约束:禁止假搜索、禁止无 source_id 事实、要求 search log,并区分 Gemini CLI 与 Antigravity native。
- `.agents/rules/deep-research-antigravity.md` 加入 Anti-Hallucination Contract。
- `.agents/skills/antigravity-surface-adapter/SKILL.md` 加入 phase artifacts、fact-audit、权限建议和检索日志要求。
- 新增 `.agents/workflows/deep-research-native.md`,把四阶段 native research 写成可执行 workflow,并在每阶段设 gate。
- `scripts/deploy_adapters.py antigravity` 同步部署 workflows;已有文件继续默认跳过,`--force` 才备份覆盖。
- 2026-05-07 v0.20.3 Antigravity rule/agent/skill separation**按 Antigravity 最佳实践重新分层**
**设计结论**
- `AGENTS.md` / `GEMINI.md` 是跨工具/Antigravity 项目规则,不应承担角色定义、技能手册和详细流程。
- `.agents/agents.md` 用于 Antigravity 角色团队定义;`.agents/rules` 放强约束;`.agents/skills` 放可复用技能;`.agents/workflows` 放 slash workflow 和阶段编排。
- 继续保留反幻觉约束,但从 `AGENTS.md` 的长段落中移出,由 Antigravity rule/skill/workflow 承载,避免根规则膨胀影响遵从性。
**已落地**
- 新增 `.agents/agents.md`,定义 Research Manager、Phase 0-1 Strategist、Evidence Analyst、Chief Reviewer、Final Editor。
- 瘦身 `AGENTS.md`,只保留跨平台研究底线与分层指引。
- `antigravity-surface-adapter` skill 和 `deep-research-native` workflow 改为引用 `.agents/agents.md`
- `scripts/deploy_adapters.py antigravity` 同步部署 `.agents/agents.md`,默认跳过已有文件,`--force` 才备份覆盖。
- 2026-05-07 v0.20.4 AGENTS/GEMINI slimdown + method selection**根规则瘦身,研究方法按场景选择**
**设计结论**
- 根 `AGENTS.md` 只保留跨工具底线、命令入口、安全边界和分层索引;Phase 0-4 工作流、Antigravity 角色、长规则和技能细则全部迁出。
- `GEMINI.md` 只做 Gemini/Antigravity 高优先级覆盖,强调上下文加载和反假搜索。
- 麦肯锡/MECE/SCQA 只是候选表达和咨询工具,不再作为默认研究方法;不同研究场景必须选择匹配的分析框架。
**已落地**
- 重写 `AGENTS.md`,缩短为跨工具规则和索引。
- 重写 `GEMINI.md`,保留 Gemini 反幻觉、平台边界和 context 加载指引。
- 新增 `.agents/skills/method-selection/SKILL.md`,覆盖市场/投资、临床、CMC/GMP、R&D、管理、政策等方法路由。
- 参考 `199-biotechnologies/claude-deep-research-skill` 的证据持久化、claim-level verification、delta retrieve、continuation state 和 final assembly gate 设计,新增 `.agents/skills/research-quality-gates/SKILL.md`
- 强化 `source-quality``evidence-table`:要求 search receipt、原文访问状态、独立性 cluster、`claims_ledger.jsonl``coverage_matrix.md` 和不可证实 claim 显式落盘。
- 重写 `.agents/agents.md`,只保留角色定义和 required skills。
- 重写 `.agents/workflows/deep-research-native.md`,把方法选择设为独立 gate,加入 claim ledger、delta retrieve、coverage audit 和 continuation state gate。
- 文档与测试同步更新。
+15 -5
View File
@@ -95,13 +95,13 @@ uv run python scripts/build_report.py <slug> --engine quarto # Quarto/xelatex
### 多平台兼容 ### 多平台兼容
v0.20 后,所有平台都是 surface adapter,核心调度只在 Python core 中执行。详细调用方式见 `docs/platform-adapters.md` v0.20 后,OpenCode/Codex/Claude Code/Gemini CLI 都是 Python core 的 surface adapter。Antigravity 走 native 模式:用 `.agents/skills` 指导其自身模型按 phase 执行研究,Python core 只做辅助。详细调用方式见 `docs/platform-adapters.md`
- OpenCode:使用 `.opencode/commands/*.md` 薄封装 Python CLI。 - OpenCode:使用 `.opencode/commands/*.md` 薄封装 Python CLI。
- Codex:使用 `AGENTS.md` + 部署到 `$CODEX_HOME` 的 adapter 文件,优先用 GPT 系列做代码/测试/审阅。 - Codex:使用 `AGENTS.md` + 部署到 `$CODEX_HOME` 的 adapter 文件,优先用 GPT 系列做代码/测试/审阅。
- Claude Code:使用 `.claude/skills/*/SKILL.md`,优先用 Opus/Sonnet 做访谈、结构讨论和中文风格审阅。 - Claude Code:使用 `.claude/skills/*/SKILL.md`,优先用 Opus/Sonnet 做访谈、结构讨论和中文风格审阅。
- Gemini CLI:使用 `GEMINI.md``.gemini/commands/dr/*.toml`,优先用 Gemini 做长上下文、多模态和替代框架审阅。 - Gemini CLI:使用 `GEMINI.md``.gemini/commands/dr/*.toml`,优先用 Gemini 做长上下文、多模态和替代框架审阅。
- Antigravity:作为 Agent Manager 打开仓库,要求 agent 在终端运行 `uv run python scripts/dr.py ...` - Antigravity:作为 Agent Manager 打开仓库,使用 `.agents/rules` + `.agents/skills` 指导其用 Antigravity 模型配额原生执行 Deep ResearchPython core 只做脚手架、校验、引用和出稿辅助;质量门由 `method-selection``research-quality-gates``source-quality``evidence-table` 共同约束
部署 Codex adapter(不在仓库内创建 `.codex`): 部署 Codex adapter(不在仓库内创建 `.codex`):
@@ -113,6 +113,15 @@ Codex adapter 会写到 `$CODEX_HOME` 或 `~/.codex`;已有文件会在 `--for
安全默认:部署脚本不会复制 `config.toml`,避免覆盖用户级 Codex 配置。只有明确需要安装本项目 bundled profile 时,才使用 `--include-config` 安全默认:部署脚本不会复制 `config.toml`,避免覆盖用户级 Codex 配置。只有明确需要安装本项目 bundled profile 时,才使用 `--include-config`
部署 Antigravity workspace adapter(只写目标工作区 `.agents/`,默认不覆盖已有文件):
```bash
uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace --dry-run
uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace
```
Antigravity 部署不会修改全局设置。若目标工作区已有同名 agents/rule/skill/workflow 文件,默认跳过;只有显式加 `--force` 时才会先生成 `.bak` 备份再覆盖。Antigravity 分层为:`.agents/agents.md` 定义角色,`.agents/rules` 放强约束,`.agents/skills` 放能力,`.agents/workflows` 放流程。关键 artifact 包括 `search_log.jsonl``sources.jsonl``claims_ledger.jsonl``coverage_matrix.md``continuation_state.json`
部署到新环境后自检: 部署到新环境后自检:
```bash ```bash
@@ -135,7 +144,7 @@ uv run python scripts/dr.py review <slug>
uv run python scripts/dr.py finalize <slug> uv run python scripts/dr.py finalize <slug>
``` ```
OpenCode/Codex/Claude Code/Antigravity/Gemini CLI adapter 只包装这些 CLI,不再承担核心调度或模型选择。 OpenCode/Codex/Claude Code/Gemini CLI adapter 只包装这些 CLI,不再承担核心调度或模型选择。Antigravity 是例外:它优先按 `.agents/skills/antigravity-surface-adapter` 用自身模型配额执行研究,避免主流程重新落回 ZenMux。
模型与搜索 API 选择见: 模型与搜索 API 选择见:
- `docs/model-playbook.md` - `docs/model-playbook.md`
@@ -177,7 +186,7 @@ uv run python scripts/search.py "FDA warning letter CAPA deviation change contro
uv run python scripts/search.py "dual-target siRNA GalNAc" --route patents uv run python scripts/search.py "dual-target siRNA GalNAc" --route patents
``` ```
v0.20 搜索分工:`evidence` 用 Exa highlights 做受控候选证据发现;`scholar/patents/news/fda` 保留专用路由;`general` 只做宽泛发现和兜底;Tavily Research 作为 Phase1 初扫、薄弱章节补证据和 Phase3 回炉工具,结果必须存盘、评分、去重后再进入 evidence packet。 v0.20 搜索分工:`evidence` 用 Exa highlights 做受控候选证据发现;`scholar/patents/news/fda` 保留专用路由;`general` 只做宽泛发现和兜底;Tavily Research 作为 Phase1 初扫、薄弱章节补证据和 Phase3 回炉工具,结果必须存盘、评分、去重后再进入 evidence packet。Antigravity 原生流程可优先使用 `paperfoot/search-cli``search` 命令作为统一检索前台,但所有结论仍必须回到本项目 Tier/source-quality 体系。
--- ---
@@ -344,7 +353,7 @@ Opus 4.7 cache 读取价格 0.5 USD/M tokens(对比输入 25 USD/M,节省 98
### 系统侧(下一阶段) ### 系统侧(下一阶段)
- [x] Python core `init/frame/research/review/finalize/status` 骨架 - [x] Python core `init/frame/research/review/finalize/status` 骨架
- [x] OpenCode/Codex/Claude Code/Gemini CLI wrapper - [x] OpenCode/Codex/Claude Code/Gemini CLI wrapper
- [ ] Antigravity 专用工作流模板(等待官方本地配置格式稳定) - [x] Antigravity 专用 workspace rule + skill,按 Antigravity 模型配额原生执行研究
- [x] 用户资料导入基础能力:PDF 文本抽取 + FireRed OCR 扫描件识别 + phase0 落盘 - [x] 用户资料导入基础能力:PDF 文本抽取 + FireRed OCR 扫描件识别 + phase0 落盘
- [ ] 用户资料导入增强:DOCX / PPTX / 表格抽取 / 版面结构化 - [ ] 用户资料导入增强:DOCX / PPTX / 表格抽取 / 版面结构化
- [ ] PDF reporting 包继续拆分:字体、宽表、引用、渲染验证 - [ ] PDF reporting 包继续拆分:字体、宽表、引用、渲染验证
@@ -499,5 +508,6 @@ direnv allow
- **v0.3** (2026-04-20) — 修正 v0.2 模型名(回到 Opus 4.7 / Sonnet 4.6 / Gemini 3.1 Pro / GPT-5.4 Pro 等真实 slug);改 venv + requirements.txt 跨平台方案(macOS + Debian);新增 `scripts/setup.sh``scripts/activate.sh` - **v0.3** (2026-04-20) — 修正 v0.2 模型名(回到 Opus 4.7 / Sonnet 4.6 / Gemini 3.1 Pro / GPT-5.4 Pro 等真实 slug);改 venv + requirements.txt 跨平台方案(macOS + Debian);新增 `scripts/setup.sh``scripts/activate.sh`
- **v0.13** (2026-05-02) — `build_report.py` 新增 `--engine quarto` 选项:Quarto 1.9 + xelatex 引擎,解决 ReportLab 超宽表格渲染 bug`negative availWidth`/`NoneType` 问题);`report-template.py` 同步修复(`render_table_blocks` 分块 + 等宽列强制分配);README 补充双引擎安装指南与排错 - **v0.13** (2026-05-02) — `build_report.py` 新增 `--engine quarto` 选项:Quarto 1.9 + xelatex 引擎,解决 ReportLab 超宽表格渲染 bug`negative availWidth`/`NoneType` 问题);`report-template.py` 同步修复(`render_table_blocks` 分块 + 等宽列强制分配);README 补充双引擎安装指南与排错
- **v0.20** (2026-05-05) — Skill-driven Python core 重构启动:新增 `scripts/runtime/*``scripts/dr.py init/frame/run/research/review/skills`、task-type 模型映射、中文原生 finalize 默认路径和 `scripts/reporting/*` 报告模块;OpenCode/Codex/Claude Code/Gemini CLI 命令降级为 Python CLI wrapper。 - **v0.20** (2026-05-05) — Skill-driven Python core 重构启动:新增 `scripts/runtime/*``scripts/dr.py init/frame/run/research/review/skills`、task-type 模型映射、中文原生 finalize 默认路径和 `scripts/reporting/*` 报告模块;OpenCode/Codex/Claude Code/Gemini CLI 命令降级为 Python CLI wrapper。
- **v0.20.1** (2026-05-07) — Antigravity-native adapter:新增 `.agents/rules/deep-research-antigravity.md``.agents/skills/antigravity-surface-adapter`,按 Gemini Flash 管理、Opus/Gemini 分 phase 执行研究;Python core 退为辅助工具。
`PLAN.md` §12 了解完整变更历史。 `PLAN.md` §12 了解完整变更历史。
+59 -13
View File
@@ -1,10 +1,10 @@
# v0.20 Platform Adapters # v0.20 Platform Adapters
> v0.20 的唯一核心入口是 Python core`scripts/dr.py``scripts/runtime/**``configs/models.yaml``.agents/skills`所有 IDE/CLI agent 只做 surface adapter > v0.20 的默认核心入口是 Python core`scripts/dr.py``scripts/runtime/**``configs/models.yaml``.agents/skills`Antigravity 例外:它使用 `.agents/skills``.agents/rules` 走 native Deep Research,让 Antigravity 模型配额承担主要研究工作
## Shared Rule ## Shared Rule
不要让平台 agent 自己调度 Phase 2 并发、模型选择或上下文压缩。平台只负责: 除 Antigravity native 模式外,不要让平台 agent 自己调度 Phase 2 并发、模型选择或上下文压缩。默认平台只负责:
- 运行 `uv run python scripts/dr.py ...` - 运行 `uv run python scripts/dr.py ...`
- 展示产物路径与失败包 - 展示产物路径与失败包
@@ -24,6 +24,8 @@ uv run python scripts/dr.py review <slug>
uv run python scripts/dr.py finalize <slug> uv run python scripts/dr.py finalize <slug>
``` ```
Antigravity 不走这条最小链路作为默认研究主流程;详见下方 Antigravity 章节。
## OpenCode ## OpenCode
官方机制:OpenCode 支持 `.opencode/commands/*.md` 自定义命令;文件名就是 slash command,内容是 promptfrontmatter 可指定 `agent``model``subtask`。OpenCode 也支持 primary/subagent 两类 agent,但 v0.20 不再把平台 subagent 当默认并发机制。 官方机制:OpenCode 支持 `.opencode/commands/*.md` 自定义命令;文件名就是 slash command,内容是 promptfrontmatter 可指定 `agent``model``subtask`。OpenCode 也支持 primary/subagent 两类 agent,但 v0.20 不再把平台 subagent 当默认并发机制。
@@ -128,26 +130,59 @@ gemini
## Antigravity ## Antigravity
官方公开资料把 Antigravity 定位为 agent-first IDEagent 可访问 editor、terminal、browser,并可并行规划、执行、验证。它适合把开发者提升为 Agent Manager,但不适合让每个 Antigravity agent 自己维护 Deep Research 的状态机 官方资料显示,Antigravity agent-first IDE主 Agent 可 editor、terminal、browser 工作;浏览器操作由 browser subagent 执行;Agent Manager 可管理多个任务流和 artifacts。基于 Codex 的 skill-driven 经验,本项目在 Antigravity 中不再默认把研究主流程交给 Python model workers,而是让 Antigravity 用自己的模型配额按 phase 执行研究
本项目已提供 Antigravity 入口:
- `.agents/agents.md`Antigravity 角色定义,只定义 Research Manager / Strategist / Analyst / Reviewer / Final Editor 等角色。
- `.agents/skills/antigravity-surface-adapter/SKILL.md`Antigravity 专用执行说明。
- `.agents/skills/method-selection/SKILL.md`:按场景选择研究方法,避免默认套用麦肯锡/MECE。
- `.agents/skills/research-quality-gates/SKILL.md`:把 search receipt、source access、claims ledger、delta retrieve、continuation state 和 final fact check 做成阶段质量门。
- `.agents/rules/deep-research-antigravity.md`workspace rule,约束其优先使用 Antigravity 模型配额,避免主流程落回 ZenMux。
- `.agents/workflows/deep-research-native.md`:可按 slash workflow 执行的四阶段研究流程与反幻觉 gate。
- `.agents/skills/*`Antigravity 官方默认 skill 目录,直接复用本项目 canonical skill registry。
部署到另一个 Antigravity workspace
```bash
uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace --dry-run
uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace
```
该命令只写 workspace-local `.agents/agents.md``.agents/skills``.agents/rules``.agents/workflows`,不修改全局 Antigravity/Gemini 设置;已有文件默认跳过,`--force` 才会备份为 `.bak` 后覆盖。
本项目调用方式: 本项目调用方式:
1. 在 Antigravity 打开仓库根目录。 1. 在 Antigravity 打开仓库根目录。
2. 确认 agent 能读 `AGENTS.md` 2. 在 Customizations / Rules 中确认 workspace rule 已启用;若未自动启用,手动 at mention `deep-research-antigravity` 或直接引用该文件
3. 给 Agent Manager 一个明确任务 3. 选择模型
| Phase / 工作 | Antigravity model | 用法 |
|---|---|---|
| Surface 管理、读 skill、状态推进 | Gemini 3 Flash | 管任务清单、跑轻量命令、收集 artifact |
| Phase 0-1 材料解读、框架规划 | Claude Opus 4.6 (Thinking) | 大局观、研究假设、章节结构 |
| Phase 2 证据包与章节草稿 | Gemini 3.1 Pro (Low) | 质量/速度均衡,按 skill 写 artifacts |
| Phase 3 总编审校 | Gemini 3.1 Pro (High) | 先试高强度 Gemini,不行再换 |
| Phase 4 最终统稿 | Claude Opus 4.6 (Thinking) | 保证中文终稿和交付质量 |
4. 给 Agent Manager 一个明确任务:
```text ```text
只作为 surface adapter,不要自行调度研究 agent 加载 .agents/agents.md、.agents/rules/deep-research-antigravity.md、.agents/skills/antigravity-surface-adapter/SKILL.md、.agents/skills/research-quality-gates/SKILL.md 和 AGENTS.md
在终端运行: 用 Gemini 3 Flash 做流程管理,按 skill 要求在需要时提示我切换模型。
uv run python scripts/dr.py run "ADC 全球竞争格局" --slug adc-global-landscape --method mckinsey_market 研究主题:"ADC 全球竞争格局"slug: adc-global-landscapemethod: mckinsey_market
然后汇报生成的项目目录、framework 路径和下一步命令 请先创建/确认项目目录,然后进入 Phase 0-1,并在生成 phase1/framework.md 和 research_brief 后暂停
``` ```
使用建议: 使用建议:
- Antigravity 的 Gemini/Opus/Gemini Computer Use/Browser 能力适合可视化 QA、PDF/HTML 预览、跨文件审阅。 - Antigravity 的 Gemini/Opus/Gemini Computer Use/Browser 能力适合可视化 QA、PDF/HTML 预览、跨文件审阅。
- 如果 Antigravity 提供 Opus 和 Gemini 模型,优先用它们做“表层审阅/交互”,不要替代 Python core 的 role/task 模型 - Opus 额度有限,但 Phase 0-1 和 Phase 4 的价值最高,优先花在框架和终稿,不花在 routine 管理
- 对高成本/长任务,要求 Antigravity 先 dry-run,再运行真实 `--execute-packets` - 不要默认运行 `dr.py run``research --execute-packets``research --assemble-chapters`,这些会把主流程重新导向 Python/ZenMux
- Python core 可用于 `init/status/skills validate/finalize/render` 等辅助动作。
- 若本机安装了 `paperfoot/search-cli``search` 命令,Antigravity Phase 0-2 可优先用 `search agent-info``search ... --json` 做统一检索入口。
- Phase 2 不只产出章节草稿;必须维护 `search_log.jsonl``sources.jsonl``claims_ledger.jsonl``coverage_matrix.md``unsupported_claims.md`,否则 Phase 3/4 不得声称已验证。
- 不建议依赖 SOUL.md:它不是 Antigravity 官方 Deep Research 约束入口。本项目用 `AGENTS.md``.agents/agents.md``.agents/rules``.agents/skills``.agents/workflows` 分层约束。
## Model Strategy Across Platforms ## Model Strategy Across Platforms
@@ -157,9 +192,9 @@ uv run python scripts/dr.py run "ADC 全球竞争格局" --slug adc-global-lands
| Codex | GPT 系列用于代码、测试、schema、review | `configs/models.yaml` | | Codex | GPT 系列用于代码、测试、schema、review | `configs/models.yaml` |
| Claude Code | Opus/Sonnet 用于访谈、中文风格、结构讨论 | `configs/models.yaml` | | Claude Code | Opus/Sonnet 用于访谈、中文风格、结构讨论 | `configs/models.yaml` |
| Gemini CLI | Gemini 用于长上下文、多模态、框架审阅 | `configs/models.yaml` | | Gemini CLI | Gemini 用于长上下文、多模态、框架审阅 | `configs/models.yaml` |
| Antigravity | Gemini/Opus 用于 IDE agent、browser/PDF QA | `configs/models.yaml` | | Antigravity | Gemini Flash/Opus/Gemini Pro 分 phase 执行研究 | `.agents/skills` + Antigravity model selector |
核心原则:平台模型负责“怎么帮用户操作项目”,ZenMux/Python role 模型负责“研究任务用哪个模型执行”。 核心原则:除 Antigravity 外,平台模型负责“怎么帮用户操作项目”,ZenMux/Python role 模型负责“研究任务用哪个模型执行”。Antigravity 专门走 native 模式,以消耗 Antigravity 自身模型配额并降低 Python-core 碎片化风险。
## Sources ## Sources
@@ -168,3 +203,14 @@ uv run python scripts/dr.py run "ADC 全球竞争格局" --slug adc-global-lands
- Claude Code skills/slash commands: https://code.claude.com/docs/en/slash-commands - Claude Code skills/slash commands: https://code.claude.com/docs/en/slash-commands
- Gemini CLI custom commands: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/custom-commands.md - Gemini CLI custom commands: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/custom-commands.md
- Google Antigravity announcement: https://blog.google/products-and-platforms/products/gemini/gemini-3/ - Google Antigravity announcement: https://blog.google/products-and-platforms/products/gemini/gemini-3/
- Google Antigravity rules/workflows: https://antigravity.google/docs/rules-workflows
- Google Antigravity skills: https://antigravity.google/docs/skills
- Google Antigravity models: https://antigravity.google/docs/models
- Google Antigravity permissions: https://antigravity.google/docs/agent-permissions
- paperfoot/search-cli skill: https://github.com/paperfoot/search-cli/blob/master/SKILL.md
- Gemini CLI GEMINI.md context: https://geminicli.com/docs/cli/gemini-md/
- Gemini CLI GEMINI.md examples issue: https://github.com/google-gemini/gemini-cli/issues/9241
- Practical GEMINI.md hierarchy: https://medium.com/google-cloud/practical-gemini-cli-instruction-following-gemini-md-hierarchy-part-1-3ba241ac5496
- Claude Code best-practice CLAUDE.md: https://github.com/shanraisshan/claude-code-best-practice/blob/main/CLAUDE.md
- Claude MD guide: https://github.com/MuhammadUsmanGM/claude-code-best-practices/blob/main/guides/claude-md-guide.md
- Writing a good CLAUDE.md: https://www.humanlayer.dev/blog/writing-a-good-claude-md
+105
View File
@@ -18,6 +18,9 @@ if str(REPO_ROOT) not in sys.path:
from scripts.runtime.skills import SkillRegistry from scripts.runtime.skills import SkillRegistry
CODEX_TEMPLATE = REPO_ROOT / "codex_adapter_templates" / "codex" CODEX_TEMPLATE = REPO_ROOT / "codex_adapter_templates" / "codex"
ANTIGRAVITY_RULES_DIR = REPO_ROOT / ".agents" / "rules"
ANTIGRAVITY_WORKFLOWS_DIR = REPO_ROOT / ".agents" / "workflows"
ANTIGRAVITY_AGENTS_FILE = REPO_ROOT / ".agents" / "agents.md"
@dataclass @dataclass
@@ -105,6 +108,51 @@ def copy_registered_skills(dst: Path, *, force: bool, dry_run: bool = False) ->
return result return result
def copy_antigravity_rules(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
result = DeployResult(platform="rules", target=dst)
if not ANTIGRAVITY_RULES_DIR.exists():
return result
part = copy_tree_contents(ANTIGRAVITY_RULES_DIR, dst, force=force, dry_run=dry_run)
result.written.extend(part.written)
result.skipped.extend(part.skipped)
result.planned.extend(part.planned)
result.backups.extend(part.backups)
return result
def copy_antigravity_workflows(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
result = DeployResult(platform="workflows", target=dst)
if not ANTIGRAVITY_WORKFLOWS_DIR.exists():
return result
part = copy_tree_contents(ANTIGRAVITY_WORKFLOWS_DIR, dst, force=force, dry_run=dry_run)
result.written.extend(part.written)
result.skipped.extend(part.skipped)
result.planned.extend(part.planned)
result.backups.extend(part.backups)
return result
def copy_antigravity_agents_file(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
result = DeployResult(platform="agents", target=dst)
if not ANTIGRAVITY_AGENTS_FILE.exists():
return result
target = dst / "agents.md"
if target.exists() and not force:
result.skipped.append(target)
return result
result.planned.append(target)
if dry_run:
return result
target.parent.mkdir(parents=True, exist_ok=True)
if target.exists() and force:
backup = target.with_name("agents.md.bak")
shutil.copy2(target, backup)
result.backups.append(backup)
shutil.copy2(ANTIGRAVITY_AGENTS_FILE, target)
result.written.append(target)
return result
def deploy_codex( def deploy_codex(
*, *,
target: Path | None = None, target: Path | None = None,
@@ -131,6 +179,36 @@ def deploy_codex(
return _merge_results("codex", codex_home, parts) return _merge_results("codex", codex_home, parts)
def deploy_antigravity(
*,
target: Path | None = None,
force: bool = False,
skip_skills: bool = False,
skip_agents: bool = False,
skip_rules: bool = False,
skip_workflows: bool = False,
dry_run: bool = False,
repo_root: Path = REPO_ROOT,
) -> DeployResult:
"""Deploy Antigravity workspace rules and skills into a workspace root.
This intentionally deploys to a workspace-local `.agents` directory, not
global Antigravity/Gemini settings, so existing user configuration is not
touched. Existing files are skipped unless `force=True`.
"""
workspace = (target or repo_root).expanduser()
parts: list[DeployResult] = []
if not skip_agents:
parts.append(copy_antigravity_agents_file(workspace / ".agents", force=force, dry_run=dry_run))
if not skip_skills:
parts.append(copy_registered_skills(workspace / ".agents" / "skills", force=force, dry_run=dry_run))
if not skip_rules:
parts.append(copy_antigravity_rules(workspace / ".agents" / "rules", force=force, dry_run=dry_run))
if not skip_workflows:
parts.append(copy_antigravity_workflows(workspace / ".agents" / "workflows", force=force, dry_run=dry_run))
return _merge_results("antigravity", workspace, parts)
def print_result(result: DeployResult) -> None: def print_result(result: DeployResult) -> None:
action = "planned" if result.planned and not result.written else "written" action = "planned" if result.planned and not result.written else "written"
print(f"{result.platform} adapter deployment") print(f"{result.platform} adapter deployment")
@@ -156,6 +234,15 @@ def build_parser() -> argparse.ArgumentParser:
codex.add_argument("--skip-skills", action="store_true", help="do not copy canonical skills into target/skills") codex.add_argument("--skip-skills", action="store_true", help="do not copy canonical skills into target/skills")
codex.add_argument("--include-config", action="store_true", help="also copy config.toml; off by default to avoid overwriting global Codex config") codex.add_argument("--include-config", action="store_true", help="also copy config.toml; off by default to avoid overwriting global Codex config")
codex.add_argument("--dry-run", action="store_true", help="show files that would be written") codex.add_argument("--dry-run", action="store_true", help="show files that would be written")
antigravity = sub.add_parser("antigravity", help="Deploy Antigravity workspace rules and skills")
antigravity.add_argument("--target", type=Path, help="Workspace root; defaults to this repository")
antigravity.add_argument("--force", action="store_true", help="overwrite existing files and create .bak backups")
antigravity.add_argument("--skip-agents", action="store_true", help="do not copy role definitions into target/.agents/agents.md")
antigravity.add_argument("--skip-skills", action="store_true", help="do not copy canonical skills into target/.agents/skills")
antigravity.add_argument("--skip-rules", action="store_true", help="do not copy workspace rules into target/.agents/rules")
antigravity.add_argument("--skip-workflows", action="store_true", help="do not copy workflows into target/.agents/workflows")
antigravity.add_argument("--dry-run", action="store_true", help="show files that would be written without writing")
return parser return parser
@@ -165,6 +252,7 @@ def main() -> int:
result = deploy_codex( result = deploy_codex(
target=args.target, target=args.target,
force=args.force, force=args.force,
skip_agents=args.skip_agents,
skip_skills=args.skip_skills, skip_skills=args.skip_skills,
dry_run=args.dry_run, dry_run=args.dry_run,
include_config=args.include_config, include_config=args.include_config,
@@ -178,6 +266,23 @@ def main() -> int:
print(" codex") print(" codex")
print("Note: config.toml is not copied by default. Use --include-config only if you want the bundled profile.") print("Note: config.toml is not copied by default. Use --include-config only if you want the bundled profile.")
return 0 return 0
if args.platform == "antigravity":
result = deploy_antigravity(
target=args.target,
force=args.force,
skip_skills=args.skip_skills,
skip_rules=args.skip_rules,
skip_workflows=args.skip_workflows,
dry_run=args.dry_run,
)
print_result(result)
print()
print("Open the target workspace in Antigravity and enable/mention the workspace rule if needed:")
print(" .agents/rules/deep-research-antigravity.md")
print("Workflow installed when supported by your Antigravity build:")
print(" .agents/workflows/deep-research-native.md")
print("Existing files are skipped by default. Use --force only when you want .bak backups and replacement.")
return 0
raise SystemExit(f"unsupported platform: {args.platform}") raise SystemExit(f"unsupported platform: {args.platform}")
+54 -1
View File
@@ -7,7 +7,7 @@ REPO_ROOT = Path(__file__).resolve().parents[1]
if str(REPO_ROOT) not in sys.path: if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT)) sys.path.insert(0, str(REPO_ROOT))
from scripts.deploy_adapters import default_codex_home, deploy_codex from scripts.deploy_adapters import default_codex_home, deploy_antigravity, deploy_codex
def test_default_codex_home_is_external_to_project(tmp_path: Path) -> None: def test_default_codex_home_is_external_to_project(tmp_path: Path) -> None:
@@ -49,3 +49,56 @@ def test_deploy_codex_dry_run_does_not_write(tmp_path: Path) -> None:
assert result.planned assert result.planned
assert not target.exists() assert not target.exists()
def test_deploy_antigravity_writes_workspace_rules_and_skills(tmp_path: Path) -> None:
target = tmp_path / "workspace"
result = deploy_antigravity(target=target, repo_root=REPO_ROOT)
assert result.written
assert (target / ".agents" / "agents.md").exists()
assert (target / ".agents" / "rules" / "deep-research-antigravity.md").exists()
assert (target / ".agents" / "workflows" / "deep-research-native.md").exists()
assert (target / ".agents" / "skills" / "antigravity-surface-adapter" / "SKILL.md").exists()
assert (target / ".agents" / "skills" / "search-strategy" / "SKILL.md").exists()
assert result.target == target
def test_deploy_antigravity_skips_existing_files_by_default(tmp_path: Path) -> None:
target = tmp_path / "workspace"
existing = target / ".agents" / "rules" / "deep-research-antigravity.md"
existing.parent.mkdir(parents=True)
existing.write_text("custom rule\n", encoding="utf-8")
result = deploy_antigravity(target=target, repo_root=REPO_ROOT)
assert existing.read_text(encoding="utf-8") == "custom rule\n"
assert existing in result.skipped
assert not existing.with_name("deep-research-antigravity.md.bak").exists()
def test_deploy_antigravity_skips_existing_agents_file_by_default(tmp_path: Path) -> None:
target = tmp_path / "workspace"
existing = target / ".agents" / "agents.md"
existing.parent.mkdir(parents=True)
existing.write_text("custom agents\n", encoding="utf-8")
result = deploy_antigravity(target=target, repo_root=REPO_ROOT)
assert existing.read_text(encoding="utf-8") == "custom agents\n"
assert existing in result.skipped
assert not existing.with_name("agents.md.bak").exists()
def test_deploy_antigravity_force_backs_up_existing_files(tmp_path: Path) -> None:
target = tmp_path / "workspace"
existing = target / ".agents" / "rules" / "deep-research-antigravity.md"
existing.parent.mkdir(parents=True)
existing.write_text("custom rule\n", encoding="utf-8")
result = deploy_antigravity(target=target, repo_root=REPO_ROOT, force=True)
assert existing.read_text(encoding="utf-8") != "custom rule\n"
assert existing.with_name("deep-research-antigravity.md.bak").read_text(encoding="utf-8") == "custom rule\n"
assert existing.with_name("deep-research-antigravity.md.bak") in result.backups
+3
View File
@@ -35,6 +35,9 @@ def test_skill_registry_uses_agents_skills_as_canonical() -> None:
assert "source-quality" in names assert "source-quality" in names
assert "document-ingest" in names assert "document-ingest" in names
assert "deep-research" in names assert "deep-research" in names
assert "antigravity-surface-adapter" in names
assert "method-selection" in names
assert "research-quality-gates" in names
assert registry.validate()["ok"] is True assert registry.validate()["ok"] is True