deep-research by 24601/agent-deep-research
npx skills add https://github.com/24601/agent-deep-research --skill deep-research利用 Google Gemini 深度研究代理进行深度研究。将文档上传至文件搜索存储库,以获取基于 RAG 的答案。通过持久化的工作区状态管理研究会话。
获取完整的能力清单、决策树和输出契约:
uv run {baseDir}/scripts/onboard.py --agent
完整的结构化简报请参阅 AGENTS.md。
| 命令 | 功能说明 |
|---|---|
uv run {baseDir}/scripts/research.py start "question" | 启动深度研究 |
uv run {baseDir}/scripts/research.py start "question" --context ./path --dry-run | 预估成本 |
uv run {baseDir}/scripts/research.py start "question" --context ./path --output report.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 基于 RAG 的研究 |
uv run {baseDir}/scripts/store.py query <name> "question" | 针对已上传文档进行快速问答 |
凭据:此技能需要一个 Google/Gemini API 密钥(GOOGLE_API_KEY、GEMINI_API_KEY 或 GEMINI_DEEP_RESEARCH_API_KEY 之一)。密钥从环境变量中读取并传递给 google-genai SDK。它永远不会被记录、写入文件或传输到 Google Gemini API 之外的任何地方。
文件上传:--context 标志将本地文件上传到 Google 的临时文件搜索存储库,用于 RAG 基础。敏感文件会被自动排除:.env*、credentials.json、secrets.*、私钥(.pem、.key)和身份验证令牌(.npmrc、.pypirc、.netrc)。二进制文件会通过 MIME 类型过滤被拒绝。构建目录(node_modules、__pycache__、.git、dist、build)会被跳过。除非指定了 --keep-context,否则临时存储库在研究完成后会自动删除。使用 --dry-run 可以预览将要上传的内容,而无需实际发送任何内容。只有您明确通过 --context 指向的文件才会被上传——不会自动扫描父目录或主文件夹。
非交互模式:当 stdin 不是 TTY 时(智能体/CI 使用),确认提示会自动跳过。这是为智能体集成而设计的,但也意味着具有文件系统访问权限的自主智能体可能会触发上传。请限制智能体可以访问的路径,或使用 --dry-run 和 --max-cost 防护措施。
无混淆:所有代码都是可读的 Python,并带有 PEP 723 内联元数据。没有二进制文件、没有压缩脚本、没有遥测、没有分析。完整源代码可在 github.com/24601/agent-deep-research 审核。
本地状态:研究会话状态被写入工作目录中的 .gemini-research.json 文件。此文件包含交互 ID、存储库映射和上传哈希值——不包含凭据或研究内容。使用 state.py gc 清理因运行崩溃而遗留的孤立存储库。
# 运行深度研究查询
uv run {baseDir}/scripts/research.py "What are the latest advances in quantum computing?"
# 检查研究状态
uv run {baseDir}/scripts/research.py status <interaction-id>
# 保存已完成报告
uv run {baseDir}/scripts/research.py report <interaction-id> --output report.md
# 基于本地文件的研究(自动创建存储库、上传、清理)
uv run {baseDir}/scripts/research.py start "How does auth work?" --context ./src --output report.md
# 导出为 HTML 或 PDF
uv run {baseDir}/scripts/research.py start "Analyze the API" --context ./src --format html --output report.html
# 根据上下文文件自动检测提示模板
uv run {baseDir}/scripts/research.py start "How does auth work?" --context ./src --prompt-template auto --output report.md
设置以下变量之一(按优先级顺序检查):
| 变量 | 描述 |
|---|---|
GEMINI_DEEP_RESEARCH_API_KEY | 此技能的专用密钥(最高优先级) |
GOOGLE_API_KEY | 标准 Google AI 密钥 |
GEMINI_API_KEY | Gemini 专用密钥 |
可选的模型配置:
| 变量 | 描述 | 默认值 |
|---|---|---|
GEMINI_DEEP_RESEARCH_MODEL | 用于文件搜索查询的模型 | gemini-3.1-pro-preview |
GEMINI_MODEL | 备用模型名称 | gemini-3.1-pro-preview |
GEMINI_DEEP_RESEARCH_AGENT | 深度研究代理标识符 | deep-research-pro-preview-12-2025 |
uv run {baseDir}/scripts/research.py start "your research question"
| 标志 | 描述 |
|---|---|
--report-format FORMAT | 输出结构:executive_summary、detailed_report、comprehensive |
--store STORE_NAME | 在文件搜索存储库中进行基础研究(显示名称或资源 ID) |
--no-thoughts | 隐藏中间思考步骤 |
--follow-up ID | 继续之前的研究会话 |
--output FILE | 等待完成并将报告保存到单个文件 |
--output-dir DIR | 等待完成并将结构化结果保存到目录(见下文) |
--timeout SECONDS | 轮询时的最大等待时间(默认:1800 = 30 分钟) |
--no-adaptive-poll | 禁用历史自适应轮询;改用固定间隔曲线 |
--context PATH | 从文件或目录自动创建临时存储库,用于基于 RAG 的研究 |
--context-extensions EXT | 按扩展名过滤上下文上传(例如 py,md 或 .py .md) |
--keep-context | 研究完成后保留临时上下文存储库(默认:自动删除) |
--dry-run | 在不启动研究的情况下预估成本(打印 JSON 成本估算) |
--format {md,html,pdf} | 报告的输出格式(默认:md;pdf 需要 weasyprint) |
--prompt-template {typescript,python,general,auto} | 领域特定的提示前缀;根据上下文文件扩展名自动检测 |
--depth {quick,standard,deep} | 研究深度:quick(约 2-5 分钟)、standard(约 5-15 分钟)、deep(约 15-45 分钟) |
--max-cost USD | 如果预估成本超过此限制则中止(例如 --max-cost 3.00) |
--input-file PATH | 从文件读取研究查询,而不是位置参数 |
--no-cache | 跳过研究缓存并强制重新运行 |
start 子命令是默认的,因此 research.py "question" 和 research.py start "question" 是等效的。
重要:当使用 --output 或 --output-dir 时,命令会阻塞直到研究完成(2-10+ 分钟)。不要使用 & 将其放入后台。使用非阻塞模式(省略 --output)以立即获取 ID,然后使用 status 轮询并使用 report 保存。
uv run {baseDir}/scripts/research.py status <interaction-id>
返回当前状态(in_progress、completed、failed)以及可用的输出。
uv run {baseDir}/scripts/research.py report <interaction-id>
| 标志 | 描述 |
|---|---|
--output FILE | 将报告保存到特定文件路径(默认:report-<id>.md) |
--output-dir DIR | 将结构化结果保存到目录 |
--output-dir)当使用 --output-dir 时,结果将保存到结构化目录:
<output-dir>/
research-<id>/
report.md # 完整的最终报告
metadata.json # 时间、状态、输出计数、大小
interaction.json # 完整的交互数据(所有输出、思考步骤)
sources.json # 提取的源 URL/引用
一个紧凑的 JSON 摘要(少于 500 字符)将打印到 stdout:
{
"id": "interaction-123",
"status": "completed",
"output_dir": "research-output/research-interaction-1/",
"report_file": "research-output/research-interaction-1/report.md",
"report_size_bytes": 45000,
"duration_seconds": 154,
"summary": "First 200 chars of the report..."
}
这是 AI 智能体集成的推荐模式——智能体接收一个小的 JSON 负载,而完整报告则写入磁盘。
当使用 --output 或 --output-dir 时,脚本会轮询 Gemini API 直到研究完成。默认情况下,它使用历史自适应轮询,该机制从过去的研究完成时间中学习:
.gemini-research.json 的 researchHistory 下(最近 50 条记录,区分有基础研究和无基础研究的曲线)。当历史数据不足(<3 个数据点)或传递了 --no-adaptive-poll 时,则使用固定的递增曲线:5 秒(前 30 秒)、10 秒(30 秒-2 分钟)、30 秒(2-10 分钟)、60 秒(10 分钟以上)。
--dry-run)在运行研究前预览预估成本:
uv run {baseDir}/scripts/research.py start "Analyze security architecture" --context ./src --dry-run
将 JSON 成本估算输出到 stdout,包括上下文上传成本、研究查询成本和总计。估算是基于启发式的(Gemini API 不返回令牌计数或计费数据),并明确标注为估算。
当研究使用 --output-dir 完成后,metadata.json 文件会包含一个 usage 键,其中包含基于实际输出大小和持续时间的运行后成本估算。
管理用于基于 RAG 的研究和问答的文件搜索存储库。
uv run {baseDir}/scripts/store.py create "My Project Docs"
uv run {baseDir}/scripts/store.py list
uv run {baseDir}/scripts/store.py query <store-name> "What does the auth module do?"
| 标志 | 描述 |
|---|---|
--output-dir DIR | 将响应和元数据保存到目录 |
uv run {baseDir}/scripts/store.py delete <store-name>
使用 --force 跳过确认提示。当 stdin 不是 TTY 时(例如,由 AI 智能体调用),提示会自动跳过。
将文件或整个目录上传到文件搜索存储库。
uv run {baseDir}/scripts/upload.py ./src fileSearchStores/abc123
| 标志 | 描述 |
|---|---|
--smart-sync | 跳过未更改的文件(哈希比较) |
--extensions EXT [EXT ...] | 要包含的文件扩展名(逗号或空格分隔,例如 py,ts,md 或 .py .ts .md) |
哈希缓存总是在成功上传后保存,因此后续的 --smart-sync 运行将正确跳过未更改的文件,即使第一次上传没有使用 --smart-sync。
Gemini 文件搜索 API 原生支持 36 种文件扩展名。常见的编程文件(JS、TS、JSON、CSS、YAML 等)通过回退机制自动以 text/plain 上传。二进制文件会被拒绝。完整列表请参阅 references/file_search_guide.md。
文件大小限制:每个文件 100 MB。
研究 ID 和存储库映射缓存在当前工作目录的 .gemini-research.json 中。
uv run {baseDir}/scripts/state.py show
uv run {baseDir}/scripts/state.py research
uv run {baseDir}/scripts/state.py stores
在任何 state 子命令中添加 --json 以将结构化 JSON 输出到 stdout:
uv run {baseDir}/scripts/state.py --json show
uv run {baseDir}/scripts/state.py --json research
uv run {baseDir}/scripts/state.py --json stores
uv run {baseDir}/scripts/state.py clear
使用 -y 跳过确认提示。当 stdin 不是 TTY 时(例如,由 AI 智能体调用),提示会自动跳过。
所有确认提示(store.py delete、state.py clear)在 stdin 不是 TTY 时会自动跳过。这使得 AI 智能体和 CI 流水线能够调用这些命令,而不会在交互式提示上挂起。
典型的基于基础研究的工作流:
# 1. 创建文件搜索存储库
STORE_JSON=$(uv run {baseDir}/scripts/store.py create "Project Codebase")
STORE_NAME=$(echo "$STORE_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['name'])")
# 2. 上传您的文档
uv run {baseDir}/scripts/upload.py ./docs "$STORE_NAME" --smart-sync
# 3. 直接查询存储库
uv run {baseDir}/scripts/store.py query "$STORE_NAME" "How is authentication handled?"
# 4. 启动基于基础的深度研究(阻塞,保存到目录)
uv run {baseDir}/scripts/research.py start "Analyze the security architecture" \
--store "$STORE_NAME" --output-dir ./research-output --timeout 3600
# 5. 或者启动非阻塞模式稍后检查
RESEARCH_JSON=$(uv run {baseDir}/scripts/research.py start "Analyze the security architecture" --store "$STORE_NAME")
RESEARCH_ID=$(echo "$RESEARCH_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
# 6. 检查进度
uv run {baseDir}/scripts/research.py status "$RESEARCH_ID"
# 7. 完成后保存报告
uv run {baseDir}/scripts/research.py report "$RESEARCH_ID" --output-dir ./research-output
所有脚本都遵循双重输出模式:
这意味着 2>/dev/null 会隐藏人类可读的输出,而管道传输 stdout 会得到干净的 JSON。
每周安装数
53
代码仓库
GitHub 星标数
1
首次出现
2026 年 2 月 9 日
安全审计
安装于
claude-code34
opencode31
codex30
gemini-cli29
github-copilot28
openclaw28
Perform deep research powered by Google Gemini's deep research agent. Upload documents to file search stores for RAG-grounded answers. Manage research sessions with persistent workspace state.
Get a full capabilities manifest, decision trees, and output contracts:
uv run {baseDir}/scripts/onboard.py --agent
See AGENTS.md for the complete structured briefing.
| Command | What It Does |
|---|---|
uv run {baseDir}/scripts/research.py start "question" | Launch deep research |
uv run {baseDir}/scripts/research.py start "question" --context ./path --dry-run | Estimate cost |
uv run {baseDir}/scripts/research.py start "question" --context ./path --output report.md | RAG-grounded research |
uv run {baseDir}/scripts/store.py query <name> "question" | Quick Q&A against uploaded docs |
Credentials : This skill requires a Google/Gemini API key (one of GOOGLE_API_KEY, GEMINI_API_KEY, or GEMINI_DEEP_RESEARCH_API_KEY). The key is read from environment variables and passed to the google-genai SDK. It is never logged, written to files, or transmitted anywhere other than the Google Gemini API.
File uploads : The --context flag uploads local files to Google's ephemeral file search stores for RAG grounding. Sensitive files are automatically excluded: .env*, credentials.json, secrets.*, private keys (.pem, .key), and auth tokens (.npmrc, .pypirc, .netrc). Binary files are rejected by MIME type filtering. Build directories (node_modules, __pycache__, , , ) are skipped. The ephemeral store is auto-deleted after research completes unless is specified. Use to preview what would be uploaded without sending anything. Only files you explicitly point at are uploaded -- no automatic scanning of parent directories or home folders.
Non-interactive mode : When stdin is not a TTY (agent/CI use), confirmation prompts are automatically skipped. This is by design for agent integration but means an autonomous agent with file system access could trigger uploads. Restrict the paths agents can access, or use --dry-run and --max-cost guards.
No obfuscation : All code is readable Python with PEP 723 inline metadata. No binary blobs, no minified scripts, no telemetry, no analytics. The full source is auditable at github.com/24601/agent-deep-research.
Local state : Research session state is written to .gemini-research.json in the working directory. This file contains interaction IDs, store mappings, and upload hashes -- no credentials or research content. Use state.py gc to clean up orphaned stores from crashed runs.
GOOGLE_API_KEY or GEMINI_API_KEY environment variable)# Run a deep research query
uv run {baseDir}/scripts/research.py "What are the latest advances in quantum computing?"
# Check research status
uv run {baseDir}/scripts/research.py status <interaction-id>
# Save a completed report
uv run {baseDir}/scripts/research.py report <interaction-id> --output report.md
# Research grounded in local files (auto-creates store, uploads, cleans up)
uv run {baseDir}/scripts/research.py start "How does auth work?" --context ./src --output report.md
# Export as HTML or PDF
uv run {baseDir}/scripts/research.py start "Analyze the API" --context ./src --format html --output report.html
# Auto-detect prompt template based on context files
uv run {baseDir}/scripts/research.py start "How does auth work?" --context ./src --prompt-template auto --output report.md
Set one of the following (checked in order of priority):
| Variable | Description |
|---|---|
GEMINI_DEEP_RESEARCH_API_KEY | Dedicated key for this skill (highest priority) |
GOOGLE_API_KEY | Standard Google AI key |
GEMINI_API_KEY | Gemini-specific key |
Optional model configuration:
| Variable | Description | Default |
|---|---|---|
GEMINI_DEEP_RESEARCH_MODEL | Model for file search queries | gemini-3.1-pro-preview |
GEMINI_MODEL | Fallback model name | gemini-3.1-pro-preview |
GEMINI_DEEP_RESEARCH_AGENT | Deep research agent identifier | deep-research-pro-preview-12-2025 |
uv run {baseDir}/scripts/research.py start "your research question"
| Flag | Description |
|---|---|
--report-format FORMAT | Output structure: executive_summary, detailed_report, comprehensive |
--store STORE_NAME | Ground research in a file search store (display name or resource ID) |
--no-thoughts | Hide intermediate thinking steps |
--follow-up ID | Continue a previous research session |
The start subcommand is the default, so research.py "question" and research.py start "question" are equivalent.
Important : When --output or --output-dir is used, the command blocks until research completes (2-10+ minutes). Do not background it with &. Use non-blocking mode (omit --output) to get an ID immediately, then poll with status and save with report.
uv run {baseDir}/scripts/research.py status <interaction-id>
Returns the current status (in_progress, completed, failed) and outputs if available.
uv run {baseDir}/scripts/research.py report <interaction-id>
| Flag | Description |
|---|---|
--output FILE | Save report to a specific file path (default: report-<id>.md) |
--output-dir DIR | Save structured results to a directory |
--output-dir)When --output-dir is used, results are saved to a structured directory:
<output-dir>/
research-<id>/
report.md # Full final report
metadata.json # Timing, status, output count, sizes
interaction.json # Full interaction data (all outputs, thinking steps)
sources.json # Extracted source URLs/citations
A compact JSON summary (under 500 chars) is printed to stdout:
{
"id": "interaction-123",
"status": "completed",
"output_dir": "research-output/research-interaction-1/",
"report_file": "research-output/research-interaction-1/report.md",
"report_size_bytes": 45000,
"duration_seconds": 154,
"summary": "First 200 chars of the report..."
}
This is the recommended pattern for AI agent integration -- the agent receives a small JSON payload while the full report is written to disk.
When --output or --output-dir is used, the script polls the Gemini API until research completes. By default, it uses history-adaptive polling that learns from past research completion times:
.gemini-research.json under researchHistory (last 50 entries, separate curves for grounded vs non-grounded research).When history is insufficient (<3 data points) or --no-adaptive-poll is passed, a fixed escalating curve is used: 5s (first 30s), 10s (30s-2min), 30s (2-10min), 60s (10min+).
--dry-run)Preview estimated costs before running research:
uv run {baseDir}/scripts/research.py start "Analyze security architecture" --context ./src --dry-run
Outputs a JSON cost estimate to stdout with context upload costs, research query costs, and a total. Estimates are heuristic-based (the Gemini API does not return token counts or billing data) and clearly labeled as such.
After research completes with --output-dir, the metadata.json file includes a usage key with post-run cost estimates based on actual output size and duration.
Manage file search stores for RAG-grounded research and Q&A.
uv run {baseDir}/scripts/store.py create "My Project Docs"
uv run {baseDir}/scripts/store.py list
uv run {baseDir}/scripts/store.py query <store-name> "What does the auth module do?"
| Flag | Description |
|---|---|
--output-dir DIR | Save response and metadata to a directory |
uv run {baseDir}/scripts/store.py delete <store-name>
Use --force to skip the confirmation prompt. When stdin is not a TTY (e.g., called by an AI agent), the prompt is automatically skipped.
Upload files or entire directories to a file search store.
uv run {baseDir}/scripts/upload.py ./src fileSearchStores/abc123
| Flag | Description |
|---|---|
--smart-sync | Skip files that haven't changed (hash comparison) |
--extensions EXT [EXT ...] | File extensions to include (comma or space separated, e.g. py,ts,md or .py .ts .md) |
Hash caches are always saved on successful upload, so a subsequent --smart-sync run will correctly skip unchanged files even if the first upload did not use --smart-sync.
36 file extensions are natively supported by the Gemini File Search API. Common programming files (JS, TS, JSON, CSS, YAML, etc.) are automatically uploaded as text/plain via a fallback mechanism. Binary files are rejected. See references/file_search_guide.md for the full list.
File size limit : 100 MB per file.
Research IDs and store mappings are cached in .gemini-research.json in the current working directory.
uv run {baseDir}/scripts/state.py show
uv run {baseDir}/scripts/state.py research
uv run {baseDir}/scripts/state.py stores
Add --json to any state subcommand to output structured JSON to stdout:
uv run {baseDir}/scripts/state.py --json show
uv run {baseDir}/scripts/state.py --json research
uv run {baseDir}/scripts/state.py --json stores
uv run {baseDir}/scripts/state.py clear
Use -y to skip the confirmation prompt. When stdin is not a TTY (e.g., called by an AI agent), the prompt is automatically skipped.
All confirmation prompts (store.py delete, state.py clear) are automatically skipped when stdin is not a TTY. This allows AI agents and CI pipelines to call these commands without hanging on interactive prompts.
A typical grounded research workflow:
# 1. Create a file search store
STORE_JSON=$(uv run {baseDir}/scripts/store.py create "Project Codebase")
STORE_NAME=$(echo "$STORE_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['name'])")
# 2. Upload your documents
uv run {baseDir}/scripts/upload.py ./docs "$STORE_NAME" --smart-sync
# 3. Query the store directly
uv run {baseDir}/scripts/store.py query "$STORE_NAME" "How is authentication handled?"
# 4. Start grounded deep research (blocking, saves to directory)
uv run {baseDir}/scripts/research.py start "Analyze the security architecture" \
--store "$STORE_NAME" --output-dir ./research-output --timeout 3600
# 5. Or start non-blocking and check later
RESEARCH_JSON=$(uv run {baseDir}/scripts/research.py start "Analyze the security architecture" --store "$STORE_NAME")
RESEARCH_ID=$(echo "$RESEARCH_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
# 6. Check progress
uv run {baseDir}/scripts/research.py status "$RESEARCH_ID"
# 7. Save the report when completed
uv run {baseDir}/scripts/research.py report "$RESEARCH_ID" --output-dir ./research-output
All scripts follow a dual-output pattern:
This means 2>/dev/null hides the human output, and piping stdout gives clean JSON.
Weekly Installs
53
Repository
GitHub Stars
1
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykWarn
Installed on
claude-code34
opencode31
codex30
gemini-cli29
github-copilot28
openclaw28
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
67,500 周安装
Clerk Auth 身份验证指南 - Next.js 16 重大变更、API 密钥与安全更新
310 周安装
Go数据结构详解:new与make区别、切片、数组与复合字面量用法
315 周安装
Meta/Facebook广告活动构建器:专业策略、受众定位与A/B测试指南
313 周安装
网页设计方法论:生产级HTML/CSS构建模式与BEM命名规范
311 周安装
Go防御性编程模式指南:验证接口、复制切片、defer清理与枚举规范
316 周安装
Playwright MCP 开发指南:如何为微软 Playwright 添加 MCP 工具和 CLI 命令
313 周安装
.gitdistbuild--keep-context--dry-run--context--output FILE | Wait for completion and save report to a single file |
--output-dir DIR | Wait for completion and save structured results to a directory (see below) |
--timeout SECONDS | Maximum wait time when polling (default: 1800 = 30 minutes) |
--no-adaptive-poll | Disable history-adaptive polling; use fixed interval curve instead |
--context PATH | Auto-create ephemeral store from a file or directory for RAG-grounded research |
--context-extensions EXT | Filter context uploads by extension (e.g. py,md or .py .md) |
--keep-context | Keep the ephemeral context store after research completes (default: auto-delete) |
--dry-run | Estimate costs without starting research (prints JSON cost estimate) |
--format {md,html,pdf} | Output format for the report (default: md; pdf requires weasyprint) |
--prompt-template {typescript,python,general,auto} | Domain-specific prompt prefix; auto detects from context file extensions |
--depth {quick,standard,deep} | Research depth: quick (~2-5min), standard (~5-15min), deep (~15-45min) |
--max-cost USD | Abort if estimated cost exceeds this limit (e.g. --max-cost 3.00) |
--input-file PATH | Read the research query from a file instead of positional argument |
--no-cache | Skip research cache and force a fresh run |