Conversation
The cited-summary step compared model quotes against chunk text with an exact substring match (`quote not in chunk.text`). PDF extraction keeps the source's hard-wrap newlines inside a chunk, so a word pair split across a printed line stays broken by a newline, while a faithful model quote renders that break as an ordinary space. Every such quote failed the check, so the semantic build raised a citation error for any real paper regardless of model — the same failure the `PaperFlow` docstring recorded for the 2026-07-24 run. Add `quote_matches_chunk_text` in the knowledge layer as the single rule for "the quote is present in its chunk": it compares under collapsed whitespace, so a quote that only differs by whitespace runs counts as verbatim while quotes whose words or order differ are still rejected. Route all three checks through it — the research-draft validation in `flows/_paper_summary`, `PaperGlobalSummary.from_draft`, and the `PaperSemanticResult` reload validator — so build-time and reload-time agree. Verified end to end against arXiv 1706.03762v7: build -> put_paper -> summary search now completes and returns a cited global summary. Verification: bash scripts/verify.sh (ruff format/check, basedpyright, lint-imports, pytest --cov) — 491 passed, 86% coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
The cited-summary step compared model quotes against chunk text with an exact substring match (
quote not in chunk.text). PDF extraction keeps the source's hard-wrap newlines inside a chunk, so a word pair split across a printed line stays broken by a newline, while a faithful model quote renders that break as an ordinary space. Every such quote failed the check, so the semanticPaperFlow(PaperSemanticCfg(...)).build(...)raised a citation error for any real paper regardless of model — the same failure thePaperFlowdocstring recorded for the 2026-07-24 run.This adds
quote_matches_chunk_textin the knowledge layer as the single rule for "the quote is present in its chunk": it compares under collapsed whitespace, so a quote that differs only by whitespace runs counts as verbatim while quotes whose words or order differ are still rejected. All three checks now route through it:flows/_paper_summary._validate_research_draft(research-draft validation)PaperGlobalSummary.from_draft(citation resolution)PaperSemanticResultreload validatorso build-time and reload-time agree.
Verified end to end against arXiv
1706.03762v7:build→LocalKnowledgeLibrary.put_paper→ summary search now completes and returns a cited global summary.Verification performed
bash scripts/verify.sh— ruff format/check, basedpyright, lint-imports, pytest --cov: 491 passed, 86% coverage.tests/knowledge/test_paper.py) and the flows research validation (tests/flows/test_paper.py).🤖 Generated with Claude Code