Paper Deep Reader (paper-deep-reader)
Produce a publication-grade, single-file interactive HTML deep-reading monograph from a research paper PDF. The output combines the calm editorial readability of an academic journal, the analytical rigor of a peer-level close reading, and precision vector diagrams with silky browser interactivity.
Input Adapters (Zero Hard Dependencies)
Resolve the source paper using the lightest available input path:
- Local PDF path (default, zero extra setup): Read the user-supplied
.pdfdirectly. - Built-in zero-dependency fetcher (
scripts/fetch_paper.py, Python stdlib only):- arXiv ID / URL:
python scripts/fetch_paper.py --source 1706.03762 --out <workdir>— fetches arXiv metadata and downloads the PDF automatically. - DOI (Open Access):
python scripts/fetch_paper.py --source 10.xxxx/... --out <workdir>— retrieves authoritative Crossref metadata and searches legal Open-Access PDFs (OpenAlex, Europe PMC, Semantic Scholar, optional Unpaywall via--email/UNPAYWALL_EMAIL, Crossref links). If the paper is paywalled with no legal OA PDF, the script savespaper_meta.jsonand exits with code2(PAYWALL_OR_NO_OA_PDF): stop and ask the user for a local PDF or Zotero item—never fabricate formulas/tables from an abstract alone and never use unauthorized download sources. - Zotero 7+ Local API (zero-plugin):
python scripts/fetch_paper.py --zotero-query "<title>" --out <workdir>(or--zotero-key <KEY>) queries127.0.0.1:23119(compatible with Zotero 7 / 8 / 9 / 10) and automatically resolves the local PDF path via/file(even for custom data directories) alongside metadata and notes.
- arXiv ID / URL:
- Optional
zotero-cli/zotero-mcp/ paper-search MCP: If already installed in the host environment, you may use them directly to retrieve metadata, notes, and local PDF paths.
Always put intermediate files (extracted text, PDF page PNGs, plotting scripts, QA screenshots) in a dedicated temporary task directory (respecting any workspace temp-directory rule such as temp/<task>/); never litter the repository root.
4-Stage Workflow
Stage 1 · Source Grounding & Visual Fidelity Verification
- Run
scripts/extract_pdf.py --pdf <paper.pdf> --out <workdir> --pages <all-or-key-pages> --dpi 200to extract full text and render key pages (all pages for short papers ≤6 pages; pages containing equations, tables, footnotes, and core figures for longer papers) to PNGs. - Visually inspect the rendered page PNGs (
read_file) to verify every equation, symbol, table value, footnote, and figure caption. Never rely solely on raw PDF text extraction for multi-column tables or formulas. - If the paper reports summary totals or grouped metrics across a table, write a brief Python assertion script to cross-check arithmetic consistency and compute key secondary metrics (e.g., absolute vs relative gaps, outlier sensitivity).
Stage 2 · Academic Monograph Synthesis & Silent Deep-Audit
Read references/academic-writing-guide.md before drafting.
- Narrative & Tone: Write in clear, rigorous, fluent academic prose matching the user's language (default Simplified Chinese with exact English technical terms preserved). Follow a natural academic reading order (Hero & Executive Summary → Research Background & Problem → Method & Equations → Experimental Analysis → Interactive Original Data → Design Analysis & Evidence Boundaries → Engineering Insights & Transfer).
- Silent Deep-Audit Checklist (apply rigorously in the background without polluting the UI with meta-QA badges):
- Design Trade-offs: Pinpoint where prior methods fail, how the proposed mechanism resolves the failure, and what cost it accepts.
- Equations + Concrete Worked Example: Define every symbol's domain and physical meaning, explain the physical intuition before/after key formulas, and carry at least one concrete small-number micro-example end-to-end (including inverse/verification closure where applicable).
- Component Role Hierarchy: Distinguish indispensable core mechanisms from conditional gains, unablated choices, and prototype simplifications.
- Evidence Boundary Check: Cross-check body claims against tables, figures, and footnotes (downplayed regressions, weighted-average skews, un-tabulated claims, sample truncations, unmeasured compute/memory overhead). Keep paper facts clearly separated from mechanism inferences through natural academic prose rather than noisy stamp badges.
Stage 3 · Adaptive Visual Layering & Interactive Assembly
Read references/diagram-and-layout-guide.md and references/plotting-guide.md before generating figures.
Do NOT hardcode figure counts or force irrelevant widgets—adapt components to the paper type:
| Paper Archetype | Recommended Core Diagrams & Interactive Widgets |
|---|---|
| Discrete Algorithm / Codec / State Machine | Conceptual intuition SVG + Route comparison SVG + Decoupled architecture SVG (data-ref linked) + Interactive Stepper Player & Custom Sandbox + Quantitative plots + Interactive raw data table |
| Deep Learning / Architecture / Systems | Conceptual overview SVG + Hierarchical pipeline SVG (data-ref linked) + Module close-up / Tensor-shape worked trace + Small Multiples (ablation or failure archetypes) + Quantitative scaling/comparison plots + Interactive benchmark table |
| Theory / Physics / Experimental Measurement | Physical setup / mechanism SVG + Derivation & worked numerical calculation + Small Multiples (regime comparison) + Error-budget / scaling Matplotlib plots + Evidence boundary & regime-validity table |
Three orthogonal visual tracks (all aligned to the Warm Paper Morandi palette in assets/theme-morandi.css and assets/morandi-academic.mplstyle):
- Conceptual Overview & Precision Mechanism Diagrams (Vector SVG default):
- Draw the actual mechanism (mini histograms, bit-planes, pixel neighborhoods, tensor dimensions, pipeline branches)—never empty labeled boxes.
- Use target-language labels (e.g. 100% Simplified Chinese with standard English acronyms/symbols for Chinese reports); never insert an English-only concept graphic into a Chinese reading page.
- Optional AI concept figure: Only if the environment has an image-generation tool and the user wants an AI conceptual anchor, generate at most 1
paper-figureimage strictly matching the target language and Warm Paper Morandi palette, and visually inspect it for zero garbled text. On quota/error or garbled output, default cleanly to a crisp vector SVG.
- Quantitative Statistical Charts (
assets/morandi-academic.mplstyle, Matplotlib SVG):- Use dual-panel layout only for concise, low-density comparisons (≤8 categories per panel).
- Split dense charts (≥15 samples or dense annotated scatters) into separate full-width SVGs so labels remain effortlessly legible inside the
860pxreading column. - Mandatory visual QA: Render PNG previews, inspect every PNG via
read_file, fix any text overlap/clipping/legend collision, then export vector SVGs (svg.fonttype: none).
- Zero-Dependency Self-Contained Assembly:
- Write the page body fragment (
body.html) using the exact semantic classes fromassets/theme-morandi.css(sticky masthead, clean left TOC sidebar only, Hero card + flush 4-KPI strip, Executive Summary,.fig-framewith⤢ 放大查看zoom buttons on every figure,.eq-box,.table-wrap,.audit-grid2×2,.transfer-grid,.sources-box). - Run
scripts/assemble_html.pyto inlineassets/theme-morandi.css,assets/widgets.js(rAF scroll/TOC sync,data-reflinked highlighting, 120fps GPU + debounced crisp vector Pan/Zoom Lightbox), cleaned/ID-prefixed SVGs, and any page-specific interactive JS into one standalone.htmlfile. - Performance guardrails: Never add render-blocking Google Fonts
<link>tags orbackdrop-filter: blur(...); keepignoredTags: ['script','noscript','style','textarea','pre','code','svg']in KaTeX auto-render; escape<as<inside KaTeX math.
- Write the page body fragment (
Stage 4 · Dual-Layer QA & Delivery
- Static QA: Run
python scripts/qa_static.py <output.html>and fix everyFAIL(unreplaced tokens, KaTeX brace/angle errors, duplicate SVG IDs, forbidden QA-noise/AI-cliche strings, JS syntax errors vianode --check). - Visual Browser QA: Run
python scripts/qa_browser_shots.py --html <output.html> --out <workdir>/qa_shots, inspect the rendered1440pxPNG slices viaread_file, fix any layout/wrapping/clipping/spacing issue, and re-verify. - Deliver HTML only: Output the standalone
.htmlfile without overwriting earlier versions. Do NOT export PDF unless the user explicitly asks for one.
Anti-Patterns to Never Ship
- Background QA scaffold leaking into reader UI: Never render a sidebar "核验口径" box, masthead "全量复核" badge, or repetitive
[原文核验事实]/校验通过stamps across paragraphs and captions. Place a concise 1–2 line source/scope note in the bottom.sources-boxonly. - Whiteboard gimmicks or AI clichés: Never use gimmicky translated section headers ("赌注 / 解剖台 / 承重墙") or filler phrases ("值得注意的是 / 至关重要 / 深入探讨 / 奠定基石").
- Cramped dense multi-panel plots: Never squeeze two 20+ point charts side by side into an
800pxcolumn. - Unverified numbers: Never copy a figure or table value from memory or noisy OCR without checking the rendered PDF page PNG.