deep-research
This skill should be used when the user asks to "deep research", "comprehensive research on", "thorough investigation of", "research report on", "deep dive into", "literature review on", or needs Gemini Deep Research for web-grounded multi-source synthesis beyond what Google Scholar and Consensus provide.
What this skill does
# Deep Research
Web-grounded deep research via Gemini Interactions API.
## IRON LAW: Always Use the Script
**NEVER call the Gemini Interactions API manually. ALWAYS use `bun deep-research.ts`. This is non-negotiable.**
```bash
cd "${CLAUDE_SKILL_DIR}" && bun deep-research.ts "research query"
```
The script handles model selection, interaction submission, polling with retries, timeout enforcement, and report formatting. Calling the Interactions API by hand means you skip retry logic, miss the 65-minute timeout guard, and lose the saved report file.
## When to Use
Deep Research is the **LAST RESORT** in the librarian's source hierarchy. It costs $1-7 per query, takes minutes not seconds, and produces a broad web-grounded report rather than precise academic citations.
```
User needs information on a topic
|
v
Check curated sources FIRST (all must be exhausted):
1. Paperpile bib (local library)
2. Google Scholar (scholar search/lookup)
3. Consensus (consensus search)
4. NLM notebooks (existing sources)
5. Readwise (highlights/full-text)
|
v
Are there still significant gaps?
|
+-- NO --> Stop. Curated sources are sufficient.
|
+-- YES
|
v
Has the user explicitly asked for broader/deeper research?
|
+-- NO --> Report gaps, suggest deep research, WAIT for approval.
|
+-- YES --> Run deep-research.ts
```
### Trigger signals (use this skill):
- User says "deep research", "thorough investigation", "comprehensive report"
- User explicitly asks for web-grounded synthesis beyond academic databases
- Curated sources have been exhausted and user wants more
### NOT-triggers (do NOT use this skill):
- User wants a specific known paper -- use Scholar or Consensus
- User wants papers from their own library -- use Paperpile bib or Readwise
- User wants citation metadata -- use Scholar with `--bibtex`
- User has not exhausted curated sources yet
- User has not explicitly approved the cost
## Commands
### Basic (thorough report)
```bash
cd "${CLAUDE_SKILL_DIR}" && bun deep-research.ts "What is the current state of mandatory climate disclosure regulation worldwide?"
```
### Fast (quick scan)
```bash
cd "${CLAUDE_SKILL_DIR}" && bun deep-research.ts --fast "ESG disclosure enforcement mechanisms"
```
### Resume polling an existing interaction
```bash
cd "${CLAUDE_SKILL_DIR}" && bun deep-research.ts --status <interaction-id>
```
### JSON output (raw interaction object)
```bash
cd "${CLAUDE_SKILL_DIR}" && bun deep-research.ts --json "corporate governance reform trends"
```
## Models
| Model | Flag | Queries | Time | Cost | Use when |
|-------|------|---------|------|------|----------|
| `deep-research-max` | (default) | ~160 web queries | 5-20 min | ~$3-7 | Thorough reports, literature reviews, multi-faceted questions |
| `deep-research` | `--fast` | ~80 web queries | 2-10 min | ~$1-3 | Quick scans, narrow questions, time-sensitive requests |
## Cost Warning
**$1-7 per query. NEVER auto-invoke. Always ask the user first.**
This is the most expensive tool in the librarian's toolkit. Before every invocation:
1. Confirm the user explicitly requested deep research
2. Report which curated sources were already checked and what gaps remain
3. State the estimated cost range ($1-3 for fast, $3-7 for thorough)
4. Wait for the user's go-ahead
### Rationalization Table
| Excuse | Reality | Do Instead |
|--------|---------|------------|
| "The user probably wants this" | $3-7 burned on assumption | Ask first, always |
| "I'll just do a quick scan" | Even --fast costs $1-3 | Check Scholar/Consensus first -- they are free |
| "The curated sources didn't have enough" | Did you try ALL five? | Exhaust Paperpile, Scholar, Consensus, NLM, Readwise before reaching for this |
| "It's faster than searching multiple sources" | It takes 5-20 minutes and costs money | The free tools return in seconds |
## Integration with Librarian Workflow
```
Paperpile bib --> Scholar --> Consensus --> NLM / Readwise
(local) (free) (free) (free)
|
v
[GAPS IDENTIFIED + USER ASKS]
|
v
Deep Research (THIS SKILL)
$1-7, 2-20 min
|
v
Curate results to NLM
(save report, extract key sources)
```
After deep research completes:
1. Present the report to the user
2. Extract key sources cited in the report
3. If the user wants to keep specific sources, add them to NLM notebooks
4. The report is also saved to `/tmp/deep-research-<id>.md` for reference
## Red Flags -- STOP If You Catch Yourself:
| # | Action | Why Wrong | Do Instead |
|---|--------|-----------|------------|
| 1 | Using before checking curated sources | Scholar, Consensus, Paperpile, NLM, Readwise are free and fast | Exhaust all five curated sources first |
| 2 | Using for known paper lookup | Deep Research returns web-grounded reports, not citation metadata | Use `scholar lookup --bibtex` or `scholar cite` |
| 3 | Launching without user's explicit request | $1-7 per query; unauthorized spending violates trust | Report gaps, state cost, wait for go-ahead |
| 4 | Calling Interactions API directly (without the script) | Skips retry logic, timeout guard, report file save | Always use `bun deep-research.ts` |
| 5 | Ignoring the report and re-searching the same topic | Wastes another $1-7 for information you already have | Read the saved report at `/tmp/deep-research-<id>.md` |
## Environment
| Variable | Required | Description |
|----------|----------|-------------|
| `GOOGLE_API_KEY` | Yes | Gemini API key with Deep Research access |
**Timeout:** 65 minutes maximum polling duration (covers the API's 60-min hard limit plus buffer).
**Polling interval:** 10 seconds between status checks.
**Retries:** Up to 3 retries on transient errors (503, 429, service_unavailable, rate_limit).
## Output
The script prints the research report to stdout as Markdown. It also saves the report to `/tmp/deep-research-<interaction-id>.md` for later reference.
With `--json`, it prints the full interaction object as JSON (useful for debugging or extracting structured metadata).
On failure, it prints the error to stderr and exits non-zero.
## Limitations
- **Beta API** -- the Gemini Interactions API is in preview; behavior may change
- **No structured output** -- reports are free-form Markdown, not JSON-structured citations
- **Max 60 minutes** -- the API enforces a hard time limit on research sessions
- **Cost per query** -- $1-7 depending on model; no free tier
- **Web-grounded, not academic-specific** -- results include news, blogs, and general web sources alongside academic content; always cross-reference claims against Scholar/Consensus for academic rigor
- **No incremental results** -- the report arrives all at once when polling completes; no streaming
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.