Remix.run Logo
dang 3 days ago

[stub for offtopicness]

dmd 3 days ago | parent | next [-]

What does this have to do with Claude Code?

Runonthespot 3 days ago | parent | next [-]

Mainly I wrote it because I noticed Claude's "by design" use of grep meant it couldn't search the code base for things it didn't already know the name of, or find "the auth section". But equally, it's well documented that e.g. Cursor's old RAG technique wasn't that great.

My idea was to make a tool that just does a quick and simple embedding on each file, and uses that to provide a semantic alternative that is much closer to grep in nature, but allows an AI tool like Claude Code to run it from the command line - with some parameters.

Arguably could be MCP, but in my experience setting up a server for a basic tool like this is a whole lot of hassle.

I'm fairly confident that this is a useful tool for CC as it started using it while I was coding it, and even when buggy, was more than willing to work around the issues for the benefit of having semantic search!

furyofantares 3 days ago | parent | next [-]

CC is so good with grep that I'm half expecting to clutter its context with bad results from semantic search. But also half optimistic at this just improving its search.

If you're getting useful results from hybrid mode that's very interesting to me since well-constructed grep that claude executes don't really look like they'd work great for semantic search to me! But intuition is often wrong on this stuff.

I am very curious your thoughts on speed. I'd rather any tools claude invokes be as fast as possible so it can get feedback immediately and execute again.

postalcoder 3 days ago | parent [-]

if you’re concerned about context you can trivially make a hook that will prune your conversation history of older semantic search results.

i do a lot of context management with hooks for all sorts of tool calls.

furyofantares 3 days ago | parent [-]

That sounds great - do you have any examples?

postalcoder 2 days ago | parent [-]

For example I have a Stop hook that scans my messages to see which files we've worked on. It'll check to see if the changes to those files have been committed and, if not, it will prevent Claude from stopping and send it a message to commit the specific files in a specific style that includes the id of the current session. The same script also cleans up all previous instances of the same message in the conversation, saving like 5k tokens per session.

I have a lot of PreToolUse hooks that injects guideline messages whenever certain tools are called or bash commands run. My hooks also prune older versions of those out of context. All of the transcripts are in ~/.claude/projects/ in jsonl format and are hot-editable.

mikebiglan 3 days ago | parent | prev [-]

Starred the repo.

Went to the github repo and was expecting a section about Claude Code and best practices on how to set this up with Claude Code. Very curious to hear how that might work, especially with what you've found compared to Claude Code's love of grep.

jtbaker 3 days ago | parent [-]

> Went to the github repo and was expecting a section about Claude Code and best practices on how to set this up with Claude Code. Very curious to hear how that might work, especially with what you've found compared to Claude Code's love of grep.

A write up on this would be great!

alvis 3 days ago | parent | prev [-]

A proper title could be "Semantic grep with completely local embeddings"

Put the title aside, the tool, if it works as described, is pretty insane

dang 3 days ago | parent [-]

Ok, we'll use that above. Thanks!

(Submitted title was "Semantic grep for Claude Code (RUST) (local embeddings)")

ayhanfuat 3 days ago | parent | prev | next [-]

Isn't Claude Code's selling point that it doesn't use embeddings?

joshuanapoli 3 days ago | parent | next [-]

I don’t think that “Claude Code” is relevant to this semantic grep tool.

Runonthespot 3 days ago | parent [-]

bear in mind that Claude Code by default uses grep - if you watch you'll see if it's looking for something it doesn't know the name of, it flails around with different patterns. Try this tool, tell CC to take a look using ck --help and take it for a spin.

CC in my case likes it so much, it started using it to debug the repo rather than grep and suggesting its own additions

Runonthespot 3 days ago | parent | next [-]

Note that it’s grep AND semantic - so Claude can start with a grep strategy and if it finds nothing can switch to semantic, and since it’s local and fast, it keeps in sync easily enough

brookst 3 days ago | parent | prev [-]

How do you tell CC to use it? Just as an entry in Claude.md?

Runonthespot 3 days ago | parent [-]

To start with just tell it- but yes Claude.md works too.

“We have a new grep semantic hybrid tool installed called ck - check it out using ck --help and take it for a spin”

dsiegel2275 3 days ago | parent | prev [-]

Why would "not using embeddings" be a selling point? Some of the most effective IR systems use embeddings (bi-encoders, cross-encoders)

AmazingTurtle 3 days ago | parent | prev | next [-]

Why does it need to say RUST in the headline as if this was a feature, lol

Runonthespot 3 days ago | parent | next [-]

we all know rust CLI tools are better right?

dang 3 days ago | parent [-]

Please don't post misleading titles. This is in the site guidelines: https://news.ycombinator.com/newsguidelines.html.

dang 3 days ago | parent | prev [-]

We've taken the Rust out of the title now.

(Submitted title was "Semantic grep for Claude Code (RUST) (local embeddings)")

mellosouls 3 days ago | parent | prev [-]

This looks interesting and I look forward to trying it but the title here should really just use the description of the repo, or that be adjusted.

Apart from anything else it appears to be very misleading as Rust (ironically) according to the documentation is not one of the languages supported.

anthonyronning 3 days ago | parent [-]

I clicked on this because it said rust in the title. Very disappointed.

Runonthespot 3 days ago | parent | next [-]

I'll add rust, ruby, elixir, Clojure next. It says rust as it's written in rust, sorry about that!

dang 3 days ago | parent | prev [-]

We've taken the Rust out of the title now.

(Submitted title was "Semantic grep for Claude Code (RUST) (local embeddings)")