Chapter 4: Reading and debugging

Grep and code search

Also called ripgrep, Regular expression

Searching every file for some text or a pattern. grep is the old command, and ripgrep (rg) a fast modern one. A regular expression is a small language for patterns: \bprice\b finds the word price, but not priced.

It is how agents find their way around a codebase, and how you check what they tell you. "Nothing else calls this" is a claim you can test with one command, so test it.

Say it to your agent

“Before you delete formatPrice, run rg -n "formatPrice" . and paste the output. Also look for names built at runtime, such as "format" + name. Then tell me why it is safe.”

The workshop

Name a word, or describe what you mean in everyday language.