run_id:        2026-11-27-evidilo-pdf-statement-copy
product:       evidilo
tier:          standard
written_at:    2026-11-27T02:05:00Z (Mac clock Asia/Tokyo 11:05)

Working data lives in `~/Repositories/.in-progress/evidilo-study/work/` (WORK below), not in
`runs/<id>/data/`: a hook refuses copying files into the skills folder (previous run, P-01).

## 1. Question

When the transaction table of a PDF bank statement is copied out by a free route (the text a PDF
viewer copies in Preview, Chrome or Firefox, `pdftotext`, Tabula, pdfplumber, or OCR of the page),
how many of its transactions arrive whole, with the right amount and sign, after the route and
after pasting into Google Sheets; which errors are silent; and which of them does a running-balance
check catch, by route and by statement layout?

## 2. Method

(Rewritten before the freeze to fold in the adversary's objections A-01 to C-11 and H RESEARCH's five
points; what changed against the first draft is listed per objection in §7.)

WORK = `~/Repositories/.in-progress/evidilo-study/work`. Every tool named below is a file in
`WORK/tools/` whose SHA-256 is recorded in `WORK/data/tools.json` at the freeze.

### Arm S — synthetic statements, made for this test and labelled as such

`tools/gen.py` (Python standard library, plus pdfminer's Helvetica widths and PIL for the scan) writes a
statement PDF and its `truth.json` per id `<L>-<P>-s<seed>`. Everything printed is fictional: the page
says "SYNTHETIC TEST STATEMENT - NOT A REAL ACCOUNT", the bank is "Sample Community Bank (fictional)",
the account is `XXXX-0000`, payees are generic words (CORNER MARKET, UTILITY POWER CO, ACME SUPPLY
INC), with a store number, a city and state, a check number or a reference, and for card purchases a
`MM/DD` date inside the description. Amounts are unique within a statement (A-02). Seeds 1 to 3 are
dated 2026, seeds 4 and 5 are dated 2025, so a spreadsheet that gives a yearless date the current year
is visible (A-15).

Six layouts (L), US conventions only (`MM/DD`, comma thousands, period decimals):
- L1 one signed amount column (`-1,234.56` for a debit) and a balance column.
- L2 separate Withdrawals and Deposits columns and a balance column, amounts without sign.
- L3 two sections, "Deposits and additions" then "Withdrawals and subtractions", unsigned amounts, no
  balance column.
- L4 one amount column with a trailing minus for a debit (`45.20-`) and ` CR` after a credit, and a
  balance column.
- L5 as L1, with descriptions of up to 80 characters wrapped over two or three lines at 30 characters
  and the date printed only on the first row of each day.
- L6 as L1, 55 to 75 rows over three pages of at most 26 rows, the column header repeated and a
  "Balance forward" line at the top of pages two and three.
Rows per statement: 20 to 45 (L6: 55 to 75). One page except L6.

Four producers (P) of the same page, because a copy route sees the text objects inside the file, not
the page (A-01, B-02):
- P1 the page as absolutely positioned HTML printed by headless Google Chrome (`--print-to-pdf`), Skia.
- P2 `tools/pdfwrite.py`, base-14 Helvetica, every word its own text object, written row by row.
- P3 the same words at the same coordinates, written column by column (all dates, then all
  descriptions, then all amounts, then all balances).
- P4 the same text with every character its own text object, written row by row.
The generator refuses to write a statement unless P2 and P3 render identical pixels at 100 dpi and P2
and P4 differ in at most 0.05 % of pixels (anti-aliasing from sub-point glyph positions). P1 is not
pixel-identical to P2 (Chrome's own Helvetica and rounding); the pixel difference between P1 and P2 is
measured and reported (B-01). The stream order of every file is measured, not assumed: the share of
adjacent text objects in the content stream that are also adjacent in reading order (B-02).

Plus SCAN: for seed 1 of every layout, the P1 page rendered at 200 dpi in grey, rotated one degree,
saved as JPEG quality 60 and wrapped in an image-only PDF (A-07). Only OCR can read it; for every other
route a SCAN statement is recorded as `no_text_layer`, a property of the file, not a route failure
(A-08), and is reported apart from the text-layer results.

Corpus: 6 × 4 × 5 = 120 text-layer statements plus 6 scans = 126; 4,468 transactions in the
text-layer set and 205 in the scans (counted from the truth files at the freeze). `WORK/data/corpus.json` lists every PDF and
truth file with SHA-256 and is never edited after the freeze. The generator's check: for P2, P3 and P4
the content stream is decoded directly (zlib) and every truth amount string must be recoverable from it
in order; for P1 the same through pdfminer's character list; a failure stops the run (§5).

### Arm R — sample statements made by others

Found by the fixed search of source child S-1 (`WORK/arm-r/frame-R.csv`, 25 candidates, 11 kept). None
of the kept files comes from a bank: the 20 largest US banks publish no sample statement PDF with a
transaction table (their guides are HTML or brochures, recorded in the frame). The kept files are
sample and benchmark statements published by vendors and open-source projects, made with other PDF
producers (PDFKit for Node, ReportLab, Skia, react-pdf, PDF Sevak). Two kept files print amounts with a
decimal comma (R22, R24) and are outside the US-format scope. Three (R13, R14, R15, one project) print
their balance column past the right edge of the page, so the page shows cut-off numbers and no reader
can see the truth; they are excluded. That leaves six: R10, R11 (its first two pages of twelve, cut with
pypdfium2 `import_pages`, content streams unchanged), R19, R20, R21, R23, from four publishers, 160
transactions, with their producer metadata recorded (C-09). They are not
redistributed; the dataset carries URL, SHA-256, Wayback status and the derived rows.

Truth for Arm R: two transcriber children (T-A, T-B) read only 150-dpi page images and are forbidden
every text-extraction tool; they write every transaction row with its printed date, description lines,
amount exactly as printed, its column and balance. `tools/compare_truth.py` lists every field where they
differ (account labels excluded, they are free text); an adjudicator child (T-C), shown only the
differing fields and the page images, decides each under a written rule for description lines; the
number of differences before adjudication is published (B-12). The sign of an Arm R amount is the
statement's own: a debit-column amount is negative, a single-column amount carries the sign it prints.
Arm R is scored by the same scorer; it is not in the spreadsheet step. The final truth must tie out where
the statement prints opening and closing balances for one account. The truth files' SHA-256 go into
`corpus.json` before any route runs on Arm R.

### Routes (R), each with its default settings, nothing tuned per statement

- `pdfkit` — Apple PDFKit `selectionForEntireDocument.string` (the engine of Preview and Safari; Preview
  itself cannot be driven here, accessibility scripting is off), `tools/pdfkit_text.swift`.
- `pdfium` — PDFium through pypdfium2 5.6.0 (PDFium 147.0.7713.0), `get_text_range()` per page (the
  engine of Chrome's viewer).
- `pdfjs` — pdf.js 6.5.438 `getTextContent`, items in order with a line break at `hasEOL`;
  `pdfjs-pos` — the same items with a line break where the baseline moves (B-03).
- `pdftotext` and `pdftotext-layout` — Poppler 26.03.0, no options and `-layout`.
- `tabula` — tabula-java 1.0.5 `--stream --pages all` (stream mode, for tables without ruling lines);
  `tabula-guess` — `--guess --pages all` (its automatic table detection).
- `pdfplumber` — pdfplumber 0.11.8 `extract_tables()` defaults (ruling lines); `pdfplumber-text` — the
  same with both strategies set to `text`.
- `ocr` — Tesseract 5.5.3 on each page rendered at 300 dpi in grey by `pdftoppm`, `--psm 3`.
Timeout 120 s per route and statement, 600 s for `ocr`. A crash is recorded per statement with its
error, and its transactions count as `missing` in a separate tally so a file property is never read as
a route failure.

Not tested, with the reason recorded in the article: Adobe Acrobat Reader (its installer is a pkg that
needs an administrator password this session does not have), Microsoft Excel and its Power Query PDF
import (not on this Mac; Power Query's PDF connector is Windows-only), Apple Numbers paste (needs
accessibility scripting, which is off).

### Scoring a route output, per transaction (`tools/score.py`)

The output is read as lines (text routes) or rows (table routes, cells joined by a space for the line
test, cells kept for the column test). Every truth transaction gets exactly one class:
- `whole` — one line holds the printed date (if the row prints one), the whole description
  (whitespace-normalised, all wrapped lines joined) and the amount, in that order, with the right sign.
- `split` — the sign is right and every part is present in the output (each description line as often as
  the truth needs it), but not on one line in that order.
- `damaged` — the sign is wrong (`sign lost`: a debit read as positive; `sign reversed`), or the
  description is cut (`description cut`), or the amount's digits are altered (a line holding the
  description carries a money value that is no amount, balance, opening or closing of the statement).
- `missing` — none of the above can be found.
The sign of a money value: a leading or trailing minus is a debit, `CR` a credit; else the column it
sits in when the output keeps the Withdrawals/Deposits columns (table cells, or `-layout` text with a
column gap of two or more spaces aligned to the heading); else the section heading above it (a line
that starts with Deposits/Withdrawals/Credits/Debits and holds no money value); else positive, as a
spreadsheet reads an unsigned number.

The mechanical reader (the same file): every line that holds a money value and is not statement
furniture (beginning/ending balance, balance forward, statement period, page) is a row; the date is the
one at the start of the line or carried from the row above; with two or more money values the
second-last is the amount and the last the balance, with one it is the amount; sign as above. Rows are
matched to transactions by the description's first line, then equal amount, then order. A matched row
whose amount differs from the truth is a **silent amount error**. A transaction classed
`damaged/description cut` is a **silent description error** (C-03). Per statement: opening plus the sum
of all reader rows equals the printed closing (`ties_out`), the first row whose printed balance
disagrees with the previous balance plus its amount, the reader rows that match nothing, the share of
adjacent matched transactions that come out in truth order (A-13), and the damaged share weighted by
absolute amount (C-07).

Falsification, run before the freeze and passing (`tools/falsify_scorer.py`): a planted perfect copy of
each of the 30 P2 statements scores 100 % `whole`, ties out, no silent error; on one statement per
layout one changed digit, one removed sign, one deleted row and one cut description each move exactly
the expected count; a wrapped L5 copy with a stray "ACH DEBIT NOTICE" line costs wholeness but no sign.
Each test was shown to fail with its mechanism removed.

### The spreadsheet step (`tools/sheets.py`, `tools/score_sheets.py`)

Google Sheets in headless Chrome under the owner's Google account, one scratch spreadsheet (deleted at the
end), locale United States, time zone Bangkok. For 48 statements (seeds 1 and 4 of every layout and
producer) and five routes (`pdfkit`, `pdfium`, `pdfjs`, `pdftotext-layout`, `tabula`): the sheet is
cleared of values and formats, the route output is pasted at A1 as `text/plain` through a paste event
(the clipboard flavour the viewers put there, A-14), the sheet is exported as xlsx (`raw`); then
Data > Split text to columns with the separator detected automatically (`auto`); then the separator set
to Space (`space`, the first fix a person tries). Per transaction and state: the amount is a number with
the right value and sign or column (`number`), a number with the wrong sign, text only, or absent; the
description sits whole in one cell; the date cell has the right day and month and which year. Per sheet:
numbers that are no amount, balance, opening or closing of the statement (**wrong numbers**: a split
value such as `578.58` out of `22,578.58`). Positive control (B-05): for one statement per layout a
tab-separated copy of the truth with full dates goes through the same pipeline and must come back with
every amount a number, every description in one cell, every date right.

### Real-viewer check (`tools/device.py`)

For one seed per layout and producer (24 statements): Chrome's own PDF viewer in headless Chrome 153,
and the pdf.js 6.5.438 viewer app in the same browser, each scrolled to the last page, select all,
copy, clipboard read; the last transaction's amount must be in the clipboard (A-09). Each is compared
with the `pdfium` and `pdfjs` route outputs after whitespace normalisation, and the engine versions are
recorded on both sides (A-10). Firefox itself was not driven (Playwright's Firefox did not launch in the
last run); the pdf.js viewer running in Chrome stands for it, and the article says so.

### Statistics

Rates per route and layout are computed per statement and summarised over statements; intervals are
cluster bootstraps over statements, 10,000 resamples (B-11). Below twenty statements in a cell: counts,
not percentages without counts.

### Repetitions and replication

Routes are deterministic; a re-execution child (R-A) regenerates the corpus from the generator, reruns
every route and scorer from this text, and must reproduce every output SHA-256 and every count; this is
reported as determinism, not as validation (C-10). The validation is an independent derivation child
(D-1) that writes its own scorer from §1 and §2's definitions without seeing `score.py`, scores the same
outputs, and reports every disagreement (C-06, B-07). The orchestrator reads 100 silent-error lines
by eye against the page and reports how many are real (B-07).

### Output

`WORK/data/outputs/<route>/<id>.txt|csv`, `WORK/data/runs.jsonl`, `WORK/data/measurements.jsonl` (one
row per route × statement × transaction), `WORK/data/statements.jsonl`, `WORK/data/sheets/*.xlsx`,
`WORK/data/sheets_tx.jsonl`, `WORK/data/sheets_st.jsonl`, `WORK/data/device/`, `WORK/data/tools.json`,
`WORK/data/corpus.json`. Nothing is discarded.


## 3. Expectation

- Layout decides more than the viewer does: on L1 and L4 from P1, the three viewer engines keep at
  least 90 % of transactions `whole`; on L2 they lose the sign of most amounts (no minus is printed,
  the column is gone), and on L5 most wrapped transactions are `split`.
- P3 (column order) leaves pdf.js and `pdftotext` (raw) with under 10 % `whole`, while PDFKit, PDFium
  and `pdftotext -layout` order by position and stay within 10 points of P2.
- Table routes (`tabula`, `pdfplumber`) keep L2 signs and lose wrapped descriptions as extra rows.
- OCR has the most `damaged` amounts.
- In Sheets, every text route lands in one column before splitting; after automatic splitting no text
  route keeps the description in one cell for most transactions; `MM/DD` becomes a date in the
  current year.
- At least one route makes silent amount errors, and the tie-out check catches at least 90 % of the
  statements carrying one.

## 4. Falsifier

- Any viewer engine with under 90 % `whole` on L1 P1, or at least 50 % `whole` with a recoverable sign
  on L2, refutes the first bullet.
- pdf.js at 10 % or more `whole` on P3, or PDFKit or PDFium more than 10 points below P2, refutes the
  second.
- `tabula` or `pdfplumber` below the viewer engines on L2 sign recovery refutes the third.
- Another route with more `damaged` amounts than `ocr` refutes the fourth.
- A text route whose Sheets paste spreads over several columns before splitting, or a majority of
  descriptions in one cell after splitting, refutes the fifth.
- Zero silent amount errors across all routes, or tie-out catching under 90 % of statements with one,
  refutes the sixth.

## 5. Abandonment condition

- The generator's statements do not survive the generator's own check (each PDF's text, read by a
  route-independent method — the content stream decoded directly — must contain every truth amount
  string): stop as `METHOD_BROKEN`.
- The scorer fails its falsification (`tools/falsify_scorer.py`, §2): stop as `METHOD_BROKEN` until
  fixed.
- More than three of the eight routes cannot run on this machine: `NOT_MEASURABLE`.
- Arm R with fewer than three usable statements: the arm is reported as too small, the run continues
  on Arm S and the article says the synthetic statements were not checked against real ones.

## 6. Estimate

- **What the run needs from the owner:** nothing. All inputs are made here or downloaded from public
  pages. Tools: tabula-java 1.0.5 (a jar from GitHub) with a portable Temurin 21 Java runtime, and
  `pdfjs-dist` 6.5.438 (npm) with its viewer release, go into WORK only, not into the system; Google Sheets runs in his headless `google` browser profile, in one scratch
  spreadsheet named `evidilo-study-scratch (synthetic data)` that is deleted at the end.
- Machine time: about 2 hours of route runs, 1 hour of Sheets, plus children.
- Money: 0 USD for data and tools; children on DeepSeek.
- Claims expected in the ledger: type M (shares per route and layout, silent errors, tie-out), type S
  (what each viewer's engine is, from vendor documentation; what Sheets' split does, from Google's
  help page), type `design` (the protocol values).

## 7. Adversary dispositions

A1 (`ADVERSARY.md`, deepseek-v4-flash, 39 objections): 34 changed the method (5 of them partly, the
rest of those accepted as a limitation), 3 accepted as stated limitations, 2 rejected.

- A-01 changed: producer P4 places every character separately; P1 (Chrome) writes its own runs.
  Tight-column fusion is not forced; accepted as a limitation beyond what P4 and Arm R show.
- A-02 changed: amounts unique per statement; `missing` requires no stray value beside the description;
  falsifier deletes a row among repeated descriptions.
- A-03 changed: the reader skips statement furniture; the planted copy with header, account and balance
  lines must tie out with zero silent errors (it does).
- A-04 rejected: a money value needs two decimals, so store numbers and references are never read as
  amounts; descriptions now carry check numbers, references and `MM/DD` dates to exercise it.
- A-05 accepted as limitation: US formats only. Evidilo's readers import into QuickBooks and Xero from
  US statements; the article states the scope. Decimal-comma statements in Arm R are excluded by rule.
- A-06 changed: description grammar with store numbers, city and state, references, dates, up to 80
  characters in L5.
- A-07 changed: SCAN arm (image-only, 200 dpi, JPEG 60, one degree).
- A-08 changed: `no_text_layer` recorded as a file property; encrypted files out of scope (an existing
  Evidilo article covers them).
- A-09 changed: the viewer check scrolls to the last page and requires the last amount in the clipboard.
- A-10 changed: engine versions recorded on both sides of the viewer check.
- A-11 partly changed: OCR timeout 600 s, errors per statement tallied apart; long statements accepted as
  a limitation (L6 is three pages).
- A-12 partly changed: every table's rows are read and unmatched rows counted; two-account statements
  out of scope for Arm S (an existing article covers them), present in Arm R (R23).
- A-13 changed: order share and unmatched rows reported.
- A-14 changed: plain-text paste only, form feeds removed before scoring, positive TSV control.
- A-15 changed: seeds 4 and 5 dated 2025; one date rule (day and month decide, year reported apart).
  The en-US locale only; another locale accepted as a limitation.
- B-01 changed: P1-P2 pixel difference measured (12 % to 22 % of pixels at 100 dpi), so P1 is compared
  as a different page, P2/P3/P4 as the same page.
- B-02 changed: stream adjacency measured per file (P2 and P4 1.0, P3 0.50 to 0.69, P1 0.92 to 0.95).
- B-03 changed: `pdfjs-pos` beside `pdfjs`; the viewer check decides which matches the viewer.
- B-04 changed with A-10.
- B-05 changed with A-14.
- B-06 changed with A-07.
- B-07 changed: independent derivation scorer (D-1) and 100 silent-error lines read by eye.
- B-08 changed with A-03.
- B-09 changed: `whole + split` (all parts present) reported beside `whole`.
- B-10 changed: Arm R composition reported; no bank publishes a usable sample, the article says so.
- B-11 changed: per-statement rates and cluster bootstrap.
- B-12 changed: disagreement count published, adjudication by a child, truth frozen before routes.
- B-13 changed with A-06.
- C-01 accepted as limitation: text-layer statements of these shapes, plus the scan arm; stated first.
- C-02 rejected: the readers are US bookkeepers (Evidilo's market); the scope sentence covers it.
- C-03 changed: silent description errors counted.
- C-04 changed: "would be caught by a balance check" wording, and the spreadsheet step reports whether
  the balance column survives as numbers.
- C-05 partly changed: the Space split stands for the first fix; a timed retyping baseline accepted as a
  limitation.
- C-06 changed: independent derivation (D-1).
- C-07 changed: amount-weighted damaged share and statements whose taken total is off.
- C-08 accepted as limitation: combinations come only from Arm R.
- C-09 changed: Arm R producer metadata recorded.
- C-10 changed: re-execution reported as determinism; validation is D-1.
- C-11 changed: the article shows the literal pasted rows of one statement per route.

H RESEARCH's five points (27 Nov 2026): Arm R added (1); the spreadsheet step added, Google Sheets
measured, Numbers and Excel recorded as not drivable or absent (2); Acrobat Reader recorded as not
installable without an administrator password (3); the page break is one layout property and the
article links statement-table-across-pages rather than re-measuring it (4); Evidilo appears only in its
own "What is Evidilo?" section (5).

## 8. Amendments

- AM-0, 2026-11-27T03:10Z, post_hoc: partly. Before the freeze, sizing probes ran: every route on 5
  statements of an earlier corpus draft, one Sheets paste and split, one viewer copy. The orchestrator
  saw their counts (for example `pdfplumber` defaults return no table, Chrome's viewer copy equals the
  PDFium text after whitespace normalisation, Sheets' automatic split cut `22,578.58` at the comma).
  The expectations in §3 were written before these probes and are unchanged; expectations for the routes,
  producers and arms added afterwards (P4, SCAN, Arm R, `pdfjs-pos`, `tabula-guess`, `pdfplumber-text`,
  the Sheets states) are `not-predicted`, so any claim about them is exploratory.
- AM-1, 2026-11-27T03:40Z, post_hoc: false (no route had run on Arm R; Arm S scoring unaffected). After the
  freeze, `score.py` was changed so that a statement printing no opening or closing balance scores with
  `ties_out = null` instead of failing, and a running balance is compared by absolute value (an Arm R card
  statement prints its balance unsigned). `tools.json` holds the hash taken before this change; R-A found the
  difference and every Arm S count it reproduced is identical. `make_jobs.py`, `compare_truth.py`,
  `build_truth_r.py`, `aggregate.py` and `compare_device.py` were written after the freeze to carry out §2 as
  written; they change no definition.
- AM-2, 2026-11-27T03:40Z, post_hoc: false. The R11 cut file's producer is recorded as PDF Sevak (pages 1 and
  2 re-saved by PDFium); the exclusion of R13 to R15 is in §2 and predates the freeze.
- AM-3, 2026-11-27T05:15Z, post_hoc: partly (the orchestrator had seen the first set's aggregate counts; no
  claim was written from them). The first Sheets run (M-C) did not clear the sheet between jobs: its clear
  clicked the column header, so Delete emptied column A only and the cells a previous split had written further
  right stayed. 228 of 238 tab-free raw sheets carried such cells, and an amount left over from an earlier
  statement could score as present. That set is kept as `data/sheets-v1-contaminated/` and is not used.
  `sheets.py` now clears with the whole sheet selected, exports the sheet as CSV and refuses to paste until it is
  empty, and refuses a paste that left it empty; `tools/sheets_clean_check.py` (it fails on the first set with
  19,407 stray-cell rows) must pass on every workbook before scoring. All 246 jobs ran again with the method of §2
  otherwise unchanged. The orchestrator ran the second set itself (the script, unchanged arguments), not a child.
- AM-4, 2026-11-27T07:10Z, post_hoc: yes (found while reading the second set's scores). In the second set the
  split step selected column A with Control+Space, which left one cell selected, and Split text to columns then
  stopped at the first blank row. Only pdftotext -layout output has a blank line (after the heading), so its
  auto and space sheets split the four heading lines and no transaction; the other routes' text has no blank
  line before its end and split whole. `sheets.py` now selects `A:A` through the name box, and
  `sheets_clean_check.py` also fails any space-split cell that still holds a space. The 48 pdftotext -layout jobs
  ran again; the old ones are kept in `data/sheets-v2-pdftotext-unsplit/`.
