Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.
This repository was archived by the owner on Sep 8, 2026. It is now read-only.

agent tool: first-class search (capped rg), stop exec-ing grep #562

Description

@btipling

Summary

Add a first-class search (or grep) workspace tool. Today the model execs rg/grep, which dumps unbounded shell output into the turn and is the usual way it “finds” code.

This is a product / tool-surface issue, not agent-session (#548). It will help context later; ship it as a sandbox tool with a hard hit cap.

Why

Peer harnesses (Orrery et al.) keep search in the prefix: one small schema, bounded hits (path, line, text), no shell. Their in-process WalkDir is a bad impl (reads every file, glob is basename-only). We already have rg in the jail — call it argv-only with a max-results cap.

Goal

Tool search (name bikeshed in plan)
Args pattern, optional glob / path, max_results (server-capped)
Impl Sandbox rg (or equivalent) argv, never sh -lc
Result Bounded list of {path, line, text} + “truncated, N more” if hit cap
Caps NEW hit-count + per-line + total-bytes caps in the create-plan table

Success: the model stops exec rg for ordinary “where is X?”; exec stays for real commands.

Constraints

  • Same jail / cwd / in-jail-abs path rules as read_file (resolvePathForTool).
  • Read grant only. Secrets redacted. Binary / oversize files skipped.
  • Do not WalkDir the workspace from the Next process.
  • Do not copy Orrery’s filepath.Match(base) glob.
  • Tool list is prefix-stable (skills: inject a catalog, not full bodies, every turn #557 is a different board) — adding one schema is the point; don’t add five search variants.

Non-goals

  • Hashline
  • Replacing exec
  • Background jobs
  • Agent-session fold / compaction

Related

Suggested next

create-plan with Caps table (max hits, max bytes, timeout).

Activity

  1. added
    enhancementNew feature or request
    sandboxAgent sandbox / workspace (BYO + Vercel Sandbox backends)
    on Aug 15, 2026
  2. btipling commented on Aug 20, 2026

    @btipling
    OwnerAuthor

    Plan filed: #717 — plan: first-class search tool (capped rg), stop exec-ing grep. Single-issue plan (one new search sandbox tool in lib/agent/tools.ts, argv-only rg, hard hit caps, read-grant-only, no Wasm/bridge change), with a Caps table and docs/ update plan. Next: plan-review on #717, then implement-plan.

  3. btipling commented on Aug 22, 2026

    @btipling
    OwnerAuthor

    Closed: shipped in PR #719 (feat(tools): add search tool capped rg code-grep, read-grant-only, plan #717).

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 requestsandboxAgent sandbox / workspace (BYO + Vercel Sandbox backends)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions