Reading a mountain of documents, where every finding must quote its page
Corpus Lens turns a large collection of documents (scanned PDFs, Word files, workbooks, emails and whole mailboxes) into something a person can search and browse by time, person, organisation and type. On top of it sits an investigation agent built around one rule: it may record a finding only with a quote that the server itself finds, character for character, on a real page.
- Started
- 22 August 2026
- Tests
- 1,950 passing, none skipped, and 37 for the interface
- Stage
- A single-user prototype that runs on one machine
- Source
- Private for now; the records quoted here are its own
From a pile of files to something you can question
- Ingest. PDFs and images, text, Word (.docx and .doc), Excel (.xlsx and .xls), CSV, email (.eml and Outlook .msg), zip archives of them, and Outlook mailboxes (.pst), each message of which becomes an email of its own. Duplicates are found by their SHA-256 hash.
- Extract. Text comes from each page's text layer, or by OCR where a page has none. Every file is read in a locked-down process of its own, with limits on its memory and time, so a hostile file can harm nothing else.
- Classify and date. Rules assign each document a type (an email, a court filing, an invoice) and find its dates.
- Name. People, organisations and places are tagged, and the same name written different ways is merged, in a way a person can review and undo.
- Explore. A timeline, an entity network, full-text search and a document viewer. Processing starts by itself and can be stopped; what has been read is kept, and it carries on from there.
The citation gate, in your browser
a sketch of the rule, on an invented pageAn agent that is asked to cite will sometimes invent a quote, or paraphrase one, or stitch two passages into a sentence that reads as damning and is not real. So the agent is never asked where a quote is. It supplies a page and the words; the server looks for them, and stores the page's own characters at the place it found them. The agent cannot put a single character into the record, only select a run of the page's. Try it:
This page's script follows the published rules: a quote must be at least 20 characters and occur exactly once on its page, and matching forgives only typography (Unicode forms, curly quotes, dashes and spacing), never case or punctuation. The project's own gate adds more: the names and numbers in a claim must appear in its quotes, a claim and its evidence are written together or not at all, and a withdrawn claim stays visible as withdrawn.
Rules the work is held to
The project's build plan opens with invariants that every later change must keep, and a list of rules for the coding agents that do much of the building:
- The six gate guarantees survive every change unchanged or stronger. The tests that pin them are themselves pinned by their SHA-256 hash, so they cannot be quietly edited, and the gate is never replaced by a stand-in in a test.
- The text of a page is never edited in place. Reading a page again makes a new lineage with new page ids, so every stored quote keeps pointing at the text it was found in.
- Logs never hold content: no document text, quotes, queries or names.
- The owner's documents never leave their machine, and no one's documents are used for benchmarks or training. Fixtures are synthetic and made by committed scripts.
- Gates are never edited to pass. No test is skipped or loosened to get a green run, and no threshold is lowered: the code is fixed instead.
What has been checked, and what has not
synthetic and public data only| Claim | Checked by | Outcome |
|---|---|---|
| The tests would notice if the gate's matching were broken | 5 deliberate breaks, among them storing the model's string instead of the page's | 5 of 5 caught the last fails twenty tests |
| The per-file sandbox is covered by its tests | 63 deliberate weakenings | 61 caught at once one made no difference; one was a real gap, now tested |
| The old Excel reader reads what another reader reads | 29 public workbooks from five open-source packages, cell by cell against python-calamine | 1,315 of 1,320 the five are error cells, which the other reader leaves empty |
| The Outlook message reader agrees with an established one | 13 messages from two open-source projects' public test data | 12 of 13 agree on the 13th, in Traditional Chinese, the other reader fails and this one reads it |
| Merging names keeps up at scale | 150,000 synthetic entities | under 5 s |
| A model can copy text verbatim well enough to drive the agent | a fixed benchmark: success ≥ 0.90, fabricated quotes ≤ 0.01, scanned pages ≥ 0.75, backend errors ≤ 0.02 | not yet run no model has been benchmarked; the thresholds are fixed in advance and are never edited |
| The agent finds what a person would, on a real investigation | an answer key committed before the run; precision ≥ 0.8, recall ≥ 0.6 | not yet run registered in the plan |
Where it stands
The pipeline, the readers and the integrity gate are built and tested, and the agent's turn loop runs. What has not happened yet is the measurement that decides whether a model may drive it: the verbatim-copying benchmark comes first, because a model that cannot reproduce text it has just read cannot drive this system at all, however fluent it sounds. A phased build plan takes the project from here toward unattended investigations, and its first phase, the foundations, is under way.
Corpus Lens can also read a slice of OpenAlex, the open catalogue of about 510 million scholarly works, as a corpus, and draw a topic map of a whole field, with communities found by clustering rather than taken from the catalogue's own labels.