paper-fetch AGENTS.md

paper-fetch AGENTS.md is an instructions file for Codex, OpenCode from drpwchen/paper-fetch. It costs 2,271 tokens per session, scanned A, original, MIT.

Instructions for deploying and using a paper-fetching tool that finds full-text research PDFs through open-access sources, publisher services, or a library proxy.

In plain words
What is it for?
Use it to set up paper retrieval, configure library access, check user permissions, and connect downloading with paper discovery and reading tools.
Why use it?
It explains the correct download route and what to check when access fails, including cases requiring the user's institution or manual action.

Instructions file for CodexOpenCode

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.

agentmods
npx agentmods add instructions/drpwchen/paper-fetch/agents-md
Clone the repo
git clone --depth 1 https://github.com/drpwchen/paper-fetch

Made for: Codex, OpenCode.

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 paper-fetch AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/drpwchen/paper-fetch/agents-md.svg)](https://agentmods.dev/instructions/drpwchen/paper-fetch/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/drpwchen/paper-fetch/agents-md"><img src="https://agentmods.dev/badge/instructions/drpwchen/paper-fetch/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,271 This file is loaded in full into every session.
When invoked 2,271 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02271 $0.02271
Opus 5 $0.01136 $0.01136
Sonnet 5 $0.00454 $0.00454
Haiku 4.5 $0.00227 $0.00227

Measured today against content hash 1c1a48456e1a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

paper-fetch AGENTS.md scanned grade A with 0 findings 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 today.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — for AI agents deploying, adapting, or calling paper-fetch

Most people will point you (an AI coding agent) at this repo and say "set this up for my library" or "explain how this works." This file tells you how to do that correctly, how to know it worked, and where the hard lines are.

What this tool is

A publisher-aware full-text PDF fetcher built as a route ladder: open access (Unpaywall + Semantic Scholar + PMC) → official publisher TDM APIs → the user's own institutional library proxy → a printed resolver link for a manual finish. It is the download end of a pipeline; the reading end is claude-paper-tools, the discovery end is paper-radar.

Deploying it for a user (the happy path)

  1. pip install -r requirements.txt. For the proxy layer also python -m patchright install chromium.
  2. cp config.example.yaml config.yaml. Fill in:
    • unpaywall_email, rate.contact — the user's email.
    • institution.sfx_base / remote_auth_base / proxy_suffix — the user's library's own endpoints. Ask the user for these, or help them find them — the four off-campus families and where each value hides are in docs/library-setup.md. Do NOT reuse endpoints from anywhere else.
  3. Help the user store their own credentials in the local secret store (see README). Never put credential values in config.yaml or anywhere in the repo.
  4. Verify layer 1 before touching anything else — this is your smoke test:
    python paper_fetch.py 10.1186/s12984-023-01168-x out.pdf   # a real OA article; must yield a PDF
    
    If that fails, the problem is config or network, not the library. Fix it here, not later.
  5. Only then the proxy layer. As of v1.0 all route code (including the full LWW/Ovid flow) ships working — what remains is authentication config: set auth.family: form and point the selectors in config.yaml at the gate's login form (inspect it in devtools; EZproxy preset in docs/library-setup.md), plus auth.persist_cookies. Only SSO gates (OpenAthens/Shibboleth) need a custom login() implementation. Then:
    python library_session.py check                 # is the session alive?
    python library_session.py fetch <DOI> out.pdf   # a DOI the library definitely holds
    
  6. Build the holdings table if the user has a library (docs/holdings.md). It is what makes step 7 possible.

Read the full file on GitHub · 141 lines

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. today Changed · +8 lines · +135 tokens per session 1c1a48456e1a
  2. 4d ago First seen · 133 lines · 2,136 tokens per session scan A b98fae513ba2

Subscribe to this mod's changes

paper-fetch AGENTS.md is an instructions file published in the GitHub repository drpwchen/paper-fetch (58 stars, last pushed 2d ago), licensed MIT. It adds 2,271 tokens to every session, about $0.0114 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories