Skip to content

core, backends: evaluate bounded multi-query search against parallel searches #3645

Closed

Description

@schlessera

Part of #3640.

Context

Research often needs several independent searches. They can already run concurrently, but a bounded multi-query operation could reduce envelope overhead and repeated results. Its benefit and agent usability have not been established; this is an investigation, not a commitment to add a production API.

Read (searchDocuments, packages/core/src/lib/ops/read.ts:58-104), (brainSearchTool, packages/ui-backend-pi/src/brain-tools.ts:94-155), (hybridSearch, packages/core/src/lib/search-engine.ts:812-1023), docs/evaluating-search.md and the parent. Scope/exclusion semantics should compose with the context/discovery work without assuming those changes are already shipped.

Scope

  • Compare current parallel single-query search with a bounded candidate that accepts named queries, preserves per-query filters/order/provenance, applies per-query and aggregate result/byte/work limits and accounts for omitted results.
  • Evaluate the value of cross-query deduplication while retaining every relevant query association and score/rank meaning.
  • Measure local FTS mechanics and model-visible response quality; separately identify embedding/reranker calls and paid work when those lanes are actually qualified.

Out of scope

Shipping new supported schemas, changing ranking constants/goldens, merging scores from unrelated queries without a defined meaning, provider migration, generic execution batching and automatic increases in paid retrieval work.

Acceptance criteria

  • A reproducible Odysseus workload with overlapping and disjoint queries compares equivalent filters/results against already-parallel calls. Use the pinned date.
  • The proposed contract covers query identity, deterministic association/order, per-query errors, duplicates, output/work caps, cancellation and compatibility with explicit path scope.
  • Evidence reports useful answer coverage/attribution, duplicate bytes, total returned size, actual tool/provider requests where observable, latency and available token/cost dimensions. Unknowns and scripted-model limitations remain explicit.
  • FTS proof is offline and exercises real core/MCP/Pi paths where comparing adapter behavior. Vector/reranker or real Terra usability claims are made only with matching authorized evidence outside tests.
  • The written recommendation is go, no-go or bounded inconclusive, identifies affected contracts and tradeoffs, and gives a concrete follow-up brief only when warranted. A documented no closes this spike successfully.

Verification

Record exact fixture, source/runtime and commands; reuse the evaluation child's measurements/harness where available without adding a new orchestration seam. Run harness-only tests in experiments/ through bun run test. Do not make an API key/network necessary for committed tests or turn a private dataset into a public benchmark.

Contract impact

None for the written spike/private prototype. Any supported tool/CLI/export change is separately scoped with contract review and changeset before implementation. No release milestone is assigned.

Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Verified the cited shared operations and concrete Pi adapters. The independent brief is complete; p2 reflects wanted unscheduled work. External model evidence is optional and does not block the specified keyless work.

Activity

  1. added
    type: spike
    area: core
    area: mcp
    area: backends
    on Nov 6, 2026
  2. added
    priority: p2
    agent-ready
    on Nov 8, 2026
  3. self-assigned this
    on Nov 8, 2026
  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claimed as part of the #3640 epic run (claim token c3640-ec699b9a-3645).

    • Branch: spike/3645-multi-query-search, PR targeting the epic integration branch epic/3640-bounded-retrieval; the epic lands on main as one batch.
    • Readiness check (2026-11-08, origin/main 1619741): every code citation in this body still points at its named anchor.
    • Collision check over the cited files: no path collisions with open PRs; only shared test-category closure overlaps.
  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claimed as part of the #3640 epic run (claim token c3640-ec699b9a-3645).

  6. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Spike result (2026-11-08): no-go. Keep parallel single-query brain_search calls.

    Delivered in #3691, merged into epic/3640-bounded-retrieval as 1890c13. The record is docs/decisions/multi-query-search.md, and the harness is experiments/multi-query-search.test.ts, which reuses the #3641 helpers.

    • Provider requests: parallel brain_search calls in one assistant message already cost the same two provider requests as one batch. This was measured with Pi's scripted provider, so it shows runtime mechanics only, not what a model would choose.
    • Envelope saving: a batch drops about 95 characters of wrapping per query, plus one repeated 81-character warning.
    • Deduplication: only per-document fields can be shared. Snippet, rank and score belong to each query. This saves 3% on the four-query overview and 11% on the heavily overlapping task, while answers to disjoint or differently filtered queries come out 6–7% larger.
    • Shared budget: under one shared 24,000-character budget, the wide task kept 5 of its 7 useful hits. Parallel calls returned all 7: MCP has no total limit, and Pi gives each call its own budget. Pi's JSON batch is also 69% larger than its current text answer.
    • Scope of evidence: FTS only, offline. The vector, reranker and paid lanes never ran. Tokens, cost and real-model usability are unavailable.

    The record still specifies the contract a future proposal would start from: query names, order, per-query errors, repeated queries, limits, cancellation, one index snapshot and #3644 path scope. Its 11 mutation receipts are in #3691.

    Follow-ups filed: #3695 (search path scope before ranking, the one gap with a measured cost), #3696 (Pi search limit bound), #3697 (cancelled searches keep running). This issue stays open until the epic lands on main.

  7. added this to the 0.45.0 milestone on Nov 8, 2026
  8. removed their assignment
    on Nov 8, 2026
  9. added a commit that references this issue on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: backendsarea: corearea: mcppriority: p2type: spike

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions