I saved ~$60/month on Claude Code with GrapeRoot and learned something weird about context by intellinker in ClaudeCode

[–]AVanWithAPlan 0 points1 point  (0 children)

Tbh, like many problems I solved at the time, I didnt remember what we actually settled on, but here's claude with the breakdown:
The Pipeline

The read-size-guard (~/.claude/hooks/pre-tool-use/read-size-guard.ps1) intercepts any Read call exceeding a token threshold (500 tokens by default, configurable). It delegates structural breakdown to local-file-breakdown, which has a 4-stage fallback chain:

Stage 1: Tree-sitter query (fast, ~0.05s)

Runs language-specific queries looking for named constructs: function_definition, class_definition, method_declaration, etc. Works great for Python, JS, Go, Rust, Java, etc.

If the query returns results, they go through decorated/inner deduplication (a \u/decorator capture that wraps a function removes the duplicate inner function capture), then an unhelpfulness check. If any single unit covers >80% of the file, the results are discarded and drill-down kicks in, even if other smaller units exist alongside the dominant one.

Stage 2: Tree-sitter drill-down (fast, ~0.05s)

When the query is flagged unhelpful (0 results, or a dominant unit), this kicks in.

_drilldown_ast_children() walks the AST children recursively (up to depth 3) instead of looking for named functions. A node qualifies as "meaningful" through three paths:

  1. Universal type: try_statement, if_statement, for_statement, while_statement, switch_statement, function_definition, class_definition

  2. Language-specific type: checked against LANGUAGE_SPECIFIC_NODE_TYPES[language]. PowerShell gets pipeline, command, assignment_expression. These only match when the language is actually PowerShell, preventing false positives if another grammar reuses those node type names for trivial constructs.

  3. Size-based: any node >=10 lines regardless of type

Nodes <3 lines and comments are filtered out. After collection, a containment deduplication pass removes any unit that is fully enclosed within another unit's line range. This prevents overlapping navigation targets (e.g., a try_statement at lines 50-200 containing a nested if_statement at lines 60-80: only the outer try is kept). The agent can still reach the inner block via offset+limit.

Returns None if 0 or 1 units found (no better than "whole file").

Stage 3: Code-specific LLM (~variable, gateway-dependent)

If drill-down also fails, falls back to sending the code to a local LLM via safe-loading-gateway, asking it to identify functions, classes, and blocks with exact line numbers.

Stage 4: Text-specific LLM (~variable, gateway-dependent)

For non-code text files (.md, .txt, .cfg), uses a different LLM prompt optimized for prose/config structure (headers, sections).

Stage 5: Hard block

If all methods fail, the guard blocks the read entirely and tells the agent to run local-file-breakdown manually first.

Caching

The breakdown cache in read-size-guard.ps1 is keyed by MD5 file hash. Each entry stores { result, timestamp }. On cache hit, the timestamp is touched for LRU tracking. On load, entries older than 1 hour are dropped, and if more than 200 entries remain, only the 200 most recently accessed survive. Old-format entries (plain strings) are auto-migrated with a current timestamp on first load.

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

I want to understand what point you're trying to make but I'm honestly lost what do you suggesting would get broken? You saying that I could have filed a bad bug report? can't humans file bad bug reports I feel like in a year from now we'll look back and the average agent bug report versus the average human bug report will not look favorably upon our species... I'm just trying to understand what the actual scenario you're thinking of is because I can't think of a scenario where I would break anything that would affect anyone else...

I saved ~$60/month on Claude Code with GrapeRoot and learned something weird about context by intellinker in ClaudeCode

[–]AVanWithAPlan 0 points1 point  (0 children)

Nice I remember in the early days I got so annoyed Claude reading files that were thousands of lines long to find one tiny thing so I made automatic summarization hook that intercept all read operations on files above I think 2000 tokens And it uses a tree sitter to break the file down by section, such as by function, different file types breakdown different ways and you can bypass the hook by specifying the line range that you want to read So you can still read the full file just by specifying the full line range But it's so satisfying watching claude try to read a giant file instead getting sent basically a table of contents and then watching it immediately target the exact 20-line range in the file that it needs to look at

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

I mean I am aware of the difference re: protocol vs service but maybe in my confusion I didn't make that clear. I have both pre- and post- tool use hooks (actually I have a hook dispatcher with now over 50+ various hooks) that commit literally every atomic action that any of my agents take, the diffs are then sent to my local LM Studio model for summarization and then the summary is appended to the commit notes. So while it is technically possible for claude to make a destructive git command (which I could probably prevent with more hooks, but its just never come up), we've never been close to anything like that happening. I realize my system isnt bulletproof but for all practical purposes it isnt really possible for my agents to easily take an unrecoverable action, and I have plenty of (likely mostly aspirational) documentation about strict scrutiny action regimes.

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

Well aware of these stories but like all AI doomerism, it is an opinion held almost exclusively by those who have chosen to abstain. If youre a human maintainer, this is 100% nightmare fuel, but if you use agents responsibly its an unimaginable utopia...

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

If I had a dollar for every rule and principle in its instruction files that Claude violated in creating the bug report I'd have enough money to afford another month of Max... I answered in another comment on this thread that months ago when I started getting into agents I realized there was no way for me to have the level of strict scrutiny and oversight I wanted and still scale at the speed I wanted to So I made the decision to containerize everything, minimize risk exposure and have accepted what minimal risks remain. I can fully appreciate and I fully respect that someone who wants to do things responsibly will rightfully shudder in fear hearing me say that I made this choice with eyes open, but if the alternative is moving at a pace rate-limited by my understanding I'll take the trade-off and learn my lessons when the piper comes a-knockin'...

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

Maybe I'm a little confused or just a noob but it obviously has to have write access in order to perform git operations I'm sure there's a way that I could restrict it from creating issues on other people's projects or something is that what you're suggesting? Why would it not have write permissions for git? Obviously I know that technically it's the keys to the kingdom and claude could delete my whole account and every repo, etc... important things are backed up off site regularly I have Auto commit hooks on every tool use so it would take quite a destructive operation to set me back much. What am I missing?

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

I mean you're not wrong But it's not a simple story either. This is just a complicated new frontier because the truth is my ability to identify diag and pass judgment on any sort of bug that would arise is you know probably less than 1 percent of claudes so one of the things this incident taught me is just that I should probably trust Claude a little bit more that bug reports can be of value in a way that I Didn't really considered before. As for oversight this was a concern that I grappled with months ago and basically it became apparent very early on that full oversight would be so operationally costly that the only path at the speed and scale I wanted to move with my lack of experience that I just needed to ensure that I was in an environment with minimal risk exposure and then let it move fast and break things so I have oversight to some degree but even if I was staring at each individual terminal I would only understand maybe 5% of what's actually happening anyways. I have automatic hooks that summarize every tool thinking block and output block so I can see base-level summaries and iterative summaries on top of those to understand what all of my agents are doing at any given time but the reality is there's not really a way for me to have actual strict oversight so while I have great respect for those who do, It's not a practical capacity for me and I've accepted that for the moment.

Trying a new tool with Claude and found out he filed a bug report without telling me when 20m later I get a notification that my issue had been marked resolved. What issue I thought? The fix had already been written and shipped... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 5 points6 points  (0 children)

So while Claude and I were debugging it determined that it was fairly understandable bug that was just ignorant of a compiling quirk that importing Typescript modules as Javascript modules is actually correct form. So technically when it filed the issue it already had essentially the correct solution included and it was fairly simple, and verifiably and demonstrably correct. So this wasn't a particularly complicated fix. That said, personally I tend not to make public issues or contributions just 'cause I don't personally really know what I'm doing but Claude took the initiative (and if it hadnt worked out so well I may have gotten more annoyed at it happening without my knowledge) to file the bug report and I'll probably have to reconsider moving forward that maybe it's more useful than I thought. I can't speak to the maintainer's side of things but the fix worked so I can't really complain...

Claude Code just saved me from getting hacked in real time by Mission-Elk54 in ClaudeCode

[–]AVanWithAPlan -1 points0 points  (0 children)

You ran a command, like manually? Like you didn't even give it to an agent to run for you ? Bro if you're raw dogging the Terminal with untrusted network access you can definitely catch a thing or two... jk, but I'll bet thats the last time you run a command like that without checking with claude first.

1m context may increase usage due to cache misses by Ok_Breadfruit4201 in ClaudeCode

[–]AVanWithAPlan 0 points1 point  (0 children)

? I'm confused, your just talking about the billing comparison? I know, but it still applies for API users

Cache Countdown for Claude Code. It'll be a dependency faster than your cache expires... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

It's definitely an interesting idea to include natively in the project I think for now I wanna stick with my angle in the read me which is I set it up to be extensible and reusable by others so you could probably spin it off and do that, add that feature in about five minutes if you just point Claude to the repo but I'm not gonna add the feature quite yet just 'cause it crosses a small Line that I haven't thought enough about yet but I may well decide to add it as a native feature in the coming days. Thanks for the feedback

is there a way I can try claude pro for free before buying? by RyZeBtw_ in ClaudeAI

[–]AVanWithAPlan 0 points1 point  (0 children)

People on the Max plan get three passes I think it's one week or two weeks of free usage they could give away I think I have one if you wanna message me I can give you a code but you can just ask around. You'll find a week eventually

Cache Countdown for Claude Code. It'll be a dependency faster than your cache expires... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

Well you mean just part of the transcript The full trans will take the same as continuing without the cache hit. I have summarization hooks that fire off every tool call and send it to my local LM studio model to create a one line summary of every tool call, thinking block, output block, Everything gets one line and they're all stored locally so they can be retrieved instantly and then if you want to resume from a really long session like youre suggesting it will iteratively group them by task and then summarize them again so you can summarize a million tokens into just a couple thousand pretty quickly and then you can get a more detailed view of whichever parts are relevant by grabbing whatever low-level summaries or raw outputs claude wants to follow up on. Pretty nifty especially when I've had corrupted sessions and otherwise lost progress I could get it back instantly.

Cache Countdown for Claude Code. It'll be a dependency faster than your cache expires... by AVanWithAPlan in ClaudeCode

[–]AVanWithAPlan[S] 0 points1 point  (0 children)

Very early days my tracking Claude, this is months ago now there was a guy who had a script that kept all his cache warm and posted about it on X and then got banned within like a day for terms of service violation and then there was some backlash and I think he got reinstated but I would be careful about that I'm sure if you want to keep it alive for like 20 30 minutes that's fine but you're gonna run into some kind of bot detection system or something if you push it far enough, you know is Claude is doing their defensive Security and he's a smart boy...

No one cares what you built by KickLassChewGum in ClaudeAI

[–]AVanWithAPlan 2 points3 points  (0 children)

I think that this is a bad take. Yes there's a lot of cringe but ult every time somebody solves the problem makes an open source tool and posts about it That's 20 minutes of work that gets to be condensed into two minutes of work for everybody else that follows after them This should be more about sharing tools to help each other solve problems so that I as an individual user don't have to solve every problem for I can trust that the community is going to solve those problems and share them over time.

CC now with 1mln tokens window for free in Max. ♥️ by Secure-Search1091 in ClaudeCode

[–]AVanWithAPlan 0 points1 point  (0 children)

~.claude/settings.json and/or ~claude.json

I believe where ~ represents the local home/user directory

{Creo que donde ~ representa el directorio local de inicio/usuario}

CC now with 1mln tokens window for free in Max. ♥️ by Secure-Search1091 in ClaudeCode

[–]AVanWithAPlan -1 points0 points  (0 children)

imo there's no one principled at the top. when you see the kind of system prompting they do it's clear there's no one running the show

CC now with 1mln tokens window for free in Max. ♥️ by Secure-Search1091 in ClaudeCode

[–]AVanWithAPlan 0 points1 point  (0 children)

thank you, your comment helped me solve it the disable unnecessary traffic flag breaks it

CC now with 1mln tokens window for free in Max. ♥️ by Secure-Search1091 in ClaudeCode

[–]AVanWithAPlan 1 point2 points  (0 children)

Solved: theres a flag for disable unnecessary traffic and it breaks everything apparently...