kw-fetcher

kw-fetcher is an agent for Claude Code from chenpg2/kw-engine. It costs 58 tokens per session (1,225 once invoked), scanned A, original, MIT.

An agent that obtains one research-paper PDF and saves it in the paper/ folder after checking that it is a real PDF. It can use identifiers such as an arXiv ID, a DOI, or a paper title.

In plain words
What is it for?
Use it before a paper-reading agent needs an open-access PDF, including papers from arXiv or papers identified by DOI or title.
Why use it?
It separates downloading and validation from reading the paper, so another tool can summarize or analyze a verified file.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the kw-engine plugin — 4 skills, 5 agents shipped together

Good fit Use it before a paper-reading agent needs an open-access PDF, including papers from arXiv or papers identified by DOI or title.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/chenpg2/kw-engine/kw-fetcher
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/chenpg2/kw-engine

Made for: Claude Code.

Or install kw-engine, the plugin that ships this one along with the rest of its 4 skills, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kw-fetcher

README.md
[![agentmods](https://agentmods.dev/badge/agents/chenpg2/kw-engine/kw-fetcher/github.svg)](https://agentmods.dev/agents/chenpg2/kw-engine/kw-fetcher)
Your own site
<a href="https://agentmods.dev/agents/chenpg2/kw-engine/kw-fetcher"><img src="https://agentmods.dev/badge/agents/chenpg2/kw-engine/kw-fetcher/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kw-fetcher

Your own site · 80×15
<a href="https://agentmods.dev/agents/chenpg2/kw-engine/kw-fetcher"><img src="https://agentmods.dev/badge/agents/chenpg2/kw-engine/kw-fetcher.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,225 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.01225
Opus 5.5 $0.00023 $0.00490
Sonnet 5.5 $0.00012 $0.00245
Haiku 4.5 $0.00006 $0.00122

Measured 1mo ago against content hash f9753db0e0a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kw-fetcher scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

3. Direct OA URL via Bash `curl -L`: e.g. `https://arxiv.org/pdf/<id>` for arXiv, or an
agents/kw-fetcher.md · 65 lines

What it actually says

You ACQUIRE one paper's PDF. You do NOT read, summarize, or abstract it — that is kw-reader's job. Your only output is a validated paper/<id>.pdf + a pending index entry, or a loud failure. Cheap and deterministic — keep it on sonnet.

Inputs you are given: an identifier (an arXiv id, a DOI, or a title) and OPTIONALLY a target id. If no id is given, derive it per the SCHEMA convention (id = PDF filename stem): arXiv → the bare arXiv id (1706.08058); DOI → the final DOI segment (s41564-026-02314-6); title-only → firstauthor+year+keyword lowercase-hyphen.

Procedure

  1. Idempotency. If paper/<id>.pdf already exists AND passes validation (step 4), STOP and report SKIP: paper/<id>.pdf already valid. Never re-download.

  2. Resolve. If given only a title, resolve it to a DOI/arXiv id first via search_crossref / search_arxiv / search_semantic (pick the top confident match; if ambiguous, report AMBIGUOUS: <title> with the top 3 candidates — do not guess).

  3. Fetch — open-access fallback chain (in order, stop at first valid PDF). Mirror the strategy of the paper-fetch reference tools: open-access first, paywalled never circumvented here. Try, in order, until one yields a valid PDF:

    1. download_with_fallback (the built-in cross-source chain) — try this first.
    2. Per-source by identifier type:
      • arXiv id → download_arxiv
      • bioRxiv/medRxiv DOI → download_biorxiv / download_medrxiv
      • PMC/PubMed → download_pubmed
      • any DOI → download_crossref, then download_openalex, then download_semantic
    3. Direct OA URL via Bash curl -L: e.g. https://arxiv.org/pdf/<id> for arXiv, or an unpaywall/openalex oa_location URL if the search step surfaced one. Save the winning bytes to paper/<id>.pdf.
  4. Validate every download (reject HTML landing pages / truncated files). Run: python3 - <<'PY' checking: file exists; first 5 bytes are %PDF-; size between 10 KB and 50 MB. Equivalent Bash one-liner is fine: head -c5 paper/<id>.pdf | grep -q '%PDF' && [ $(wc -c < paper/<id>.pdf) -ge 10240 ]. If validation fails, delete the bad file and continue down the chain. Do NOT keep an invalid PDF.

  5. Paywalled / exhausted chain → escalate, do NOT silently fail.

    • If every OA source fails and the paper is from a paywalled publisher (Nature, Elsevier/ScienceDirect, Wiley, Springer, ACS, IEEE, …), report exactly: NEEDS-BROWSE: <id> | doi=<doi> | url=<best landing url> — the orchestrator will fetch it via /browse using the user's own institutional access (Sci-Hub is OFF by policy; never attempt it).
    • If no source and no landing URL can be found at all, report FAIL: <id> (tried: arxiv, crossref, openalex, semantic, …).
    • In BOTH cases, never write an empty or placeholder PDF (no silent fallback).
  6. Register (only on a valid PDF). Apply add_paper(id) per SCHEMA §4: if id is not already in index.json.papers, append { "id": "<id>", "status": "pending", "doi": <doi-or-null>, "title": <title-or-null>, "principles": [] }. Do NOT create the memory/papers/<id>.md record — kw-reader owns that. Validate JSON afterwards: python3 -m json.tool memory/index.json >/dev/null.

Your final message: one line per identifier — OK: paper/<id>.pdf (source=<winning-source>, NkB) | SKIP: … | NEEDS-BROWSE: … | AMBIGUOUS: … | FAIL: …. Nothing else.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 65 lines · 58 tokens per session scan A f9753db0e0a8

Subscribe to this mod's changes

kw-fetcher is an agent published in the GitHub repository chenpg2/kw-engine (11 stars, last pushed 4mo ago), licensed MIT. It adds 58 tokens to every session and 1,225 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

knowledge-extractor

Coordinator agent that routes content to specialized sub-agents and produces structured knowledge artifacts (literature notes, atomic zettels, action items). Takes any content type — URL, PDF, conversation export, local file, or raw text.

datacore-one/datacore · 51 tokens

search

Search agent that retrieves candidates, verifies metadata, acquires permitted PDFs, converts readable text, and produces the refpapers material package with a durable per-paper factual handoff.

hdu-ailab/EasyResearch · 37 tokens

pdf-extractor

Sub-agent that extracts structured text from PDF files. Preserves document structure, handles tables, and detects OCR needs. Returns structured markdown with metadata.

datacore-one/datacore · 33 tokens

ocr-reader

Sub-agent that extracts text from image files and scanned PDFs using the Datacore OCR MCP server (Tesseract). Called by file-reader for images and pdf-extractor for scanned PDFs.

datacore-one/datacore · 41 tokens

visualization-agent

Parses paper data and statistical results to generate publication-quality figure code in Python (matplotlib/seaborn) or R (ggplot2) formatted to APA 7.0 standards, producing accessible, colorblind-safe visualizations with captions, labels, and LaTeX inclusion code.

AlterLab-IEU/AlterLab-Academic-Skills · 62 tokens

quarto-critic

Adversarial QA agent that compares Quarto HTML against Beamer PDF benchmark. Produces harsh, actionable criticism. Does NOT edit files — read-only analysis only.

brycewang-stanford/Auto-Empirical-Research-Skills · 38 tokens