Matrix for Claude Code
A third of the time. Half the tokens.
That is what this free plugin saved Claude Code on 442 pages of EU regulations: on average 42 instead of 126 seconds per question, 303k instead of 651k input tokens. The answers stayed the same.
The plugin gives Claude Code a local index of your PDFs, Word files, scans and charts, with file, page and passage for every answer. Claude Code is the language model, so you need no extra model and no API key.
Get it on GitHubThe problem
Without an index, every question starts from zero.
Claude Code converts the PDFs to text, greps, opens pages, greps again. That works. On a few hundred pages it takes 20 or more tool calls per question.
Matrix reads the documents once. It splits them by their structure, indexes them and gives Claude Code short hits instead of whole pages.
What it does
Ask your documents. Get the page.
Answers with sources
Every answer names file, page and passage. The citations are checked against the original text.
Tables across documents
One question for every document or passage, returned as a table with a source in each cell.
Other words, other language
Search works on meaning. An English question finds the German provision.
Scans and charts
Scanned pages are searchable. A value that exists only in a chart is found on its page.
Cross-references
"Pursuant to Article 26" leads to Article 26. Claude can read the whole article, not just a snippet.
Stays current
New and changed files in the folder are indexed again on their own. Deleted files are left out of the search.
The measurement
Two test sets. Everything public.
Claude Code alone against Claude Code with the plugin, on public EU regulations and reports. Same questions, same prompt. The right answers were written down before the first run.
| Question (442 pages) | Alone | With Matrix |
|---|---|---|
| English question, German legal text | 86 s · 381k tokens | 26 s · 187k tokens |
| A number that exists only in a chart | 109 s · 585k tokens | 51 s · 407k tokens |
| One answer spread over three regulations | 245 s · 1,279k tokens | 62 s · 428k tokens |
| Paraphrased question, single regulation | 64 s · 357k tokens | 27 s · 191k tokens |
Averages per run, Claude Code with Sonnet, October 2026. Questions, right answers and the script to rerun it are in DEMO.md.
The limits
It saves effort. It doesn't make Claude smarter.
Claude Code alone answered every question correctly too.
More documents, more gain
The gain is largest when the question uses other words or another language than the text. For one short document it is small.
Spread-out questions gain less
On the larger set, a question across three acts saved almost nothing: Claude still searches once per act.
Indexing costs minutes
Once per folder: 16 minutes for 1,592 pages, no Claude tokens. Worth it if you ask more than once.
Page numbers slipped
In the measured version, two citations were one page off where a passage crosses a page break. File, article and passage were right in every answer.
One miss, then fixed
One answer was wrong because a chart label was too small to read. After a fix in the skill, 4 of 4 were right.
Small samples
Two runs per question in the first test, one in the second. Run-to-run differences of 10–20 % are normal.
How it works
Code finds the passages. Claude reads them.
Split along the real structure rules
By PDF layout, headings, articles and tables. No language model decides where a section ends. Scans and charts are indexed too.
Search by meaning and by keyword rules
Vectors from a multilingual embedding model plus full-text search, merged by rank. The vector database is built in, on SQLite: nothing to install, no server. An optional second model re-sorts the top hits.
Short hits rules
About 1,160 tokens per search instead of 5,500. Each hit is an excerpt with file, pages and the path document › chapter › article.
Read before citing AI
Claude Code opens the passage or the article it wants to quote. Then it answers with file, page and passage.
Check the citations rules
Each citation is checked against the original text.
Two lines
Install it, then just ask.
claude plugin marketplace add matthiasnordwig/matrix-mcp
claude plugin install matrix@matrix-mcpStart Claude Code in the folder with your documents and ask. The first time, it walks you through the setup. Needs a Mac with Apple silicon and Node.js 18 or later for now. The engine is portable Rust and also builds for Linux and Windows. Want it on your platform? Tell me.
Matrix reads the folder you started in and asks before touching any other. It never changes or deletes your files. The only text that leaves your Mac is what Claude Code reads anyway.
Where it comes from
It started as an app.
The plugin runs on the same Rust core as Matrix, my document app for Mac and iPhone. In the app a local model does the reading; here Claude Code does.
Get it on GitHubWrite to me