# AGENTS.md — Deep Research Cross-Tool Rules

This file is the shared, cross-tool instruction layer for Codex, OpenCode, Claude Code, Gemini CLI, and Antigravity.

Keep this file short. Do not put Antigravity roles, detailed workflows, or long skill manuals here.

## Project

Deep Research produces professional biomedical research reports for R&D, CMC/GMP, management, market, and investment topics.

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.

## Instruction Layers

- Cross-tool baseline: `AGENTS.md`
- Gemini / Antigravity override: `GEMINI.md`
- Platform adapter source templates: `platform_adapters/`
- Rebuilt local platform environments: `platform_envs/` (ignored; generated)
- Implementation plan and changelog: `PLAN.md`

If instructions conflict, use the more specific layer. For Antigravity, `GEMINI.md` and the generated `platform_envs/antigravity/.agent/rules/` override this file.

## Operating Modes

Python-core mode:

- Use `scripts/dr.py`, `scripts/runtime/**`, `configs/models.yaml`, and `platform_adapters/antigravity/agent/skills`.
- Platform agents should call the Python CLI rather than reimplement worker orchestration.
- Model routing is resolved by the Python runtime.

Antigravity native mode:

- Use a rebuilt `platform_envs/antigravity` workspace.
- Inside that workspace, Antigravity loads `.agent/agents.md`, `.agent/rules/`, `.agent/skills/`, and `.agent/workflows/`.
- Antigravity uses its own model quota for research execution.
- Python scripts are auxiliary for scaffolding, local material processing, deterministic checks, citation/report rendering, and status.
- 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.
- Do not open the full multi-platform repository in Antigravity for production research. Rebuild and open `platform_envs/antigravity`.

## Core Commands

```bash
uv run python scripts/dr.py init "研究主题" --slug <slug> --method <method>
uv run python scripts/dr.py frame <slug>
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

- 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.
- No claim that a search or verification was performed unless there is a real tool receipt or search log.
- Search snippets, AI summaries, and model memory are discovery leads, not final evidence.
- Every major conclusion needs at least two independent Tier 1-2 sources. If not available, downgrade and mark uncertainty.
- Counter-evidence is mandatory. Do not collect only supporting evidence.
- Wikipedia is allowed for orientation only and must not support final conclusions.
- Use Chinese for formal report writing. English may remain in search keywords, titles, DOI/URL, original excerpts, and raw notes.

## Method Selection

Do not default to McKinsey/MECE for every topic.

Choose the research method and tools based on the user's scenario. Use `platform_adapters/antigravity/agent/skills/method-selection/SKILL.md` as source, or `.agent/skills/method-selection/SKILL.md` inside the generated Antigravity env.

## Source Quality

Detailed scoring belongs in `platform_adapters/antigravity/agent/skills/source-quality/SKILL.md`.

Baseline tiers:

- Tier 1: original academic papers, systematic reviews where appropriate, regulator documents, clinical trial registries, patents, company filings.
- Tier 2: authoritative consulting/industry reports, industry associations, reputable professional media and databases.
- Tier 3: preprints, conference abstracts, brokerage research, company white papers. Use with caution.
- Tier 4: general web pages, ordinary news, Wikipedia. Discovery only.

## Safety

- 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.

## Change Management

- Treat `AGENTS.md`, `GEMINI.md`, `platform_adapters/**`, `scripts/update_platform_envs.py`, and `PLAN.md` as production configuration.
- Keep root rules short. Move platform-specific roles, constraints, skills, and workflows to `platform_adapters/<platform>/`, then rebuild `platform_envs/<platform>/`.
- When changing runtime rules or adapter behavior, update `PLAN.md` changelog.
