AIToday
Large Language ModelsZenn AI/MLPublished: Nov 22, 2026, 04:00 JST

1,431 tool calls, 2 hook blocks: written agent rules are only requests

Send on LINE
1,431 tool calls, 2 hook blocks: written agent rules are only requests

3 Key Points

  1. What happened

    A developer logged 1,924 events between 2026-11-12 10:35 and 2026-11-14 02:50 UTC, including 1,431 tool calls; a PreToolUse hook blocked 2 of them, one touching a per-use billing key variable and one a commit that skips checks.

  2. Why it matters

    Only 2 of those 1,431 calls were stopped, both by a hook written to reject exactly those calls — so instructions that live in text entered the model's context and competed with everything else read, while the hook acted as a hard gate that refused the call outright.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The developer's two-day record draws a line between two kinds of control. Text files such as CLAUDE.md and AGENTS.md carry project conventions, and SKILL.md, published at agentskills.io, carries how to do a specific job; Claude Code reads CLAUDE.md, and AGENTS.md is one of the founding projects of the Linux Foundation's Agentic AI Foundation alongside MCP and goose. All three are prose that enters the context, and in long work they compete with everything else the agent has read — the author notes that a standing rule to reply in Japanese dropped out after a long conversation was summarized.

The hook works differently: registered on PreToolUse, it runs just before a tool is used and exits with code 2 to refuse the call, which is then not executed and returns the text from standard error to the agent. The published hook is a few dozen lines under the MIT license; because it matches strings, it misses the short -n flag and can react to a string inside an echo, and it lets calls through when an exception occurs inside it. The author also treats the SKILL.md format as machine-checkable, using Python's standard library to verify rules — name of 1 to 64 lowercase letters, digits, or hyphens matching the folder name, description of 1 to 1,024 characters, compatibility of 500 characters or fewer — and halting shipment of a product ZIP if any SKILL.md fails. A separate caution applies to other people's SKILL.md and MCP settings, which the agent will act on: before installing, the author suggests looking for environment-variable references, URLs other than localhost, commands that send data out, and forms that restore hidden content and pipe it into a shell, treating any finding as material for a judgment call.

FAQ
What is a hook in Claude Code, and how does it refuse a call?
A hook registered on PreToolUse runs just before a tool is used. If it exits with code 2, the call is not executed and the agent receives the text from standard error.
What was the record of leak checks before committing or publishing?
The author counted 125 leak checks before commits or publishing, of which 6 were stopped with exit code 1; each was fixed, re-run, and then published.
What limits does the published hook have?
It matches strings, so it misses the short -n flag, can react to strings inside echo, and lets calls through if an exception occurs inside the hook.
Send on LINE

AI news that matters for your work, delivered every morning.

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

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.

Questions and answers are published on this page.

Related Articles

Next articleLangChain lays out a "knowledge factory" for AI agents