logoalt Hacker News

hmokiguesstoday at 3:45 PM4 repliesview on HN

Tangential, I have a hook that rewriters grep to rg but lately I wonder if this is actually wasteful as the model is so biased to grep, is there a way to shim/alias perhaps?


Replies

sdesoltoday at 4:04 PM

My CLI does something close to this:

https://github.com/gitsense/gsc-cli

`gsc grep` is just an alias for `gsc rg`, mostly because agents are much more likely to reach for “grep” than “rg”.

It works pretty well, but it is not a perfect drop-in replacement. `grep` and `ripgrep` differ in a few details, especially around glob/wildcard behaviour and flags. What I found works is to not use `grep` in search examples, and have the CLI spit out an error message for the AI saying this is `ripgrep`, so it needs to use `ripgrep` syntax.

celrodtoday at 3:57 PM

If performance is the concern, ugrep will get you most of the way there relative to gnu grep, and should be fully grep compatible in terms of syntax:

https://github.com/Genivia/ugrep#aliases

Claude Code may ship with ugrep already.

verdvermtoday at 3:47 PM

Many harnesses are doing this already, "Grep" is the tool name, ripgrep is the implementation

It depends on if it is using Grep the harness tool or Grep from the bash tool

show 1 reply
cyanydeeztoday at 4:45 PM

I've been on a look out for any harness that properly secures a protocol to the LLM, but they're all just "here's some tools, hopefully you don't use bash for everything".