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.
git clone --depth 1 https://github.com/chenpg2/kw-engineWrote 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.
[](https://agentmods.dev/agents/chenpg2/kw-engine/kw-fetcher)<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.
<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>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.
| Model | Per session | Once 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 |
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 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
-
Idempotency. If
paper/<id>.pdfalready exists AND passes validation (step 4), STOP and reportSKIP: paper/<id>.pdf already valid. Never re-download. -
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, reportAMBIGUOUS: <title>with the top 3 candidates — do not guess). -
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:
download_with_fallback(the built-in cross-source chain) — try this first.- Per-source by identifier type:
- arXiv id →
download_arxiv - bioRxiv/medRxiv DOI →
download_biorxiv/download_medrxiv - PMC/PubMed →
download_pubmed - any DOI →
download_crossref, thendownload_openalex, thendownload_semantic
- arXiv id →
- Direct OA URL via Bash
curl -L: e.g.https://arxiv.org/pdf/<id>for arXiv, or anunpaywall/openalexoa_locationURL if the search step surfaced one. Save the winning bytes topaper/<id>.pdf.
-
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. -
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/browseusing 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).
- If every OA source fails and the paper is from a paywalled publisher (Nature,
Elsevier/ScienceDirect, Wiley, Springer, ACS, IEEE, …), report exactly:
-
Register (only on a valid PDF). Apply add_paper(id) per SCHEMA §4: if
idis not already inindex.json.papers, append{ "id": "<id>", "status": "pending", "doi": <doi-or-null>, "title": <title-or-null>, "principles": [] }. Do NOT create thememory/papers/<id>.mdrecord — 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.
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.
- 1mo ago First seen · 65 lines · 58 tokens per session scan A f9753db0e0a8
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.
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.
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.
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.
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.
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.
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.