Page-Memory Pipeline PR4: Per-Page Parsing Modules, Excel Table Pathing, and Evidence Renderer Optimization
Summary
When processing large PDF documents, the current chunk-based parsing pipeline produces text-only chunks that lose the visual layout and page-level context of the original document. Users who need to retrieve specific pages — such as financial tables, engineering drawings, or compliance certificates — cannot navigate back to the exact source page, making verification difficult.
Additionally, Excel workbooks with multiple subtables on a single sheet are flattened into a single table asset with no hierarchical path, making it hard to distinguish which subtable a retrieval result refers to. And when large HTML tables appear in agentic retrieval evidence, they consume the entire token budget, crowding out other relevant evidence.
What This Issue Covers
1. Page-Memory Per-Page Parsing Modules (PR4)
A complete per-page parsing pipeline (C1–C7) that converts each PDF page into an individually addressable chunk:
- C1 page_renderer: Renders page images and extracts raw text per page
- C2 page_plan: Derives processing strategy per page based on document profile labels
- C3 page_tagger: VLM-based page summarization with budget-aware tagging
- C4 skeleton_extractor: Extracts section skeleton from document anatomy for heading-to-page mapping
- C6 page_section_mapper: Maps each page to its hierarchical section path
- C7 DataFrame assembly: Produces the standard parser DataFrame with page-type chunks
This pipeline is gated behind RETRIEVAL_PAGE_MEMORY_ENABLED=false (default) and documents.parse_track='chunk' (default), ensuring zero impact on existing production parsing.
2. Document Agent: Page Locate Stage and Lazy Loading
- New
page_locatebudget stage envelope (default min=0, cap=0 — inactive in production) hierarchy_locatorandpage_locate_agent/subagentmodules for residual heading resolutionProfileAgentconverted to lazy import to avoid pulling heavy dependencies at module load time
3. Excel Table Parsing Enhancement
- Hierarchical pathing for Excel tables (
filename/sheet_name/subtable_title) - Subtable metadata propagation (sheet_name, subtable_index, subtable_count, subtable_title)
- Table content now stores prettified HTML directly instead of a reference string
doc_nav.jsonfallback: when a document has only table chunks and no text chunks, tables now participate in the section tree
4. Agentic Evidence Renderer: Large Table Optimization
- Tables exceeding a configurable character limit (
RETRIEVAL_AGENTIC_INLINE_TABLE_CHAR_LIMIT, default 10,000 chars) are replaced with a compact summary (asset URL, path, summary, keywords) instead of being inlined in full - Prevents large tables from consuming the entire evidence token budget
- Table chunk rendering now includes asset URL and file path references
Acceptance Criteria
- [ ]
make checkpasses (lint + typecheck: 0 errors) - [ ] Default
parse_track=chunkbehavior is unchanged — no regression in PDF/DOCX/Excel parsing - [ ]
RETRIEVAL_PAGE_MEMORY_ENABLED=falseblocks all page_memory API requests with 400 - [ ] Excel tables have hierarchical paths in chunks.json and doc_nav.json
- [ ] Evidence renderer truncates tables above the configured character limit