←back to thread

177 points Runonthespot | 10 comments | | HN request time: 0.557s | source | bottom
Show context
dang ◴[] No.45161889[source]
[stub for offtopicness]
replies(4): >>45157793 #>>45158731 #>>45158788 #>>45159252 #
1. dmd ◴[] No.45158788[source]
What does this have to do with Claude Code?
replies(2): >>45158845 #>>45158867 #
2. Runonthespot ◴[] No.45158845[source]
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!

replies(2): >>45159585 #>>45160547 #
3. alvis ◴[] No.45158867[source]
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

replies(1): >>45161912 #
4. furyofantares ◴[] No.45159585[source]
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.

replies(1): >>45160723 #
5. mikebiglan ◴[] No.45160547[source]
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.

replies(1): >>45161302 #
6. postalcoder ◴[] No.45160723{3}[source]
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.

replies(1): >>45160950 #
7. furyofantares ◴[] No.45160950{4}[source]
That sounds great - do you have any examples?
replies(1): >>45164443 #
8. jtbaker ◴[] No.45161302{3}[source]
> 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!

9. dang ◴[] No.45161912[source]
Ok, we'll use that above. Thanks!

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

10. postalcoder ◴[] No.45164443{5}[source]
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.