> For AI agents: the complete documentation index is available at /Prism/llms.txt, the full documentation bundle is available at /Prism/llms-full.txt.

# Hybrid Zotero + Web Autonomous Deep Research (`/deep-research`)

Commercial "Deep Research" tools cannot search inside your private multi-thousand-paper Zotero PDF library, cannot anchor claims to exact local PDF pages, and cannot run 100% locally on confidential collections. Conversely, single-turn RAG chats cannot autonomously iterate across dozens of papers and open-access databases to produce a structured, publication-grade survey.

Prism's **Autonomous Deep Research (`/deep-research`)** bridges both worlds right inside Zotero—planning structured sub-questions, searching your local **Tier 1 + Tier 2 Semantic Index** alongside zero-key academic APIs, deep-reading top Zotero PDFs page-by-page, running a targeted gap-check pass, and synthesizing a rigorously cited report with 1-click batch import into Zotero.

:::tip Fail-Closed Privacy Guardrail (`Zotero Library Only`)
Whenever any scoped collection or matched paper triggers your **Local-Only Privacy Guardrails** (e.g., `unpublished`, `confidential`, or a protected collection), Prism automatically blocks **cloud LLMs** (offering a 1-click switch to your configured local LLM) and locks local LLM runs strictly to **`Zotero Library Only`**—disabling **all** outbound OpenAlex, arXiv, Semantic Scholar, PubMed, and Crossref queries before any network request can occur.
:::

## 1. Ways to Launch

| Entry Point                             | How It Works                                                                                                                                      |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Sidebar `Studios ▾` → Deep Research** | Opens the Pre-Flight Scope & Plan Modal from any paper or workspace tab.                                                                          |
| **Collection Right-Click**              | Right-click one or more folders in Zotero → **`Run Deep Research on Collection in Prism`** (pre-fills the topic and selected collections).        |
| **Library Right-Click**                 | Right-click selected papers → **`Prism Actions ▸ Run Deep Research (/deep-research)`** (pins selected items as seed evidence).                    |
| **Chat Slash Command**                  | Type **`/deep-research [your research question]`** in the composer to open the Pre-Flight modal with your topic and active context pre-populated. |
| **Command Palette (`⌘K` / `Ctrl+K`)**   | Press **`⌘K`** / **`Ctrl+K`** → **Deep Research**.                                                                                                |

## 2. Pre-Flight Scope, Format & Editable Research Plan

Before spending retrieval or synthesis tokens, Prism opens the **Pre-Flight Modal**:

1. **Choose Search Scope:**
   - **`Zotero Library Only (100% Private)`** — searches only your local Zotero PDFs, notes, and Semantic Index with zero external web calls.
   - **`Selected Collection(s) + Open Academic Web`** — narrows local retrieval to chosen Zotero folders (including nested subcollections) while cross-checking zero-key academic APIs.
   - **`Entire Library + Open Academic Web`** — cross-checks your whole Zotero library against open academic literature.
2. **Choose Output Format:**
   - **Technical Literature Survey** — executive summary, taxonomy & SOTA synthesis, comparison table, consensus vs. contradictions, and open research gaps.
   - **Method Comparison Report** — executive verdict matrix, head-to-head architectural comparison, performance vs. efficiency trade-offs, and failure modes.
   - **Grant Background Brief** — scientific significance, current state of the art, critical unresolved bottlenecks, and validation milestones.
3. **Review Research Plan Before Running (Optional Toggle):**
   - Generates **4–7 structured sub-questions** and academic keyword queries first.
   - Edit wording inline, reorder (`↑` / `↓`), prune irrelevant angles, or add your own sub-questions before launching execution.

## 3. Autonomous Multi-Stage Execution & Safe Cancellation

During execution, Prism streams live stage telemetry right inside the chat turn (**Plan → Zotero Library → Read PDFs → Academic Web → Gap Check → Synthesize**) with real-time counts and deterministic disk checkpoints (`<ZoteroProfile>/prism-cache/deep-research/`):

1. **Stage 1 (Plan):** Uses your approved 4–7 sub-questions (or decomposes the topic automatically using your `fast` / active model).
2. **Stage 2 (Iterative Retrieval):** Queries your local **Tier 1 + Tier 2 Semantic Index** (with automatic native Zotero metadata/abstract lexical fallback if unindexed) and—when permitted—zero-key academic APIs (**OpenAlex**, **arXiv**, **Semantic Scholar**, **PubMed**, and **Crossref**).
3. **Stage 3 (Deep Reading & Evidence Ledger):** Reads top local Zotero PDFs page-by-page (`extractPaperBundle`) to extract verified page quotes (`zotero_pdf`) alongside newly discovered external literature (`web_paper`).
4. **Stage 4 (Gap Check & Grounded Synthesis):** Identifies under-covered sub-questions for **1 targeted follow-up retrieval round**, then synthesizes a structured report with automatic **prompt-cache reuse** (`enablePromptCaching: true`).
5. **Non-Blocking Stop & Keep Partial Ledger:** Click **`Stop & Keep Partial Ledger`** at any time to abort cleanly via `AbortController`—preserving every collected passage and discovered external paper inside the card with zero UI freeze.

## 4. Interactive Report Card, 1-Click Batch Import & Exports

Every completed (or stopped) run persists on the chat node (`PaperChatStore`, synced conflict-free across devices) with 3 interactive tabs:

- **Report:** Renders the full Markdown survey with **clickable green `[N]` badges** that jump straight into the exact local Zotero PDF page (with multi-pulse flashing highlight), **circular link-chain web source chips** synchronized with the bottom `**Sources:**` list, GFM comparison tables, and optional inline Mermaid/SVG diagrams.
- **Evidence Ledger:** Filter all collected evidence by provenance (**All** / **Zotero PDF** / **Web Paper**) and by sub-question, with 1-click `p. N` PDF page jumps and external links.
- **Discovered Papers:** Automatically deduplicates external papers against your Zotero holdings (by DOI, arXiv ID, and title similarity). Select newly discovered papers and click **`Import Selected (N) to Zotero`** to generate an atomic **`Preview → Approve → Commit` + 1-Click Undo** Approval Card right below the report (including open-access PDFs).
- **Exports & Canvas Handoff:** Export directly as **Overleaf LaTeX** (`\cite{bbt_key}`), **Cited BibTeX (`.bib`)** (combining Zotero Better BibTeX keys + external entries), **Obsidian Markdown**, **Word (`.docx`)**, **Markdown (`.md`)**, **Zotero Note**, or click **`Send to Research Canvas`** to explore the key papers spatially on a whiteboard.
