Nous.Tools.FileGrep (nous v0.17.1)

Copy Markdown View Source

Content search tool.

Searches file contents using regex patterns. Uses ripgrep (rg) when available for performance, falls back to pure Elixir regex.

Sandbox exemption

ripgrep is spawned with System.cmd/3, outside NetRunner, and is deliberately not confined by Nous.Sandbox. This is the documented exception to "NetRunner is the single execution path". The reasoning:

  • Neither provider restricts reads. Seatbelt's profile is (allow default) (deny file-write*) and bwrap binds / read-only, so confining a process that only ever reads adds exactly zero enforcement.
  • The argv is already hardened: the pattern goes through --regexp and a -- terminator ends option parsing before the positional path, and the environment is scrubbed via Nous.Tools.Env.scrubbed_overrides/0.
  • The environment is genuinely scrubbed rather than merged: Erlang's {env, _} option adds to the inherited environment, so the allowlist is passed as scrubbed_overrides/0, which also emits {name, false} for every other currently-set variable and thereby actually unsets it.
  • Every matched path is re-validated through Nous.Tools.PathGuard before it reaches the caller.
  • Nous.Sandbox fails closed, so routing this tool through it would delete a working read-only search tool on every host with no provider installed — for no security gain whatsoever.

Summary

Functions

Return the full tool schema definition for introspection.

Functions

__tool_schema__()

@spec __tool_schema__() :: map()

Return the full tool schema definition for introspection.

Includes parameter declarations, category, and tags.