Ripgrep Context Builder
Fast code search with session.grep and session.glob lets you gather the
relevant files and matching lines, then feed them into a prompt — a lightweight
retrieval step before the agent reasons. Use this when you want to scope the
agent to a specific slice of a large codebase instead of letting it explore from
scratch.
glob returns a list of matching file paths, while grep returns the raw
ripgrep output as a single string. Both run locally and return quickly, so you
can chain several searches to assemble context cheaply before spending a model
turn. Pair them with session.readFile when you need the full body of a file
rather than just the matching lines.