PolyLabs Research Contact
Programme · Corpus Lens

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

  1. 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.
  2. 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.
  3. Classify and date. Rules assign each document a type (an email, a court filing, an invoice) and find its dates.
  4. 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.
  5. 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 page

An 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:

The page (invented for this demonstration)

the gate says…
stored

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:

What has been checked, and what has not

synthetic and public data only
ClaimChecked byOutcome
The tests would notice if the gate's matching were broken5 deliberate breaks, among them storing the model's string instead of the page's5 of 5 caught the last fails twenty tests
The per-file sandbox is covered by its tests63 deliberate weakenings61 caught at once one made no difference; one was a real gap, now tested
The old Excel reader reads what another reader reads29 public workbooks from five open-source packages, cell by cell against python-calamine1,315 of 1,320 the five are error cells, which the other reader leaves empty
The Outlook message reader agrees with an established one13 messages from two open-source projects' public test data12 of 13 agree on the 13th, in Traditional Chinese, the other reader fails and this one reads it
Merging names keeps up at scale150,000 synthetic entitiesunder 5 s
A model can copy text verbatim well enough to drive the agenta fixed benchmark: success ≥ 0.90, fabricated quotes ≤ 0.01, scanned pages ≥ 0.75, backend errors ≤ 0.02not 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 investigationan answer key committed before the run; precision ≥ 0.8, recall ≥ 0.6not 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.