Skip to content

Exclude or de-prioritize active-session query echoes in search ranking #64

Description

@pablontiv

Problem

Searches performed from an active coding-agent session become indexed tool content. A later unfiltered search for the same subject can rank those serialized backscroll search invocations above the historical prose the user is trying to recover.

This occurred during a real decision-recall workflow. After an initial query, subsequent searches ranked the previous Backscroll command at positions 1–2 because the command contained every query token verbatim. The historical assistant response containing the requested terminology was pushed below the top five.

The behavior is especially costly for agent callers because:

  • unfiltered search intentionally merges prose and tool indexes through RRF;
  • query commands are near-perfect lexical matches for their own terms;
  • repeated refinements add more echoes;
  • long echoed tool records consume output budget without adding historical evidence.

Proposed Solution

Treat serialized Backscroll retrieval invocations as query echoes and either exclude or strongly de-prioritize them by default during unfiltered recall searches.

A bounded first implementation could:

  1. identify tool rows whose command head is backscroll and whose operation is search;
  2. retain them for explicit --content-type tool searches;
  3. exclude or penalize them when prose and tool results are merged without an explicit content-type filter;
  4. expose an opt-in flag if callers need to search historical Backscroll invocations themselves.

The policy should be deterministic and covered at the RRF boundary so a perfect lexical echo cannot outrank the underlying prose solely because it repeats the query.

Alternatives Considered

  • Require every agent to pass --content-type text. This avoids tool echoes but weakens unfiltered retrieval, which intentionally searches both stores, and repeats a product-specific workaround in every caller.
  • Exclude the complete active session. This is broader than necessary and can hide legitimate earlier decisions made in the same session.
  • Deduplicate identical query strings only. Helpful, but the first echo can still outrank the target and slightly reformulated commands remain noisy.

Additional Context

This is distinct from general duplicate-content handling. The problematic rows are self-referential retrieval operations generated by use of Backscroll itself.

Suggested evaluation fixture:

  1. index a historical assistant response containing a target phrase;
  2. index one or more later backscroll search tool calls containing the same query terms;
  3. verify the historical prose remains in the top five for an unfiltered search;
  4. verify the command remains discoverable with --content-type tool.

Related work: the recall eval-set enhancement should preserve this scenario as a regression case.

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions