PaperClaw turns your papers into a database you can question. You drop PDFs (or Markdown, text, arXiv LaTeX) into a folder; LLM agents read each paper and record its sections, its reference list, every citation with the sentence around it, and summaries. References are then linked to the papers they point to, so the result is one citation graph across your whole library, stored in a local DuckDB file.
Then you ask questions in plain language from a coding agent such as Claude Code:
- "Which references appear in the bibliographies of at least three of my papers?"
- "How is Abadie (2007) cited across the corpus: as method, as evidence, or as contrast?"
- "Which heavily cited papers am I missing? Rank them."
- "What do these two papers both cite, and what does that say about their common basis?"
- "Find the passages that discuss synthetic control with few pre-treatment periods."
Answers come from the corpus only and carry references to the lines they rest on.
Status. A personal project in active change; no stability promise. In November 2026 the repository was rewritten from scratch. The earlier version, built on slash commands and build scripts (
/ingest,/merge,/pull-citing), is gone, and its commands and JSON database no longer exist here.
- Python 3.11+ and uv.
- Claude Code. Configurations for Codex and oh-my-pi are checked in, but Claude Code is the host in active use.
- Disk space:
uv syncinstalls docling and PyTorch for PDF conversion, about 1.3 GB. - Tokens: every paper is read by LLM workers. Most tasks run on Haiku, the harder ones on Sonnet; queries run on Haiku. There is no measured per-paper figure yet, so try a few papers first.
git clone https://github.com/hurtjan/PaperClaw.git
cd PaperClaw
uv sync
claude
Start the agent from the repository root: .mcp.json registers the servers and they look
for inbox/ and data/ there. Then:
- Put your files into
inbox/(.pdf,.md,.txt,.tex, or an arXiv source archive.gz/.tgz). - Ask the session to ingest. The coordinator server converts the files, hands out the reading tasks to workers, checks every answer against the source text, and reports progress.
- Review what the run reports and approve the finalize. Nothing reaches the corpus before that.
- Ask your questions. The session answers through the read-only query server.
It runs locally, as three MCP servers and one command-line tool:
| Entry point | What it is for | Who calls it |
|---|---|---|
paperclaw-coordinator |
start, resume and inspect ingestion runs; review and finalize; maintenance | the session that coordinates a run |
paperclaw-task |
get_task, read_task_lines, renew_task_lease, submit_task |
one worker agent per task |
paperclaw-query |
guide, run, start: read-only questions to the corpus |
any session or research agent |
paperclaw index |
build the full-text search index next to the corpus | people and scripts |
paperclaw tidy |
move finished papers out of the ingestion database and compact its file (every new run does this first) | people and scripts |
The servers read their configuration once, at start:
| Variable | Default | Meaning |
|---|---|---|
PAPERCLAW_PROJECT_ROOT |
. |
root that holds inbox/, processed/, data/ |
PAPERCLAW_CORPUS_DATABASE |
<root>/data/corpus.duckdb |
the corpus to publish into and query |
To work on another root, start a new session with both variables set. The other variables
(leases, worker limits, stall limits, auto-finalize, Semantic Scholar key) are listed in
config.py and forwarded by .mcp.json.
The coordinator protocol is returned by the ingest tool itself
(src/paperclaw_mcp/prompts/coordinator.md). For questions about the corpus, the query server's
guide tool is the manual.
| Path | Content |
|---|---|
inbox/ |
files waiting to be ingested |
processed/ |
sources of finalized papers |
data/paperclaw.duckdb |
ingestion database: runs and the papers being worked on (revisions, tasks, submissions) |
data/artifacts/ |
per revision: accepted stage outputs (write-once files) and, once finished, its ingestion rows (ingestion_state.json.gz) |
data/corpus.duckdb |
the corpus: what queries read |
data/debug/ |
per-run traces when a run is started with debug |
src/paperclaw_mcp/ |
the package; prompts/ holds every worker and coordinator instruction |
docs/ARCHITECTURE.md |
how the code is laid out and how a paper moves through it |
AGENTS.md, CLAUDE.md |
rules for agents working in this repository |
env -u PAPERCLAW_PROJECT_ROOT -u PAPERCLAW_CORPUS_DATABASE uv run pytest -q
About 900 tests, 6–10 minutes, roughly 4 GB of temporary files per full run. Run one full suite
at a time. Tests marked live start real headless workers and are deselected by default.
Run tests without the two PAPERCLAW_* variables. tests/conftest.py removes them for each
test, but a session that exports them points at a real corpus, and anything that runs outside a
test function would use it.
Lint: ruff check --select F src.
- Nothing is published without review:
finalize_revisionwrites the corpus and is confirmed each time unless a run was explicitly authorized to auto-finalize. - Matching only adds links from a reference to a publication. It never merges, renames or promotes entries.
- No external lookups during ingestion or queries. Semantic Scholar and arXiv are reached only
through
s2_fetch/arxiv_fetch, on request. - Workers never open a database; they get one task through the four task tools.
MIT, see LICENSE.