<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eugeniu Ghelbur</title>
    <description>The latest articles on DEV Community by Eugeniu Ghelbur (@eugeniughelbur).</description>
    <link>https://dev.to/eugeniughelbur</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4036557%2F8b36891a-3f66-49d8-b5a6-1083a1f6ae0d.jpg</url>
      <title>DEV Community: Eugeniu Ghelbur</title>
      <link>https://dev.to/eugeniughelbur</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eugeniughelbur"/>
    <language>en</language>
    <item>
      <title>Agent memory: how to give Claude and other AI agents a memory that lasts</title>
      <dc:creator>Eugeniu Ghelbur</dc:creator>
      <pubDate>Thu, 26 Nov 2026 18:35:12 +0000</pubDate>
      <link>https://dev.to/eugeniughelbur/agent-memory-how-to-give-claude-and-other-ai-agents-a-memory-that-lasts-25dn</link>
      <guid>https://dev.to/eugeniughelbur/agent-memory-how-to-give-claude-and-other-ai-agents-a-memory-that-lasts-25dn</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agent memory is what an AI agent knows when a new session starts. Without it, every session begins from zero.&lt;/li&gt;
&lt;li&gt;Claude's built-in memory helps, but Claude Code reads only the first 200 lines of MEMORY.md and 10,000 characters of hook text.&lt;/li&gt;
&lt;li&gt;The setup that lasts is plain markdown files, a small recall budget and a nightly cleanup. No vector database needed below about 50,000 notes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every AI agent I use forgets. Claude Code, Codex, Grok Bot: close the session and the decisions, the people and the dead ends are gone. The next session starts from zero, and I explain the same things again.&lt;/p&gt;

&lt;p&gt;I spent most of 2026 fixing that for myself. The result is obsidian-second-brain, a free memory layer that 8 AI agents can share. It has over 5,400 stars on GitHub.&lt;/p&gt;

&lt;p&gt;This guide puts everything I learned in one place. What agent memory is, what Claude already gives you, why agents still forget, and the setup that holds up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is agent memory?
&lt;/h2&gt;

&lt;p&gt;Agent memory is what an AI agent knows at the start of a session without you telling it again. It sits in three layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Working memory.&lt;/strong&gt; The context window: everything in the current chat. It is gone when the session ends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project memory.&lt;/strong&gt; Rules files such as CLAUDE.md or AGENTS.md, read at the start of every session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long-term memory.&lt;/strong&gt; Decisions, people, lessons and history, stored outside the model and pulled in when they matter.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most "my AI forgot" problems are a missing third layer. Models do not learn between your sessions. Whatever your agent knows next week, something outside the model has to store it and hand it back.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the types of agent memory?
&lt;/h3&gt;

&lt;p&gt;Research papers and memory tools sort long-term memory into three kinds. Semantic memory holds facts, like your stack or a client's name. Episodic memory holds what happened, like last week's session and why a fix failed. Procedural memory holds how to do things, like your rules and saved workflows. One notes folder can hold all three: fact notes, a dated log and rules files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9knzg9iw41bm0uxmfjh0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9knzg9iw41bm0uxmfjh0.png" alt="Three stacked layers: working memory (this chat only, gone after session), project memory (rules file), and long-term memory (your notes, lasts)." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What memory does Claude have built in?
&lt;/h2&gt;

&lt;p&gt;Claude gives you three kinds today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chat memory&lt;/strong&gt; in the Claude app, which carries facts across conversations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Projects&lt;/strong&gt;, which hold files and instructions for one topic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto memory&lt;/strong&gt; in Claude Code, which writes a MEMORY.md file per project. It is on by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three remember the project more than they remember you. Auto memory keeps things like a test command or a lint setting. It does not keep why you rejected an idea in March.&lt;/p&gt;

&lt;p&gt;They also have size limits. Claude Code loads only the first 200 lines or 25KB of MEMORY.md. Anything past that point is never read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do AI agents forget?
&lt;/h2&gt;

&lt;p&gt;Agents forget for three reasons, and I have hit all three.&lt;/p&gt;

&lt;h3&gt;
  
  
  The window resets
&lt;/h3&gt;

&lt;p&gt;The context window is the only thing a model sees. When the session ends, it empties. Long sessions get compacted, which means summarized, and the summary drops details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory gets cut without a warning
&lt;/h3&gt;

&lt;p&gt;Hooks are small scripts that can hand Claude your notes when a session starts. Claude Code reads only the first 10,000 characters of that text. Past the limit, it saves the text to a file and shows Claude a 2,000-character preview. Nothing tells you this happened.&lt;/p&gt;

&lt;p&gt;My own hook sent 11,970 characters. 0 of my 20 newest jobs reached Claude, and I found out only because a user reported it. I wrote up &lt;a href="https://theaioperator.io/p/claude-code-memory-forgets-after" rel="noopener noreferrer"&gt;the 10,000-character limit and the fix&lt;/a&gt;: newest items first, and under 10,000 characters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Old notes go stale
&lt;/h3&gt;

&lt;p&gt;Notes do not delete themselves. A decision from June still sits next to the one that replaced it in October. If the agent reads both, it can pick the wrong one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqcyeggpj1y5u5g7n61k0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqcyeggpj1y5u5g7n61k0.png" alt="Three scenes: a window being wiped (window resets), scissors cutting a scroll at 10,000 (text gets cut), and two notes marked June and October (old notes)." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you need a memory tool or a vector database?
&lt;/h2&gt;

&lt;p&gt;Probably not. In October, a study called Memory Tax tested 11 AI memory tools against plain search over the raw chat history. Search won in 90 of 99 head-to-head results. The tools rewrite your history into short notes, and the rewrite drops facts. A second study found no memory tool beat the best search setup. I covered both in &lt;a href="https://theaioperator.io/p/ai-memory-tools-lost-to-search-in" rel="noopener noreferrer"&gt;AI memory tools lost to search&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My own numbers point the same way. In June, my vault search found the right note in the top 10 zero times on 35 test questions. By July, with meaning search running on my own laptop, it found the right note 77% of the time. The fix was better search and cleaner notes, not a new memory product.&lt;/p&gt;

&lt;p&gt;Below about 50,000 notes, plain text search with a hard limit on what it returns beats a vector database. It is faster, and you run nothing extra beside it. I explained &lt;a href="https://theaioperator.io/p/how-i-gave-claude-code-memory-without" rel="noopener noreferrer"&gt;how my recall hook works without a vector database&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you give Claude a memory that lasts?
&lt;/h2&gt;

&lt;p&gt;This is the setup I run, and the one obsidian-second-brain installs. It has five parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One folder of markdown notes.&lt;/strong&gt; An Obsidian vault works. Plain files mean any agent can read them, and you can open and fix any fact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A rules file.&lt;/strong&gt; CLAUDE.md or AGENTS.md tells the agent where the memory lives and how to write to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A recall hook with a budget.&lt;/strong&gt; On each prompt, a hook searches the notes and adds at most 4 notes, about 900 characters. When it is not confident, it adds nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write-back.&lt;/strong&gt; At the end of a task, the agent saves new decisions, people and lessons to the right note.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A nightly cleanup.&lt;/strong&gt; A scheduled agent fixes contradictions, links orphan notes and rebuilds the index, so the next session starts from clean notes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The budget in step 3 matters most. Memory that floods the prompt crowds out the task. Four short notes that fit beat forty that do not. The install takes about 5 minutes, and every step is in &lt;a href="https://theaioperator.io/p/build-an-obsidian-second-brain-every" rel="noopener noreferrer"&gt;the obsidian-second-brain setup guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhy6meehmt9euznkm3lli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhy6meehmt9euznkm3lli.png" alt="A loop of five steps around a notes folder: notes folder, rules file, recall 4 notes, write back, and nightly cleanup." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do several AI agents share one memory?
&lt;/h2&gt;

&lt;p&gt;Point them all at the same folder. That is the whole trick, and it works only because the memory is plain files.&lt;/p&gt;

&lt;p&gt;One codebase in &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain&lt;/a&gt; builds the same commands for 8 agents, including Claude Code, Codex, Gemini and Grok Bot. I run one vault across four command-line agents every day, and most of the 45 commands run on all four.&lt;/p&gt;

&lt;p&gt;Agents also need to know what the others did. Crew, a shared logbook in obsidian-second-brain, records each finished job. So Codex sees what Claude Code did an hour ago.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6273xl9q2td0poziay2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6273xl9q2td0poziay2c.png" alt="Four terminals labeled Claude Code, Codex, Gemini and Grok Bot, all pointing to one folder labeled one vault, with a shared log beneath it." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does agent memory break?
&lt;/h2&gt;

&lt;p&gt;At a few hundred notes, a setup that is only "Claude reads my folder" starts to fail. At 2,000 notes you cannot load the whole vault into context, and simple search misses the chain of cause and effect. Old notes go stale, and nothing prunes them.&lt;/p&gt;

&lt;p&gt;Karpathy's LLM wiki pattern runs into the same wall. I covered &lt;a href="https://theaioperator.io/p/i-rebuilt-karpathys-llm-wiki-heres" rel="noopener noreferrer"&gt;how I rebuilt Karpathy's LLM wiki&lt;/a&gt; so it maintains itself, and &lt;a href="https://theaioperator.io/p/karpathys-llm-wiki-v2-what-to-keep" rel="noopener noreferrer"&gt;what to keep from LLM Wiki v2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The other risk is ownership. Built-in memory lives on someone else's server, inside one product. A file-based memory is yours. You can read every fact, fix the wrong ones and move to a different model later. I compared both in &lt;a href="https://theaioperator.io/p/claude-code-as-a-second-brain-what" rel="noopener noreferrer"&gt;Claude Code as a second brain&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A vault you own can even push back: &lt;a href="https://theaioperator.io/p/i-built-a-tool-that-lets-my-obsidian" rel="noopener noreferrer"&gt;my Obsidian vault argues with me&lt;/a&gt; before I repeat an old mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about a company brain?
&lt;/h2&gt;

&lt;p&gt;The same problem gets bigger in a team. Each person's knowledge sits in their own notes, chats and head, and the agents they use see none of it.&lt;/p&gt;

&lt;p&gt;I tested the two places most teams keep notes. In a 50-note test with Claude, Obsidian and Notion both scored 36 of 36. Obsidian took a median of 27 steps and $0.11 a run. Notion took 64 steps and $0.25.&lt;/p&gt;

&lt;p&gt;Team memory needs more than a shared folder: one home per fact, an owner for each note, and rules for who can change what. That is the next problem I am working on.&lt;/p&gt;

&lt;p&gt;Want the ready-made version? The &lt;a href="https://theaioperator.io/s/vault" rel="noopener noreferrer"&gt;Vault&lt;/a&gt; has AI tools for paid members, each set up in 10 minutes or less.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is memory in AI?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Memory in AI is what a model or agent can recall from before the current request. The model starts fresh every session, so memory is stored outside it and handed back: a rules file, saved notes or a searchable history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Claude have built-in memory?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes. The Claude app saves memory from your chats as topics, and each project keeps its own memory. Claude Code writes a MEMORY.md file per project and loads only the first 200 lines or 25KB of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Claude have memory for free?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes. Memory is on by default for Free, Pro, Max and Ultra plans on the web, desktop and mobile apps. Searching your past chats needs a paid plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the best memory for AI agent?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
For most people, plain notes you own plus good search. In the Memory Tax study, search over the raw history beat 11 memory tools in 90 of 99 results. Below about 50,000 notes you do not need a vector database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use memory for AI agents?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Keep one folder of markdown notes and add a rules file that says where the memory lives. Let a hook add at most 4 relevant notes per prompt, have the agent write new decisions back, and run a nightly cleanup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I share memory between Claude Code and Codex?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Point both at the same folder of markdown notes, and give each a rules file that says where the memory lives. obsidian-second-brain builds this for 8 agents from one codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Agent memory is what an AI agent knows when a session starts, and the model itself never keeps it between sessions.&lt;/li&gt;
&lt;li&gt;Claude Code reads only the first 200 lines or 25KB of MEMORY.md, and only 10,000 characters of hook text.&lt;/li&gt;
&lt;li&gt;Plain search beat 11 AI memory tools in 90 of 99 results in the 2026 Memory Tax study.&lt;/li&gt;
&lt;li&gt;A recall budget of about 4 notes per prompt keeps memory from crowding out the task.&lt;/li&gt;
&lt;li&gt;Plain markdown files let several AI agents share one memory, and let you fix any wrong fact by hand.&lt;/li&gt;
&lt;li&gt;A memory that is only "the agent reads my folder" breaks at a few hundred notes without a cleanup.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;Claude Code memory docs&lt;/a&gt;, Anthropic&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2610.34073" rel="noopener noreferrer"&gt;Memory Tax paper&lt;/a&gt;, arXiv, October 2026&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f" rel="noopener noreferrer"&gt;Karpathy's LLM Wiki gist&lt;/a&gt;, Andrej Karpathy&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.anthropic.com/research/components-of-agent-memory" rel="noopener noreferrer"&gt;The components of agent memory&lt;/a&gt;, Anthropic&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the author
&lt;/h2&gt;

&lt;p&gt;I'm Eugeniu Ghelbur, an AI Automation Engineer working on agent memory. I built &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain&lt;/a&gt;, an open-source memory layer that 8 AI agents can share. It's MIT-licensed and starred by over 5,400 people on GitHub. I write The AI Operator.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post first ran on &lt;a href="https://theaioperator.io/p/agent-memory" rel="noopener noreferrer"&gt;The AI Operator&lt;/a&gt;, my newsletter on AI agents and agent memory.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>llm</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Claude Code Hooks Decoded: Rules That Actually Run</title>
      <dc:creator>Eugeniu Ghelbur</dc:creator>
      <pubDate>Thu, 26 Nov 2026 18:34:56 +0000</pubDate>
      <link>https://dev.to/eugeniughelbur/claude-code-hooks-decoded-rules-that-actually-run-1442</link>
      <guid>https://dev.to/eugeniughelbur/claude-code-hooks-decoded-rules-that-actually-run-1442</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code hooks are shell commands the runtime runs on set events. Those events include a tool call, session start, stop and a file change. Hooks run outside the model, and a failing exit code can block the action. Use them only for rules that must never break, like a secret scan or the tests.&lt;/li&gt;
&lt;li&gt;A rule written in CLAUDE.md is a request. A hook is a rule.&lt;/li&gt;
&lt;li&gt;One survey of 2,500 public Claude Code repos found hooks in 13.3% of them, so most projects run on requests.&lt;/li&gt;
&lt;li&gt;The order that worked in mine: write the promise, add a check that fails, then wire the gate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Someone opened an issue on my repo two weeks ago that I could not argue with.&lt;/p&gt;

&lt;p&gt;The bootstrap message printed a line saying Claude reads your &lt;code&gt;_CLAUDE.md&lt;/code&gt; automatically on every session. A contributor named motkoning pointed out that this is true only when three separate pieces of wiring are all in place: a SessionStart hook, an environment variable pointing at the vault, and a session actually started inside that vault. Miss one and the file sits there doing nothing while the message says otherwise.&lt;/p&gt;

&lt;p&gt;He was right. That sentence had been in the repo for months. It read like enforcement. It enforced nothing.&lt;/p&gt;

&lt;p&gt;That gap is what this post is about. It is not a bug in Claude Code. It is a bug in how most of us write rules for coding agents, mine included, and after four rounds of it I can finally describe the shape.&lt;/p&gt;




&lt;h2&gt;
  
  
  The failure class nobody names
&lt;/h2&gt;

&lt;p&gt;Open any repo built for Claude Code and you find a &lt;code&gt;CLAUDE.md&lt;/code&gt; full of rules. Never commit secrets. Always run the tests before you claim done. Use sentence case in headers.&lt;/p&gt;

&lt;p&gt;None of those are rules. They are requests, written in prose, read by a model that decides fresh each time whether to follow them. Most sessions it follows them. The sessions it does not are the ones that teach you the difference, usually in public.&lt;/p&gt;

&lt;p&gt;I wrote about &lt;a href="https://theaioperator.io/p/the-claudemd-behind-a-tool-3000-developers" rel="noopener noreferrer"&gt;what belongs in a CLAUDE.md&lt;/a&gt; back in July, and I stand by the file. What I got wrong was the assumption underneath it: that a well-written instruction and an enforced constraint are the same category of thing. They are not even close.&lt;/p&gt;

&lt;p&gt;The clean test is one question. If the model ignores this line, does anything stop?&lt;/p&gt;

&lt;p&gt;For every rule in my &lt;code&gt;CLAUDE.md&lt;/code&gt;, the honest answer was no.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1o1bs3ib1u3g0apq6woa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1o1bs3ib1u3g0apq6woa.png" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why can't CLAUDE.md enforce a rule?
&lt;/h2&gt;

&lt;p&gt;CLAUDE.md is context. The model reads it, weighs it against everything else in the window, and can skip it, more so after compaction. A hook is code the runtime runs whether the model agrees or not, and its exit code can stop the action. The &lt;a href="https://code.claude.com/docs/en/hooks" rel="noopener noreferrer"&gt;Claude Code hooks reference&lt;/a&gt; lists every event you can attach one to.&lt;/p&gt;

&lt;p&gt;The reason is structural, not a matter of prompt quality.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is context. It gets loaded into the window, competes with everything else in there, survives or does not survive compaction, and then gets interpreted. A long file makes this worse, because the instruction that matters is now sharing space with forty that do not.&lt;/p&gt;

&lt;p&gt;Hooks sit somewhere else entirely. A hook is a shell command the runtime fires on a lifecycle event: before a tool call, after a tool call, on session start, on stop, on a file change. It is not read by the model. It runs whether the model wanted it to or not, and its exit code can block the action outright.&lt;/p&gt;

&lt;p&gt;That is the whole distinction. Instructions live inside the model’s judgment. Hooks live outside it.&lt;/p&gt;

&lt;p&gt;The consensus that formed in the docs and the community over the last few months puts it in three lines: a skill teaches the how, a hook enforces the rule, a subagent isolates the work. Useful, and it is where I would start if you are choosing between them today.&lt;/p&gt;

&lt;p&gt;What almost nobody publishes is the cost of learning it the other way round.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx9ig708fhp7hrlv2pqec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx9ig708fhp7hrlv2pqec.png" alt="Two stacked lanes. Top lane labelled INSTRUCTION shows a purple card entering a box crammed with overlapping paper slips labelled CONTEXT WINDOW, exiting into a large navy question mark. Bottom lane labelled HOOK shows an identical card entering a teal cog labelled RUNTIME EVENT, exiting into a solid rust orange bar labelled BLOCKED." width="799" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug three people found four times
&lt;/h2&gt;

&lt;p&gt;Here is the expensive version of the lesson.&lt;/p&gt;

&lt;p&gt;My repo has a tokenizer that splits a search query into terms. The original version split on whitespace and dropped anything shorter than three characters. That works in English and destroys Chinese and Japanese, where a two-character word is a normal word.&lt;/p&gt;

&lt;p&gt;SylvesterTee filed it first, as issue 159. I fixed it in &lt;code&gt;vault_ops.py&lt;/code&gt; and closed the issue.&lt;/p&gt;

&lt;p&gt;Then P1uxozor filed it again on a different command. A copy of the same tokenizer lived there too. Fixed, closed.&lt;/p&gt;

&lt;p&gt;Then hamidasiblog filed it again, on the abstention gate. Same logic, third copy. Fixed, closed.&lt;/p&gt;

&lt;p&gt;Then hamidasiblog filed it a fourth time, as issue 212, on the NotebookLM command. And in that report they suggested a grep, which found a fourth copy I did not know about.&lt;/p&gt;

&lt;p&gt;Three different people. Four issues. One root cause, copied by hand into four files over months, each copy quietly aging past the fix.&lt;/p&gt;

&lt;p&gt;My &lt;code&gt;CLAUDE.md&lt;/code&gt; already said not to duplicate logic. It said it clearly. It said it in a file the model reads every session. Four copies grew anyway, because a sentence in a document has no way to fail.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnws6i5vgegw2rnx47x3j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnws6i5vgegw2rnx47x3j.png" alt="A purple rounded terminal window glyph labelled ONE TOKENIZER at top. Four arrows fan down to four identical green file pages labelled ISSUE 159, ISSUE 188, ISSUE 192 and ISSUE 212. A rust orange brace spans all four labelled THREE PEOPLE." width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The fence that made the fifth copy impossible
&lt;/h2&gt;

&lt;p&gt;The fix for issue 212 was not another patch.&lt;/p&gt;

&lt;p&gt;I moved the tokenizer into one shared module, pointed every caller at it, and then added a test whose only job is to fail if a copy ever regrows in that directory. Not a warning. Not a note in the contributing guide. A test in the suite that turns red.&lt;/p&gt;

&lt;p&gt;I call it a fence. It does not explain the rule to anyone. It makes the rule impossible to break without the build telling you.&lt;/p&gt;

&lt;p&gt;The suite went from 591 tests to 607 across that window, and most of those new tests are this shape: not proving a feature works, but making a specific past mistake unrepeatable.&lt;/p&gt;

&lt;p&gt;A week later the same principle caught me. I pushed a commit that was green on my machine and red in CI, because a new test imported a module whose top-level import needed an optional package that CI does not install. Local green was not CI green. The gate held and the instruction in my head did not.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fko3raqj75x5nbg0dkwu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fko3raqj75x5nbg0dkwu6.png" alt="Four green file pages on the left converge into a single teal block labelled SHARED MODULE. To its right stands a mustard picket fence carrying a rust orange sign reading TEST RED, and past the fence a dashed empty page outline labelled CANNOT REGROW." width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When a hook is the wrong answer
&lt;/h2&gt;

&lt;p&gt;The obvious next move is to convert every rule into a hook. I tried a version of that and stopped.&lt;/p&gt;

&lt;p&gt;My repo builds for seven agent surfaces, not just Claude Code. One of them is the Codex CLI, and the write-time validation hook that guards note quality only works where the host actually fires hooks. Claude Code does. Codex, at the time I looked, does not.&lt;/p&gt;

&lt;p&gt;The tempting fix was to ship the hooks directory into the Codex build anyway so the layout matched. I decided against it, and the reason is the entire point of this post: a hook directory with no host wiring reads as enforcement and enforces nothing. That is the exact bug I had spent two weeks closing. Shipping it as a fix would have been the same lie with better file structure.&lt;/p&gt;

&lt;p&gt;So instead the docs got scoped. The guide now says which platform the hook ships on, and the Codex install page has a section titled with what is not included. Honest documentation is worse than a working gate and much better than a fake one.&lt;/p&gt;

&lt;p&gt;Same logic applies to smaller cases. Hooks that run on every tool call add latency to every tool call. Hooks holding flexible business logic get brittle, and hidden constraints confuse the next person. A rule that is genuinely a preference belongs in prose. Only the non-negotiable ones earn a gate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqd0h6b9ctbzzebc6nlwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqd0h6b9ctbzzebc6nlwi.png" alt="The trap on the other side. An unwired hook is a better-looking lie. Alt: A purple electrical plug held a visible gap short of a grey wall socket, the gap marked in rust orange, labelled LOOKS ENFORCED. On the right, a green document page with one squiggled line beside a navy checkmark, labelled SAYS THE TRUTH." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you turn a CLAUDE.md rule into a hook?
&lt;/h2&gt;

&lt;p&gt;Use three steps. Write the rule in plain words first. Then write a check that goes red on a real past mistake, like a test that fails. Then wire that check to an event: PreToolUse to block, PostToolUse to validate, Stop to gate the finish. A survey of 2,500 public Claude Code repos found hooks in only 13.3% of them.&lt;/p&gt;

&lt;p&gt;If I were setting this up again on a fresh repo, this is the sequence.&lt;/p&gt;

&lt;p&gt;Write the rule in prose first. You need to know what you mean before you can enforce it, and most rules die at this step because they turn out to be preferences.&lt;/p&gt;

&lt;p&gt;Then write the check that catches the violation. A test, a lint, a script that exits non-zero. Run it against a real past failure and confirm it actually goes red, because a check that cannot fail is another promise.&lt;/p&gt;

&lt;p&gt;Then wire it to an event so nobody has to remember to run it. PreToolUse to block, PostToolUse to validate, Stop to gate the finish, a file-change event for the fast stuff.&lt;/p&gt;

&lt;p&gt;Prose, check, gate. In that order, and only for the rules where a miss actually costs something.&lt;/p&gt;

&lt;p&gt;The measured picture says most projects have not done step three. That survey of 2,500 public repos found hooks in 13.3% of them, and the GitHub topic for Claude Code hooks lists a couple hundred repos total. Interest is loud and adoption is thin, which is a strange place for a feature this cheap to install.&lt;/p&gt;

&lt;p&gt;My honest read after four rounds of the same bug: I did not have a discipline problem. I had a wiring problem, and I kept trying to solve it by writing better sentences. The &lt;a href="https://theaioperator.io/p/claude-code-as-a-second-brain-what" rel="noopener noreferrer"&gt;second-brain setup I run on Claude Code&lt;/a&gt; works now for one boring reason. The parts that must not break are gates, and everything else is allowed to be advice. All of it is in the open, at &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;github.com/eugeniughelbur/obsidian-second-brain&lt;/a&gt;, issues included.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What are Claude Code hooks?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Hooks are shell commands the Claude Code runtime fires on lifecycle events such as before a tool call, after a tool call, session start, stop, or a file change. They run outside the model, so they execute whether or not the model decided to follow an instruction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between a hook and a CLAUDE.md rule?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A &lt;code&gt;CLAUDE.md&lt;/code&gt; rule is context the model reads and may or may not follow. A hook is code the runtime executes, and its exit code can block the action. Instructions rely on judgment, hooks do not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When should I use a hook instead of a skill or a subagent?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Use a hook when something must always happen, a skill when you want a reusable procedure the agent pulls in when relevant, and a subagent when the work needs its own isolated context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do Claude Code hooks slow things down?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A hook wired to a frequent event runs on every one of those events, so a slow hook on PreToolUse is felt on every tool call. Keep frequent hooks cheap and push heavier checks onto Stop or a file-change event.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I just put everything in CLAUDE.md instead?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can, and most repos do. It works until the session where the model deprioritizes your line, and you find out that nothing was ever checking. Keep preferences in prose, and move the non-negotiables to gates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why did the same bug get reported four times in one repo?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Because the fix landed in one file while three hand-made copies of the same logic lived elsewhere, and a written no-duplication rule cannot fail. A shared module plus a test that goes red on a new copy fixed it structurally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A rule in &lt;code&gt;CLAUDE.md&lt;/code&gt; is a request read by a model. A hook is code the runtime runs regardless.&lt;/li&gt;
&lt;li&gt;The test for any agent rule you have written: if the model ignores this line, does anything stop?&lt;/li&gt;
&lt;li&gt;One survey of 2,500 public Claude Code repos found hooks in 13.3% of them, so most projects are running on requests.&lt;/li&gt;
&lt;li&gt;The same root bug was reported four times by three different people because a written no-duplication rule has no way to fail.&lt;/li&gt;
&lt;li&gt;A test that goes red when a past mistake reappears is worth more than the paragraph explaining the mistake.&lt;/li&gt;
&lt;li&gt;A hook directory with no host wiring reads as enforcement and enforces nothing, which is worse than honest documentation.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://code.claude.com/docs/en/hooks" rel="noopener noreferrer"&gt;Claude Code hooks reference&lt;/a&gt; - the full event surface, exit-code semantics, and hook types.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://code.claude.com/docs/en/hooks-guide" rel="noopener noreferrer"&gt;Automate actions with hooks&lt;/a&gt; - the official guide to deterministic control over formatting, validation, and project rules.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain/issues/212" rel="noopener noreferrer"&gt;Issue 212 in obsidian-second-brain&lt;/a&gt; - the fourth report of the same tokenizer bug, and the grep that found the copy I missed.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://theaioperator.io/p/the-claudemd-behind-a-tool-3000-developers" rel="noopener noreferrer"&gt;The CLAUDE.md behind a tool 3,000 developers use&lt;/a&gt; - what belongs in the file, and what does not.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://theaioperator.io/p/claude-code-as-a-second-brain-what" rel="noopener noreferrer"&gt;Claude Code as a second brain&lt;/a&gt; - the setup these gates protect.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About the author
&lt;/h2&gt;

&lt;p&gt;I'm Eugeniu Ghelbur, an AI Automation Engineer working on agent memory. I built &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain&lt;/a&gt;, an open-source memory layer that 8 AI agents can share. It's MIT-licensed and starred by over 5,400 people on GitHub. I write The AI Operator.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post first ran on &lt;a href="https://theaioperator.io/p/claude-code-hooks-decoded-rules-that" rel="noopener noreferrer"&gt;The AI Operator&lt;/a&gt;, my newsletter on AI agents and agent memory.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>devtools</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Claude Code on Windows: 13 Checks I Could Not Trust</title>
      <dc:creator>Eugeniu Ghelbur</dc:creator>
      <pubDate>Thu, 26 Nov 2026 18:34:41 +0000</pubDate>
      <link>https://dev.to/eugeniughelbur/claude-code-on-windows-13-checks-i-could-not-trust-5g8h</link>
      <guid>https://dev.to/eugeniughelbur/claude-code-on-windows-13-checks-i-could-not-trust-5g8h</guid>
      <description>&lt;p&gt;Claude Code hooks can fail silently on Windows when they call python3. On most Windows machines that name points to a Microsoft Store placeholder, not Python. It exists, prints nothing, and exits with code 9009. A hook that only checks whether python3 exists will skip the real work and still report success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On 14 September I shipped v0.16.0 of a tool 4,449 people run, and named it The Silent Failure. Thirteen of its fixes are checks that stopped matching reality.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The worst one let a note containing an API key pass a secret scan for ten days on every Windows install, because the scan never ran and said nothing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A check that cannot fail loudly is decoration. A check that fires when nothing is wrong is worse, because you train yourself to ignore it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most bug reports arrive as a crash. You get a stack trace, a line number, and a bad afternoon.&lt;/p&gt;

&lt;p&gt;The reports in this release were different. Almost none of them crashed. The tool ran, returned success, and did the wrong thing quietly. Some of it had been doing that for ten days across every Windows install.&lt;/p&gt;

&lt;p&gt;I maintain &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain&lt;/a&gt;, an open-source tool that runs an Obsidian vault as a knowledge base an agent can read. It has 4,449 stars, so it runs on a lot of machines that are nothing like mine. That is the only reason I found any of this.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one that actually mattered
&lt;/h2&gt;

&lt;p&gt;My tool has a write-time check that runs every time an agent writes a note. Among other things, it scans for secrets, so an API key pasted into a note never reaches a commit.&lt;/p&gt;

&lt;p&gt;On Windows, that scan did not run. It reported success anyway.&lt;/p&gt;

&lt;p&gt;A note holding an &lt;code&gt;sk-&lt;/code&gt; key wrote clean on every Windows install for ten days, between the previous release and this one. Nobody was told. The check was there, the check was listed, the check passed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx7lmk393t0x94xd9h4wp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx7lmk393t0x94xd9h4wp.png" alt="Hand-drawn sketchnote of a document carrying a key labelled sk- walking under a raised gate barrier. The inspection lamp above is unlit and labelled never ran, and a green tick beside it reads reported clean." width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The secret scan was listed, was passed, and never executed.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One wrong word broke three checks
&lt;/h2&gt;

&lt;p&gt;All three Windows failures in &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain/releases/tag/v0.16.0" rel="noopener noreferrer"&gt;obsidian-second-brain v0.16.0&lt;/a&gt; came from one word: the hooks called python3. On Windows that is a Store alias. My code checked that python3 existed before running the checks, the alias passed, and a secret scan skipped every write for ten days while reporting success.&lt;/p&gt;

&lt;p&gt;All three Windows failures trace to a single line: my hooks called &lt;code&gt;python3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On macOS and Linux that is Python. On Windows it is usually a Microsoft Store alias, a placeholder that exists so the system can offer to install Python for you. It exists, it prints nothing, and it exits with an error code.&lt;/p&gt;

&lt;p&gt;Here is why that was so quiet. My code tested whether &lt;code&gt;python3&lt;/code&gt; existed before running the checks. The alias exists. So the test passed, the checks were skipped, and nothing complained.&lt;/p&gt;

&lt;p&gt;That is the whole bug. A test for presence instead of a test for function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi53hyxxivsq65r8d1jwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi53hyxxivsq65r8d1jwa.png" alt=" Hand-drawn sketchnote of two gates. The left asks is it there and lets a hollow dotted placeholder through. The right asks did it work and stops it." width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A Microsoft Store placeholder passes an existence test every time.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The general shape
&lt;/h3&gt;

&lt;p&gt;Any check that asks “is the tool there” instead of “did the tool do the work” has this hole. Presence is cheap to test and proves nothing.&lt;/p&gt;

&lt;p&gt;I wrote about this before in &lt;a href="https://theaioperator.io/p/what-a-harness-is" rel="noopener noreferrer"&gt;what a harness is&lt;/a&gt;: instructions are requests, gates are code. This release was the bill for a gate I had written as a request.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lie that was worse than the silence
&lt;/h2&gt;

&lt;p&gt;One report was worse than a silent skip.&lt;/p&gt;

&lt;p&gt;Claude Code caps the text a startup hook can inject at 10,000 characters. Anything longer is cut, and the session gets a short preview instead.&lt;/p&gt;

&lt;p&gt;My hook loaded the vault’s operating manual at startup. On a real vault that manual runs well past the cap. So the session received a fragment, under a header that told it the manual was already loaded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnejdm1hxowaevkbgy8fy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnejdm1hxowaevkbgy8fy.png" alt=" Hand-drawn sketchnote of a manual with most pages torn off into a pile labelled cut at 10,000 chars, while a banner across the remaining stub reads fully loaded." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The truncation was fine. The header claiming it was fully loaded was not.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Read that again, because the failure is not the truncation. The truncation is a documented platform limit and fine. The failure is that my own header asserted something false, so the agent had no way to know it was working from a fragment.&lt;/p&gt;

&lt;p&gt;A tool that goes quiet costs you a bug. A tool that reports success it did not earn costs you your judgment, because you then spend a week debugging the wrong layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The other direction: checks that screamed for nothing
&lt;/h2&gt;

&lt;p&gt;Half of this release is the opposite failure, and I think it is underrated.&lt;/p&gt;

&lt;p&gt;A user with a Chinese vault found that my write-time check blocked every single write. The check flags unusual characters that language models slip in, like a curly quote where a straight one belongs. Chinese uses those same characters as its ordinary punctuation. So the check called correct Chinese a violation, on every write, with no way to turn it off.&lt;/p&gt;

&lt;p&gt;Another user with a Cyrillic vault ran my health command and was told most of the vault was missing from its search index. The index held every note. Two scripts disagreed about how to spell a non-English filename, and the report believed the wrong one.&lt;/p&gt;

&lt;p&gt;A third case recommended a repair that could never work. The health check warned about notes a user had deliberately excluded, then told them to rebuild the index to fix it. Rebuilding excluded them again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4wqypo90bipgo76vcyhs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4wqypo90bipgo76vcyhs.png" alt="Hand-drawn sketchnote of one alarm bell between a sleeping figure labelled said nothing and a figure covering its ears labelled cried wolf." width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Saying nothing and crying wolf are the same bug wearing different clothes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These are not milder than silence. A check that fires when nothing is wrong gets ignored within a week, and after that it is the same as having no check.&lt;/p&gt;

&lt;h2&gt;
  
  
  The failure you cannot see at all
&lt;/h2&gt;

&lt;p&gt;One report was the hardest to accept, because nothing was broken.&lt;/p&gt;

&lt;p&gt;Two processes edited the same note. Both writes succeeded. The later one won, and the earlier edit was gone. No error, no conflict, no trace.&lt;/p&gt;

&lt;p&gt;Each individual write was already atomic, so the write was never the race. The gap was the read, change, write sequence that every caller performs. A scheduled agent, a second session, or a sync client landing an edit inside that gap just vanished.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Facclqry4bmgftm9nl11t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Facclqry4bmgftm9nl11t.png" alt="Hand-drawn sketchnote of two pencils writing on one page from opposite sides. One hand of text has faded away labelled lost no error, the other is solid and labelled won." width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Both writes succeed. One edit is gone and nothing reports it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the failure mode that arrives with parallel agents, and it is going to bite a lot of people this year. If you run several agents at once against the same files, you are running this race.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why I did not use a lock
&lt;/h3&gt;

&lt;p&gt;The obvious fix is a lock file. I rejected it for three reasons worth stating, because they generalize.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A lock drops files into a vault that is backed by git and replicated by a sync tool, so the lock itself becomes synced litter.&lt;/li&gt;
&lt;li&gt;Locking needs a second implementation on Windows, and I had just spent a release learning what I do not know about Windows.&lt;/li&gt;
&lt;li&gt;It would not have covered the reported case anyway. An edit landing on disk from a sync client holds no lock.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What I shipped instead is a check on the way out. Before writing, confirm the file still holds the bytes you read. If it does not, refuse and say so. The tiny window that remains is documented rather than hidden.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I changed structurally
&lt;/h2&gt;

&lt;p&gt;Four rules came out of this release, and they apply to any agent tooling, not just mine.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test the work, not the tool.&lt;/strong&gt; Never ask whether a binary exists. Ask whether it produced the output you needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assert your checks ran.&lt;/strong&gt; A skipped check must be an error, not a silence. If a scan cannot run, the write should fail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never label output you did not verify.&lt;/strong&gt; Do not write “loaded” unless you counted the bytes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let users switch off a rule that misfires.&lt;/strong&gt; My punctuation check had no escape hatch, which is why it broke an entire language.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I still cannot verify
&lt;/h2&gt;

&lt;p&gt;I do not own a Windows machine.&lt;/p&gt;

&lt;p&gt;Both Windows fixes are tested against a stub that behaves the way the report described: it exists, prints nothing, exits with code 9009. That is a reproduction of the symptom, not a test on real hardware. One branch of the fix cannot be exercised on macOS or Linux at all.&lt;/p&gt;

&lt;p&gt;So the honest status is that two fixes are unverified in the environment they target. That limitation is written into the release notes. The issue stays open for anyone on Windows to tell me it is still broken.&lt;/p&gt;

&lt;p&gt;I would rather publish that sentence than a version number that implies more than I tested. Three of these bugs came from one person filing reproductions that actually reproduced, and two more came from someone who fixed both himself. That is the only reason any of it got found, and it is worth more than my test suite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why do Claude Code hooks fail silently on Windows?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Usually because the hook calls &lt;code&gt;python3&lt;/code&gt;, which on Windows is often a Microsoft Store placeholder rather than Python. It exists, prints nothing, and exits with an error, so any code that checks whether it exists will skip the real work and report success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I know if my Claude Code hook is actually running?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Do not check that the interpreter exists. Make the hook write a line of output or a timestamp on every run, and treat a missing line as a failure. If a check cannot execute, it should fail loudly rather than pass quietly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a silent failure in AI tooling?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Any case where the tool returns success while doing the wrong thing or nothing. It costs more than a crash because it looks identical to working, so you keep trusting the output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can two AI agents safely edit the same file?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Not without a guard. If both read the file, change it, and write it back, the later write silently erases the earlier one. Confirm the file still holds the bytes you read before writing, and refuse if it does not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does my AI tool flag correct Chinese or Russian text as an error?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Most character checks are written for English and treat non-English punctuation or non-Latin filenames as anomalies. It is a rule written against one alphabet, not a problem with your text. The rule needs a way to be switched off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is an open-source tool with thousands of users better tested?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It is better reported, which is not the same thing. Users on machines unlike mine find the failures my test suite cannot reach, and this release exists entirely because four of them wrote detailed reports.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A check that asks whether a tool exists, rather than whether it did the work, will pass on a placeholder and skip everything silently.&lt;/li&gt;
&lt;li&gt;A skipped security check must raise an error. Mine did not, so a note holding an API key wrote clean for ten days on every Windows install.&lt;/li&gt;
&lt;li&gt;Reporting success you did not earn is worse than reporting nothing, because it sends people to debug the wrong layer.&lt;/li&gt;
&lt;li&gt;A check that fires when nothing is wrong gets ignored within a week, which makes it equivalent to no check at all.&lt;/li&gt;
&lt;li&gt;Two agents editing one file will silently lose an edit unless you confirm the bytes are unchanged before writing.&lt;/li&gt;
&lt;li&gt;Publishing what you could not verify is cheaper than a version number that implies more testing than you did.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About the author
&lt;/h2&gt;

&lt;p&gt;I'm Eugeniu Ghelbur, an AI Automation Engineer working on agent memory. I built &lt;a href="https://github.com/eugeniughelbur/obsidian-second-brain" rel="noopener noreferrer"&gt;obsidian-second-brain&lt;/a&gt;, an open-source memory layer that 8 AI agents can share. It's MIT-licensed and starred by over 5,400 people on GitHub. I write The AI Operator.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post first ran on &lt;a href="https://theaioperator.io/p/claude-code-on-windows-13-checks" rel="noopener noreferrer"&gt;The AI Operator&lt;/a&gt;, my newsletter on AI agents and agent memory.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claude</category>
      <category>windows</category>
      <category>ai</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
