Description
backscroll search --robot does not honor the documented agent-output contract for --fields minimal or --max-tokens.
runSearch builds robot output from modelResults, whose Content field is populated from the complete r.Text, and then writes the formatted lines directly. The robot branch therefore bypasses both the minimal r.Snippet projection used by JSON and the picokit formatter that enforces the token budget.
Relevant implementation: cmd/backscroll/search.go in runSearch, particularly the r.Text assignment and direct robot-line output.
Steps to Reproduce
-
Use an index containing several long messages that match a known term.
-
Run:
backscroll search "<known-term>" \
--all-projects \
--robot \
--fields minimal \
--max-tokens 100 \
--limit 10 > /tmp/backscroll-robot.out
wc -c /tmp/backscroll-robot.out
-
Compare with text output using the same budget:
backscroll search "<known-term>" \
--all-projects \
--max-tokens 100 \
--limit 10 > /tmp/backscroll-text.out
wc -c /tmp/backscroll-text.out
In the observed corpus, robot output was 16,350 bytes while text output was 388 bytes under the same --max-tokens 100 budget.
Expected Behavior
--robot --fields minimal emits only the documented minimal fields: source path, bounded snippet, score, role, and timestamp.
--max-tokens bounds the complete robot payload and emits an explicit truncation indicator when results do not fit.
- Agent callers can trust the declared output budget.
Actual Behavior
- Robot output includes complete message content.
--fields minimal does not alter the robot payload.
--max-tokens does not constrain robot output because the branch writes directly to stdout.
- One long high-ranked result can consume the caller's context before later relevant results are reached.
Environment
- Backscroll version:
3.5.1
- OS: macOS (darwin/arm64)
- Go implementation from current
main
Acceptance criteria
Description
backscroll search --robotdoes not honor the documented agent-output contract for--fields minimalor--max-tokens.runSearchbuilds robot output frommodelResults, whoseContentfield is populated from the completer.Text, and then writes the formatted lines directly. The robot branch therefore bypasses both the minimalr.Snippetprojection used by JSON and thepicokitformatter that enforces the token budget.Relevant implementation:
cmd/backscroll/search.goinrunSearch, particularly ther.Textassignment and direct robot-line output.Steps to Reproduce
Use an index containing several long messages that match a known term.
Run:
Compare with text output using the same budget:
In the observed corpus, robot output was 16,350 bytes while text output was 388 bytes under the same
--max-tokens 100budget.Expected Behavior
--robot --fields minimalemits only the documented minimal fields: source path, bounded snippet, score, role, and timestamp.--max-tokensbounds the complete robot payload and emits an explicit truncation indicator when results do not fit.Actual Behavior
--fields minimaldoes not alter the robot payload.--max-tokensdoes not constrain robot output because the branch writes directly to stdout.Environment
3.5.1mainAcceptance criteria
--fields minimalis selected.--fields fullis selected.--max-tokensapplies to the complete robot payload, not independently per field or result.result_N_field=valueoutput and reports that additional results were omitted.