feat: cross-document synthesis — query across all notebooks#6
Merged
Conversation
The killer feature. Click "All" in the chat header to switch to cross-notebook mode. Questions are answered by synthesizing information from ALL your notebooks at once. Sources show which notebook each chunk came from. Backend: query_across_notebooks merges results from multiple ChromaDB collections, ranked by L2 distance. prepare_prompt_cross_notebook builds a prompt that identifies sources by notebook + document name and instructs the LLM to compare, contrast, and name disagreements. Frontend: "All/Single" toggle in chat header, notebook labels in source panel when in cross-notebook mode. Includes 6 unit tests for multi-collection query: merge, top_k, empty notebooks, single notebook fallback, distance sorting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cross-document synthesis: query across all notebooks at once. Co-Authored-By: Claude Opus 4.6 <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.
Summary
The killer feature. Researchers can now ask questions that synthesize information across ALL their notebooks at once.
Cross-Document Synthesis
Backend
query_across_notebooksinvector_store.py: queries multiple ChromaDB collections, merges results, re-ranks by distance, returns top_kprepare_prompt_cross_notebookinrag.py: builds a prompt that groups excerpts by notebook + document and instructs the LLM to synthesize across all sourcesstream_replyinchat.py: routes to cross-notebook RAG whennotebook_idslist has 2+ entriesFrontend
crossNotebookModein Zustand store with "All/Single" toggle in chat headeruseChat.tssendsnotebook_ids(all notebook IDs) instead ofnotebook_idwhen in cross modeSourcePanel.tsxshows notebook name labels in sage uppercase text when cross-mode is activeTest Coverage
6 new tests for multi-collection query: merge results, top_k limit, empty notebooks skipped, single notebook fallback, all-empty returns empty, results sorted by distance.
Tests: 7 → 8 files (+1 new). 28 passed, 1 skipped.
Pre-Landing Review
No issues found. Backend changes follow existing RAG patterns. No new auth surface (single-user desktop app).
Test plan
🤖 Generated with Claude Code