frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: A Claude Code plugin that catch destructive Git and filesystem commands

https://github.com/kenryu42/claude-code-safety-net
21•kenryu•4d ago

Comments

WolfeReader•1h ago
You should probably rely less on AI. If your first thought is "I need to delete some directories" and your immediate next thought is "I'd better ask an AI agent to do this for me", you are definitely exhibiting skill entropy.
thrdbndndn•1h ago
What is "skill entropy"
intev•1h ago
They think it's a smart way to say that the o.p. is dumb.
itemize123•1h ago
atrophy?
AdieuToLogic•1h ago
> What is "skill entropy"

Skill entropy is a result of reliance on tools to perform tasks which otherwise would contribute to and/or reinforce a person's ability to master same. Without exercising one's acquired learning, skills can quickly fade.

For example, an argument can be made that spellcheckers commonly available in programs degrade people's ability to spell correctly without this assistance (such as when using pen and paper).

RogerL•1h ago
Claude does these things even though you have explicit instructions not to do them, this isn't a tool for you asking it to delete files.

Just today Claude decided to do a git restore on me, blowing away local changes, despite having strict instructions to do nothing with git except to use it to look at history and branches.

Why jump to the conclusion that the person is so incompetent with no evidence?

intev•1h ago
Because there's now a class of programmers who are very anti AI when it comes to coding because they think anybody who relies on it are degenerate vibe coders who have no idea what they are doing. You can see this in pretty much every single HN post w.r.t AI and coding.
joshribakoff•1h ago
Thanks for framing my physical disability as a skill issue. Injuries i sustained developing my skills beyond what most others were willing to do, but i guess my use of AI to assist my input so i can continue developing totally erases that experience.
TheDong•1h ago
In my opinion this is a solution at the wrong layer. It's working by trying to filter executed commands, but it doesn't work in many cases (even in 'strict mode'), and there's better, more complete, solutions.

What do I mean by "it doesn't work"? Well, claude code is really good at executing things in unusual ways when it needs to, and this is trying to parse shell to catch them.

When claude code has trouble running a bash command, it sometimes will say something like "The current environment is wonky, let's put it in a file and run that", and then use the edit tool to create 'tmp.sh' and then 'bash tmp.sh'. Which this plugin would allow, but would obviously let claude run anything.

I've also had claude reach for awk '{system(...)}', which this plugin doesn't prevent, among some others. A blacklist of "unix commands which can execute arbitrary code" is doomed to failure because there's just so many ways out there to do so.

Preventing destructive operations, like `rm -rf ~/`, is much more easily handled by running the agent in a container with only the code mounted into it, and then frequently committing changes and pushing them out of the container so that the agent can't delete its work history either.

Half-measures, like trying to parse shell commands and flags, is just going to lead to the agent hitting a wall and looping into doing weird things (leading to it being more likely to really screw things up), as opposed to something like containers or VMs which are easy to use and actually work.

ramoz•1h ago
I agree with this take. Esp with the simplicity of /sandbox

I created the feature request for hooks so I could build an integrated governance capability.

I don’t quite yet think the real use cases for hooks has materialized. Through a couple more maturity phases it will. Even though it might seem paradoxical with “the models will just get better” - to which is exactly why we have to be hooked into the mech suits as they'll end up doing more involved things.

But I do pitch my initial , primitive, solution as “an early warning system” at best when used for security , but more so an actual way (opa/rego) to institute your own policies:

https://github.com/eqtylab/cupcake

https://cupcake.eqtylab.io/security-disclaimer/

SOLAR_FIELDS•43m ago
I got hooks working pretty well for simpler things, a very common hello world use case for hooks is gitleaks on every edit. One of the use cases I worked on for quite awhile was getting hooks that ran all unit tests at the end before the agent could stop generating. This approach forces the LLM to then fix any unit tests it broke and I also enforce 80% unit test coverage in same commit. I found it took a bit of finagling to get the hook to render results in a way that was actionable for the LLM because if you block it but it doesn’t know what to do it will basically endlessly loop or try random things to escape

FWIW I think your approach is great, I had definitely thought about leveraging OPA in a mature way, I think this kind of thing is very appealing for platform engineers looking to scale AI codegen in enterprises

ramoz•28m ago
Part of my initial pitch was to automate linting. Interesting insight on the stop loop. Ive been wanting to explore that more. I think there is a lot to be gained also with llm-as-a-judge hooks (they do enable this today via `prompt` hooks).

Ive had a lot of fun with random/creative hooks use cases: https://github.com/backnotprop/plannotator

I dont think the team meant for the hooks to work with plan mode this way (its not fully complete with approve/allow payload), but it enabled me to build an interactive UX I really wanted.

SOLAR_FIELDS•50m ago
I think the key you point out is something that is worth observing more generically - if the LLM hits a wall it’s first inkling is not to step back and understand why the wall exists and then change course, its first inkling is to continue assisting the user on its task by any means possible and so it’s going to instead try to defeat it in any way possible. I see the is all the time when it hits code coverage constraints, it would much rather just lower thresholds than actually add more coverage.

I experimented with hooks a lot over the summer, these kind of deterministic hooks that run before commit, after tool call, after edit, etc and I found they are much more effective if you are (unsurprisingly) able to craft and deliver a concise, helpful error message to the agent on the hook failure feedback. Even just giving it a good howToFix string in the error return isn’t enough, if you flood the response with too many of those at once the agent will view the task as insurmountable and start seeking workarounds instead.

AdieuToLogic•23m ago
> ... if the LLM hits a wall it’s first inkling is not to step back and understand why the wall exists and then change course, its first inkling is ...

LLM's do not "understand why." They do not have an "inkling."

Claiming they do is anthropomorphizing a statistical token (text) document generator algorithm.

ramoz•16m ago
The more concerning algorithms at play are how they are post-trained. And the then concern of reward hacking. Which is what he was getting at. https://en.wikipedia.org/wiki/Reward_hacking

100% - we really shouldn't anthropomorphize. But the current models are capable of being trained in a way to steer agentic behavior from reasoned token generation.

AndyNemmity•49m ago
Exactly right, well said. None of these solutions work in this case for the reasons you outlined.

It will just as easily get around it by running it as a bash command or any number of ways.

roywiggins•40m ago
If the LLM never gets a chance to try to work around the block then this is more likely to work.

Probably one better way to do this would be, if it detects a destructive edit, block it and switch Claude out of any autoaccept mode until the user re-engages it. If the model mostly doesn't realize there is a filter at all until it's blocked, it won't know to work around it until it's kicked the issue up to the user, who can prevent that and give it some strongly worded feedback. Just don't give it second and third tries to execute the destructive operation.

Not as good as giving it a checkpointed container to trash at its leisure though obviously.

kevinday•18m ago
Yeah, I had an issue where Claude was convinced that a sqlite database was corrupt and kept wanting to delete it. It wasn't corrupt, the code using it was just failing to parse the data it was retrieving from it correctly.

I kept telling it to debug the problem, and that I had confirmed that database file was not the problem. It kept trying to rm the file after it noticed the code would recreate it (although with no data, just an empty db). I thought we got past this debate until I wasn't paying enough attention and it added an "rm db.sqlite" line into the Makefile and ran it, since I gave it permission to run "make" and didn't even consider it would edit the Makefile to get around my instructions.

BewareTheYiga•1h ago
I am always surprised at how quick Claude will ask to run git filter-branch vs doing the same operation safely via an extra command or two.
hombre_fatal•1h ago
Switching to plan mode for everything before the application step seems to avoid the problem.

The problem seems to come when it’s stuck in a debug death loop with full permissions.

johnnyfived•54m ago
Two MCP tools back to back on the HN frontpage when seemingly dozens of them doing the same functionality already exist. Both posts written by AI with the typical tells. Daring today aren't we?
MarsIronPI•29m ago
Someone should write a version of this that uses AI to detect whether the command that the AI wants to run is dangerous. Certainly that seems like the current trend in software "engineering".

Google is dead. Where do we go now?

https://www.circusscientist.com/2025/12/29/google-is-dead-where-do-we-go-now/
614•tomjuggler•8h ago•562 comments

GOG is getting acquired by its original co-founder

https://www.gog.com/blog/gog-is-getting-acquired-by-its-original-co-founder-what-it-means-for-you/
551•haunter•12h ago•324 comments

Hacking Washing Machines [video]

https://media.ccc.de/v/39c3-hacking-washing-machines
51•clausecker•3h ago•10 comments

ManusAI Joins Meta

https://manus.im/blog/manus-joins-meta-for-next-era-of-innovation
151•gniting•6h ago•84 comments

MongoDB Server Security Update, December 2025

https://www.mongodb.com/company/blog/news/mongodb-server-security-update-december-2025
55•plorkyeran•4h ago•18 comments

Show HN: Stop Claude Code from forgetting everything

https://github.com/mutable-state-inc/ensue-skill
111•austinbaggio•6h ago•150 comments

Tesla's 4680 battery supply chain collapses as partner writes down deal by 99%

https://electrek.co/2025/12/29/tesla-4680-battery-supply-chain-collapses-partner-writes-down-dea/
297•coloneltcb•11h ago•331 comments

Stranger Things creator says turn off "garbage" settings

https://screenrant.com/stranger-things-creator-turn-off-settings-premiere/
77•1970-01-01•5h ago•67 comments

Incremental Backups of Gmail Takeouts

https://baecher.dev/stdout/incremental-backups-of-gmail-takeouts/
50•pbhn•4d ago•21 comments

Outside, Dungeon, Town: Integrating the Three Places in Videogames (2024)

https://keithburgun.net/outside-dungeon-town-integrating-the-three-places-in-videogames/
45•vector_spaces•4h ago•22 comments

Streaming compression beats framed compression

https://bou.ke/blog/compressed/
6•bouk•3d ago•0 comments

The future of software development is software developers

https://codemanship.wordpress.com/2025/11/25/the-future-of-software-development-is-software-devel...
94•cdrnsf•9h ago•88 comments

Parsing Advances

https://matklad.github.io/2025/12/28/parsing-advances.html
58•birdculture•5h ago•5 comments

100x (YC S22) Is Hiring a Front End Engineer

1•shardullavekar•4h ago

Show HN: A Claude Code plugin that catch destructive Git and filesystem commands

https://github.com/kenryu42/claude-code-safety-net
21•kenryu•4d ago•22 comments

When someone says they hate your product

https://www.getflack.com/p/responding-to-negative-feedback
120•jger15•9h ago•90 comments

AI is forcing us to write good code

https://bits.logic.inc/p/ai-is-forcing-us-to-write-good-code
113•sgk284•9h ago•96 comments

Static Allocation with Zig

https://nickmonad.blog/2025/static-allocation-with-zig-kv/
174•todsacerdoti•13h ago•85 comments

Geology of the Gulf of the Farallones National Marine Sanctuary

https://pubs.usgs.gov/fs/farallones/
40•greesil•5h ago•12 comments

I migrated to an almost all-EU stack and saved 500€ per year

https://www.zeitgeistofbytes.com/p/bye-bye-big-tech-how-i-migrated-to
92•alexcos•5h ago•46 comments

Flame Graphs vs Tree Maps vs Sunburst (2017)

https://www.brendangregg.com/blog/2017-02-06/flamegraphs-vs-treemaps-vs-sunburst.html
113•gudzpoz•2d ago•29 comments

Kidnapped by Deutsche Bahn

https://www.theocharis.dev/blog/kidnapped-by-deutsche-bahn/
976•JeremyTheo•16h ago•865 comments

Vitest Browser Mode Guide

https://howtotestfrontend.com/resources/vitest-browser-mode-guide-and-setup-info
36•howToTestFE•5d ago•4 comments

A production bug that made me care about undefined behavior

https://gaultier.github.io/blog/the_production_bug_that_made_me_care_about_undefined_behavior.html
126•birdculture•10h ago•73 comments

Stanford Lecture: Dr. Don Knuth – Adventures with Knight's Tours [video]

https://www.youtube.com/watch?v=MKiRte-tnMY
44•vismit2000•5d ago•3 comments

List of domains censored by German ISPs

https://cuiiliste.de/domains
331•elcapitan•10h ago•135 comments

Linux DAW: Help Linux musicians to quickly and easily find the tools they need

https://linuxdaw.org/
211•prmoustache•16h ago•102 comments

Karpathy on Programming: “I've never felt this much behind”

https://twitter.com/karpathy/status/2004607146781278521
375•rishabhaiover•3d ago•413 comments

Show HN: A 45x45 Connections Puzzle To Commemorate 2025=45*45

https://thomaswc.com/2025.html
34•thomaswc•6d ago•6 comments

All Delisted Steam Games

https://delistedgames.com/all-delisted-steam-games/
222•Bondi_Blue•9h ago•96 comments