Live data from Hacker News

Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

github.com

21–30 of 49 posts

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#21
post #7

Does Claude's grep still prepend the relative path of the file before _every_ single line? Because that is nasty, especially in java projects.

We are using hooks to direct the coding agent to use graft grep instead of just grep, so this should ideally not happen.

Also, for java projects we do support a more deeper graph, a few of our contributors are working on making it better for java projects, let us know if you have any ideas there.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#22

>"The problem: Every task, your coding agent starts blind. Before it changes anything, it re-explores the repo: grep a term, open a file, follow an import, back out, try again. It is rebuilding a picture of a codebase it mapped an hour ago and threw away. That rediscovery burns most of a run's tool calls, tokens, and latency, and it is pure overhead " The author of this article brings up a very interesting problem --…

for your point #2: people are trying out to give coding agents LSP support, not sure though how well it'll work but it gives coding agents a better idea of the language in which the code is written.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#24

What's the benchmark against graphify?

In our tests, graft found the right code about twice as often as graphify (MRR 0.73 vs 0.38, recall@10 54% vs 20%). The difference is simple: graft searches inside the actual code, while graphify only looks at names and file paths.

You feel it while working too. graft hands the agent the exact file and line it needs for each question, so Claude keeps using graft.

Same is true for any other cli tools, claude never actually uses them as it's trained to use grep. but for graft as we set the directive to use graft at the start of the session and before the turn, claude just knows graft exists and also get the relevant context without it going and calling tools it was not trained on.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#25
post #11

Why these animations in the github README? why? It just made understanding anything more difficult

We made this for X audience initially but got a lot of praise for it on reddit, so decided to put in the README. Sorry it made it more difficult for you.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#26
This looks cool and the mechanism looks plausible. I found the experience of trying to understand whether the claims here are legit to be aggravating.

First of all, the whole readme section about benchmarks appears to be Claude/Codex written. What a slog to read this.

Second, they claim success on SWE-Bench Verified, but it's only on 50 tasks, not making clear how these tasks are chosen. I know from experience that you can keep selecting sets of tasks until you get a result. Also, this was run 1x, and the lift they show actually only has a p val of 0.22.

There's a famous book "how to lie with statistics". I don't think the continual posts about benchmark results here are purposeful lies, but I think it's just so easy to fool yourself (and I've been burned, most recently building http://pellmell.ai ). Also I don't think this post is the most egregious example.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#27
post #23

I intuitively and perhaps naively thought that Claude using the LSP server would negate a lot of grep use. Is this tool solving the same problem or something else?

LSP is for when you already know the symbol and want an exact answer, like go-to-definition or find-references. graft is for the step before that: you ask "where does auth happen" and it hands the agent the right files and lines to start from, so it reads a lot less to get oriented.

so graft solves for making claude code understand your codebase every session.

And I feel you can save a lot more tokens and also increase accuracy by just switching to new claude session without worrying about your codebase context. (doesn't solve for the session context yet, but we are still figuring out how can we solve for that. Maybe hooks that can manage your CLAUDE.md)

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#28

Love the idea, I was thinking about this problem a few weeks ago, but never got anywhere with it. I'm intrigued by the latency savings in particular, that sounds great. One concern I have is that right now each session gets fresh "eyes" on the problem. Right now I find I get a lot of mileage out of a combination of long-running sessions and fresh ones. I worry with a single generated concept graph that gets only incr…

For the staleness specifically we are using hooks on claude code and codex, where on every turn, or post edit or pre-tool use, we sync the graph. so that graph never goes stale. We have run tests on DeepSWE as well which are long running tasks, we got 20% better accuracy on the tasks where sonnet 5 failed. didn't want to post that numbers yet as I think we can do better on DeepSWE and on a cheaper model like gpt-5.6-…

The graph is pre-filling the context that does the sync, right? Doesn't that create a bias towards what's already present? If anything hallucinated does make it in at some point, won't the sync just reinforce that hallucination if some new component touches the bad info, just like a long session rabbit-holing? New sessions, in contrast, have no contextual assumptions and often catch those problems.

Re: Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

#30

This looks cool and the mechanism looks plausible. I found the experience of trying to understand whether the claims here are legit to be aggravating. First of all, the whole readme section about benchmarks appears to be Claude/Codex written. What a slog to read this. Second, they claim success on SWE-Bench Verified, but it's only on 50 tasks, not making clear how these tasks are chosen. I know from experience that y…

we are running them on a recurring basis, so will keep on updating that 50 number. and hence as it's currently running that section gets updated by claude only.
Post reply on HN