Skip to content

feat: cross-document synthesis — query across all notebooks#6

Merged
vikranthreddimasu merged 2 commits into
mainfrom
feat/cross-doc-synthesis
Apr 16, 2026
Merged

feat: cross-document synthesis — query across all notebooks#6
vikranthreddimasu merged 2 commits into
mainfrom
feat/cross-doc-synthesis

Conversation

@vikranthreddimasu

Copy link
Copy Markdown
Owner

Summary

The killer feature. Researchers can now ask questions that synthesize information across ALL their notebooks at once.

Cross-Document Synthesis

  • Click "All" in the chat header to switch to cross-notebook mode
  • Questions retrieve and rank results from every notebook's ChromaDB collection, merged by L2 distance
  • The LLM prompt explicitly instructs the model to compare, contrast, and name disagreements across sources
  • Sources in the panel show which notebook each chunk came from (sage-colored notebook label)
  • Click "Single" to switch back to querying just the active notebook

Backend

  • query_across_notebooks in vector_store.py: queries multiple ChromaDB collections, merges results, re-ranks by distance, returns top_k
  • prepare_prompt_cross_notebook in rag.py: builds a prompt that groups excerpts by notebook + document and instructs the LLM to synthesize across all sources
  • stream_reply in chat.py: routes to cross-notebook RAG when notebook_ids list has 2+ entries

Frontend

  • crossNotebookMode in Zustand store with "All/Single" toggle in chat header
  • useChat.ts sends notebook_ids (all notebook IDs) instead of notebook_id when in cross mode
  • SourcePanel.tsx shows notebook name labels in sage uppercase text when cross-mode is active

Test 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

  • All backend tests pass (28 passed, 1 skipped)
  • Manual: Create 2+ notebooks with documents, click "All", ask a cross-cutting question
  • Manual: Verify source panel shows notebook labels for each source
  • Manual: Click "Single" to return to single-notebook mode

🤖 Generated with Claude Code

vikranthreddimasu and others added 2 commits April 15, 2026 22:06
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>
@vikranthreddimasu vikranthreddimasu merged commit 5d63ad7 into main Apr 16, 2026
0 of 2 checks passed
@vikranthreddimasu vikranthreddimasu deleted the feat/cross-doc-synthesis branch April 16, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant