<?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: Myeongseok Kang</title>
    <description>The latest articles on DEV Community by Myeongseok Kang (@dooly6276).</description>
    <link>https://dev.to/dooly6276</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%2F4234438%2F89e062ec-a530-40e6-a623-370f9df31b22.png</url>
      <title>DEV Community: Myeongseok Kang</title>
      <link>https://dev.to/dooly6276</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dooly6276"/>
    <language>en</language>
    <item>
      <title>Search engines quietly drop part of your site: query. I measured where Google, Bing, DuckDuckGo and Brave stop reading</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Tue, 24 Nov 2026 05:49:10 +0000</pubDate>
      <link>https://dev.to/dooly6276/search-engines-quietly-drop-part-of-your-site-query-i-measured-where-google-bing-duckduckgo-and-4p4k</link>
      <guid>https://dev.to/dooly6276/search-engines-quietly-drop-part-of-your-site-query-i-measured-where-google-bing-duckduckgo-and-4p4k</guid>
      <description>&lt;p&gt;A lot of people search the way I do now: type the question, then add &lt;code&gt;reddit&lt;/code&gt; at the end, or &lt;code&gt;site:reddit.com OR site:news.ycombinator.com OR ...&lt;/code&gt; when one site is not enough. The top results for anything with money behind it (product reviews, how-to guides, "best X for Y") are increasingly pages written to rank, and the answer usually sits in a forum thread, a first-hand review or a primary source further down. A 2024 study, &lt;a href="https://link.springer.com/chapter/10.1007/978-3-031-56063-7_4" rel="noopener noreferrer"&gt;Is Google Getting Worse?&lt;/a&gt;, tracked 7,392 product review queries on Google, Bing and DuckDuckGo for a year and found top results strongly linked to affiliate marketing on all three.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;site:&lt;/code&gt; operator fixes most of that, and every major engine supports it. What I did not know until I built a tool around it is that every engine also stops reading your query at some point, without telling you. If you paste twenty sites after your words, some of them are simply not searched, and the results page looks exactly as if they were.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I measured it
&lt;/h2&gt;

&lt;p&gt;The test is simple enough to repeat by hand. Search for one common word, then add made-up &lt;code&gt;site:&lt;/code&gt; domains that have no pages at all, joined with &lt;code&gt;OR&lt;/code&gt;, and put &lt;code&gt;site:reddit.com&lt;/code&gt; last. If Reddit threads appear in the results, the engine read the whole query. Add one more fake domain and try again. When the Reddit results disappear and the page shows results from everywhere instead, you have found the point where the engine stopped reading. For the length limits I padded the query with longer fake domains and watched for the engine's error page.&lt;/p&gt;

&lt;p&gt;These are the numbers from November 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;Words and sites it reads (&lt;code&gt;OR&lt;/code&gt; not counted)&lt;/th&gt;
&lt;th&gt;Length limit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Google&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;none found before the word limit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bing&lt;/td&gt;
&lt;td&gt;60 and more (no limit found)&lt;/td&gt;
&lt;td&gt;about 1,750 characters: 1,777 gave a full page of results, 1,822 only four&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DuckDuckGo&lt;/td&gt;
&lt;td&gt;about 22&lt;/td&gt;
&lt;td&gt;about 500 bytes, then it shows its home page (493 worked, 505 did not)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brave Search&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;about 400 characters, then "Your query is too long" (394 worked, 410 did not)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Google's 32-word limit has been known among search power users for a long time, so that one was expected. What surprised me is how quiet all of them are. Google and DuckDuckGo give no sign that anything was ignored. A list of 25 forums that works on Bing searches only the first few on Brave once your question is more than a couple of words long. And because the cut happens at the end of the query, the sites you typed last are the ones that disappear, together with any &lt;code&gt;-site:&lt;/code&gt; exclusions you put after them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means in practice
&lt;/h2&gt;

&lt;p&gt;If you keep a long &lt;code&gt;site:&lt;/code&gt; list in a text file and paste it into searches, three things help. Put your own words first and keep them short, since every word counts against the same budget as the sites. Put the sites you care most about at the front of the list. And if you use exclusions like &lt;code&gt;-site:pinterest.com&lt;/code&gt; together with included sites, drop the exclusions: once you name the sites to search, results can only come from them anyway, so the exclusions only use up room.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tool I built around it
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://github.com/dooly6276/sourcepick" rel="noopener noreferrer"&gt;Sourcepick&lt;/a&gt; to stop doing this by hand. It keeps lists of sites as sources (forums, Reddit, Q&amp;amp;A sites, first-hand reviews, papers, government and statistics sites, official docs, and Korean and Japanese communities, 69 sources with 793 sites in total) and applies them with one click on Google, Bing, DuckDuckGo or Brave Search. Every search is fitted to the limits above before the URL is built. When the chosen sites do not all fit, the app says how many it searched and lets you search the rest one site at a time.&lt;/p&gt;

&lt;p&gt;The browser extension adds a row of source buttons under the search box on the results page. The query in the address bar carries the full &lt;code&gt;site:&lt;/code&gt; list, but the search box and the tab title show only your words, so you can edit the question and press Enter without wading through operators, and the same sources stay applied. There is also a web app at &lt;a href="https://sourcepick.toolnjoy.com/" rel="noopener noreferrer"&gt;sourcepick.toolnjoy.com&lt;/a&gt; that works on phones and can be added to the home screen. On Android it appears in the share sheet, so you can select text in any app and search it with your sources.&lt;/p&gt;

&lt;p&gt;Sourcepick has no account, no server and no analytics. Settings stay in the browser, and the search goes straight to the engine you picked. The source lists are plain JSON files in the repository, so adding a missing site is a one-line pull request. The code is strict TypeScript with no runtime dependencies, under the MIT license.&lt;/p&gt;

&lt;p&gt;Version 0.4.0 is out now. The extension for Chrome, Edge, Brave and Firefox is on the &lt;a href="https://github.com/dooly6276/sourcepick/releases/latest" rel="noopener noreferrer"&gt;releases page&lt;/a&gt; while the store listings are in review, and the measuring method above is described in the repository's architecture notes if you want to check the numbers on your own engine.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I am the author of Sourcepick. I wrote this post with some help from an AI assistant for editing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Ten coding-agent deletions, traced to the shell command that ran</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Sat, 14 Nov 2026 18:06:45 +0000</pubDate>
      <link>https://dev.to/dooly6276/ten-coding-agent-deletions-traced-to-the-shell-command-that-ran-25jf</link>
      <guid>https://dev.to/dooly6276/ten-coding-agent-deletions-traced-to-the-shell-command-that-ran-25jf</guid>
      <description>&lt;p&gt;Between September and November this year, several incidents were made public in which a coding agent deleted user files or killed unrelated processes. They came from Claude Code, Codex, Antigravity and opencode alike. Most write-ups stop at "the agent ran rm -rf", but when you look at the actual commands, the agent almost never set out to delete something broad. In most cases a command meant to remove one narrow folder ended up pointing somewhere else because of shell evaluation order, quote handling, the return value of a path tool, or a link.&lt;/p&gt;

&lt;p&gt;This post covers only the cases where the executed command can be confirmed from the original source (GitHub issues, Reddit posts and their attached screenshots). For each one it explains why the command did something other than what was intended, and what form to use when doing the same job. Where a cause could be reproduced, I reproduced it on macOS and Windows 11 (Windows PowerShell 5.1, Git for Windows 2.52, WSL2), and the results are noted in each case. The reproductions used &lt;code&gt;echo&lt;/code&gt; and throwaway test folders instead of real deletion targets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;Agent&lt;/th&gt;
&lt;th&gt;Command that ran&lt;/th&gt;
&lt;th&gt;What actually happened&lt;/th&gt;
&lt;th&gt;Safer form&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/109735" rel="noopener noreferrer"&gt;claude-code#109735&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (Windows, WSL)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;wsl -- bash -lc '...R=~/dir; rsync -a --delete src/ $R/'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Outer shell expanded &lt;code&gt;$R&lt;/code&gt; to empty, rsync synced to &lt;code&gt;/&lt;/code&gt; and deleted files under &lt;code&gt;/mnt/d&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;wsl --exec&lt;/code&gt; or a script file inside WSL, &lt;code&gt;"${R:?}/"&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.reddit.com/r/google_antigravity/comments/1xpbc54/" rel="noopener noreferrer"&gt;r/google_antigravity&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Antigravity (Windows)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cmd /c "rmdir /s /q \"D:\My Documents\...\profile\""&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;cmd received &lt;code&gt;rmdir /s /q \&lt;/code&gt; and deleted from the root of D:&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Remove-Item -LiteralPath '...' -Recurse -Force&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/openai/codex/issues/43343" rel="noopener noreferrer"&gt;codex#43343&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Codex CLI (Windows)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cmd.exe /d /c "rd /s /q \"\\?\$resolved\""&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deleted several repositories under the volume root instead of the build folder&lt;/td&gt;
&lt;td&gt;Same as above; build the cmd string in single quotes and print it first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/95426" rel="noopener noreferrer"&gt;claude-code#95426&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (Windows, Git Bash)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rm -rf "$(cygpath -u 'C:\')" 2&amp;gt;/dev/null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deleted all of &lt;code&gt;/c/&lt;/code&gt;, about 600GB&lt;/td&gt;
&lt;td&gt;Put the target in a variable, print it, stop if it is a root&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/anomalyco/opencode/issues/62825" rel="noopener noreferrer"&gt;opencode#62825&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;opencode (Windows)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$home = Join-Path ...; Remove-Item -Recurse -Force (Split-Path $home)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Assignment to &lt;code&gt;$home&lt;/code&gt; failed, &lt;code&gt;C:\Users&lt;/code&gt; was deleted&lt;/td&gt;
&lt;td&gt;Avoid automatic variable names, set &lt;code&gt;$ErrorActionPreference = 'Stop'&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.reddit.com/r/ClaudeCode/comments/1xqfp7m/" rel="noopener noreferrer"&gt;r/ClaudeCode&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (macOS)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;find&lt;/code&gt; output piped through &lt;code&gt;xargs -n1 dirname&lt;/code&gt; into &lt;code&gt;xargs rm -rf&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Path split at a space, &lt;code&gt;~/Library&lt;/code&gt; deleted&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-print0&lt;/code&gt; with &lt;code&gt;xargs -0&lt;/code&gt;, or &lt;code&gt;find -exec rm -rf -- {} +&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/openai/codex/issues/42355" rel="noopener noreferrer"&gt;codex#42355&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Codex CLI (Windows)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git clean -fdX -- config/&amp;lt;subpath&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deleted the whole ignored parent folder &lt;code&gt;config/&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Check first with &lt;code&gt;git clean -ndX&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.reddit.com/r/ClaudeAI/comments/1xsgltl/" rel="noopener noreferrer"&gt;r/ClaudeAI&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (Windows)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git worktree remove --force &amp;lt;worktree&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deleted a model folder of about 230GB that a junction inside the worktree pointed to&lt;/td&gt;
&lt;td&gt;Remove the link first, then remove without &lt;code&gt;--force&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/107274" rel="noopener noreferrer"&gt;claude-code#107274&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (macOS)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;rm -rf&lt;/code&gt; (including &lt;code&gt;.git&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Lost more than 12 months of git history&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git worktree remove&lt;/code&gt;; move &lt;code&gt;.git&lt;/code&gt; aside&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/109627" rel="noopener noreferrer"&gt;claude-code#109627&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Claude Code (macOS)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pkill -f "gcloud.py compute" -u &amp;lt;user&amp;gt; --signal 0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Killed every other Claude Code session and about 66 apps&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pgrep -f&lt;/code&gt; to check existence, kill by PID&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The sections below group the cases by type of root cause rather than by agent, because the same cause showed up in nearly the same form across different agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. When a command passes through two shells, the outer one interprets it first
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A variable passed through WSL (claude-code#109735)
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://github.com/anthropics/claude-code/issues/109735" rel="noopener noreferrer"&gt;#109735&lt;/a&gt;, filed on November 14, a subagent working on Windows ran the following command to make a WSL copy of the project folder. The user had left it running overnight without approvals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl -d Ubuntu-24.04 -- bash -lc &lt;span class="s1"&gt;'set -u; R=~/some-dir; mkdir -p $R; rsync -a --delete --exclude ... /mnt/d/&amp;lt;project&amp;gt;/ $R/; ...'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent expected &lt;code&gt;$R&lt;/code&gt; to be expanded by the inner bash, but &lt;code&gt;wsl.exe&lt;/code&gt; hands the arguments after &lt;code&gt;--&lt;/code&gt; to the default Linux shell, which interprets them once more. That outer shell has no &lt;code&gt;R&lt;/code&gt;, so &lt;code&gt;$R&lt;/code&gt; becomes an empty string, and the command the inner bash receives is &lt;code&gt;rsync -a --delete /mnt/d/&amp;lt;project&amp;gt;/ /&lt;/code&gt;. &lt;code&gt;set -u&lt;/code&gt; is a setting of the inner bash, so it could not help once the expansion had already happened. rsync deleted the files under &lt;code&gt;/&lt;/code&gt; that a normal user could delete, and that included the Windows data drive mounted at &lt;code&gt;/mnt/d&lt;/code&gt;. Files deleted from WSL do not go to the Recycle Bin.&lt;/p&gt;

&lt;p&gt;Testing the same structure with &lt;code&gt;echo&lt;/code&gt; on WSL2 under Windows 11 shows the difference directly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;wsl&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="n"&gt;bash&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;lc&lt;/span&gt; &lt;span class="s1"&gt;'R=hello; echo "[R=$R]"'&lt;/span&gt;         &lt;span class="c1"&gt;# [R=]&lt;/span&gt;
&lt;span class="n"&gt;wsl&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="n"&gt;bash&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;lc&lt;/span&gt; &lt;span class="s1"&gt;'R=hello; echo "[R=$R]"'&lt;/span&gt;     &lt;span class="c1"&gt;# [R=hello]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--exec&lt;/code&gt; runs the program directly with no intermediate shell, so the quoted content reaches the inner bash unchanged. A more reliable approach is to put the script in a file inside WSL and run that file. If the target of a delete or a &lt;code&gt;--delete&lt;/code&gt; sync is a variable, write it as &lt;code&gt;"${R:?}/"&lt;/code&gt; so the shell stops with an error when the value is empty, and start with &lt;code&gt;rsync -n&lt;/code&gt; to see what would be deleted.&lt;/p&gt;

&lt;p&gt;Two more things in this issue are worth recording beyond the command itself. When the parent agent stopped the subtask, &lt;code&gt;wsl.exe&lt;/code&gt; on the Windows side exited, but rsync inside WSL kept running for about two more minutes. And the subagent's first damage report was that the documents folder was unaffected. rsync does not print the files it deletes successfully, so the absence of error lines proves nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quotes passed from PowerShell to cmd (Antigravity, codex#43343)
&lt;/h3&gt;

&lt;p&gt;A &lt;a href="https://www.reddit.com/r/google_antigravity/comments/1xpbc54/" rel="noopener noreferrer"&gt;post&lt;/a&gt; on r/google_antigravity on November 6 (651 points) includes a screenshot of the explanation Antigravity itself wrote up after the incident. To delete &lt;code&gt;D:\My Documents\Projects\_scratch_sitevideo\profile&lt;/code&gt;, the agent ran this from PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="s2"&gt;"rmdir /s /q \"D:\My Documents\Projects\_scratch_sitevideo\profile\""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PowerShell's escape character is the backtick, not the backslash. So the string ends at the quote in &lt;code&gt;\"&lt;/code&gt;, and the first argument becomes &lt;code&gt;rmdir /s /q \&lt;/code&gt;. The rest is split again at the space in &lt;code&gt;My Documents&lt;/code&gt;. Replacing &lt;code&gt;rmdir&lt;/code&gt; with &lt;code&gt;echo&lt;/code&gt; in Windows PowerShell 5.1 to see what cmd receives gives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="nb"&gt;rmdir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; \ &lt;span class="no"&gt;D&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;\&lt;span class="nc"&gt;My&lt;/span&gt; &lt;span class="nc"&gt;Documents&lt;/span&gt;\&lt;span class="nc"&gt;Projects&lt;/span&gt;\&lt;span class="n"&gt;_scratch&lt;/span&gt;\&lt;span class="n"&gt;profile&lt;/span&gt;\
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In cmd, a lone &lt;code&gt;\&lt;/code&gt; is the root of the current drive. According to the screenshot, the deletion went through the top-level folders of D: in alphabetical order, and in the roughly 19 seconds before the agent noticed a permission error on &lt;code&gt;$RECYCLE.BIN&lt;/code&gt; and stopped, the &lt;code&gt;Epic Games&lt;/code&gt; folder (about 9GB) was deleted. The poster was reviewing commands one at a time, and wrote that they approved this one because at a glance it did not look broad.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/openai/codex/issues/43343" rel="noopener noreferrer"&gt;#43343&lt;/a&gt;, filed in the Codex repository on September 7, has the same cause. Deleting a build folder with &lt;code&gt;Remove-Item&lt;/code&gt; failed on a file with the reserved name &lt;code&gt;NUL&lt;/code&gt;, so Codex switched to cmd with a &lt;code&gt;\\?\&lt;/code&gt; prefixed path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="s2"&gt;"rd /s /q \"\\?\$resolved\""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent had just checked that &lt;code&gt;$resolved&lt;/code&gt; matched the build folder, but that value did not reach cmd intact. The reporter confirmed through the NTFS USN journal that several repositories outside the working folder were deleted, and wrote that deletion continued for several minutes after Codex reported that it had stopped.&lt;/p&gt;

&lt;p&gt;When deleting a folder from PowerShell, the simplest approach is to not go through cmd at all.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Remove&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Item&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;LiteralPath&lt;/span&gt; &lt;span class="s1"&gt;'D:\My Documents\Projects\_scratch\profile'&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Recurse&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-LiteralPath&lt;/code&gt; also does not interpret wildcard characters such as square brackets. If you must use cmd, build the string for cmd in single quotes and print what cmd receives with &lt;code&gt;echo&lt;/code&gt; once before running it. In the test setup above, &lt;code&gt;cmd /c 'echo rmdir /s /q "D:\My Documents\Projects\_scratch\profile"'&lt;/code&gt; passed the path as one piece. When a variable has to go in, build the string first, as in &lt;code&gt;$line = 'rd /s /q "\\?\' + $resolved + '"'&lt;/code&gt;, print it, and then run &lt;code&gt;cmd /d /c $line&lt;/code&gt;. That way you can see where the shell will split it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The computed path was a root
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A drive root returned by cygpath (claude-code#95426)
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://github.com/anthropics/claude-code/issues/95426" rel="noopener noreferrer"&gt;#95426&lt;/a&gt;, on September 16, Claude Code in Git Bash on Windows ran the following command, which the user had not asked for, with the stated reason of cleaning up stale test state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rm -rf &lt;span class="s2"&gt;"$(cygpath -u 'C:\')"&lt;/span&gt; 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cygpath -u 'C:\'&lt;/code&gt; returns &lt;code&gt;/c/&lt;/code&gt; (confirmed with the cygpath that ships with Git for Windows). The value is not empty, so &lt;code&gt;${VAR:?}&lt;/code&gt; would not catch it, and quoting does not change the result. Because stderr was discarded, the permission errors that system folders should have produced were never seen, and about 600GB was deleted over about 35 minutes. &lt;code&gt;~/.claude/projects&lt;/code&gt;, which held the session logs, was deleted too, so the original session did not survive.&lt;/p&gt;

&lt;p&gt;As the reporter pointed out, even if a permission prompt had appeared, what it shows is the expression &lt;code&gt;$(cygpath ...)&lt;/code&gt;, not the result &lt;code&gt;/c/&lt;/code&gt;. When deleting by a computed path, add a separate step: put it in a variable, print it, and stop if it is a root or home.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;T&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(cygpath -u "&lt;/span&gt;&lt;span class="nv"&gt;$WIN_PATH&lt;/span&gt;&lt;span class="s2"&gt;")"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Delete target: $T"&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"$T"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
  /&lt;span class="o"&gt;|&lt;/span&gt;/?&lt;span class="o"&gt;|&lt;/span&gt;/?/&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"$HOME"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"$HOME"&lt;/span&gt;/&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Refusing, root or home: $T"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt; 1 &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
rm -rf -- &lt;span class="s2"&gt;"${T:?}/build"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you append a fixed subfolder name as in the last line, then even if the earlier computation returns a root, the deletion is limited to that subfolder. Do not add &lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; to delete commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  An unassigned PowerShell automatic variable (opencode#62825)
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://github.com/anomalyco/opencode/issues/62825" rel="noopener noreferrer"&gt;opencode#62825&lt;/a&gt;, the agent ran these two lines to clean up a temp folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$home&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Join&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Path&lt;/span&gt; &lt;span class="nv"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;TEMP&lt;/span&gt; &lt;span class="s2"&gt;"qml-shot\home"&lt;/span&gt;
&lt;span class="nc"&gt;Remove&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Item&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Recurse&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Force&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Split&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Path&lt;/span&gt; &lt;span class="nv"&gt;$home&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ErrorAction&lt;/span&gt; &lt;span class="nc"&gt;SilentlyContinue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PowerShell variable names are case-insensitive, so &lt;code&gt;$home&lt;/code&gt; is the automatic variable &lt;code&gt;$HOME&lt;/code&gt;, which is read-only. The assignment on the first line fails, but that error does not stop the script. Checking in Windows PowerShell 5.1: after &lt;code&gt;$home = "X"&lt;/code&gt;, the next line still runs, &lt;code&gt;$home&lt;/code&gt; is &lt;code&gt;C:\Users\&amp;lt;user&amp;gt;&lt;/code&gt;, and &lt;code&gt;Split-Path $home&lt;/code&gt; returns &lt;code&gt;C:\Users&lt;/code&gt;. So the second line recursively deleted &lt;code&gt;C:\Users&lt;/code&gt;, and &lt;code&gt;-ErrorAction SilentlyContinue&lt;/code&gt; hid the errors for files that were in use and could not be deleted. The reporter wrote that their opencode config, &lt;code&gt;~/.cargo/bin&lt;/code&gt;, &lt;code&gt;~/.bun&lt;/code&gt; and &lt;code&gt;~/.local/bin&lt;/code&gt; were deleted, and that because opencode recreated its config folder on the next run, they first mistook it for an update problem.&lt;/p&gt;

&lt;p&gt;Do not use automatic variable names such as &lt;code&gt;$home&lt;/code&gt;, &lt;code&gt;$profile&lt;/code&gt;, &lt;code&gt;$input&lt;/code&gt;, &lt;code&gt;$args&lt;/code&gt;, &lt;code&gt;$pwd&lt;/code&gt; or &lt;code&gt;$host&lt;/code&gt; as temporary variables, and put &lt;code&gt;$ErrorActionPreference = 'Stop'&lt;/code&gt; on the first line of cleanup scripts so execution stops at the failed assignment. Do not add &lt;code&gt;-ErrorAction SilentlyContinue&lt;/code&gt; to delete commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A path passed as text was split again
&lt;/h2&gt;

&lt;h3&gt;
  
  
  xargs and Application Support (r/ClaudeCode)
&lt;/h3&gt;

&lt;p&gt;In a &lt;a href="https://www.reddit.com/r/ClaudeCode/comments/1xqfp7m/" rel="noopener noreferrer"&gt;post&lt;/a&gt; on r/ClaudeCode on November 7 that passed 4,000 points, &lt;code&gt;~/Library&lt;/code&gt; on macOS was deleted. The agent was trying to delete five test channels it had created earlier, and those files lived under &lt;code&gt;~/Library/Application Support/&lt;/code&gt;. The agent computed the parent folders with &lt;code&gt;xargs -n1 dirname&lt;/code&gt; and passed them to &lt;code&gt;rm -rf&lt;/code&gt;. The poster wrote that they were running with &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; and that the deletion ran for about two minutes while they were away.&lt;/p&gt;

&lt;p&gt;By default, xargs splits input on spaces and newlines. Here is the result with a test folder of the same shape on macOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ find . -path &lt;span class="s1"&gt;'*ch1'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; xargs -n1 dirname
./Library
Support/app
$ find . -path &lt;span class="s1"&gt;'*ch1'&lt;/span&gt; -print0 &lt;span class="o"&gt;|&lt;/span&gt; xargs -0 -n1 dirname
./Library/Application Support/app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The path is split in two at the space in &lt;code&gt;Application Support&lt;/code&gt;, and &lt;code&gt;dirname&lt;/code&gt; of the first piece is &lt;code&gt;Library&lt;/code&gt;. When passing paths to another command, pair &lt;code&gt;-print0&lt;/code&gt; with &lt;code&gt;xargs -0&lt;/code&gt;, and when deleting, it is better to let &lt;code&gt;find&lt;/code&gt; do it directly with no pipe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="s2"&gt;"$HOME/Library/Application Support/myapp"&lt;/span&gt; -maxdepth 1 -type d -name &lt;span class="s1"&gt;'test-*'&lt;/span&gt; -exec rm -rf -- &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; +
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is one more point in this case. What needed deleting was five channels, but the command was shaped to delete their parent folder. When cleaning up things an agent created itself, recording the paths at creation time and deleting only those paths is narrower than computing a parent folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The command's scope was wider than expected
&lt;/h2&gt;

&lt;h3&gt;
  
  
  git clean removing an entire ignored parent folder (codex#42355)
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://github.com/openai/codex/issues/42355" rel="noopener noreferrer"&gt;codex#42355&lt;/a&gt;, the user asked to delete only a few unused subfolders under &lt;code&gt;config/&lt;/code&gt;, and Codex ran &lt;code&gt;git clean -fdX -- config/&amp;lt;subpath&amp;gt;&lt;/code&gt;. &lt;code&gt;config/&lt;/code&gt; was listed in &lt;code&gt;.gitignore&lt;/code&gt;, and git deleted all of &lt;code&gt;config/&lt;/code&gt;. It contained API key files and operational scripts, and they were not included in the partial backup the agent had made.&lt;/p&gt;

&lt;p&gt;Building the same structure with git 2.56 reproduces this behavior exactly. Even when you specify a path inside an ignored folder, git treats that folder as a single unit, and the dry run already shows it will remove &lt;code&gt;config/&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ git clean -ndX -- config/skills/old
Would remove config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always run &lt;code&gt;git clean&lt;/code&gt; with &lt;code&gt;-n&lt;/code&gt; first to see the list, and stop if a folder above the path you specified shows up. If the job is to delete a few folders, specifying those paths directly is clearer in scope than &lt;code&gt;git clean&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A junction inside a worktree (r/ClaudeAI)
&lt;/h3&gt;

&lt;p&gt;In a &lt;a href="https://www.reddit.com/r/ClaudeAI/comments/1xsgltl/" rel="noopener noreferrer"&gt;post&lt;/a&gt; on r/ClaudeAI on November 10, a real model folder (about 230GB) and a &lt;code&gt;.venv&lt;/code&gt; were deleted while two old git worktrees were being cleaned up on Windows. The agent explained that it had checked whether the worktrees' remaining changes had been merged into the main branch, but had not checked whether the worktrees contained directory junctions pointing at real folders. The poster stated that this is the agent's own explanation and not an independently confirmed cause.&lt;/p&gt;

&lt;p&gt;I built the same structure with test folders on Windows 11 and Git for Windows 2.52. With a junction inside the worktree pointing at an outside folder, running &lt;code&gt;git worktree remove --force&lt;/code&gt; deleted the files inside the folder the junction pointed to. In the same state without &lt;code&gt;--force&lt;/code&gt;, git refused with "contains modified or untracked files". After first removing the junction with &lt;code&gt;cmd /c rmdir &amp;lt;junction&amp;gt;&lt;/code&gt; (without &lt;code&gt;/s&lt;/code&gt;), the worktree was removed normally without &lt;code&gt;--force&lt;/code&gt; and the target folder survived. For reference, in the same environment, &lt;code&gt;Remove-Item -Recurse -Force&lt;/code&gt; in Windows PowerShell 5.1 did not delete files beyond the junction. Whether a tool follows links differs by tool and version, so rather than assuming some tool is safe, it is more reliable to find and remove the links first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;AL&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;S&lt;/span&gt; &lt;span class="s2"&gt;"D:\project-wt-old"&lt;/span&gt;       &lt;span class="c1"&gt;# list junctions and symlinks&lt;/span&gt;
&lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="n"&gt;rmdir&lt;/span&gt; &lt;span class="s2"&gt;"D:\project-wt-old\models"&lt;/span&gt;     &lt;span class="c1"&gt;# remove only the link, no /s&lt;/span&gt;
&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;worktree&lt;/span&gt; &lt;span class="n"&gt;remove&lt;/span&gt; &lt;span class="s2"&gt;"D:\project-wt-old"&lt;/span&gt;     &lt;span class="c1"&gt;# without --force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A message saying &lt;code&gt;--force&lt;/code&gt; is required means something is still left in the worktree. When you see it, look at what is left before forcing anything.&lt;/p&gt;

&lt;h3&gt;
  
  
  The .git folder (claude-code#107274)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/107274" rel="noopener noreferrer"&gt;#107274&lt;/a&gt;, reported on macOS, is short. It says more than 12 months of git history were lost to a mistaken &lt;code&gt;rm -rf&lt;/code&gt;, and the exact command was not made public. The lesson is still clear: files in the working tree can be recreated, but if &lt;code&gt;.git&lt;/code&gt; is deleted, unpushed commits, branches and stashes go with it.&lt;/p&gt;

&lt;p&gt;To clean up a checkout, use &lt;code&gt;git worktree remove&lt;/code&gt;. If you need to recreate a repository, do not delete &lt;code&gt;.git&lt;/code&gt;; move it aside, as in &lt;code&gt;mv .git ../repo.git.bak&lt;/code&gt;. For a repository with no remote, &lt;code&gt;git bundle create ../repo-backup.bundle --all&lt;/code&gt; keeps the entire history as a single file outside the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. How a process-kill command parsed its arguments (claude-code#109627)
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://github.com/anthropics/claude-code/issues/109627" rel="noopener noreferrer"&gt;#109627&lt;/a&gt;, the target was processes rather than files. On macOS, a subagent in a workflow ran this to check whether a gcloud process was still alive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pkill -f &lt;span class="s2"&gt;"gcloud.py compute"&lt;/span&gt; -u &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;user&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --signal 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--signal 0&lt;/code&gt; is Linux procps syntax, and signal 0 only checks for existence. The BSD pkill on macOS has no long options, so it read &lt;code&gt;--signal&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; as additional patterns and sent the default signal, SIGTERM, to every process matching any of the patterns. &lt;code&gt;0&lt;/code&gt; appears in almost every command line. As a result, about 66 processes were terminated, including every Claude Code session other than this one, the Claude desktop app, Slack and Chrome helpers. The instructions given to the agent even included a sentence telling it not to kill gcloud.&lt;/p&gt;

&lt;p&gt;Testing the same arguments on macOS with &lt;code&gt;pgrep&lt;/code&gt;, which only lists, &lt;code&gt;pgrep -f "&amp;lt;nonexistent name&amp;gt;" -u "$USER" --signal 0&lt;/code&gt; returns more than 400 processes even for a name that does not exist. This is because BSD argument parsing does not treat arguments after the first pattern as options. To check existence, use &lt;code&gt;pgrep -f 'gcloud.py compute'&lt;/code&gt;, and if termination is needed, read the PID from that output and end it with &lt;code&gt;kill &amp;lt;pid&amp;gt;&lt;/code&gt;. On macOS, always put options before the pattern.&lt;/p&gt;

&lt;h2&gt;
  
  
  What repeated across the cases
&lt;/h2&gt;

&lt;p&gt;The commands differed, but a few things came up in several cases.&lt;/p&gt;

&lt;p&gt;First, most were cleanup tasks: cleaning up test state (#95426), a temp folder (opencode), a build folder (codex#43343), test channels (r/ClaudeCode), a temporary browser profile (Antigravity), and old worktrees (r/ClaudeAI). These were steps the agent added on its own before or after the main task, and in some cases the user had not asked for them.&lt;/p&gt;

&lt;p&gt;Second, options that hide errors made the damage worse. &lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; (#95426) and &lt;code&gt;-ErrorAction SilentlyContinue&lt;/code&gt; (opencode) suppressed permission errors, which are the first signal that a delete has started on the wrong target.&lt;/p&gt;

&lt;p&gt;Third, deletion continued after stopping, and the first damage report was wrong. In #109735, rsync inside WSL ran for about two more minutes after the task was stopped, and in codex#43343, deletion continued for several minutes after Codex reported that it had stopped. The "unaffected" report in #109735 was found to be wrong a few hours later.&lt;/p&gt;

&lt;p&gt;Fourth, 7 of the 10 cases were on Windows. At the center of the cause was a setup in which a command is reinterpreted one or more times as it passes between PowerShell, cmd, Git Bash and WSL.&lt;/p&gt;

&lt;h2&gt;
  
  
  What helps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Command habits
&lt;/h3&gt;

&lt;p&gt;Collecting the forms from the cases above: when deleting through a variable, use &lt;code&gt;"${VAR:?}/fixed-name"&lt;/code&gt; so an empty value stops the shell and a fixed subfolder name narrows the scope. Print computed paths before deleting, and stop if they are a root or home. When passing paths through a pipe, use &lt;code&gt;-print0 | xargs -0&lt;/code&gt; or handle them with &lt;code&gt;find -exec&lt;/code&gt;. In PowerShell, use &lt;code&gt;Remove-Item -LiteralPath&lt;/code&gt; without going through cmd, avoid automatic variable names, and set &lt;code&gt;$ErrorActionPreference = 'Stop'&lt;/code&gt;. When passing commands into WSL, use &lt;code&gt;wsl --exec&lt;/code&gt; or a script file. In folders that may contain links, remove the links first, and run &lt;code&gt;git worktree remove&lt;/code&gt; and &lt;code&gt;git clean&lt;/code&gt; without &lt;code&gt;--force&lt;/code&gt;, or with &lt;code&gt;-n&lt;/code&gt; first. Do not add error-hiding options to deletes or &lt;code&gt;--delete&lt;/code&gt; syncs. You can write these habits into the agent's instruction file (CLAUDE.md, AGENTS.md and so on), but as #109627 shows, sentences in the instructions can still be violated, so instructions alone are hard to call sufficient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Permission prompts
&lt;/h3&gt;

&lt;p&gt;Making the agent ask for confirmation on every command lets a person see and stop many incidents. These cases also showed the limits, though. As the #95426 reporter pointed out, the prompt shows the expression &lt;code&gt;$(cygpath ...)&lt;/code&gt;, not its result. The Antigravity poster reviewed the command and still approved it, and commenters said they would not have noticed even if a prompt had appeared. In a reply on the issue, an opencode maintainer explained that permission rules match only the command string, so they cannot catch paths computed at run time or deletions inside script files. Claude Code checkpoints, according to the &lt;a href="https://code.claude.com/docs/en/checkpointing" rel="noopener noreferrer"&gt;official docs&lt;/a&gt;, do not revert files changed only by Bash commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sandboxes and virtual machines
&lt;/h3&gt;

&lt;p&gt;A sandbox that limits writes to the working folder reduces the blast radius no matter where a computation points. Claude Code's &lt;a href="https://code.claude.com/docs/en/sandboxing" rel="noopener noreferrer"&gt;sandbox&lt;/a&gt; allows writes only to the working folder and temp folders on macOS, Linux and WSL2, but according to the same docs, commands run without a sandbox when running natively on Windows. That is worth reading alongside the fact that many of these cases were on Windows. A virtual machine, a container, or a separate low-privilege account has the same effect, but if a host drive is mounted writable at &lt;code&gt;/mnt/d&lt;/code&gt; as in #109735, that drive is not outside the isolation boundary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backups outside the repository
&lt;/h3&gt;

&lt;p&gt;Whatever mistake an agent makes, the last line of defense is a backup. The r/ClaudeCode poster wrote that they had no backup (and later added that they recovered most of the important data). The codex#42355 user restored the API keys from a backup they had made separately, and the codex#43343 reporter recovered most of it from the remote repository and the IDE's local history. You need a copy somewhere other than the folder the agent works in: a remote push, &lt;code&gt;git bundle&lt;/code&gt;, or Time Machine on macOS (right after a deletion, &lt;code&gt;tmutil listlocalsnapshots /&lt;/code&gt; shows local snapshots).&lt;/p&gt;

&lt;h3&gt;
  
  
  Pre-execution hooks
&lt;/h3&gt;

&lt;p&gt;Claude Code, Codex, Gemini CLI and others support hooks that call a user script before a tool runs, where the command can be read and blocked. &lt;a href="https://github.com/Dicklesworthstone/destructive_command_guard" rel="noopener noreferrer"&gt;destructive_command_guard&lt;/a&gt; (dcg), recommended in the comments of the Antigravity post, is a hook written in Rust that blocks destructive filesystem, git, database and other commands, and can be wired into several agents. The #95426 reporter also wrote that after the incident they built their own hook that asks for confirmation on every recursive delete, and the issue comments introduce several hooks made by others.&lt;/p&gt;

&lt;p&gt;Hooks have limits too. Most read the command string, so they cannot see commands inside script files the agent runs, and they cannot know values computed at run time. As a comment on #95426 pointed out, a hook cannot block based on the result of &lt;code&gt;$(cygpath ...)&lt;/code&gt;; the only option is to block the &lt;code&gt;rm -rf&lt;/code&gt; action itself, and confirmation requests grow accordingly. So a hook is best seen as one of several layers, used together with the habits, sandboxes and backups above.&lt;/p&gt;

&lt;p&gt;I maintain one such pre-execution hook, &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, and several of the cases in this post were the starting point for its rules.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>bash</category>
      <category>windows</category>
      <category>git</category>
    </item>
    <item>
      <title>Cinco borrados reales hechos por agentes de IA este otoño y cómo prevenir cada uno</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Sat, 14 Nov 2026 07:28:25 +0000</pubDate>
      <link>https://dev.to/dooly6276/cinco-borrados-reales-hechos-por-agentes-de-ia-este-otono-y-como-prevenir-cada-uno-22oc</link>
      <guid>https://dev.to/dooly6276/cinco-borrados-reales-hechos-por-agentes-de-ia-este-otono-y-como-prevenir-cada-uno-22oc</guid>
      <description>&lt;p&gt;Este otoño se publicaron varios informes de agentes de programación (Claude Code, opencode y otros) que borraron cosas que no se podían recuperar. Los leí uno por uno. Casi ninguno es un agente "que se volvió loco": son comandos normales que reciben una entrada distinta de la esperada. Por eso cada caso tiene una prevención concreta que sirve también cuando el comando lo escribe una persona.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Una variable vacía en &lt;code&gt;rm -rf&lt;/code&gt; o &lt;code&gt;rsync --delete&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rm -rf &lt;span class="s2"&gt;"$BUILD_DIR"&lt;/span&gt;/*
rsync -a --delete src/ &lt;span class="nv"&gt;$R&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Si &lt;code&gt;BUILD_DIR&lt;/code&gt; o &lt;code&gt;R&lt;/code&gt; llegan vacíos, el primero se convierte en &lt;code&gt;rm -rf /*&lt;/code&gt; y el segundo sincroniza contra la raíz. En &lt;a href="https://github.com/anthropics/claude-code/issues/109735" rel="noopener noreferrer"&gt;anthropics/claude-code#109735&lt;/a&gt; un &lt;code&gt;rsync --delete&lt;/code&gt; en WSL terminó apuntando a &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Prevención: &lt;code&gt;"${BUILD_DIR:?}"&lt;/code&gt;. Con &lt;code&gt;:?&lt;/code&gt; la shell se detiene con un error si la variable está vacía o no existe, en lugar de seguir con una ruta truncada.&lt;/p&gt;

&lt;p&gt;Un caso cercano es #95426: &lt;code&gt;rm -rf "$(cygpath -u 'C:\')"&lt;/code&gt; como limpieza después de unas pruebas. &lt;code&gt;cygpath&lt;/code&gt; devolvió &lt;code&gt;/c/&lt;/code&gt;, la unidad entera, y la persona perdió unos 600 GB. Aquí &lt;code&gt;:?&lt;/code&gt; no ayuda porque el valor no está vacío. Lo que sirve es guardar la ruta en una variable, imprimirla y comprobar que está dentro del proyecto antes de borrar.&lt;/p&gt;

&lt;p&gt;Un caso parecido en PowerShell: &lt;code&gt;Remove-Item -Recurse -Force (Split-Path $home)&lt;/code&gt; (anomalyco/opencode#62825). &lt;code&gt;$home&lt;/code&gt; es una variable automática de PowerShell con la carpeta del usuario, así que &lt;code&gt;Split-Path $home&lt;/code&gt; es la carpeta que contiene a todos los usuarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Espacios en rutas que pasan por &lt;code&gt;xargs&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find . -name &lt;span class="s1"&gt;'*.tmp'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; xargs -n1 dirname &lt;span class="o"&gt;|&lt;/span&gt; xargs rm -rf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;xargs&lt;/code&gt; separa por espacios. Una ruta como &lt;code&gt;~/Library/Application Support/...&lt;/code&gt; se parte en dos y una de las mitades es &lt;code&gt;~/Library&lt;/code&gt;. Una publicación en r/ClaudeCode con unos 4.000 puntos contaba exactamente eso: se fue &lt;code&gt;~/Library&lt;/code&gt; entero.&lt;/p&gt;

&lt;p&gt;Prevención: &lt;code&gt;find ... -print0 | xargs -0&lt;/code&gt;, que separa por el carácter nulo y no por espacios.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;rm -rf .git&lt;/code&gt; en un repositorio que ya existe
&lt;/h2&gt;

&lt;p&gt;En #107274 el agente quería "empezar limpio" y borró &lt;code&gt;.git&lt;/code&gt; en un repositorio con 12 meses de historial sin subir a ningún remoto.&lt;/p&gt;

&lt;p&gt;Prevención: hacer push a menudo, aunque sea a una rama de respaldo, y no aceptar nunca un borrado de &lt;code&gt;.git&lt;/code&gt; en un repositorio con commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Un enlace dentro de una carpeta que se borra
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git worktree remove --force&lt;/code&gt; (o un borrado recursivo en PowerShell) sobre una carpeta que contiene una junction o un enlace simbólico a datos de fuera. En Windows algunas herramientas siguen el enlace y borran el destino. En r/ClaudeAI alguien perdió así unos 230 GB de modelos que estaban fuera del worktree.&lt;/p&gt;

&lt;p&gt;Prevención: antes de borrar una carpeta temporal, buscar enlaces dentro (&lt;code&gt;find . -type l&lt;/code&gt;, o &lt;code&gt;dir /AL /S&lt;/code&gt; en Windows) y quitarlos primero.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;code&gt;pkill&lt;/code&gt; con un patrón demasiado amplio
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pkill -f node&lt;/code&gt; o &lt;code&gt;killall node&lt;/code&gt; para "reiniciar el servidor" también mata los servidores de otras sesiones y aplicaciones de escritorio hechas con Node. En macOS &lt;code&gt;pkill -f cat&lt;/code&gt; coincide con todo lo que está bajo &lt;code&gt;/Applications&lt;/code&gt;, porque "Applications" contiene "cat". Y en #109627, &lt;code&gt;pkill ... --signal 0&lt;/code&gt; en macOS no se interpretó como se esperaba y mandó SIGTERM a todas las demás sesiones de Claude Code abiertas.&lt;/p&gt;

&lt;p&gt;Prevención: matar por PID. &lt;code&gt;lsof -nP -iTCP:3000 -sTCP:LISTEN&lt;/code&gt; da el proceso que tiene el puerto, y &lt;code&gt;kill &amp;lt;pid&amp;gt;&lt;/code&gt; lo cierra a él solo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lo que hice con esto
&lt;/h2&gt;

&lt;p&gt;Mantengo un proyecto pequeño, &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, que convierte estos casos en hooks que se ejecutan antes de cada comando. Lee el comando que el agente va a lanzar, bloquea esta lista corta y le devuelve al agente el motivo y la forma segura. Normalmente el agente reescribe el comando y sigue. Funciona como plugin de Claude Code y también con Codex, Gemini CLI, Copilot CLI, Cursor, opencode y otros. Es MIT, sin dependencias, Node 18 o superior.&lt;/p&gt;

&lt;p&gt;Se puede probar sin instalar nada; este comando no ejecuta el comando que recibe, solo lo analiza:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y claude-bulkhead explain -- &lt;span class="s1"&gt;'rm -rf "$BUILD_DIR"/*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;La respuesta dice &lt;code&gt;BLOCKED by basics rm-empty-var&lt;/code&gt; y propone &lt;code&gt;rm -rf "${BUILD_DIR:?}"/*&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;El límite importante: solo ve el texto del comando. Si el agente escribe un script y luego lo ejecuta, un borrado dentro del script no se detecta. Las prevenciones de arriba siguen siendo la primera defensa.&lt;/p&gt;

</description>
      <category>spanish</category>
      <category>ai</category>
      <category>bash</category>
      <category>devops</category>
    </item>
    <item>
      <title>An empty variable turned rm -rf and rsync --delete into "delete /". Coding agents did it three times this fall</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Sat, 14 Nov 2026 00:51:55 +0000</pubDate>
      <link>https://dev.to/dooly6276/an-empty-variable-turned-rm-rf-and-rsync-delete-into-delete-coding-agents-did-it-three-48lo</link>
      <guid>https://dev.to/dooly6276/an-empty-variable-turned-rm-rf-and-rsync-delete-into-delete-coding-agents-did-it-three-48lo</guid>
      <description>&lt;p&gt;Three reports on the Claude Code issue tracker this autumn describe the same accident from different angles. In each one an agent built a destructive command around a value it never printed, the value came out empty or pointed at a drive root, and the command did exactly what it said.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three incidents
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/95426" rel="noopener noreferrer"&gt;#95426&lt;/a&gt;, Windows with Git Bash. As a "clear old test state" step the agent ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rm -rf &lt;span class="s2"&gt;"$(cygpath -u 'C:\')"&lt;/span&gt; 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cygpath -u 'C:\'&lt;/code&gt; prints &lt;code&gt;/c/&lt;/code&gt;, the whole drive. stderr went to &lt;code&gt;/dev/null&lt;/code&gt;, so nothing appeared on screen while it ran for about 35 minutes. The reporter lost roughly 600 GB, including the Windows user profile and several git repositories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/109735" rel="noopener noreferrer"&gt;#109735&lt;/a&gt;, Windows with WSL, opened this week. A subagent wanted a Linux copy of a project and ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl -d Ubuntu-24.04 -- bash -lc &lt;span class="s1"&gt;'set -u; R=~/some-dir; mkdir -p $R; rsync -a --delete /mnt/d/&amp;lt;project&amp;gt;/ $R/; ...'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The assignment is inside the single-quoted script, which looks safe, and &lt;code&gt;set -u&lt;/code&gt; is there too. But the command line went through &lt;code&gt;wsl.exe --&lt;/code&gt; and was interpreted by a shell once more before the inner &lt;code&gt;bash&lt;/code&gt; started, and in that shell &lt;code&gt;R&lt;/code&gt; was not set. &lt;code&gt;$R/&lt;/code&gt; became &lt;code&gt;/&lt;/code&gt;, the command that ran was &lt;code&gt;rsync -a --delete /mnt/d/&amp;lt;project&amp;gt;/ /&lt;/code&gt;, and rsync deleted what the user could delete under &lt;code&gt;/&lt;/code&gt;, including files on the Windows data drive mounted at &lt;code&gt;/mnt/d&lt;/code&gt;. Files deleted through WSL skip the Recycle Bin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/107274" rel="noopener noreferrer"&gt;#107274&lt;/a&gt;, macOS: an &lt;code&gt;rm -rf&lt;/code&gt; in the harness removed a repository's &lt;code&gt;.git&lt;/code&gt;, and with it more than twelve months of history that had not been pushed anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the usual advice did not save them
&lt;/h2&gt;

&lt;p&gt;Quoting does not help when the variable is empty: &lt;code&gt;rm -rf "$D"/&lt;/code&gt; is still &lt;code&gt;rm -rf /&lt;/code&gt;. &lt;code&gt;set -u&lt;/code&gt; only fires in the shell that sees the unset variable, and in #109735 that was not the shell that expanded it. &lt;code&gt;--preserve-root&lt;/code&gt; protects &lt;code&gt;/&lt;/code&gt; itself but not &lt;code&gt;/*&lt;/code&gt;, &lt;code&gt;/c/&lt;/code&gt; or &lt;code&gt;/mnt/d/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What does help is making the empty case fail before the command runs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rm -rf &lt;span class="s2"&gt;"${D:?}/"&lt;/span&gt;           &lt;span class="c"&gt;# exits with "D: parameter null or not set"&lt;/span&gt;
rsync -a --delete src/ &lt;span class="s2"&gt;"${R:?}/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;${D:?}&lt;/code&gt; makes the shell stop instead of substituting an empty string, in every shell layer it is expanded in. Printing the target first (&lt;code&gt;echo "$D"&lt;/code&gt;), or resolving it into a variable and checking it is under the project, catches the cygpath case, where the value is not empty but wrong. For &lt;code&gt;.git&lt;/code&gt;, the safe default is to move it aside (&lt;code&gt;mv .git .git.bak&lt;/code&gt;) rather than delete it.&lt;/p&gt;

&lt;p&gt;Agents rarely do any of this unprompted, and a memory file that says "never rm -rf a variable" is a suggestion, not a check.&lt;/p&gt;

&lt;h2&gt;
  
  
  A hook that checks the command text first
&lt;/h2&gt;

&lt;p&gt;I maintain &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, a set of PreToolUse hooks for Claude Code (MIT, no dependencies; the same guards also load in Codex, Gemini CLI, Copilot CLI, Cursor and opencode). Its basics guard already refused &lt;code&gt;rm -rf ~&lt;/code&gt; and &lt;code&gt;rm -rf /&lt;/code&gt;. Version 0.4.0 adds rules for the three patterns above:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm-empty-var&lt;/code&gt; blocks a recursive delete whose path is a variable or a command substitution followed by &lt;code&gt;/&lt;/code&gt; (&lt;code&gt;rm -rf $D/&lt;/code&gt;, &lt;code&gt;rm -rf "$BUILD_DIR"/*&lt;/code&gt;, &lt;code&gt;rm -rf $(cygpath -u "$X")/&lt;/code&gt;), a path that is only a quoted substitution (&lt;code&gt;rm -rf "$(cygpath -u 'C:\')"&lt;/code&gt;, the exact #95426 command), and &lt;code&gt;rsync --delete&lt;/code&gt; whose destination is &lt;code&gt;$R/&lt;/code&gt; or a bare &lt;code&gt;$R&lt;/code&gt;. It lets the command through when the same shell set the variable earlier to something that cannot be empty, such as &lt;code&gt;D=$(mktemp -d) &amp;amp;&amp;amp; rm -rf $D/&lt;/code&gt;, or when the command already uses &lt;code&gt;${D:?}&lt;/code&gt;. An assignment inside &lt;code&gt;wsl ... -- bash -lc '...'&lt;/code&gt; does not count, because the outer shell expands the variable first, which is the #109735 trap; the exact command from that report is blocked.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm-git-dir&lt;/code&gt; blocks &lt;code&gt;rm -rf .git&lt;/code&gt;, &lt;code&gt;rm -rf path/.git&lt;/code&gt; and &lt;code&gt;find . -name .git -exec rm -rf {} +&lt;/code&gt; when that &lt;code&gt;.git&lt;/code&gt; is an existing folder, and points to &lt;code&gt;git worktree remove&lt;/code&gt; or moving it aside instead.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm-unquoted-var&lt;/code&gt; blocks an unquoted &lt;code&gt;rm -rf $D&lt;/code&gt; when the value set on the same line contains a space or a wildcard, since bash splits it into several paths. zsh does not split it, which is part of what went wrong in #107271.&lt;/p&gt;

&lt;p&gt;The same release also covers &lt;a href="https://github.com/anthropics/claude-code/issues/109627" rel="noopener noreferrer"&gt;#109627&lt;/a&gt;, from this week: on macOS an agent ran &lt;code&gt;pkill -f "gcloud.py compute" -u &amp;lt;user&amp;gt; --signal 0&lt;/code&gt; as an existence check. BSD &lt;code&gt;pkill&lt;/code&gt; has no &lt;code&gt;--signal&lt;/code&gt; option, so &lt;code&gt;--signal&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; became two more patterns, &lt;code&gt;0&lt;/code&gt; matched almost every process, and every other Claude Code session got SIGTERM. kill-guard now reads &lt;code&gt;pkill&lt;/code&gt; arguments the way the platform's &lt;code&gt;pkill&lt;/code&gt; does and blocks long options and extra patterns on macOS, pointing to &lt;code&gt;pgrep -f&lt;/code&gt; for a check that only lists.&lt;/p&gt;

&lt;p&gt;Each block tells the agent why and gives the safe form, usually &lt;code&gt;"${VAR:?}"&lt;/code&gt;. The command is not run, so you can check any line without installing anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y claude-bulkhead explain -- &lt;span class="s1"&gt;'rsync -a --delete src/ $R/'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hooks read the command text. A delete inside a script the agent wrote and then runs is not seen, which is also why &lt;a href="https://github.com/anthropics/claude-code/issues/107271" rel="noopener noreferrer"&gt;#107271&lt;/a&gt;, an unquoted &lt;code&gt;rm -rf $D&lt;/code&gt; inside a helper script, is out of reach. That one needs the script itself to use &lt;code&gt;"${D:?}"&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>ai</category>
      <category>claude</category>
      <category>opensource</category>
    </item>
    <item>
      <title>pkill -f cat quits every app on a Mac, and coding agents keep running it</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Thu, 12 Nov 2026 08:35:28 +0000</pubDate>
      <link>https://dev.to/dooly6276/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it-phg</link>
      <guid>https://dev.to/dooly6276/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it-phg</guid>
      <description>&lt;p&gt;Three open issues on the Claude Code repository describe the same event. An agent wants to stop one stuck &lt;code&gt;cat&lt;/code&gt; process, it runs something like &lt;code&gt;pkill -f 'cat' -n -u 501 2&amp;gt;/dev/null&lt;/code&gt;, and a second later Safari, Chrome, Docker Desktop, Telegram and the Claude app itself quit. The reports in &lt;a href="https://github.com/anthropics/claude-code/issues/100684" rel="noopener noreferrer"&gt;#100684&lt;/a&gt; and &lt;a href="https://github.com/anthropics/claude-code/issues/107867" rel="noopener noreferrer"&gt;#107867&lt;/a&gt; include unified log lines where dozens of launchd services exit with &lt;code&gt;SIGTERM | sent by pkill[...]&lt;/code&gt; in the same second, and the thread on #100684 has new occurrences on versions 2.1.284, 2.1.309 and 2.1.318. &lt;a href="https://github.com/anthropics/claude-code/issues/90070" rel="noopener noreferrer"&gt;#90070&lt;/a&gt; is the smaller version of the same habit: &lt;code&gt;pkill -f "next-server"&lt;/code&gt; to restart one dev server, which also took down a sibling project's server.&lt;/p&gt;

&lt;p&gt;The command looks narrow. It names &lt;code&gt;cat&lt;/code&gt;, asks for the newest match only, and limits itself to one user. It is not narrow, for two separate reasons, and the second one is specific to macOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reason one: -f matches the whole command line
&lt;/h2&gt;

&lt;p&gt;Without &lt;code&gt;-f&lt;/code&gt;, &lt;code&gt;pkill cat&lt;/code&gt; compares the pattern with the process name. With &lt;code&gt;-f&lt;/code&gt;, it compares the pattern with the full command line, as a regular expression, anywhere in the string. On a Mac every app runs from a path such as &lt;code&gt;/Applications/Safari.app/Contents/MacOS/Safari&lt;/code&gt;, and "Applications" contains "cat". So do &lt;code&gt;Library/Caches&lt;/code&gt;, &lt;code&gt;com.apple.location...&lt;/code&gt;, &lt;code&gt;CoreLocationAgent&lt;/code&gt; and a long list of helpers. On the MacBook I am writing this on, &lt;code&gt;pgrep -lf cat&lt;/code&gt; lists 105 processes that live inside an &lt;code&gt;.app&lt;/code&gt; bundle, from AdBlock and Hammerspoon to the Claude desktop app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reason two: BSD pkill stops reading options at the pattern
&lt;/h2&gt;

&lt;p&gt;The agent did add &lt;code&gt;-n&lt;/code&gt; and &lt;code&gt;-u&lt;/code&gt;, which would have limited the damage to one process. They were written after the pattern, and the &lt;code&gt;pkill&lt;/code&gt; that ships with macOS comes from BSD. Its option parsing stops at the first argument that is not an option, so everything after &lt;code&gt;cat&lt;/code&gt; is read as more patterns, not as flags. &lt;code&gt;-n&lt;/code&gt; and &lt;code&gt;-u 501&lt;/code&gt; narrow nothing. The difference is easy to measure without killing anything, because &lt;code&gt;pgrep&lt;/code&gt; takes the same arguments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ pgrep -f &lt;span class="s1"&gt;'cat'&lt;/span&gt; -n -u &lt;span class="nv"&gt;$(&lt;/span&gt;id -u&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; wc -l
     180
$ pgrep -n -u &lt;span class="nv"&gt;$(&lt;/span&gt;id -u&lt;span class="o"&gt;)&lt;/span&gt; -f &lt;span class="s1"&gt;'cat'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; wc -l
       1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same words, different order, 180 matches against 1. On Linux the procps &lt;code&gt;pkill&lt;/code&gt; reorders its arguments the GNU way, so the first form does mean "newest match only" there. That may be why the shape looks safe to a model trained mostly on Linux examples, and why it keeps coming back on macOS. The commands in these reports also end with &lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; and are chained with &lt;code&gt;;&lt;/code&gt;, so nothing tells the agent that anything unusual happened, and it carries on with the next command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safer ways to stop one process
&lt;/h2&gt;

&lt;p&gt;The reliable way is to kill by PID. A process the agent started in the background has its PID in &lt;code&gt;$!&lt;/code&gt;, and a server can be found from the port it holds with &lt;code&gt;lsof -ti tcp:3000 -sTCP:LISTEN&lt;/code&gt;. When a name is all there is, &lt;code&gt;pkill -x cat&lt;/code&gt; matches the exact process name instead of a substring of the command line, and putting every option before the pattern (&lt;code&gt;pkill -n -P $$ -x cat&lt;/code&gt;) keeps them as options on both BSD and Linux. Running &lt;code&gt;pgrep -lf '&amp;lt;pattern&amp;gt;'&lt;/code&gt; first shows what a pattern would reach, which is the check an agent skips when it writes the whole thing as one line.&lt;/p&gt;

&lt;p&gt;None of this changes what the model will type next week. A PreToolUse hook can, because it sees the command before the shell does. This is a minimal one that refuses &lt;code&gt;pkill -f&lt;/code&gt; when the pattern also matches a running app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;#&lt;span class="o"&gt;!/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;
&lt;span class="c1"&gt;// PreToolUse hook for Claude Code (Bash): refuse pkill -f patterns that reach a macOS app.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;execFileSync&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'child_process'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'end'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool_input&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matchAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;bpkill&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;|&lt;/span&gt;\&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="s1"&gt;'[^'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="s1"&gt;'|"[^"]*"|\S+/g) || []).map(w =&amp;gt; w.replace(/^['&lt;/span&gt;&lt;span class="s2"&gt;"]|['"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;/^-&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;zA&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;Z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'-'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!/^-&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;uUgGPst&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;execFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'pgrep'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'-lf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'utf8'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\n'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.app/Contents/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;hookSpecificOutput&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;hookEventName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'PreToolUse'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;permissionDecision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'deny'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;permissionDecisionReason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`pkill -f "${pattern}" also matches a desktop app. Kill your own process by its PID instead.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested it against the exact commands from the three issues: the &lt;code&gt;cat&lt;/code&gt; variants are refused, while &lt;code&gt;pkill -f my-worker.js&lt;/code&gt; and plain &lt;code&gt;pkill cat&lt;/code&gt; pass. It is deliberately small, so it does not follow &lt;code&gt;sh -c '...'&lt;/code&gt;, &lt;code&gt;xargs&lt;/code&gt;, or &lt;code&gt;killall&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I changed in bulkhead
&lt;/h2&gt;

&lt;p&gt;I maintain &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, a set of PreToolUse guards for people who run several Claude Code, Codex or Gemini CLI sessions on one machine. Its kill guard already blocked kills by name for shared programs like &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;next-server&lt;/code&gt;, and it blocked a &lt;code&gt;pkill -f&lt;/code&gt; pattern when it reached a process of another live agent session. Reading these issues showed me the gap: with only one session running, &lt;code&gt;pkill -f cat&lt;/code&gt; reached nothing that belonged to another session, so it passed.&lt;/p&gt;

&lt;p&gt;Version 0.3.5 adds a rule for exactly this. &lt;code&gt;pkill -f &amp;lt;pattern&amp;gt;&lt;/code&gt; is blocked when the pattern matches a process inside an &lt;code&gt;.app&lt;/code&gt; bundle, or 8 or more processes outside the session's own process tree, whether one session is running or twenty. Processes the session started itself do not count, so killing its own stuck &lt;code&gt;cat&lt;/code&gt; still works. The reason it sends back asks for the PID and explains the BSD option order. The decision can be checked without installing or running anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx claude-bulkhead explain -- &lt;span class="s2"&gt;"pkill -f 'cat' -n -u 501"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parser behind it also handles the cases the snippet above skips: commands inside &lt;code&gt;bash -c&lt;/code&gt;, &lt;code&gt;ssh localhost&lt;/code&gt;, heredocs fed to a shell, &lt;code&gt;xargs&lt;/code&gt;, and kill commands that only appear inside quoted text and never run. The repository is MIT, has no dependencies and sends nothing off the machine.&lt;/p&gt;

&lt;p&gt;Claude Code wrote most of the code and tests with me. I reproduced the option-order behavior and the match counts above on macOS 27.2 myself.&lt;/p&gt;

</description>
      <category>shell</category>
      <category>ai</category>
      <category>claude</category>
      <category>opensource</category>
    </item>
    <item>
      <title>250 small tools on one site, all running in the browser</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Thu, 12 Nov 2026 06:06:47 +0000</pubDate>
      <link>https://dev.to/dooly6276/250-small-tools-on-one-site-all-running-in-the-browser-478g</link>
      <guid>https://dev.to/dooly6276/250-small-tools-on-one-site-all-running-in-the-browser-478g</guid>
      <description>&lt;p&gt;I run a small site called &lt;a href="https://joyoftools.com" rel="noopener noreferrer"&gt;Joy of Tools&lt;/a&gt;. It has 254 tools for jobs that take about two minutes: merging a PDF, shrinking a photo, counting words, working out a loan payment.&lt;/p&gt;

&lt;p&gt;I set one rule before I wrote any of them. Whatever you add stays on your device. There is no upload and no account. Most of the technical choices followed from that rule, so this post goes through what each kind of tool runs on and where it gets awkward.&lt;/p&gt;

&lt;h2&gt;
  
  
  PDF
&lt;/h2&gt;

&lt;p&gt;Merging, splitting, rotating and adding page numbers use pdf-lib. Turning pages into images uses pdf.js. Both are fine on a phone for ordinary files. Large scans are the weak spot, because the whole file has to sit in memory and a phone browser gives up long before a laptop does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Images, audio and video
&lt;/h2&gt;

&lt;p&gt;Resizing and converting images is plain canvas work. HEIC photos from an iPhone are the exception, because browsers other than Safari cannot read them, so those go through libheif first. Audio and video conversion use ffmpeg compiled to WebAssembly. It is several times slower than a server would be. I decided that was an acceptable price for the file not going anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  OCR and speech
&lt;/h2&gt;

&lt;p&gt;Text recognition is Tesseract running in the browser. Text to speech runs a voice model through ONNX Runtime Web, and speech to text uses transformers.js. A model downloads the first time a tool is opened and is cached after that. The first run is slow and I have not found a good way around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six languages
&lt;/h2&gt;

&lt;p&gt;The site is built with Next.js and next-intl, and every tool has its own page in English, Japanese, Spanish, Portuguese, German and French. That comes to about 1,400 pages.&lt;/p&gt;

&lt;p&gt;I expected translation to be the work. It was not. The work was the data behind the tools, and the last five tools I opened in the other languages showed it clearly.&lt;/p&gt;

&lt;p&gt;A tip calculator cannot keep American percentages. In Germany service is included and people round up or leave 5 to 10 percent. In Brazil a 10 percent service charge is already on the bill. Each language needed its own currency, its own preset buttons, and a decimal comma in the input.&lt;/p&gt;

&lt;p&gt;The periodic table shows Cobalt and Caesium in German, which is the official spelling, but people type Kobalt and Cäsium, so the search needed a list of other spellings. In Japanese several element names are written in kanji, and someone typing in hiragana would find nothing unless the search also knew the readings.&lt;/p&gt;

&lt;p&gt;The fantasy name generator builds names from syllables. Written in katakana, some of those syllables turned into rude words, so the Japanese version needed a filter the English one never did.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would like to hear
&lt;/h2&gt;

&lt;p&gt;If you try it, tell me which tool you looked for and did not find, and what felt slow on your phone.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Seven PreToolUse hooks cost 318 ms per tool call at 10 Claude Code sessions. One process got it to 89 ms.</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:47:17 +0000</pubDate>
      <link>https://dev.to/dooly6276/seven-pretooluse-hooks-cost-318-ms-per-tool-call-at-10-claude-code-sessions-one-process-got-it-to-4mp2</link>
      <guid>https://dev.to/dooly6276/seven-pretooluse-hooks-cost-318-ms-per-tool-call-at-10-claude-code-sessions-one-process-got-it-to-4mp2</guid>
      <description>&lt;p&gt;I run many Claude Code sessions on one machine at the same time, often ten or more. Each of them makes a shell call every few seconds, and every shell call goes through the PreToolUse hooks of &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, the plugin I wrote to stop those sessions from killing each other's dev servers, taking each other's ports and committing each other's half-finished edits. This post is about what those hooks cost, why the cost grew with the number of sessions, and how version 0.3.0 changed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the time went
&lt;/h2&gt;

&lt;p&gt;Up to version 0.2, bulkhead registered seven separate Bash hooks: kill-guard, wait-guard, memory-guard, port-guard, checkout-guard, disk-guard and basics. Claude Code runs every matching hook for a tool call side by side, each as its own process with the payload on stdin. On an idle machine that looks cheap. The guards run in parallel, most of them only look at the command text, and one call took 47 ms on my MacBook Pro (M5 Pro, Node 24).&lt;/p&gt;

&lt;p&gt;The number that mattered was a different one. Starting Node alone takes 32 ms on that machine, so every guard paid most of its cost before reading a single byte of input. Seven guards meant seven Node processes per shell call. When ten sessions make a tool call at the same moment, which happens all the time when several agents are running test suites and builds, that is seventy Node processes starting at once and competing for the same cores. Each session then waited 318 ms for its hooks. With twenty sessions it was 611 ms.&lt;/p&gt;

&lt;h2&gt;
  
  
  One process, cheapest checks first
&lt;/h2&gt;

&lt;p&gt;In 0.3.0 Claude Code starts a single hook for Bash and PowerShell, &lt;code&gt;src/bash-guards.js&lt;/code&gt;, and that process runs the guards one after another. The order is deliberate. The guards that only parse the command text go first. The ones that may read git, the memory state, the process table or a port go last, and they only do that work after the text matched something: port-guard tries a TCP connection to the port before it reads any process list, checkout-guard runs git only when another session is alive, and basics runs &lt;code&gt;git status&lt;/code&gt; only for &lt;code&gt;git reset --hard&lt;/code&gt; and &lt;code&gt;git clean&lt;/code&gt;. The process stops at the first block, so a blocked command never pays for the guards after it.&lt;/p&gt;

&lt;p&gt;The benchmark ships with the repository, so you can run it on your own machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node scripts/bench-hooks.js 9 --sessions 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On my machine it measured this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;one process per guard (0.2)&lt;/th&gt;
&lt;th&gt;one process (0.3)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;one tool call, allowed&lt;/td&gt;
&lt;td&gt;47 ms&lt;/td&gt;
&lt;td&gt;76 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10 sessions at once&lt;/td&gt;
&lt;td&gt;318 ms&lt;/td&gt;
&lt;td&gt;89 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20 sessions at once&lt;/td&gt;
&lt;td&gt;611 ms&lt;/td&gt;
&lt;td&gt;109 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first row went the wrong way, and that is expected. Running the guards in a row is slower than running them side by side when nothing else is happening. I kept the change because nobody runs bulkhead for a single idle session. It exists for the case in the second and third rows, and there one process per call instead of seven is what keeps the hooks out of the way. Writing a block to the event log added no measurable time in either layout.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else is in 0.3.0
&lt;/h2&gt;

&lt;p&gt;Merging the hooks also made two features easy that needed one place to see every guard's verdict. &lt;code&gt;bulkhead explain -- &amp;lt;command&amp;gt;&lt;/code&gt; runs a command through every guard against the sessions, processes, ports and git tree on the machine right now, and prints what each one would say and why, without executing anything. Every block message now ends with a short code, and the user can run &lt;code&gt;bulkhead allow &amp;lt;code&amp;gt;&lt;/code&gt; in their own terminal to let that exact command through once within ten minutes. A rule in basics blocks the agent from running &lt;code&gt;bulkhead allow&lt;/code&gt; itself, so the approval stays with the person.&lt;/p&gt;

&lt;p&gt;kill-guard now also knows which session owns a process. &lt;code&gt;kill &amp;lt;pid&amp;gt;&lt;/code&gt; and &lt;code&gt;pkill -f &amp;lt;pattern&amp;gt;&lt;/code&gt; pass when they reach only your own session's processes and are blocked when they reach another live session's tree, and broad kills such as &lt;code&gt;pkill -u&lt;/code&gt;, &lt;code&gt;kill -1&lt;/code&gt;, &lt;code&gt;docker system prune&lt;/code&gt; and &lt;code&gt;adb kill-server&lt;/code&gt; are blocked while another session is alive. The same guards can be registered for Codex, Gemini CLI, Copilot CLI, Cursor, Windsurf and five other agents with &lt;code&gt;bulkhead setup &amp;lt;agent&amp;gt; --write&lt;/code&gt;. The full list is in the &lt;a href="https://github.com/dooly6276/claude-bulkhead/blob/main/CHANGELOG.md" rel="noopener noreferrer"&gt;changelog&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trying it
&lt;/h2&gt;

&lt;p&gt;bulkhead has no dependencies and sends nothing off the machine. You can see what it would have done on your own history before turning anything on, because &lt;code&gt;scan&lt;/code&gt; only reads your past transcripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx claude-bulkhead scan 30d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install it as a Claude Code plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plugin marketplace add dooly6276/claude-bulkhead
/plugin install bulkhead@bulkhead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code, the benchmark and the 18-second recording of a real session are on &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. Claude Code wrote most of the code and the tests with me, and I reviewed and measured every change described here.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>node</category>
      <category>performance</category>
    </item>
    <item>
      <title>Subagents ran 73% of my Claude Code shell commands. The risky git commands came from the main sessions.</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Tue, 10 Nov 2026 21:13:04 +0000</pubDate>
      <link>https://dev.to/dooly6276/subagents-ran-73-of-my-claude-code-shell-commands-the-risky-git-commands-came-from-the-main-2lhg</link>
      <guid>https://dev.to/dooly6276/subagents-ran-73-of-my-claude-code-shell-commands-the-risky-git-commands-came-from-the-main-2lhg</guid>
      <description>&lt;p&gt;Two days ago I wrote about replaying two weeks of Claude Code transcripts to count how often my parallel sessions got in each other's way. A reader on Hashnode asked a question I could not answer from that post: how many of those commands came from subagents rather than the session I was talking to?&lt;/p&gt;

&lt;p&gt;Claude Code writes a separate transcript for each subagent under &lt;code&gt;&amp;lt;session&amp;gt;/subagents/&lt;/code&gt;, so the question has an exact answer. I reran the replay on the latest two weeks (October 27 to November 10) twice, once on everything and once on the subagent transcripts alone, and subtracted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who runs the commands
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Transcript files&lt;/th&gt;
&lt;th&gt;Shell commands&lt;/th&gt;
&lt;th&gt;Would have been blocked&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;All sessions&lt;/td&gt;
&lt;td&gt;1,754&lt;/td&gt;
&lt;td&gt;112,417&lt;/td&gt;
&lt;td&gt;546&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subagents only&lt;/td&gt;
&lt;td&gt;1,447&lt;/td&gt;
&lt;td&gt;82,475&lt;/td&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Main sessions&lt;/td&gt;
&lt;td&gt;307&lt;/td&gt;
&lt;td&gt;29,942&lt;/td&gt;
&lt;td&gt;145&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Subagents ran 73% of the shell commands. That matched my feeling about how I use Claude Code: the main session plans and talks to me, and the subagents go off and run tests, builds, searches and renders. The share of commands that a rule would have blocked was almost the same on both sides, about 0.5%.&lt;/p&gt;

&lt;p&gt;So far that says nothing interesting. The split by rule does.&lt;/p&gt;

&lt;h2&gt;
  
  
  What each side does wrong
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Main sessions&lt;/th&gt;
&lt;th&gt;Subagents&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Foreground poll loop (&lt;code&gt;until [ -f done ]; do sleep 15; done&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;td&gt;364&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long foreground sleep&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;29&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Whole-disk &lt;code&gt;find&lt;/code&gt; or &lt;code&gt;du&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git add -A&lt;/code&gt; / &lt;code&gt;commit -a&lt;/code&gt; in a tree another session was using&lt;/td&gt;
&lt;td&gt;27&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git checkout&lt;/code&gt; in a shared tree&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git rebase&lt;/code&gt; in a shared tree&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git merge&lt;/code&gt; in a shared tree&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git stash&lt;/code&gt; in a shared tree&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Force push to main&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kill by process name&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The subagents' 401 are almost all waiting. 393 of them are a subagent sitting in a loop for a background job it started. The prompt cache expires after about five minutes without a request, so a subagent that polls in the foreground for ten minutes wakes up to a cold cache and writes its whole context again. In my setup a hook was already blocking the poll loops, so the damage was low: 364 of the 393 were stopped before they ran.&lt;/p&gt;

&lt;p&gt;Of the 73 risky git commands, 72 came from main sessions. The subagents almost never touched the branch or the index. The main sessions did, in working trees where another session was active around the same time. Take the waiting rules out and the picture flips: main sessions have 78 rule hits and subagents have 11.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this split makes sense
&lt;/h2&gt;

&lt;p&gt;When I ask a main session to finish a task, it is the one that commits, switches branches, rebases on main and pushes. Subagents are handed narrower jobs: run this suite, search for that symbol, render these frames. They inherit the git habits of the main session only if they are told to commit, and I rarely tell them to.&lt;/p&gt;

&lt;p&gt;That changes where a guard earns its keep. If you only run one session at a time with many subagents, the waiting and RAM rules are the ones that will fire. If you run several main sessions in the same checkout, the git rules are the ones that matter, and the subagents are mostly innocent.&lt;/p&gt;

&lt;p&gt;I also expected subagents to be the main source of the "killed another session's dev server" problem, because they start most of the servers. These two weeks do not show that: only five commands killed processes by name, three from subagents and two from main sessions. That is too few to say either way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits of these numbers
&lt;/h2&gt;

&lt;p&gt;This is one person's machine and one person's way of working. The replay reads command text only, so a kill hidden inside a script or an alias is not counted. The "another session was active" test is rebuilt from transcript timestamps per minute, so it can count a session that was open but idle. And subagents share their parent's session identity, so a rule that compares sessions cannot tell a subagent apart from its own parent at run time. The split above comes from the transcript folders, not from the hooks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it on your own transcripts
&lt;/h2&gt;

&lt;p&gt;The replay is &lt;code&gt;bulkhead scan&lt;/code&gt; from &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;claude-bulkhead&lt;/a&gt;, an MIT Claude Code plugin I maintain. It only reads &lt;code&gt;~/.claude/projects&lt;/code&gt; and sends nothing anywhere. To get the same split, copy only the &lt;code&gt;subagents&lt;/code&gt; folders into a separate directory (hard links work) and point &lt;code&gt;--path&lt;/code&gt; at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bulkhead scan --since 14d
bulkhead scan --since 14d --path ~/subagent-transcripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your numbers look different, especially if your subagents do commit, I would like to hear about it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used Claude Code to write parts of the scan and to help draft this post. The numbers come from running it on my own transcripts.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>git</category>
      <category>devops</category>
    </item>
    <item>
      <title>I replayed two weeks of Claude Code transcripts to see what my parallel sessions did to each other</title>
      <dc:creator>Myeongseok Kang</dc:creator>
      <pubDate>Mon, 09 Nov 2026 05:10:35 +0000</pubDate>
      <link>https://dev.to/dooly6276/i-replayed-two-weeks-of-claude-code-transcripts-to-see-what-my-parallel-sessions-did-to-each-other-4n5b</link>
      <guid>https://dev.to/dooly6276/i-replayed-two-weeks-of-claude-code-transcripts-to-see-what-my-parallel-sessions-did-to-each-other-4n5b</guid>
      <description>&lt;p&gt;For two weeks I ran Claude Code the way a lot of people now do: several sessions at once, usually one per git worktree, each starting its own subagents, dev servers and test runs. Every session behaves as if it owns the computer. None of them does. They share one process table, one set of ports, one pool of RAM, one disk, and sometimes one working tree.&lt;/p&gt;

&lt;p&gt;I suspected this was costing me. Servers vanished in the middle of a test. Commits contained files I did not remember touching. The machine would stall and then come back. What I did not have was a count. So I took the transcripts Claude Code had already written to disk and replayed every shell command in them against a set of rules, each describing one way a command can hurt another session. This post covers what came out, how the rules work as hooks, and where the approach stops working.&lt;/p&gt;

&lt;h2&gt;
  
  
  The data
&lt;/h2&gt;

&lt;p&gt;Claude Code stores a JSONL transcript for each session and each subagent under &lt;code&gt;~/.claude/projects&lt;/code&gt;. Two weeks of mine came to 1,536 transcript files and 7.0 GB, covering 204 sessions and 101,167 shell commands (Bash and PowerShell tool calls). Reading all of it took 39 seconds. The first number that surprised me was not about commands at all. At the peak, on November 1, 13 sessions were running at the same time. I would have guessed far fewer.&lt;/p&gt;

&lt;p&gt;The second number: 507 of those commands match a rule and would have been blocked. As a share of the total that is small. But each one is a command that can take down work belonging to some other session, and with that many sessions open, the other session is usually me in another window.&lt;/p&gt;

&lt;p&gt;The case I found most uncomfortable: 25 of the 507 were &lt;code&gt;git add -A&lt;/code&gt;, run in a working tree where a different session was active within ten minutes of the command.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the collisions look like
&lt;/h2&gt;

&lt;p&gt;I am not going to walk through all 507. The rules are written around a handful of command shapes, and these are the ones that matter most when sessions share a machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Staging everything in a shared tree.&lt;/strong&gt; Session A is halfway through a refactor in &lt;code&gt;src/&lt;/code&gt;. Session B, in the same checkout, finishes a small fix and runs &lt;code&gt;git add -A &amp;amp;&amp;amp; git commit -m "fix typo"&lt;/code&gt;. B's commit now holds A's unfinished refactor. Nothing fails. You find out later, in review or during a bisect. Staging by file name avoids the problem, so the rule only objects to the "take everything" forms (&lt;code&gt;git add -A&lt;/code&gt;, &lt;code&gt;git add .&lt;/code&gt;, &lt;code&gt;git add -u&lt;/code&gt;, &lt;code&gt;git commit -a&lt;/code&gt;) and lets named paths through.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Killing by program name.&lt;/strong&gt; An agent wants to restart its dev server and reaches for &lt;code&gt;pkill node&lt;/code&gt;, or &lt;code&gt;taskkill /IM node.exe&lt;/code&gt; on Windows. That stops its own server, every other worktree's server, and any Node test runner. The agent only meant one PID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two servers, one port.&lt;/strong&gt; Two worktrees of the same app both run &lt;code&gt;npm run dev&lt;/code&gt;. The second one either fails on port 3000 or silently takes 3001, while its agent keeps opening &lt;code&gt;localhost:3000&lt;/code&gt; and testing the other branch's code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whole-disk scans.&lt;/strong&gt; An agent asked what is using disk space runs &lt;code&gt;du -sh ~&lt;/code&gt;, or starts ten &lt;code&gt;du&lt;/code&gt; processes in parallel. Every other session's &lt;code&gt;git status&lt;/code&gt;, build and test run slows down until it finishes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deleting a folder that is in use.&lt;/strong&gt; A cleanup task runs &lt;code&gt;git worktree remove&lt;/code&gt; or &lt;code&gt;rm -rf&lt;/code&gt; on a worktree that another live session is still working in.&lt;/p&gt;

&lt;p&gt;None of these is a model bug. Each command is reasonable if you are the only process on the machine. The problem is that the agent has no idea the other sessions exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning the rules into hooks
&lt;/h2&gt;

&lt;p&gt;Claude Code has hooks: programs it runs at fixed points in a session. A &lt;code&gt;PreToolUse&lt;/code&gt; hook registered for the Bash and PowerShell tools receives the pending tool call as JSON on stdin before the command executes. If the hook exits with code 2, Claude Code cancels the call and hands whatever the hook wrote to stderr back to the model as the reason.&lt;/p&gt;

&lt;p&gt;That stderr message matters more than the block. A bare "denied" tends to make the agent try a small variation of the same command. A message that says what to do instead usually settles it in one turn. The kill rule answers with how to find and stop the agent's own PID. The port rule names a free port. The staging rule asks for file names. The checkout rule suggests &lt;code&gt;git worktree add&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Each guard works in the same order. It first matches the command text cheaply, and since most commands do not match, the hook usually exits 0 at once. Only on a match does it look at the machine: the process table, listening ports, which Claude sessions are alive and where they work, free RAM and &lt;code&gt;git status&lt;/code&gt;. If the command would hurt another live session or lose uncommitted work, it logs the case and exits 2 with a message.&lt;/p&gt;

&lt;p&gt;Two design choices came from getting this wrong early. First, the guards fail open. If a guard throws, receives JSON it cannot parse, or cannot read the process table, it exits 0 and the command runs. A bug in a guard should cost you protection, not your work. Second, the command parser unwraps &lt;code&gt;bash -c&lt;/code&gt;, &lt;code&gt;powershell -Command&lt;/code&gt;, &lt;code&gt;cmd /c&lt;/code&gt;, &lt;code&gt;eval&lt;/code&gt;, &lt;code&gt;sudo&lt;/code&gt;, &lt;code&gt;xargs&lt;/code&gt; and similar wrappers a few levels deep, because agents wrap commands more often than people do. It also ignores text that only mentions a command, such as a commit message or a grep pattern, so writing about &lt;code&gt;pkill&lt;/code&gt; in a changelog does not trigger anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replaying instead of guessing
&lt;/h2&gt;

&lt;p&gt;The scan runs the same guard code against history instead of a live call. For each shell command in a transcript, it rebuilds whatever context it can and asks every guard whether it would have blocked. The report is grouped by guard and rule: number of hits, number of sessions they came from, how many a hook or the user had already stopped at the time, and the newest examples with anything that looks like a token masked.&lt;/p&gt;

&lt;p&gt;For the rules about shared trees, the question "was another session working here" is answered from the transcripts themselves, by checking which sessions were active in the same git tree within ten minutes of the command. That is how the 25 &lt;code&gt;git add -A&lt;/code&gt; cases turned up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;The approach has clear edges, and I would rather list them than have someone find them the hard way.&lt;/p&gt;

&lt;p&gt;It reads command strings, so it is not a sandbox. A kill inside a script file, an alias, or an encoded command the parser cannot open goes through. The aim is to catch the forms an agent reaches for when it is not thinking about other sessions, not to contain an agent that is actively working around the rules.&lt;br&gt;
Some checks cannot be replayed. Transcripts do not record which ports were listening or how much memory was free at a given moment, so the port rule and the low-memory check are left out of the scan. The 507 does not include them, which means the real number on my machine was higher by an amount I cannot measure from history.&lt;br&gt;
Matching a rule is also not the same as causing damage. Some of the 507 would have been harmless at that exact moment. The count says how often my sessions did something unsafe on a shared machine, not how many times something broke.&lt;br&gt;
Finally, the scan only reads. It reads &lt;code&gt;~/.claude/projects&lt;/code&gt;, prints to the terminal, writes nothing and sends nothing over the network. Secrets are masked in the examples it prints.&lt;/p&gt;
&lt;h2&gt;
  
  
  Run it on your own transcripts
&lt;/h2&gt;

&lt;p&gt;The guards and the scan ship as a Claude Code plugin called claude-bulkhead (MIT, Node 18 or later, no dependencies). Install it from inside Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plugin marketplace add dooly6276/claude-bulkhead
/plugin install bulkhead@bulkhead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then replay the last month:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bulkhead:scan 30d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From a shell it is &lt;code&gt;bulkhead scan --since 14d&lt;/code&gt;, with &lt;code&gt;--project&lt;/code&gt; to narrow it to one repository and &lt;code&gt;--json&lt;/code&gt; if you want to process the result yourself. Installing the plugin also turns the guards on for new sessions, and each guard can be switched off on its own if you only want the report.&lt;/p&gt;

&lt;p&gt;If you run one session at a time, expect a short report, since most of these rules are about sessions getting in each other's way.&lt;/p&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/dooly6276/claude-bulkhead" rel="noopener noreferrer"&gt;https://github.com/dooly6276/claude-bulkhead&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I built claude-bulkhead. This article was written by an AI agent from my scan data and the project docs, at my request.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>git</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
