Skip to main content

Paper Library Kit (plk)

CI License: MIT Python 3.10+ PyPI Downloads

Stop letting AI coding agents hallucinate DOIs and burn tokens reading raw PDFs.

Demo: a fabricated quote is rejected, the real verbatim quote passes

paper-library-kit is a Git-native, verbatim-verified literature knowledge graph, PDF-to-Markdown pipeline, and proactive debugging hook designed for Claude Code, Codex, Cursor, and Perplexity/Gemini research workflows.

English | 繁體中文版說明 (Traditional Chinese) | Live Interactive Evolution Graph Demo (16 Real AI-Agent/RAG Papers)


Why This Exists

Standard reference managers (Zotero, Mendeley) are built for humans, while naive vector RAG stores often fail in rigorous engineering and academic workflows:

Common AI Failure Mode How paper-library-kit Fixes It
Fabricated DOIs during deep-research surveys plk verify extracts every DOI in a Markdown file and checks title similarity live against Crossref
Token bloat & garbled columns when agents read raw PDFs plk ingest converts PDFs to clean two-column Markdown with === p.N === markers + cropped figures; raw PDFs stay archived locally (never in Git)
Hallucinated numbers & unit swaps in summaries plk cards & plk check enforce verbatim «quote» substring matching and number-unit adjacency before writing any entry
Isolated paper lists with no technical lineage plk cites runs 4-source citation cross-auditing and plk graph build compiles a zero-backend interactive HTML evolution timeline
Forgetting relevant papers while debugging .claude/hooks/paper_hint.py automatically surfaces the top 3 papers & evolution links when you log recurring failures

5-Stage Pipeline

flowchart LR
    S1["1. Survey & Gaps\nplk lit / verify / chain / gap"] --> S2["2. PDF to AI-Readable\nplk ingest / ocr / audit-pdfs"]
    S2 --> S3["3. Verbatim Cards & Tags\nplk cards / check / meta-health"]
    S3 --> S4["4. Relation Graph & Timeline\nplk backfill / cites / graph build"]
    S4 --> S5["5. Retrieval & Proactive Hooks\nplk search / neighbors / paper_hint.py"]

Real Anti-Hallucination Catch Examples

  1. Catching misquoted metrics before they enter your notes (plk check):

    ✗ [數字查無] M05: 5 datasets @ plug-and-play retrieval correction evaluation
    ✗ [引句無此數值] M05: 5 «Experiments on five datasets demonstrate that CRAG»
    

    If the paper text says "five datasets" and an LLM rewrites "5", or attaches a model number like SM15T30A as 30 A, check_core_tags.py rejects it immediately.

  2. Catching LLM-hallucinated DOIs (plk verify survey_notes.md):

    | Verdict              | Sim  | DOI                        | Crossref Actual Title                     | In Lib |
    |----------------------|------|----------------------------|-------------------------------------------|--------|
    | OK                   | 1.00 | 10.48550/arxiv.2210.03629  | ReAct: Synergizing Reasoning and Acting   | M01    |
    | DOI 錯(指到別篇)    | 0.14 | 10.1109/jssc.2020.9999999  | Unrelated Journal Article                 | —      |
    

Quick Start (5 Minutes)

1. Install the plk CLI

git clone https://github.com/Debiddo0506/paper-library-kit.git
cd paper-library-kit
pip install -e ".[all]"     # or `pip install -e .` without optional extras

Optional system packages for scanned PDFs: poppler-utils (pdftoppm/pdftotext) and tesseract-ocr.
Optional environment variable for high-rate OpenAlex queries: export OPENALEX_API_KEY=...

2. Initialize a Project

plk init ./my-research
cd my-research

Edit config/paper_config.yaml for your domain (topics, themes swimlanes, controlled vocab, aliases, and local pdf_archive_dir).

3. Try the 16-Paper Real Demo Immediately

python examples/demo_build.py
# Open examples/demo_evo_graph.html in your browser

CLI & Prompt Reference

Unified plk Commands (also runnable via python papers/tools/*.py)

Stage Commands Purpose
1. Survey plk lit search, plk verify, plk chain, plk gap Crossref/OpenAlex search, DOI anti-hallucination verification, citation chains, problem-gap scan
2. Convert plk ingest, plk ocr, plk audit-pdfs PDF -> === p.N === Markdown + cropped images/ + SHA-256 meta.yaml, OCR, 6-point audit
3. Verify plk cards, plk check, plk meta-health, plk triage-apply Build summary.md & TSVs from YAML with verbatim quote verification, OpenAlex metadata audit
4. Graph plk backfill, plk rel-context, plk check-relations, plk cites, plk graph Batch relation backfill, 4-source citation audit (H x T x O x Y), compile evo_graph.html
5. Retrieve plk search, plk show, plk neighbors, plk path, plk vocab Multi-signal search (problem ID, vocab, alias, --fulltext), multi-hop graph traversal

Ready-to-Use Prompt Templates

  • English: prompts/en/ (00_AGENT_LITERATURE_RULES.md through 05_PROMPT_RELATION_NETWORK.md)
  • 繁體中文: prompts/ (00_AGENT_LITERATURE_RULES.md through 05_PROMPT_RELATION_NETWORK.md)

Local MCP Server

Install the optional MCP extra from this checkout.

pip install '.[mcp]'

Start the stdio server with plk mcp --project-dir /absolute/path/to/my-research. Without --project-dir, plk looks for the library from the current working directory. Point it at a trusted, initialized local library. The server runs that library's existing query scripts and reads its local index.

Clients that use mcpServers can launch it with this configuration.

{
  "mcpServers": {
    "paper-library": {
      "command": "/absolute/path/to/plk",
      "args": ["mcp", "--project-dir", "/absolute/path/to/my-research"]
    }
  }
}

The client can discover and call four read-only tools.

Tool Example arguments
search {"terms": ["tile-rendering"], "limit": 5}
show {"paper_id": "R01"}
neighbors {"paper_id": "R01", "depth": 2, "include_cites": false}
path {"start_id": "R01", "end_id": "R02"}

Each tool returns the corresponding CLI --json value in a result field. For full-text queries, pass "fulltext": true with terms. For indexed queries, search also accepts block and text. Graph tools include citation edges by default. A disconnected path returns {"result": null}.


Development, Tests & Contributing

python -m unittest discover -s tests -v

See ROADMAP.md for good first issue ideas (Marker/Docling backend, BibTeX/Zotero importer, MCP server wrapper, Obsidian exporter, domain presets) and CONTRIBUTING.md for guidelines.

License

MIT License — see LICENSE. Never commit copyrighted PDFs or private API keys to a public repository.

Metadata

Release files for paper-library-kit 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paper-library-kit 0.1.2
File Size Uploaded Provenance Actions
paper_library_kit-0.1.2.tar.gz 114.7 kB With provenance Details for paper_library_kit-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paper-library-kit 0.1.2
File Interpreter ABI Platform Actions
paper_library_kit-0.1.2-py3-none-any.whl Python 3 none any Details for paper_library_kit-0.1.2-py3-none-any.whl

Total release size: 234.6 kB

Release files / paper_library_kit-0.1.2.tar.gz

Download URL paper_library_kit-0.1.2.tar.gz
Size 114.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b66b2f9f04a1ba91160874d57f0de5fce2ad666c5576a2f8d78388cab4cd86c5
BLAKE2b-256 checksum
How to use checksums
2c8fc1265a091649c23c84dbba04897159a494cc27b2444392d12fb713b7d541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / paper_library_kit-0.1.2-py3-none-any.whl

Download URL paper_library_kit-0.1.2-py3-none-any.whl
Size 119.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b85c99dafc4b725851e3cfc6ca18aa61c56ac587ee1020d5a4da37b99c854db9
BLAKE2b-256 checksum
How to use checksums
0fd95cc5363d7e751d7df7a7b4d86a40ac14ea435c98fb069d349788b558c082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for paper-library-kit 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for paper_library_kit-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page