Search Files

SearcherKit provides a out-of-the-box local file search pipeline for agents to answer questions about files in a local directory, with the config file_search.

question -> LLM -> search -> ripgrep matches
                -> visit  -> complete file content
                -> LLM -> final answer

To use it, you should - Install the required dependencies - Configure enviroment variables for LLM and file search root - Run searchagent tui with the file_search config.

Install SearcherKit

SearcherKit requires Python 3.12 or later. Install the package in a virtual environment:

python -m venv .venv
source .venv/bin/activate  # macOS/Linux
# Windows PowerShell: .venv\Scripts\Activate.ps1
pip install searcherkit
uv venv --python 3.12
source .venv/bin/activate  # macOS/Linux
# Windows PowerShell: .venv\Scripts\Activate.ps1
uv pip install searcherkit

SearcherKit uses ripgrep to search through local files. Install with the Installation Guide.

To ensure that ripgrep is available, run:

rg --version

Supported file types

FileSource searches readable text files. Typical supported names include:

Category Examples
Code .py, .js, .ts, .java, .c, .cpp, .rs, .go, .rb
Web and docs .html, .css, .md, .rst, .adoc, .xml, .tex
Data and config .json, .jsonl, .yaml, .yml, .toml, .ini, .csv
Project files Dockerfile, Makefile, CMakeLists.txt, README

The authoritative list, including the exact extension/glob mapping for the installed version, is available with:

rg --type-list

The source reads files as text with the configured encoding (utf-8 by default). PDF, ZIP, images, and other binary files cannot be searched directly. For the complete list, run rg --type-list and see ripgrep’s File types guide.

Configure the environment

SearcherKit with the file_search config uses the following environment variables.

Variable Meaning
LLM_MODEL Model name sent to the endpoint
LLM_API_KEY Endpoint credential; use EMPTY only when the server permits it
LLM_BASE_URL OpenAI-compatible API base URL
FILE_SEARCH_ROOT Directory that search and visit may access; defaults to ./docs

For a one-time setup, define the variables in the terminal session where you will start SearcherKit. The values remain available until that terminal is closed.

export LLM_MODEL="YOUR_MODEL"
export LLM_API_KEY="YOUR_API_KEY"
export LLM_BASE_URL="https://your-endpoint.example/v1"
export FILE_SEARCH_ROOT="./docs"
$env:LLM_MODEL = "YOUR_MODEL"
$env:LLM_API_KEY = "YOUR_API_KEY"
$env:LLM_BASE_URL = "https://your-endpoint.example/v1"
$env:FILE_SEARCH_ROOT = ".\docs"
Tip

To keep the configuration across terminal sessions, create a .env file in the directory where you run SearcherKit:

LLM_MODEL=YOUR_MODEL
LLM_API_KEY=YOUR_API_KEY
LLM_BASE_URL=https://your-endpoint.example/v1
FILE_SEARCH_ROOT=./docs

SearcherKit loads .env by default. Use --env-file path/to/another.env to load a different file. Variables already defined in the terminal take precedence over values in the dotenv file.

Start to search files

searcher tui --config-path file_search

The source searches exact text fragments with smart case. Search results use paths relative to FILE_SEARCH_ROOT; the visit tool reads those relative paths. Paths outside the configured root are rejected.

Type / in the TUI to view available commands. Use /tool-detail to inspect tool arguments and results. For general controls and record behavior, see Use the Interactive TUI.

Interactive records, the global log, and trace logs are written under outputs/file-search-tui/interactive.

For the complete source/tool guidance, see Sources and Tools.