Deep Research
Free Perplexity/Gemini-level deep research for any AI coding agent. Combines NotebookLM's Gemini-powered research engine with iterative web search, domain-aware routing, and post-research artifact generation.
Activation
Triggered by /deep-research "topic" or intent detection ("research this", "deep dive into", "investigate").
Argument Parsing
"topic"— required, the research query--domain maritime|legal|academic— optional domain boost--continue— resume previous research session--compare "X vs Y"— structured comparison mode
If no arguments provided, ask: "What topic should I research?"
Dependency Check
Before starting, determine available capabilities:
-
Try
notebooklm statusfirst. If command not found, trypython3 -m notebooklm statusorpython -m notebooklm status. Use whichever works for all subsequent notebooklm commands.- If success: Full mode (NotebookLM + WebSearch)
- If all fail: Fallback mode (WebSearch only)
-
If fallback mode, inform user:
"NotebookLM not detected. Running in web-search-only mode. For full features (deep research, podcast, video, slides, quiz), install:
pip install notebooklm-py && notebooklm login" -
Store mode for pipeline decisions.
Pre-flight
Present this prompt and WAIT for user response before proceeding:
Research Topic: "{topic}"
Depth:
1 = Quick (fast mode, 5-10 sources, ~1 min)
2 = Moderate (fast + 1 WebSearch round, 10-15 sources)
3 = Standard (deep mode, 20+ sources, ~3 min) [default]
4 = Deep (deep + 1 WebSearch round, 30+ sources)
5 = Exhaustive (deep + 2 WebSearch rounds, 40+ sources)
Source focus:
A = Everything (web + your notebooks) [default]
B = Academic only (papers, journals, research)
C = News & current events (last 12 months)
D = Technical docs & specs
E = Custom (tell me what to focus on)
Enter choices (e.g. "3, A") or press Enter for defaults:
Parse response:
- Default if empty: depth=3, focus=A
- Extract depth (1-5) and focus (A-E)
- If focus=E, ask follow-up: "What should I focus on?"
Pipeline — Full Mode (NotebookLM available)
Step 1: Check existing notebooks
Run: notebooklm list --json
Search results for notebooks with titles matching the topic. If found, ask user: "Found existing notebook '{title}' with {n} sources. Use it? (y/n)"
- If yes:
notebooklm use {id}, skip to Step 3 - If no: continue to Step 2
Step 2: Create research notebook
Run: notebooklm create "Research: {topic}" --json
Parse notebook ID from output.
Run: notebooklm use {id}
Step 3: Query existing sources (if focus=A and existing notebook)
If existing notebook was selected, run:
notebooklm ask "What information do you have about {topic}?" --json
Store response as baseline context.
Step 4: Launch deep research
Determine mode from depth:
- Depth 1-2:
--mode fast - Depth 3-5:
--mode deep
Run: notebooklm source add-research "{topic_query}" --mode {fast|deep} --no-wait
Show progress: [2/5] Starting deep research... (mode: {mode})
Step 5: Wait for research completion
Run: notebooklm research wait --import-all --timeout 300
Show progress: [3/5] Waiting for sources... (processing...)
When complete, run: notebooklm source list --json
Report: [3/5] {n} sources imported and ready.
Step 6: Extra WebSearch rounds (depth > 3)
If depth >= 4, run 1 WebSearch round:
- Generate 3-5 targeted search queries based on initial findings
- For each query: WebSearch, then read top 3 results with WebFetch
- Add discovered URLs as sources:
notebooklm source add "{url}"
If depth = 5, run a second WebSearch round:
- Generate 3-5 NEW queries based on combined findings
- Same process: search, fetch, add as sources
- Wait for new sources:
notebooklm source wait {id}
Show progress: [4/5] Running additional searches... ({n} extra sources)
Step 7: Domain boost (if --domain specified)
Run domain-specific searches from the Domain Boost section below. Add discovered URLs as sources to the notebook.
Step 8: Synthesize
Run structured synthesis query:
notebooklm ask "Based on ALL sources in this notebook, provide a comprehensive research report on '{topic}'.
Structure your response as:
1. EXECUTIVE SUMMARY (3-5 sentences, key takeaways)
2. MAIN FINDINGS (organized by theme, each finding citing specific sources)
3. KEY FINDINGS (bullet list of most important discoveries)
4. CONTRADICTIONS & OPEN QUESTIONS (where sources disagree or gaps exist)
5. For each claim, note which source(s) support it.
Be thorough, analytical, and cite sources precisely." --json
Parse response and extract references. Format into the Report Format below.
Pipeline — Fallback Mode (WebSearch only)
Used when NotebookLM is not available. Iterative WebSearch + WebFetch.
Round 1: Broad search
Generate 5 search queries from the topic (different angles). For each query:
- WebSearch to collect top 5 URLs
- WebFetch top 3 URLs to extract key findings
- Store findings + source URLs
Show progress: [1/{total_rounds}] Broad search... ({n} sources found)
Round 2+ (if depth > 1): Deep dive
For each round (up to depth-1 additional rounds):
- Analyze findings from previous round
- Identify gaps and unanswered questions
- Generate 3-5 new targeted queries
- WebSearch + WebFetch for each
- Merge new findings with existing
Show progress: [{round}/{total_rounds}] Deep dive round {n}... ({total} sources)
Domain boost in fallback
Same domain-specific queries as full mode, but results stay in-memory instead of being added to a NotebookLM notebook.
Synthesis in fallback
Compile all findings into the Report Format below. Synthesis is done by the agent directly from collected findings.
Limitations in fallback mode
Post-research actions NOT available without NotebookLM:
- Podcast generation
- Video generation
- Slide deck generation
- Quiz/flashcard generation
- Follow-up questions against persistent notebook
Available actions in fallback:
- Save as .md
- Go deeper (additional WebSearch rounds)
- Compare mode
Domain Boost
When --domain is specified, add these targeted searches to the pipeline.
Maritime (--domain maritime)
Additional search queries:
"{topic}" site:imo.org"{topic}" SOLAS regulation"{topic}" STCW code"{topic}" ISM Code"{topic}" site:iacs.org.uk"{topic}" Maritime Safety Committee MSC circular"{topic}" class society guidelines
Source priority (highest to lowest):
- IMO resolutions, circulars, guidelines
- SOLAS/STCW/ISM Code references
- IACS unified requirements
- Class society publications (Lloyd's, DNV, BV, ABS)
- Maritime industry papers (BIMCO, ICS, INTERCARGO)
- General maritime publications
Citation format: include regulation references when available. Example: "SOLAS Ch. III, Reg. 19.3.3" or "STCW Code Table A-VI/1"
Legal (--domain legal)
Additional search queries:
"{topic}" legislation regulation"{topic}" official journal law"{topic}" court decision ruling"{topic}" regulatory framework directive"{topic}" compliance requirements
Source priority:
- Official government legislation/gazettes
- Court decisions and rulings
- Regulatory body publications
- Legal databases and commentary
- Law firm analysis and white papers
Academic (--domain academic)
Additional search queries:
"{topic}" research paper study"{topic}" peer-reviewed journal"{topic}" systematic review meta-analysis"{topic}" site:arxiv.org"{topic}" site:researchgate.net"{topic}" IEEE conference proceedings
Source priority:
- Peer-reviewed journal articles
- Systematic reviews and meta-analyses
- Conference proceedings
- Preprints (arXiv, SSRN)
- University research reports
- Technical reports and white papers
Report Format
Format the final output as a Gemini Deep Research-style report:
# {Topic}