Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

paper-corpus-rag

БесплатноЗапускает вложенные скриптыНе проверен

Build grounded question answering over your own collection of research papers, with answers that cite the exact paper, page and passage. Use when a user wants…

KalarisLabsот KalarisLabs★ 218 звёзд на GitHub

Об этом скилле

RAG over a Research Paper Corpus

The goal is answers a researcher can check: every claim traces to a page of a paper. The pipeline has five layers, and most failures are in the first two, not in retrieval:

  1. Full text. You can only search what you have. Abstracts alone miss methods, sample sizes and edge cases. Use paper-lookup for open-access copies and fulltext-acquisition to track papers still missing.
  2. Conversion. PDF to Markdown with page markers and a quality grade, so you know when not to trust the text.
  3. Index. Heading-bound passages in one SQLite file: BM25, optionally plus embeddings.
  4. Locate. Search finds which papers and passages matter. It does not answer the question.
  5. Read. For synthesis, read the whole converted paper (or the relevant pages), not the top-k chunks.

Never index or cite a paper you do not have a lawful copy of. To discover candidates first, use firecrawl-research-index or paper-lookup.

Step 1: Convert (page markers and a grade)

python scripts/paper_convert.py papers/ -o papers_md/                    # every PDF and .txt in a folder
python scripts/paper_convert.py paper.pdf -o papers_md/ --abstract abstract.txt   # check the abstract's numbers

Engines, tried in order: pymupdf4llm (layout-aware, pipe tables), then pypdf. With neither installed, run pdftotext -layout paper.pdf paper.txt (form feeds separate pages) and convert the .txt. Each paper becomes name.md with <!-- page: N --> markers plus name.quality.json.

Grade Meaning What to do
good No damage detected (a heuristic, not a guarantee) Cite normally; still spot-check key numbers
tables-poor Tables flattened to loose numbers Read table values from the PDF, never from the text
math-poor Symbol-font or encoding damage Treat every statistic and equation as unverified
scan-poor Little or no text layer OCR first (liteparse, markitdown with OCR, or a vision parser), then reconvert

Repairs are never silent. Symbol-font fixes (P 5 0.04 to P = 0.04, P , 0.05 to P < 0.05) and ligatures are listed in the sidecar with their before and after text. With --abstract, every number in the abstract is looked up in the converted text, and any that is missing is flagged: that is the quickest signal of a damaged conversion. For hard cases (image-only tables, Ovid printouts) use a vision parser and have it flag any number that the text layer did not contain.

Step 2: Index

python scripts/paper_index.py index papers_md/ --db corpus.sqlite        # incremental; --rebuild after an upgrade
python scripts/paper_index.py stats --db corpus.sqlite                   # documents, chunks, grade mix, embeddings

Chunks follow headings: about 400 words (never more than 600), never crossing a heading, each keeping its section path (Methods > Training details) and page range. Figure and table captions are separate chunks. Reference lists are not indexed (they pollute BM25); read the file when you need them. The grade from name.quality.json is stored with each paper and shown on every hit.

Step 3: Locate

python scripts/paper_index.py query "effect of batch size on calibration" --db corpus.sqlite -k 8
python scripts/paper_index.py query "label smoothing" --db corpus.sqlite --by-paper    # which papers to read
python scripts/paper_index.py query '"temperature scaling"' --db corpus.sqlite --json --full

Each hit is file#chunk, section, pages and grade. Quote a phrase for an exact match. BM25 is strong on scientific text full of exact terms (gene names, methods, datasets), so start there.

Hybrid (optional). Add embeddings when queries are conceptual ("methods that avoid labeled data"):

pip install numpy sentence-transformers
python scripts/paper_index.py embed --db corpus.sqlite --model BAAI/bge-base-en-v1.5 --model <second-model>
python scripts/paper_index.py query "..." --db corpus.sqlite --mode hybrid      # BM25 + each model, fused by RRF

Vectors live in the same SQLite file as float32 blobs and are scanned brute-force, which is well under a second at a few thousand papers (about 100k chunks); beyond that move to pgvector, qdrant-vector-search or faiss. Rankings are fused with Reciprocal Rank Fusion, score = sum 1/(60 + rank). It needs no tuning. --mode auto (default) uses hybrid when vectors exist and says so when it falls back to BM25; --mode hybrid fails loudly instead. The embed command takes any single-encoder sentence-transformers model. Models with separate query and article encoders (such as MedCPT) need a small wrapper around embed_texts. Store the model name with the index: changing models means re-embedding.

Step 4: Read, then answer

python scripts/paper_index.py read paper.md --db corpus.sqlite               # the whole converted paper
python scripts/paper_index.py read paper.md --db corpus.sqlite --pages 3-5   # j
Полный SKILL.md на GitHub

Установить paper-corpus-rag в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

scripts/paper_convert.pyscripts/paper_index.py

FAQ

Что делает скилл paper-corpus-rag?

Build grounded question answering over your own collection of research papers, with answers that cite the exact paper, page and passage. Use when a user wants to chat with or search a folder of PDFs, summarize what a set of papers says, synthesize evidence across a literature corpus, find which paper says X, convert PDFs to citable Markdown with a quality grade, handle scanned PDFs or damaged tables, decide whether a vector database is needed, evaluate whether a paper-QA pipeline is any good, or build a hybrid index (SQLite FTS5 BM25 plus embeddings fused by reciprocal rank). Search locates papers; the agent then reads the full converted file before synthesizing.

Как установить скилл paper-corpus-rag?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл paper-corpus-rag запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить paper-corpus-rag с