|
| 1 | +# ReadyCode Reader |
| 2 | + |
| 3 | +**Ask huge PDFs, Word documents and spreadsheets specific questions. Your AI gets only the passages that answer, with citations, instead of reading the whole file.** |
| 4 | + |
| 5 | +ReadyCode Reader is a free, open-source [MCP](https://modelcontextprotocol.io) server for Claude Code, Cursor, Codex and any other MCP client, and it also runs in a browser. It reads a file once on your computer. Then, for each question, it returns **only the passages that answer it**, with where they came from, plus checks on that evidence: |
| 6 | + |
| 7 | +- **Not in the document:** if the file can't answer, your AI is told `not_in_document` instead of getting passages to guess from. |
| 8 | +- **Passages disagree:** if two passages give different values, your AI is told to report both. |
| 9 | +- **Hidden instructions:** passages that try to instruct the AI reading them are flagged and treated as data only. |
| 10 | +- **Needs a calculation:** spreadsheet questions like "how many…" or "list every…" are flagged instead of being estimated from a few rows. |
| 11 | + |
| 12 | +## Standard AI vs Reader |
| 13 | + |
| 14 | +Same questions, same AI, fresh sessions: once the normal way (the AI reads the file with its own tools), once with Reader. |
| 15 | + |
| 16 | +| Test | Standard | With Reader | |
| 17 | +|---|---|---| |
| 18 | +| **Codex**, 200-page NASA PDF, 8 questions | 8/8 correct · **913,468 tokens** · about 3 min | 8/8 correct · **41,997 tokens** · about 20 s | |
| 19 | +| **Grok 4.7 in Cursor**, same PDF | 8/8 correct · read the whole book (about 45,000 tokens) · about 4 min | 8/8 correct · **4,693 tokens** of evidence · about 2 min | |
| 20 | + |
| 21 | +Token counts for Codex come from Codex's own session log. That's **95% fewer tokens and about 9× faster** for the same answers. Most of the saving comes from steps: an agent re-sends its whole conversation at every step, and with Reader it needed 2 steps instead of 17. |
| 22 | + |
| 23 | +## Measured on large files |
| 24 | + |
| 25 | +Every expected answer below was checked by code against the file, and every "not in the document" question was checked to be truly absent. Scripts and question files are in [`benchmark/`](benchmark/). |
| 26 | + |
| 27 | +| File | Size as text | Correct | Tokens returned | Time for all questions | Check cost | |
| 28 | +|---|---|---|---|---|---| |
| 29 | +| NASA *Earth at Night* (PDF, 200 pages) | 42,282 tokens | 8/8 | 3,487 | 2.3 s | $0.0027 | |
| 30 | +| Australian Universities Accord Final Report (Word) | 263,487 tokens | 11/11 | 15,790 | 1.7 s | $0.0042 | |
| 31 | +| Sample contacts workbook (Excel, 100 MB, 1.1 million rows) | 271,424,159 tokens | 11/11 | 2,323 | 0.9 s | $0.0038 | |
| 32 | + |
| 33 | +The Word report is larger than many AI context windows, and the spreadsheet is more than a hundred times larger than any. Each set includes questions the file cannot answer; Reader said `not_in_document` every time. On the spreadsheet it also declined 3 counting and ranking questions rather than guess. |
| 34 | + |
| 35 | +Honest limits of these results: they are our own runs on three files, not an independent study, and head-to-head runs against a standard AI exist so far only for the PDF. |
| 36 | + |
| 37 | +## Install (MCP) |
| 38 | + |
| 39 | +You need [Node.js](https://nodejs.org) 20 or newer and an [OpenRouter](https://openrouter.ai) API key, set once as the environment variable `OPENROUTER_API_KEY`. |
| 40 | + |
| 41 | +**Claude Code** |
| 42 | + |
| 43 | +```bash |
| 44 | +claude mcp add readycode-reader -- npx -y @readycode/reader |
| 45 | +``` |
| 46 | + |
| 47 | +**Cursor**: add to `~/.cursor/mcp.json`: |
| 48 | + |
| 49 | +```json |
| 50 | +{ |
| 51 | + "mcpServers": { |
| 52 | + "readycode-reader": { "command": "npx", "args": ["-y", "@readycode/reader"] } |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +**Codex**: add to `~/.codex/config.toml`: |
| 58 | + |
| 59 | +```toml |
| 60 | +[mcp_servers.readycode-reader] |
| 61 | +command = "npx" |
| 62 | +args = ["-y", "@readycode/reader"] |
| 63 | +``` |
| 64 | + |
| 65 | +**Claude Desktop**: add the same entry as Cursor under `mcpServers` in `claude_desktop_config.json`. |
| 66 | + |
| 67 | +Restart your tool and check that `readycode-reader` shows three tools: `load_document`, `ask_document` and `list_documents`. |
| 68 | + |
| 69 | +## Use |
| 70 | + |
| 71 | +Ask your AI something like: |
| 72 | + |
| 73 | +> Load `C:\Docs\contract.pdf` with readycode-reader and tell me everything it says about late fees and termination. |
| 74 | +
|
| 75 | +Your AI loads the file, sees its contents, asks Reader specific questions and answers from the cited passages. You don't need to know the file or write special questions. |
| 76 | + |
| 77 | +- `load_document(path)` reads a PDF, Word (.docx), Excel (.xlsx), TXT, Markdown, CSV or JSON file. It returns the file's size and **its contents**: a PDF's bookmarks with page numbers, the Word headings, or a spreadsheet's sheets, columns and an example row. That tells the AI what the file covers before it asks anything. |
| 78 | +- `ask_document(questions: [...])` asks up to 20 questions in one call. Each answer carries its passages with page numbers (and printed page numbers), Word sections and paragraphs, or spreadsheet sheet and row. |
| 79 | +- `list_documents()` lists what is loaded. |
| 80 | + |
| 81 | +Very large files keep reading in the background: `load_document` may answer `still_reading`, and `ask_document` waits for the file to finish. |
| 82 | + |
| 83 | +## Try it in your browser |
| 84 | + |
| 85 | +The same engine runs in a web page: choose a file, add your OpenRouter key, ask. The page shows the file's contents and suggests questions to start with. The file is read in your browser and never uploaded. See [`web/`](web/); build it with `npm run build:web`. |
| 86 | + |
| 87 | +## How it works |
| 88 | + |
| 89 | +1. **Read** on your computer: [pdf.js](https://mozilla.github.io/pdf.js/) for PDFs; Word sections follow its headings; Excel is streamed, so a 100 MB workbook uses about 650 MB of memory. |
| 90 | +2. **Split** into whole passages of about 1,200 characters, never cut mid-passage. Each spreadsheet row is one record, and identical records are returned once, with a note of where else they appear. |
| 91 | +3. **Search** with a keyword index to find the 20 most likely passages. |
| 92 | +4. **Check** with one call to TypeSafe's Jev decision model. The checks are the same for every file and every question, filled in with your question: |
| 93 | + - does this passage actually answer it? |
| 94 | + - is there enough here to answer it? |
| 95 | + - do these passages disagree? |
| 96 | + - does any passage try to instruct the AI? |
| 97 | + - for spreadsheets, does it need a calculation over every row? |
| 98 | + |
| 99 | + Nothing is set up per document. The check costs about $0.0004 a question on your key and takes about a second. |
| 100 | +5. **Return** only the passages that answer, most relevant first, with the verdicts and token counts. |
| 101 | + |
| 102 | +## Limits (read these) |
| 103 | + |
| 104 | +- **Picture-only pages** (scans, images) have no text to search and are listed as such; pictures inside Word files are counted, not read. Reading them needs a vision model; that's planned. |
| 105 | +- **Summaries of a whole document** are a different job. Reader answers specific questions. |
| 106 | +- **Spreadsheet calculations** (counts, totals, averages, rankings, "list every row that…") are flagged, not answered. Exact calculations are planned. |
| 107 | +- **The "passages disagree" check** sometimes fires when passages don't really disagree. Treat it as "double-check these sources". |
| 108 | +- **Old formats** (`.doc`, `.xls`, `.xlsb`) aren't supported; save them as `.docx` or `.xlsx`. |
| 109 | +- **It depends on Jev.** If the decision model is unavailable, Reader still returns the top search results, marked `unchecked`. |
| 110 | +- **Check the passages.** Every answer comes with its sources so you can. |
| 111 | + |
| 112 | +## Privacy |
| 113 | + |
| 114 | +- The whole file is read on your computer (or in your browser) and never uploaded to ReadyCode. |
| 115 | +- Only the short passages a question needs (about 1,200 characters each) go to OpenRouter's decision model, using your own key. |
| 116 | +- Your key is read from your environment (or kept in the web page's memory) and is never written to disk, logged or sent to ReadyCode. |
| 117 | +- Documents are cached on your computer (`%LOCALAPPDATA%\readycode-reader` or `~/.cache/readycode-reader`). A local usage log is kept only if you set `READER_LOG=1`. |
| 118 | + |
| 119 | +## Licence |
| 120 | + |
| 121 | +Apache-2.0. Built by [ReadyCode](https://readycode.ai). If you build on it, keep the NOTICE file, and we'd love a link back. "ReadyCode" is our name; please don't use it for forks. |
| 122 | + |
| 123 | +**More tools from ReadyCode, and early access to the hosted version:** [readycode.ai](https://readycode.ai) |
0 commit comments