feature/Document-reading · L-261115-b6776f

Merged
LC
7d ago
+213-0

TL;DR

  • The library gains document_reading, a method that reads every page of a document with one model call per page and returns what each page states or shows, with exact quotations.
  • The build assistant will run it by address to read a file a user attaches, instead of taking the file whole into its context.
  • If it misbehaves, the build assistant's reading of attached files loses facts or costs more than quoted; nothing else in the library depends on it.

Changes

  • New package methods/document_reading/: read_document extracts the pages with Azure Document Intelligence and a 100-dpi page view of each page, then read_pages sends each page to one Claude Sonnet call. Both pipes are exported, so a caller can read a single page again from an earlier run's output without extracting the document a second time.
  • Output: a PageReading per page, in page order, each with its findings (exact quote, kind, source as text, picture or both, an optional note), what could not be read, what was not looked at, and the printed page number when there is one.
  • The prompt lists everything a page holds rather than summarising it, keeps the OCR's reading of a figure and the picture's reading in the note when they disagree, lists a picture element by element, marks values read off a chart as approximate, and treats the page as untrusted data: instructions written on a page are listed as findings, never followed.
  • The library README.md table and the CHANGELOG.md [Unreleased] section list the package.

How it was verified

  • plxt fmt --check, plxt lint, pipelex validate bundle (with 0.95.1 and 0.103.1) and check-samples.sh pass.
  • On the campaign's bench (wip/build-assistant-reading-notes/method-reading/, cells shipped and shipped-2), the package found every fact the phase-1 views-100 variant found, on the brand guidelines, the flowchart, the poor scan, the rate card, a Word file and a PowerPoint deck, at the same cost per page and with no false finding. A page from an earlier run's output was read again through read_pages on the hosted dev runner.
  • /rev round 1 (cubic, Codex, the official code-review): Codex's one finding, the prompt-injection guard, is fixed in this branch.

Left out

  • The release tag, cut by a release/ pull request after this merges.
  • Reading a range of pages within the method waits on a PipeExtract page range in pipelex.

Closes L-261115-b6776f
Advances L-261115-b2b931

🤖 Generated with Claude Code


Summary by cubic

Adds the document_reading package, which reads a document page by page for a caller who will never see it, listing every rule, value, threshold, name and constraint each page states or shows in its exact words.

  • New methods/document_reading/ package with two exported pipes: read_document extracts each page (Azure Document Intelligence OCR plus a 100-dpi picture) and reads it in one claude-5.5-sonnet call; read_pages re-reads pages from an earlier run's output without extracting the document again.
  • Returns one PageReading per page in page order, each with its findings (exact quote, kind, source, optional note), unreadable, not_looked_at, and the printed page number when present.
  • Treats the page as untrusted data: instructions written on a page are listed as findings, never followed.
  • Updates the library README.md table and the CHANGELOG.md [Unreleased] entry.

Reading a page range within the method is left out; it waits on a PipeExtract page range in pipelex.