The doctor verb
rf doctor [path] [--json]
doctor reports the environment a search will run in, so a surprising result
can be explained rather than guessed at.
What it reports
engine— the linked in-process engine (theignorewalker andgrepsearcher), confirming there is no subprocess in the hot path.git_repo— whetherpathis inside a git work tree.ignore_mode— whether.gitignore/.ignorerules are active here.external_tools— forgitandast-grep:path,version,status, andstate.overall—healthywhen both tools are available.recommended_action— a short next step.
Exit 6: a tool is absent or does not run
doctor is a check. When git or ast-grep is absent, doctor exits 6.
ok is false, data still holds the full report, and errors has one
COMPONENT_DEGRADED entry for each absent tool, with an install link in
remediation. A tool that is present and fails its --version probe gives
COMPONENT_UNHEALTHY.
Exit 6 from doctor does not mean that rf cannot search. content, why,
and the in-process stages of find need neither tool.
The context-flip it catches
.gitignore rules apply only inside a git work tree. The exact same corpus
searched in a plain scratch directory and in a real repository can return
different results, because outside a repo ripgrep does not honor .gitignore at
all.
This is the trap doctor exists to surface. An agent that validates a query in
a temporary directory and then runs it against a real project may silently get a
different answer. doctor makes the active mode explicit before you rely on a
result, and repeats it in the IGNORE_MODE warning.
Example
rf doctor . --json
{
"ok": true,
"data": {
"rf_version": "0.1.2",
"engine": "in-process: ignore + grep crates (ripgrep/fd guts)",
"path": ".",
"git_repo": true,
"ignore_mode": "gitignore-ACTIVE (walker skips ignored+hidden)",
"external_tools": {
"ast-grep": { "path": "/opt/homebrew/bin/ast-grep", "probe_error": null, "state": "healthy", "status": "available", "version": "ast-grep 0.51.0" },
"git": { "path": "/usr/bin/git", "probe_error": null, "state": "healthy", "status": "available", "version": "git version 2.50.1" }
},
"overall": "healthy",
"recommended_action": { "rationale": "all external tools available", "command": null, "…": "…" }
}
}
Outside a repo, ignore_mode reads gitignore-INACTIVE (not a git repo; ignore files not applied) — your cue that results here will not match those from
inside the repository.