
What happened
The author added a PreToolUse hook to a local Cline and Ollama setup, plus a guard.mjs checker, that cancels tool calls violating three rules and returns the reason to the AI.
Why it matters
Rules alone are requests an AI can forget mid-task, so this hook forces a stop; the guard sits outside the workspace so the AI cannot edit it.
Summaries like this, in your inbox every morning.
The problem this addresses is not malicious AI but helpful AI. Asked to fix a missing package or find a config, an agent may install software system-wide, search the home folder, or call an API to test something — all in good faith, and all capable of breaking a work machine, peeking outside a project, or leaking data.
The author's design splits enforcement into two layers. Rules in a file tell the AI what not to do and how to behave when stopped; the safety hook then inspects the actual tool call before it runs and cancels it if it violates the rules. The hook is written to fail closed: if the checker cannot run or returns nothing, the operation is stopped as a precaution.
The checker sorts tool calls by type — file reads and writes, commands, web access — and matches them against patterns paired with the reason for stopping. That reason is passed back to the AI, which is expected to shift toward asking the user to do the operation instead. Some operations are deliberately allowed, such as pip install inside a project's own virtual environment, to avoid blocking so much that users disable the hook. Web access is restricted to a small self-written MCP server that only issues GET requests, sends no body, strips cookies and auth headers, caps URL and query length, refuses localhost and internal IP addresses, and logs every request. Testing covered 49 decision cases and 11 run cases under the same launch method as Cline, and confirmed fail-closed behavior when guard.mjs was deleted.
Pick your industry and the AI tools you use, and get news related to your work every day.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.
ServiceNow announced AI Passport, a cryptographically signed credential defining an agent's identity, permitte…
Microsoft Agent Framework has ported Semantic Kernel's Python vector-store work forward, keeping typed records…

An unofficial guide for people rolling out Claude Code across a team reports hands-on checks of managed settin…

nohe, an engineer at 株式会社ソニックムーブ, switched to Orca v1.4.224 about a month ago and found the move from a VS Cod…

After Anthropic's Claude Code desktop app update 2.37337.1, an AI-led search of X turned up user complaints ab…

A solo developer built Yurune, a web app that plays synthesized rain, wave and forest sounds and lets users ta…
