The content verb

rf content <pattern> [path] [flags] [--json]

content searches file contents for pattern under path (default .). It runs the search once per filter layer and attributes each newly surfaced file to the layer that had hidden it.

The layers

The layers are cumulative — each one relaxes an additional default filter, in the order ripgrep applies them:

surfaced_by What it means Confirm with
default Found by a plain search; nothing hid it rg 'pattern' .
vcs_ignore Hidden by .gitignore / .ignore rules rg -u 'pattern' .
hidden A hidden file or dotfile rg -uu 'pattern' .
binary A file ripgrep detects as binary rg -uu -a 'pattern' .
case Matched only when case is ignored rg -uu -a -i 'pattern' .

Binary detection replicates ripgrep exactly: quit-on-NUL unless binary-as-text is requested. .git internals are never treated as content, so commit messages and reflogs never show up as spurious matches.

The encoding probe

encoding_utf16 is not a cumulative layer — it is a parallel probe. Forcing a UTF-16 decoder makes ripgrep misread every UTF-8 file, which would hide the matches the other layers found. So rf runs the UTF-16 decode against its own base and keeps only the files that decoder alone surfaces, never disturbing the cumulative layers.

Flags

Flag Effect
--fixed-strings Read the pattern as a literal string.
--word Match whole words only.
--ignore-case Match without case.
--case-sensitive Match with case, and do not run the case recovery layer.
--matches Add occurrence evidence to each row: { line, column_byte, text }.
--max-matches <n> Maximum occurrences for each file. Needs --matches. The cap is 16.
--limit <n> Maximum rows in one page. Default 100, range 1 to 1000.
--cursor <c> Continue from meta.pagination.cursor.
--paths-stdin Search only the NUL-delimited paths on stdin. Paths are raw bytes.
--paths-envelope Search only the paths of an rf envelope on stdin: data.items[].file_bytes_hex when not null, else data.items[].file.

meta.query states the active match mode: syntax (regex or fixed), case, and word.

Warnings and commands

Each miss adds a warning with a stable code — IGNORE_VCS, HIDDEN_SKIPPED, BINARY_SKIPPED, CASE_SENSITIVE, or ENCODING_MISS — and the paste-ready rg command that reproduces it. A path that cannot be read adds PARTIAL_RESULT; with --paths-stdin or --paths-envelope, this includes an unreadable directory above a selected file. With --matches, a matched file that cannot be read again for its occurrences has matches: null and is named in the same warning. The full list is on the exit codes page and under rf capabilities --json.

Example

rf content timeout . --json
{
  "ok": true,
  "data": {
    "items": [
      { "file": "config.py",      "surfaced_by": "default",    "matches": null, "selection": null },
      { "file": ".env.local",     "surfaced_by": "hidden",     "matches": null, "selection": null },
      { "file": "cache/build.py", "surfaced_by": "vcs_ignore", "matches": null, "selection": null }
    ],
    "total": 3
  },
  "warnings": [
    { "code": "IGNORE_VCS",     "message": "1 match(es) hidden by default; add -u (ignore .gitignore/.ignore rules)", "details": { "files": ["cache/build.py"] } },
    { "code": "HIDDEN_SKIPPED", "message": "1 match(es) hidden by default; add -uu (also search hidden/dotfiles)", "details": { "files": [".env.local"] } }
  ],
  "commands": [
    "'rg' '-u' '-e' 'timeout' '--' '.'",
    "'rg' '-uu' '-e' 'timeout' '--' '.'"
  ]
}

meta is elided here. It carries matched_files, default_matched_files, hidden_by_filters, query, pagination, and evidence.

With --matches, a row carries its occurrences:

{ "file": "config.py", "surfaced_by": "default", "selection": null,
  "matches": [{ "line": 1, "column_byte": 1, "text": "timeout = 30", "text_lossy": false, "text_truncated": false }] }

An absent term returns exit 0 with data.items equal to [] — see Exit codes.