Skip to content

tools: default Grep to content mode with a 200-line cap - #310

Merged
thedancingdeveloper merged 1 commit into
mainfrom
wi-1311-grep-content-default
Oct 13, 2026
Merged

thedancingdeveloper merged 1 commit into
mainfrom
wi-1311-grep-content-default

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Contributor

Summary

  • Grep's output_mode defaulted to files_with_matches, so a call naming only a pattern returned paths. Models that never pass a mode (grok, WI-1311) saw no lines and reported the tool as returning no content.
  • The default is now content with line numbers, capped at 200 lines with the remainder counted. files_with_matches and count stay explicit options and are uncapped. -A/-B/-C also force line numbers.
  • The tool description now says content is the default and how to get paths only. New test TestGrepDefaultIsContentWithLineNumbersAndCap; existing tests that asserted bare paths now pass output_mode explicitly.

WI-1311. The cwd half of the original report is out of scope (removed at the source by WI-1298).

Test plan

  • CGO_ENABLED=0 go build ./...
  • go vet ./...
  • go test ./internal/...
  • make hermetic
  • Not verified on vogt-dev: the Klaudia pin is not yet bumped.

A Grep call that named only a pattern returned matching paths, because
output_mode defaulted to files_with_matches. Models that never pass a mode
(grok, in the WI-1311 report) then saw no lines and reported the tool as
returning no content. Content with line numbers is what a pattern-only call
is asking for, so it is now the default, capped at 200 lines with the
remainder counted; files_with_matches and count stay explicit and uncapped.
Context flags (-A/-B/-C) also force line numbers, since context lines are
unreadable without them.

Measured: CGO_ENABLED=0 go build ./..., go vet ./..., go test ./internal/...,
and make hermetic all pass. Assumed: nothing outside internal/tools depends
on the old default — the only callers asserting bare paths were the tool's
own tests, which now pass output_mode explicitly.

Co-Authored-By: Klaudia <noreply@greenthread.ai>
@thedancingdeveloper
thedancingdeveloper merged commit beaf694 into main Oct 13, 2026
3 checks passed
@thedancingdeveloper
thedancingdeveloper deleted the wi-1311-grep-content-default branch October 13, 2026 06:55
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