<?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: Fred 🍓</title>
    <description>The latest articles on DEV Community by Fred 🍓 (@fxdgif).</description>
    <link>https://dev.to/fxdgif</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%2F4200015%2F1dd5c9be-a05a-4788-80c4-1bbaf2c6cbc9.png</url>
      <title>DEV Community: Fred 🍓</title>
      <link>https://dev.to/fxdgif</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fxdgif"/>
    <language>en</language>
    <item>
      <title>Nobody updates the notes file. So I made a Stop hook do it.</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Thu, 03 Dec 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/a-stop-hook-that-makes-claude-code-update-its-own-notes-4m31</link>
      <guid>https://dev.to/fxdgif/a-stop-hook-that-makes-claude-code-update-its-own-notes-4m31</guid>
      <description>&lt;p&gt;My CLAUDE.md described last week's project. Claude reads that file fine. The problem was that I never updated it.&lt;/p&gt;

&lt;p&gt;Every Claude Code session starts from zero. The usual fix is a notes file (&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;NOTES.md&lt;/code&gt;, a &lt;code&gt;docs/&lt;/code&gt; folder) that tells the next session what the last one learned. Reading it isn't the hard part. Writing it is: a long session ends with a new module, two decisions and one nasty pitfall, and the notes file still describes last week.&lt;/p&gt;

&lt;p&gt;You can ask at the end of every task ("update the notes, please"), but you have to remember every single time. I wanted it to happen without asking.&lt;/p&gt;

&lt;p&gt;So I let a hook ask instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a Stop hook
&lt;/h2&gt;

&lt;p&gt;Claude Code fires &lt;code&gt;Stop&lt;/code&gt; when Claude is about to end its turn. A Stop hook can answer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"block"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Before you finish: update NOTES.md ..."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and Claude doesn't stop. It reads the reason and keeps going in the same turn.&lt;/p&gt;

&lt;p&gt;That timing is the whole point. At that moment Claude still has the full context of what it just did: which files, why, what went wrong on the way. A background job afterwards would have to reconstruct all of that from a diff. A prompt you send automatically afterwards would collide with whatever you type next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Only ask when it makes sense
&lt;/h2&gt;

&lt;p&gt;Blocking every Stop would be awful. The rules I ended up with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Only after a turn that changed files.&lt;/strong&gt; A turn that only answered a question has nothing to note.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Not if the notes were already updated in this turn.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;At most once per turn.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never when &lt;code&gt;stop_hook_active&lt;/code&gt; is true.&lt;/strong&gt; That flag means Claude is already continuing because a Stop hook blocked it. Block again and you have a loop.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rule 1 needs to know what happened during the turn, so the same script also listens to &lt;code&gt;UserPromptSubmit&lt;/code&gt; (a turn starts) and &lt;code&gt;PostToolUse&lt;/code&gt; (a file was edited), and keeps a tiny state file per session.&lt;/p&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;Save it as &lt;code&gt;~/.claude/notes-keeper.js&lt;/code&gt;:&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="c1"&gt;// notes-keeper.js - asks Claude Code to update NOTES.md before it ends a turn that changed code.&lt;/span&gt;
&lt;span class="c1"&gt;// One script for three hooks: UserPromptSubmit, PostToolUse, Stop. Always exits 0.&lt;/span&gt;
&lt;span class="s1"&gt;'use strict'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fs&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;'fs'&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;os&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;'os'&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;path&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;'path'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;NOTES&lt;/span&gt; &lt;span class="o"&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;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;'NOTES.md'&lt;/span&gt; &lt;span class="c1"&gt;// relative to the project folder&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;EDIT_TOOLS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'Edit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Write'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'MultiEdit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'NotebookEdit'&lt;/span&gt;&lt;span class="p"&gt;]&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;input&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;setEncoding&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="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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&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="n"&gt;input&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;c&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;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;'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="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;main&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;input&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="c1"&gt;// a broken hook must never break Claude Code&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="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&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;id&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_id&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="nf"&gt;replace&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="no"&gt;A&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Za&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&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="s1"&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;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stateFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tmpdir&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="sb"&gt;`notes-keeper-${id}.json`&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;load&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;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&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;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stateFile&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;return&lt;/span&gt; &lt;span class="kc"&gt;null&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;save&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stateFile&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="n"&gt;s&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hook_event_name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'UserPromptSubmit'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;edits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tended&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// a new turn starts&lt;/span&gt;
    &lt;span class="k"&gt;return&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hook_event_name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'PostToolUse'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="no"&gt;EDIT_TOOLS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool_name&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;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load&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="n"&gt;edits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tended&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&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;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;notebook_path&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;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;notes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cwd&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="no"&gt;NOTES&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;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cwd&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="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&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="n"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&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;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tended&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edits&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hook_event_name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Stop'&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_hook_active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="c1"&gt;// Claude is already continuing because of us: let it stop&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load&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;s&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tended&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edits&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tended&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;// ask once per turn, never twice&lt;/span&gt;
    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&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;decision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'block'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Before you finish: update ${NOTES} with what you learned or decided in this turn `&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="s1"&gt;'(new areas, decisions and why, pitfalls), and fix notes that are now out of date. '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="s1"&gt;'If there is nothing new, just answer "Notes are up to date." Keep it short and do not repeat your previous answer.'&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Register it for all three events in &lt;code&gt;.claude/settings.json&lt;/code&gt; (or your user settings):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"UserPromptSubmit"&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="nl"&gt;"hooks"&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="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node ~/.claude/notes-keeper.js"&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="nl"&gt;"PostToolUse"&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="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Edit|Write|MultiEdit|NotebookEdit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="nl"&gt;"hooks"&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="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node ~/.claude/notes-keeper.js"&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="nl"&gt;"Stop"&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="nl"&gt;"hooks"&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="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node ~/.claude/notes-keeper.js"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use a different file, pass it as an argument: &lt;code&gt;node ~/.claude/notes-keeper.js CLAUDE.md&lt;/code&gt;. On Windows, write the full path to the script instead of &lt;code&gt;~&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the reason text needs
&lt;/h2&gt;

&lt;p&gt;The reason is a prompt, and a vague one gets vague results. Three things in it make a big difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Say what's worth keeping:&lt;/strong&gt; new areas, decisions &lt;em&gt;with the reason&lt;/em&gt;, pitfalls. Otherwise you get a changelog ("edited src/a.ts"), which git already has.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give it a way out:&lt;/strong&gt; "If there is nothing new, just answer 'Notes are up to date.'" Without that, Claude invents something to write.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Say "don't repeat your previous answer".&lt;/strong&gt; The continuation is part of the same turn, and Claude likes to summarize again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changed for me
&lt;/h2&gt;

&lt;p&gt;I've had this running in VibeDesk since mid-October, where it writes to a folder of linked Markdown notes through an MCP tool instead of one file. The notes now grow with the project without me asking. A new session reads them first and can start from there, instead of rediscovering things by reading half the codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Claude decides what's worth noting. Sometimes it writes something obvious, sometimes it misses the one pitfall that mattered. I still read the notes now and then and delete the noise.&lt;/li&gt;
&lt;li&gt;It adds a short extra step to every turn that changed files. That costs some tokens.&lt;/li&gt;
&lt;li&gt;Notes can go stale in a different way: the code changes in a later turn that never touched the note. The hook doesn't catch that. In VibeDesk I check for notes whose files changed since, before a commit. That's a different mechanism.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;Where does the memory of your project live, and when did you last update it?&lt;/p&gt;

&lt;p&gt;Or pick one:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; &lt;code&gt;CLAUDE.md&lt;/code&gt; / &lt;code&gt;AGENTS.md&lt;/code&gt;, updated by hand&lt;br&gt;
&lt;strong&gt;B)&lt;/strong&gt; some notes folder, updated by Claude&lt;br&gt;
&lt;strong&gt;C)&lt;/strong&gt; nowhere, every session starts fresh&lt;br&gt;
&lt;strong&gt;D)&lt;/strong&gt; a tool or MCP server for it&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(This is how the "brain" in &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt; stays up to date, a free Windows desktop for Claude Code. The real version is in &lt;code&gt;src/main/brainTend.ts&lt;/code&gt;.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>I was sure Claude waited 15 minutes for me. It happened once.</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Wed, 02 Dec 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/i-was-sure-claude-code-waited-15-minutes-for-me-30-days-of-transcripts-it-happened-once-3pg9</link>
      <guid>https://dev.to/fxdgif/i-was-sure-claude-code-waited-15-minutes-for-me-30-days-of-transcripts-it-happened-once-3pg9</guid>
      <description>&lt;p&gt;I wrote that one of my Claude Code sessions is usually waiting for me, and that I find out fifteen minutes late. Then I measured it: 30 days of transcripts, 38 waits, median 1 minute 53 seconds. Fifteen minutes happened once.&lt;/p&gt;

&lt;p&gt;I had built a whole feature on that sentence: every session became a lit window in the city behind my terminals, and it turns amber when the session waits. I had never checked whether the sentence was true.&lt;/p&gt;

&lt;p&gt;Claude Code keeps a transcript of every session as a JSONL file under &lt;code&gt;~/.claude/projects&lt;/code&gt;. By default it deletes them after 30 days, so 30 days is what I had.&lt;/p&gt;

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

&lt;p&gt;A wait starts when Claude's turn ends: the last assistant message, with no tool call still open. It ends with my next prompt. If a background task or another agent wakes the session first, that gap doesn't count, because Claude wasn't waiting for me.&lt;/p&gt;

&lt;p&gt;The other rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A prompt I typed while Claude was still working (Claude Code marks it as queued) ends no wait. It just joins the running turn.&lt;/li&gt;
&lt;li&gt;Gaps over two hours count as "I was away" and are left out. There was one of those in 30 days, almost 6 hours long. With the cutoff anywhere between 30 minutes and 4 hours, every number below stays the same.&lt;/li&gt;
&lt;li&gt;Headless runs (&lt;code&gt;claude -p&lt;/code&gt;) and subagent transcripts are out. Nothing waits for me there.&lt;/li&gt;
&lt;li&gt;A permission wait is a tool call I approved or rejected myself. Recent Claude Code versions write who decided into the transcript (&lt;code&gt;permissionDecision&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;"Claude working" is the time from my prompt to the last assistant message of that turn.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The script prints numbers and nothing else. Trimmed down, the core is this (Node 20+):&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fs&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;'fs'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&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;'os'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&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;'path'&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;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;homedir&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="s1"&gt;'.claude'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'projects'&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;files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readdirSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;recursive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.jsonl'&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="n"&gt;f&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;'subagents'&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;waits&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="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;f&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;)&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;lastAssistant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;open&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// tool calls without a result yet&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;line&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&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="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="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;line&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;e&lt;/span&gt; &lt;span class="o"&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;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timestamp&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'assistant'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;lastAssistant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&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;b&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;c&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'tool_use'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&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="n"&gt;c&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;b&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'tool_result'&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;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;b&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool_use_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'user'&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isMeta&lt;/span&gt;
        &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;turnOrigin&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'human'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'human'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;promptSource&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'queued'&lt;/span&gt;
        &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;lastAssistant&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&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;min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;lastAssistant&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;60000&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;min&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;waits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// longer: I was away&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;The full version also skips slash-command output, interrupts and headless sessions, and only looks at the last 30 days.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;19 interactive sessions, 83 prompts from me, 38 waits.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Claude done → my next prompt&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;median&lt;/td&gt;
&lt;td&gt;1 min 53 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p75&lt;/td&gt;
&lt;td&gt;4 min 41 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p90&lt;/td&gt;
&lt;td&gt;8 min 26 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;longest&lt;/td&gt;
&lt;td&gt;24 min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;over 5 min&lt;/td&gt;
&lt;td&gt;9 of 38 (24 %)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;over 15 min&lt;/td&gt;
&lt;td&gt;1 of 38 (2.6 %)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;over 60 min&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;14 waits were over in less than a minute. 37 of 38 were under ten.&lt;/p&gt;

&lt;p&gt;A wait also includes the time I spend typing the next prompt. So a two-minute "wait" is often just me writing the reply.&lt;/p&gt;

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

&lt;p&gt;All 38 waits add up to 2.2 hours in 30 days.&lt;/p&gt;

&lt;p&gt;Claude worked about 36 hours in the same sessions. A few long autonomous runs inflate that: the five longest turns make up two thirds of it, and the longest ran for more than eight hours. If I cap every gap inside a turn at 15 minutes (long builds, background agents, the PC going to sleep), it's still 18.8 hours. Either way, Claude worked 8 to 16 times longer than it waited for me.&lt;/p&gt;

&lt;p&gt;The median turn was 4 minutes. And 15 of my 83 prompts (18 %) I typed before Claude was even done.&lt;/p&gt;

&lt;p&gt;Permission prompts have almost disappeared for me. I use auto mode. Of 3,662 tool calls, I answered 3 myself (median 51 seconds, longest 2.5 minutes). The classifier and my allow rules took care of the rest and blocked 4.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parallel sessions
&lt;/h2&gt;

&lt;p&gt;This was the part I cared about most. Lights across the street only make sense if several sessions wait at the same time.&lt;/p&gt;

&lt;p&gt;Two or more sessions waiting at once: 12 minutes in 30 days. 3 of the 38 waits started while another session was already waiting.&lt;/p&gt;

&lt;p&gt;Two sessions working at once: 3.2 of 32.7 hours.&lt;/p&gt;

&lt;p&gt;So the "three sessions most days" from my last post isn't what my transcripts show, at least not this month. Mostly I ran one main session and let it hand work to subagents. Subagents don't wait for me, so they aren't in these numbers.&lt;/p&gt;

&lt;p&gt;My guess about the fifteen minutes: I remember the 24-minute wait. I don't remember the 14 that were over in under a minute. And the waits I'd most like to measure might not be in the data at all (third point below).&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One person, one Windows PC, 30 days. 38 waits is a small sample.&lt;/li&gt;
&lt;li&gt;I measured while already using a tool that shows me when a session waits. There's no "before". Maybe the waits are short because of it, maybe I just sit close to my terminals.&lt;/li&gt;
&lt;li&gt;The last wait of a session is invisible. 16 of 19 sessions end with Claude done and no reply from me: I read the result and closed the session, or I forgot about it. That could be where my fifteen minutes live, and the transcript can't tell.&lt;/li&gt;
&lt;li&gt;"Me" means what Claude Code marks as a human prompt. If another agent types into a session on my behalf, it looks like me.&lt;/li&gt;
&lt;li&gt;Time spent on background agents counts as Claude working, not as waiting.&lt;/li&gt;
&lt;li&gt;Auto mode. If you approve tool calls by hand, your permission waits will look nothing like mine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;Run the script above. What's your median? I'd like to know if mine is typical.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(I build &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, a free, open-source Windows desktop for Claude Code. It shows waiting sessions with status colors, as lights in the background scene and on your phone. The post with the lights is &lt;a href="https://dev.to/fxdgif/which-of-my-claude-code-sessions-is-waiting-i-turned-them-into-lights-across-the-street-5eh"&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>productivity</category>
      <category>discuss</category>
      <category>ai</category>
    </item>
    <item>
      <title>Claude Code's 5-hour limit is in the statusline, not in hooks</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Tue, 01 Dec 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/your-claude-code-plan-limits-are-in-the-statusline-json-not-in-hooks-2mpi</link>
      <guid>https://dev.to/fxdgif/your-claude-code-plan-limits-are-in-the-statusline-json-not-in-hooks-2mpi</guid>
      <description>&lt;p&gt;If you're on a Pro or Max plan, the most annoying moment in Claude Code is the one where it stops mid-task because you hit the 5-hour limit. I wanted to see that coming: a small "82 %" somewhere, before it happens, not after.&lt;/p&gt;

&lt;p&gt;The obvious place to look is hooks. VibeDesk already listens to every Claude Code hook event. But the limits aren't in there: no hook payload carries them.&lt;/p&gt;

&lt;p&gt;They're in the &lt;strong&gt;statusline&lt;/strong&gt; input.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the numbers are
&lt;/h2&gt;

&lt;p&gt;Claude Code runs your &lt;code&gt;statusLine&lt;/code&gt; command and pipes a JSON object into it on stdin. On Pro and Max plans that JSON has a &lt;code&gt;rate_limits&lt;/code&gt; field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"rate_limits"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"five_hour"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"used_percentage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;82.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"resets_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1796320800&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"seven_day"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"used_percentage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="nl"&gt;"resets_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1796745600&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;ul&gt;
&lt;li&gt;
&lt;code&gt;used_percentage&lt;/code&gt; is 0 to 100.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;resets_at&lt;/code&gt; is a Unix timestamp in &lt;strong&gt;seconds&lt;/strong&gt;, not milliseconds. Pass it straight to &lt;code&gt;new Date()&lt;/code&gt; and you land in January 1970.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's documented in the &lt;a href="https://code.claude.com/docs/en/statusline" rel="noopener noreferrer"&gt;statusline docs&lt;/a&gt;, which is easy to miss if you only ever read the hooks reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  A statusline that shows them
&lt;/h2&gt;

&lt;p&gt;Save this as &lt;code&gt;~/.claude/limits-statusline.js&lt;/code&gt;:&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="c1"&gt;// limits-statusline.js - show your Claude Code plan limits in the statusline&lt;/span&gt;
&lt;span class="s1"&gt;'use strict'&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;input&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;setEncoding&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="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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&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="n"&gt;input&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;c&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;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;'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="k"&gt;try&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;r&lt;/span&gt; &lt;span class="o"&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;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rate_limits&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&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="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;w&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;used_percentage&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'number'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resets_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resets_at&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// resets_at is in seconds&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;at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&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="kc"&gt;null&lt;/span&gt; &lt;span class="c1"&gt;// window already over&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleTimeString&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="n"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2-digit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2-digit'&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;at&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleDateString&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="n"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'short'&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="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`${label} ${Math.round(w.used_percentage)}% (resets ${time})`&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;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;part&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'5h'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;five_hour&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;part&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'week'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;seven_day&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&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="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&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="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;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// never break the statusline: print nothing&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="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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;And point your settings at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"statusLine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node ~/.claude/limits-statusline.js"&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;You get something like &lt;code&gt;5h 82% (resets 22:10) · week 30% (resets Sun 08:00)&lt;/code&gt; under the prompt.&lt;/p&gt;

&lt;p&gt;On Windows, write the full path (&lt;code&gt;node C:/Users/you/.claude/limits-statusline.js&lt;/code&gt;). Depending on which shell runs the command, &lt;code&gt;~&lt;/code&gt; isn't expanded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four things that surprised me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. It's empty at the start.&lt;/strong&gt; The field only shows up after the first response in a session. A fresh session has no &lt;code&gt;rate_limits&lt;/code&gt; yet, so the script has to be fine with printing nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Windows can be missing.&lt;/strong&gt; Sometimes only one of the two is there. And with an API key instead of a subscription there are no limits at all. Treat every field as optional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. An old window is still an old window.&lt;/strong&gt; If you cache the last value (I do, to show it in the app between turns), check &lt;code&gt;resets_at&lt;/code&gt; before you show it. A "95 %" from a window that ended an hour ago is worse than nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. If you set &lt;code&gt;statusLine&lt;/code&gt; from a tool, you replace the user's own.&lt;/strong&gt; VibeDesk starts each session with its own &lt;code&gt;--settings&lt;/code&gt; file, and the &lt;code&gt;statusLine&lt;/code&gt; in there overrides the one in the user's &lt;code&gt;~/.claude/settings.json&lt;/code&gt;. Done naively, that silently takes away the statusline of everyone who had one. So the app looks up the user's command first (project &lt;code&gt;.claude/settings.local.json&lt;/code&gt;, then &lt;code&gt;.claude/settings.json&lt;/code&gt;, then the user settings), runs it with the same JSON, and passes its output through.&lt;/p&gt;

&lt;h2&gt;
  
  
  Warn once, not every turn
&lt;/h2&gt;

&lt;p&gt;The statusline runs often. If you turn the numbers into notifications, keep track of what you already said. I key each warning by window, reset time and level:&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${key}|${resetsAt}|${level}`&lt;/span&gt; &lt;span class="c1"&gt;// e.g. "fiveHour|1796320800|hot"&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;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&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="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you get one note at 75 %, one at 90 %, and one "free again" after a window you were warned about has reset. A new window gets a new &lt;code&gt;resets_at&lt;/code&gt;, so the next warning works without any cleanup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't cover
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I only see what Claude Code chooses to send. Whatever "used_percentage" is based on is up to Anthropic, and I can't check it.&lt;/li&gt;
&lt;li&gt;The exact moments the statusline runs aren't something I'd build timing on. I only use it as "the latest known value".&lt;/li&gt;
&lt;li&gt;This is Pro and Max only. On the API you'd look at token counts and cost instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;How do you deal with the 5-hour limit?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(This is how the limit chip in &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt; works, a free Windows desktop for Claude Code. When a session does hit the limit, it picks up again by itself after the reset.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>productivity</category>
      <category>ai</category>
      <category>discuss</category>
    </item>
    <item>
      <title>My agent builds its own windows and checks them by screenshot</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Mon, 30 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/claude-code-builds-its-own-windows-in-my-app-then-takes-a-screenshot-to-check-its-work-5ba4</link>
      <guid>https://dev.to/fxdgif/claude-code-builds-its-own-windows-in-my-app-then-takes-a-screenshot-to-check-its-work-5ba4</guid>
      <description>&lt;p&gt;At the start of November someone whose opinion I value looked at my app and said it felt like too many menus. I counted. 16 windows, a dozen overlays, 24 actions in the command palette. Fair point.&lt;/p&gt;

&lt;p&gt;The obvious fix would have been one more panel, the one he was missing. But the panels I'd want myself are small and personal: "which session is waiting for me", "the open tasks in this project", "how many tokens did I burn today". I can't build all of them, and I shouldn't.&lt;/p&gt;

&lt;p&gt;So I gave Claude Code a way to build them itself.&lt;/p&gt;

&lt;p&gt;VibeDesk is a desktop app around Claude Code. It already had an MCP server for things like arranging windows. I added six tools to it: &lt;code&gt;desk_app_create&lt;/code&gt;, &lt;code&gt;desk_app_snapshot&lt;/code&gt;, &lt;code&gt;desk_app_code&lt;/code&gt;, &lt;code&gt;desk_app_list&lt;/code&gt;, &lt;code&gt;desk_app_open&lt;/code&gt; and &lt;code&gt;desk_app_delete&lt;/code&gt;. You ask in any session, "build me a window that shows which session needs me", and a few seconds later it's on your desktop, in the same glass look as everything else.&lt;/p&gt;

&lt;p&gt;The one on my own desktop is a list of open tasks from the project's notes, newest first, with a filter and checkboxes to tick them off. Exactly the kind of window I'd never have built as a feature for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a call looks like
&lt;/h2&gt;

&lt;p&gt;Claude sends three strings and a name (shortened here):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Waiting on me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"html"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;div class=\"row\"&amp;gt;&amp;lt;h2&amp;gt;Waiting on me&amp;lt;/h2&amp;gt;&amp;lt;span class=\"spacer\"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=\"today\" class=\"muted small\"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;ul id=\"l\" class=\"list\"&amp;gt;&amp;lt;/ul&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vd.watch('sessions', (all) =&amp;gt; vd.mount('#l', all.map((x) =&amp;gt; vd.h('li', { class: 'row' }, ...))))"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"css"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;html&lt;/code&gt; is the body, without any &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;. &lt;code&gt;code&lt;/code&gt; is JavaScript that runs after it. The window already has VibeDesk's styles loaded, so a &lt;code&gt;button&lt;/code&gt;, a &lt;code&gt;.badge&lt;/code&gt; or a &lt;code&gt;.dot.waiting&lt;/code&gt; looks native without Claude writing CSS. The tool description lists those classes in one paragraph, plus a one-line example.&lt;/p&gt;

&lt;p&gt;The script talks to a global &lt;code&gt;vd&lt;/code&gt; object, and that's all it gets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;await vd.data('sessions' | 'brain' | 'usage' | 'project')&lt;/code&gt; reads, and &lt;code&gt;vd.watch(kind, fn)&lt;/code&gt; calls &lt;code&gt;fn&lt;/code&gt; on every change. Read only.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vd.store.get/set&lt;/code&gt; is the window's own storage, at most 200 kB of JSON.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vd.h(tag, props, ...children)&lt;/code&gt; builds elements. Text never gets parsed as HTML.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The loop: build, report, look
&lt;/h2&gt;

&lt;p&gt;The app saves the files, opens the window and waits up to 6 seconds for it to report back. The window only reports "ok" after it has run for 500 ms without an error, so an error after the first &lt;code&gt;await&lt;/code&gt; still makes it in. Only then does the tool return.&lt;/p&gt;

&lt;p&gt;I broke a window on purpose to show it. I changed &lt;code&gt;u.today.tokens&lt;/code&gt; to &lt;code&gt;u.totals.tokens&lt;/code&gt;, a field that doesn't exist. The tool came back after 584 ms with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tool window "Waiting on me" saved (id: waiting-on-me, 460×250).
ERROR: Cannot read properties of undefined (reading 'tokens')
Fix it and call desk_app_create again with id "waiting-on-me" (only the changed parts are needed).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Translated. The real tool texts are in German, which is my language. Claude doesn't mind.)&lt;/p&gt;

&lt;p&gt;The error also shows up in the window, with a button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6rg0lwe99diyx9gp299o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6rg0lwe99diyx9gp299o.png" alt="The broken window: the session list renders, and a red bar at the bottom shows the error and a &amp;quot;Let Claude fix it&amp;quot; button" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;"Let Claude fix it" sends the error as a prompt to the Claude session whose terminal is on top. If that session is busy, the prompt waits in its queue.&lt;/p&gt;

&lt;p&gt;Then there's &lt;code&gt;desk_app_snapshot&lt;/code&gt;. It brings the window to the front, asks the renderer where exactly it sits, takes a picture of only that rectangle with Electron's &lt;code&gt;capturePage&lt;/code&gt; (scaled down to 1,100 px wide at most) and returns it to Claude as an &lt;code&gt;image&lt;/code&gt; content block. Claude sees what you see.&lt;/p&gt;

&lt;p&gt;That turned out to be the important part. Code that runs without an error can still look wrong: a row that wraps, a badge in the wrong color, a list that's empty because the data has a different shape than Claude assumed. Without the picture, "it runs" is all Claude knows. I first built this loop for animated backgrounds, and it was the biggest quality jump there too.&lt;/p&gt;

&lt;p&gt;Fixed, sent again with only &lt;code&gt;code&lt;/code&gt; changed, 620 ms:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F86l4xrnrq0xp0kxfwzmr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F86l4xrnrq0xp0kxfwzmr.png" alt="The fixed window: three sessions, api waiting for you, shop-frontend working, docs-site done, 96 k tokens today" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's a test instance with demo projects, not my real desktop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the walls are
&lt;/h2&gt;

&lt;p&gt;Claude writes the code, but I still don't want code I haven't read running inside my app. So the window has no way out, and each layer is meant to hold even if another one fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An iframe with &lt;code&gt;sandbox="allow-scripts"&lt;/code&gt; and nothing else.&lt;/strong&gt; No &lt;code&gt;allow-same-origin&lt;/code&gt;, so the frame gets an opaque origin. It can't reach the app's DOM, the preload API, cookies or storage. It can't open popups, submit forms or navigate the top window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A strict CSP on every file.&lt;/strong&gt; The window loads from a custom protocol (&lt;code&gt;vibedesk-scene://app/&amp;lt;id&amp;gt;/…&lt;/code&gt;), and each response carries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;default-src 'none'; script-src vibedesk-scene:; style-src vibedesk-scene: 'unsafe-inline';
img-src vibedesk-scene: data: blob:; font-src data:; form-action 'none'; base-uri 'none'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;connect-src&lt;/code&gt; falls back to &lt;code&gt;'none'&lt;/code&gt;, so no &lt;code&gt;fetch&lt;/code&gt;, no XHR and no WebSocket. No outside scripts, and no inline scripts either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WebRTC is gone.&lt;/strong&gt; CSP doesn't cover it. Before Claude's code runs, the runtime replaces &lt;code&gt;RTCPeerConnection&lt;/code&gt; and its relatives with &lt;code&gt;undefined&lt;/code&gt;, as non-configurable properties, so they can't be put back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The frame stays where it is.&lt;/strong&gt; If a script sets &lt;code&gt;location.href&lt;/code&gt; to a web page, the main window's own CSP (&lt;code&gt;frame-src 'self' vibedesk-scene:&lt;/code&gt;) blocks the load.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data is a short list.&lt;/strong&gt; The renderer only answers messages whose &lt;code&gt;source&lt;/code&gt; is that exact iframe. There are four kinds of data, all read only. Pushes are throttled to one per 800 ms and only go out when something changed. Code is capped at 150,000 characters and there's a limit of 40 windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  What went wrong on the way
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Every error said "Script error."&lt;/strong&gt; In a sandboxed iframe, every script counts as cross-origin, even your own, so &lt;code&gt;window.onerror&lt;/code&gt; hides the message. The fix: &lt;code&gt;crossorigin="anonymous"&lt;/code&gt; on every script tag and &lt;code&gt;access-control-allow-origin: *&lt;/code&gt; on the protocol's responses. Then the real message comes through.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inline handlers fail silently.&lt;/strong&gt; The CSP blocks &lt;code&gt;onclick="..."&lt;/code&gt; without an error the window could report, so the button just does nothing, and the window still says "ok". Now &lt;code&gt;desk_app_create&lt;/code&gt; rejects &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;on...=&lt;/code&gt; in the HTML up front, with a message that says to use &lt;code&gt;addEventListener&lt;/code&gt; in &lt;code&gt;code&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Top-level &lt;code&gt;await&lt;/code&gt; costs you line numbers.&lt;/strong&gt; Claude's code is wrapped in an &lt;code&gt;async&lt;/code&gt; function so it can &lt;code&gt;await vd.data(...)&lt;/code&gt; right away. Anything that throws inside it becomes a rejected promise, and an &lt;code&gt;unhandledrejection&lt;/code&gt; has no line number at all. That's why the error in my broken example above says what went wrong but not where. Errors in event handlers still arrive as normal &lt;code&gt;error&lt;/code&gt; events, one line off because of the wrapper, and the runtime subtracts that line again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My navigation guard never fired.&lt;/strong&gt; I had a handler on Electron's &lt;code&gt;will-frame-navigate&lt;/code&gt; to keep the frame from leaving. For a plain &lt;code&gt;location.href&lt;/code&gt; change in the iframe, it didn't fire. The main window's CSP blocked the navigation anyway, so nothing leaked. An end-to-end test now checks exactly that. A fake web server on &lt;code&gt;127.0.0.1&lt;/code&gt; was useless as a test, by the way: Chromium's Private Network Access blocks that on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't cover
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The window can still show you anything.&lt;/strong&gt; It can draw a fake dialog that asks for a password. It can't send what you type anywhere, but it can put it in its own storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The repair button forwards text from the window to Claude.&lt;/strong&gt; The error message comes from the window's own code. Today Claude wrote that code itself, so it can only prompt itself. If windows ever become shareable, that button is a prompt injection path, and it needs a closer look before then.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read only, local only.&lt;/strong&gt; A window can't start a session, write a note or call GitHub. That rules out a lot of dashboards people would want. It's deliberate for now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The snapshot needs VibeDesk on screen.&lt;/strong&gt; If the app is minimized, the tool says so instead of returning an empty image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New tools only show up in new sessions.&lt;/strong&gt; Claude Code reads the MCP config when a session starts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is on main now and ships with VibeDesk 2.1 on December 13. The status side of it, which session is waiting, I wrote about &lt;a href="https://dev.to/fxdgif/which-of-my-claude-code-sessions-is-waiting-i-turned-them-into-lights-across-the-street-5eh"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;Which window would you want your agent to build for you?&lt;/p&gt;

&lt;p&gt;Or pick one:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; a dashboard: sessions, tokens, cost&lt;br&gt;
&lt;strong&gt;B)&lt;/strong&gt; a tracker for one project: tasks, decisions, checklists&lt;br&gt;
&lt;strong&gt;C)&lt;/strong&gt; a calculator or converter for something I do every day&lt;br&gt;
&lt;strong&gt;D)&lt;/strong&gt; nothing, I want fewer windows, not more&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(I build &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, a free, open-source Windows desktop for Claude Code. The tool windows live in &lt;code&gt;src/main/appStore.ts&lt;/code&gt;, &lt;code&gt;src/main/appTools.ts&lt;/code&gt; and &lt;code&gt;resources/app-runtime.js&lt;/code&gt; if you want to read the actual code.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>mcp</category>
      <category>ai</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Rust on Windows without Visual Studio: what builds with the GNU toolchain, and what doesn't</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Sun, 29 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/rust-on-windows-without-visual-studio-what-builds-with-the-gnu-toolchain-and-what-doesnt-39bo</link>
      <guid>https://dev.to/fxdgif/rust-on-windows-without-visual-studio-what-builds-with-the-gnu-toolchain-and-what-doesnt-39bo</guid>
      <description>&lt;p&gt;I'm moving parts of my Electron app to Rust. My Windows laptop has no Visual Studio on it, and I didn't want to install several gigabytes of Build Tools (with an admin prompt) just to try it out.&lt;/p&gt;

&lt;p&gt;So I used the GNU toolchain instead. After one day, two Rust pieces sit on the main branch: a 590 KB command-line binary and a 56 KB WebAssembly module. Neither needed Visual Studio or a MinGW install.&lt;/p&gt;

&lt;p&gt;This is what worked, plus the one wall I hit, and when you really do need MSVC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install without admin
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rustup-init.exe -y --default-host x86_64-pc-windows-gnu --profile minimal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;rustup installs into your user folder (&lt;code&gt;%USERPROFILE%\.rustup&lt;/code&gt; and &lt;code&gt;.cargo&lt;/code&gt;) and adds &lt;code&gt;.cargo\bin&lt;/code&gt; to your user PATH, so no admin prompt. &lt;code&gt;--profile minimal&lt;/code&gt; gives you &lt;code&gt;rustc&lt;/code&gt;, &lt;code&gt;cargo&lt;/code&gt; and the standard library. No docs, no clippy, no rustfmt; you can add those later with &lt;code&gt;rustup component add&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What I have now (trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; rustup show
Default host: x86_64-pc-windows-gnu
installed targets:
  wasm32-unknown-unknown
  x86_64-pc-windows-gnu

&amp;gt; rustc -V
rustc 1.100.1 (20ddd0171 2026-11-25)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;About 950 MB on disk, including the WebAssembly target.&lt;/p&gt;

&lt;p&gt;One small thing: a terminal or editor that was already open during the install doesn't see the new PATH. My build script checks &lt;code&gt;~/.cargo/bin&lt;/code&gt; directly for that reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it links without MinGW
&lt;/h2&gt;

&lt;p&gt;The GNU toolchain ships its own linker. Look in &lt;code&gt;lib\rustlib\x86_64-pc-windows-gnu\bin\self-contained&lt;/code&gt; and you'll find &lt;code&gt;x86_64-w64-mingw32-gcc.exe&lt;/code&gt;, &lt;code&gt;ld.exe&lt;/code&gt; and &lt;code&gt;dlltool.exe&lt;/code&gt;. Next door, in &lt;code&gt;lib\self-contained&lt;/code&gt;, there are 44 files with the C runtime bits and import libraries like &lt;code&gt;libkernel32.a&lt;/code&gt; and &lt;code&gt;libws2_32.a&lt;/code&gt;. And there's a &lt;code&gt;GCC-WARNING.txt&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;gcc.exe contained in this folder cannot be used for compiling C files - it is only used as a linker.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the whole deal. Pure Rust builds and links. C code doesn't compile.&lt;/p&gt;

&lt;p&gt;The binaries only import system DLLs. My bridge binary pulls in &lt;code&gt;kernel32&lt;/code&gt;, &lt;code&gt;ws2_32&lt;/code&gt;, &lt;code&gt;ntdll&lt;/code&gt;, &lt;code&gt;msvcrt&lt;/code&gt; and &lt;code&gt;bcryptprimitives&lt;/code&gt;, all of which ship with Windows. There's no &lt;code&gt;libgcc&lt;/code&gt; or &lt;code&gt;libwinpthread&lt;/code&gt; DLL to bundle.&lt;/p&gt;

&lt;h2&gt;
  
  
  What builds and what doesn't
&lt;/h2&gt;

&lt;p&gt;I built each of these in an empty project on the same machine (&lt;code&gt;serde_json&lt;/code&gt; I didn't need to, the bridge uses it):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Crate&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;serde_json&lt;/code&gt; 1&lt;/td&gt;
&lt;td&gt;builds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;socket2&lt;/code&gt; 0.5 (pulls &lt;code&gt;windows-sys&lt;/code&gt; 0.52)&lt;/td&gt;
&lt;td&gt;builds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;portable-pty&lt;/code&gt; 0.8 (pulls &lt;code&gt;winapi&lt;/code&gt; 0.3)&lt;/td&gt;
&lt;td&gt;builds; in a quick spike ConPTY, resize and exit codes worked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;socket2&lt;/code&gt; 0.6 (pulls &lt;code&gt;windows-sys&lt;/code&gt; 0.61)&lt;/td&gt;
&lt;td&gt;fails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;portable-pty&lt;/code&gt; 0.9 (pulls &lt;code&gt;windows-sys&lt;/code&gt; 0.61)&lt;/td&gt;
&lt;td&gt;fails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;anything that compiles C through the &lt;code&gt;cc&lt;/code&gt; crate&lt;/td&gt;
&lt;td&gt;fails: &lt;code&gt;failed to find tool "gcc.exe"&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pattern is in the parentheses: &lt;code&gt;windows-sys&lt;/code&gt; 0.61 or newer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The windows-sys 0.61 wall
&lt;/h2&gt;

&lt;p&gt;Here's the first error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: error calling dlltool 'dlltool.exe': program not found
error: could not compile `windows-sys` (lib) due to 1 previous error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;dlltool.exe&lt;/code&gt; is right there in the &lt;code&gt;self-contained&lt;/code&gt; folder, just not on PATH. So I put it on PATH, and got further:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: dlltool could not create import library with ...\self-contained\dlltool.exe
  -d ...\kernel32.dll_imports.def -D kernel32.dll ...
  ...\dlltool.exe: CreateProcess
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;dlltool&lt;/code&gt; itself wants to start an assembler, and the toolchain doesn't ship one.&lt;/p&gt;

&lt;p&gt;Why only 0.61? Older versions of &lt;code&gt;windows-sys&lt;/code&gt; came with prebuilt import libraries through &lt;code&gt;windows-targets&lt;/code&gt; (for 0.52 that's the &lt;code&gt;windows_x86_64_gnu&lt;/code&gt; crate). 0.61 goes through &lt;code&gt;windows-link&lt;/code&gt; instead and declares its imports with &lt;code&gt;raw-dylib&lt;/code&gt;. The compiler then generates the import libraries during the build, and on the GNU target it does that with &lt;code&gt;dlltool&lt;/code&gt;, which needs &lt;code&gt;as&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On its own that would be a footnote. Then I checked who depends on it. In a fresh project with &lt;code&gt;tokio&lt;/code&gt;, &lt;code&gt;notify&lt;/code&gt; and &lt;code&gt;reqwest&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cargo tree -i windows-sys@0.61.2 -e normal --depth 1
windows-sys v0.61.2
├── mio v1.2.5
├── notify v9.0.0
├── rustls-platform-verifier v0.7.1
├── socket2 v0.6.5
├── tokio v1.54.1
└── winapi-util v0.1.11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Async, file watching, TLS, and &lt;code&gt;winapi-util&lt;/code&gt; (which &lt;code&gt;walkdir&lt;/code&gt; uses). That's most of the crates you'd reach for in a real program.&lt;/p&gt;

&lt;p&gt;What I do for now: pin versions that still use the old import libraries, and write down why, right in &lt;code&gt;Cargo.toml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="k"&gt;[dependencies]&lt;/span&gt;
&lt;span class="na"&gt;serde_json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;features&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"preserve_order"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;# 0.5 instead of 0.6: windows-sys &amp;gt;= 0.61 needs dlltool + an assembler on windows-gnu
&lt;/span&gt;&lt;span class="na"&gt;socket2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.5"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And build with &lt;code&gt;--locked&lt;/code&gt;, so the build fails instead of quietly resolving something newer than &lt;code&gt;Cargo.lock&lt;/code&gt; says.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you need MSVC after all
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Any dependency on &lt;code&gt;windows-sys&lt;/code&gt; 0.61 or newer. Today that includes &lt;code&gt;tokio&lt;/code&gt;, &lt;code&gt;mio&lt;/code&gt;, &lt;code&gt;notify&lt;/code&gt; and &lt;code&gt;socket2&lt;/code&gt; 0.6.&lt;/li&gt;
&lt;li&gt;Any crate that compiles C or C++ code. In my test project, &lt;code&gt;reqwest&lt;/code&gt; 0.13 pulled in &lt;code&gt;aws-lc-sys&lt;/code&gt;, which builds a C library with CMake.&lt;/li&gt;
&lt;li&gt;Anything that has to link against C++ libraries built with MSVC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You have two ways out. MSVC Build Tools need admin rights and a few GB. A portable MinGW-w64 build (WinLibs, for example) is a zip you unpack and put on PATH, and it brings both &lt;code&gt;gcc&lt;/code&gt; and &lt;code&gt;as&lt;/code&gt;. I haven't tested either route yet. The next piece I'm moving to Rust will probably need &lt;code&gt;tokio&lt;/code&gt;, so I'll find out.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebAssembly is the easy part
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustup target add wasm32-unknown-unknown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This target links with &lt;code&gt;rust-lld&lt;/code&gt;, which comes with the toolchain. No Visual Studio, no MinGW, no &lt;code&gt;dlltool&lt;/code&gt;. My layout crate has no dependencies and no &lt;code&gt;wasm-bindgen&lt;/code&gt;. It exports plain functions and raw pointers, and JavaScript reads the arrays straight out of WebAssembly memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cp"&gt;#[unsafe(no_mangle)]&lt;/span&gt; &lt;span class="c1"&gt;// edition 2024 wants the unsafe(...)&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="s2"&gt;"C"&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;layout_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&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="kt"&gt;u32&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="kd"&gt;mut&lt;/span&gt; &lt;span class="nc"&gt;Layout&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;Box&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;into_raw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Box&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Layout&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;usize&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="cp"&gt;#[unsafe(no_mangle)]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;unsafe&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="s2"&gt;"C"&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;layout_tick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="kd"&gt;mut&lt;/span&gt; &lt;span class="nc"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;unsafe&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="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alpha&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;The release build is 57,393 bytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting it into an Electron app
&lt;/h2&gt;

&lt;p&gt;All of this runs from one script, &lt;code&gt;native/build.mjs&lt;/code&gt;, which runs before &lt;code&gt;npm run dev&lt;/code&gt; and &lt;code&gt;npm run build&lt;/code&gt;. Here's what it does, and why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No Rust, no problem.&lt;/strong&gt; If &lt;code&gt;cargo&lt;/code&gt; isn't found, it prints a warning and the app uses the old JavaScript versions. Only release builds pass &lt;code&gt;--required&lt;/code&gt; and fail hard. Anyone can still clone the repo and run it without installing Rust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;cargo build --release --locked&lt;/code&gt;.&lt;/strong&gt; The release profile has &lt;code&gt;lto = true&lt;/code&gt;, &lt;code&gt;codegen-units = 1&lt;/code&gt; and &lt;code&gt;strip = true&lt;/code&gt;. A tiny test binary with the default release profile came out at 1.2 MB; the real bridge, with a JSON parser, an HTTP client and an MCP server, is 590 KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The binary goes to &lt;code&gt;resources/bin&lt;/code&gt;.&lt;/strong&gt; That folder is gitignored, and electron-builder copies it into the installer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;extraResources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;resources/bin&lt;/span&gt;
    &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bin&lt;/span&gt;
    &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"*.exe"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;A running .exe can't be overwritten.&lt;/strong&gt; If the old binary is still running, the copy fails. Windows does let you rename a running exe, so the script renames it aside (&lt;code&gt;.old-&amp;lt;timestamp&amp;gt;&lt;/code&gt;), copies the new one in and cleans up the leftovers on the next build.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The WebAssembly goes in as base64.&lt;/strong&gt; This one cost me some time. The renderer is loaded from &lt;code&gt;file://&lt;/code&gt;, so &lt;code&gt;fetch('./layout.wasm')&lt;/code&gt; isn't an option, and Vite's &lt;code&gt;?inline&lt;/code&gt; import for &lt;code&gt;.wasm&lt;/code&gt; didn't work inside the worker bundle. So the build script writes a generated TypeScript module, also gitignored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// generated by native/build.mjs from native/layout&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="s1"&gt;'AGFzbQEAAAAB...'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The worker imports it with &lt;code&gt;import.meta.glob&lt;/code&gt;, which returns an empty object when the file doesn't exist. No Rust means no file, and the worker falls back to the JavaScript layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;embedded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./wasm.gen.ts'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;eager&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'default'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b64&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;embedded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&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;b64&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nc"&gt;WebAssembly&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'undefined'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="c1"&gt;// → JavaScript engine&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;atob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b64&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;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&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;let&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;0&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;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&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="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;bytes&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;=&lt;/span&gt; &lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;charCodeAt&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="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;WebAssembly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;57 KB of WebAssembly becomes a 77 KB module. For a single file that's a fair price.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't cover
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One Windows 11 laptop, Rust 1.100.1, crate versions as of late November 2026. If the compiler ever stops needing &lt;code&gt;dlltool&lt;/code&gt; for &lt;code&gt;raw-dylib&lt;/code&gt; on the GNU target, the wall goes away.&lt;/li&gt;
&lt;li&gt;No C dependencies, no cross-compiling, no code signing.&lt;/li&gt;
&lt;li&gt;I haven't tested the MSVC or WinLibs routes, so I can't tell you which one hurts less.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x86_64-pc-windows-msvc&lt;/code&gt; is still the default and the best-supported Windows target. GNU works well for small programs with few dependencies. Mine are both like that, on purpose.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;How do you build Rust on Windows?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; MSVC with Visual Studio or the Build Tools&lt;br&gt;
&lt;strong&gt;B)&lt;/strong&gt; the GNU toolchain, like here&lt;br&gt;
&lt;strong&gt;C)&lt;/strong&gt; WSL, and I ship Linux binaries&lt;br&gt;
&lt;strong&gt;D)&lt;/strong&gt; I don't, yet&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(I build &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, a free, open-source Windows desktop for Claude Code. It's an Electron app that I'm moving to Rust one piece at a time. Both pieces from this post are in &lt;a href="https://github.com/fxd-gif/vibedesk/tree/main/native" rel="noopener noreferrer"&gt;&lt;code&gt;native/&lt;/code&gt;&lt;/a&gt; and ship in version 2.1 on December 13.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>windows</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>I moved my graph layout to Rust. It fixed one of three bottlenecks.</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Sat, 28 Nov 2026 19:30:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/i-moved-my-graph-layout-to-rust-it-fixed-one-of-three-bottlenecks-9oo</link>
      <guid>https://dev.to/fxdgif/i-moved-my-graph-layout-to-rust-it-fixed-one-of-three-bottlenecks-9oo</guid>
      <description>&lt;p&gt;VibeDesk has a window I call the brain. It shows what Claude Code knows about a project as a graph: notes as dots, the files they mention as smaller dots, lines between them. With a few dozen notes it looks calm and pretty. With a big project it fell apart.&lt;/p&gt;

&lt;p&gt;I wanted to know how badly, so I generated a synthetic brain: 500 notes, 3,000 files. That came out as 3,242 nodes and 12,038 edges. Hovering over the notes ran at 6 to 13 fps. Zooming with the files visible ran at 1 fps.&lt;/p&gt;

&lt;p&gt;I'm already moving VibeDesk to Rust one piece at a time, so the plan looked obvious. Port the force layout to Rust, compile it to WebAssembly, done.&lt;/p&gt;

&lt;p&gt;It runs at 60 fps now. But Rust fixed only one of the three things that were wrong. The other two had nothing to do with the language.&lt;/p&gt;

&lt;h2&gt;
  
  
  The profile said "idle"
&lt;/h2&gt;

&lt;p&gt;The first thing I did was record a CPU profile of the renderer while hovering. It was about 90% idle.&lt;/p&gt;

&lt;p&gt;So JavaScript wasn't the bottleneck, at least not while hovering. A low frame rate with an idle CPU means something else is slow, and in a browser that's usually the GPU. From there I measured one layer at a time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the Electron main process: event loop lag, with a &lt;code&gt;setInterval&lt;/code&gt; that checks how late it fires&lt;/li&gt;
&lt;li&gt;the renderer: the CDP profiler&lt;/li&gt;
&lt;li&gt;the GPU: turn off drawing layers one by one and watch the frame rate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That turned up three separate causes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 1: lines wider than one pixel
&lt;/h2&gt;

&lt;p&gt;The graph was drawn with Canvas 2D. In Chrome that's Skia, and on the GPU Skia takes a slow path for strokes wider than one device pixel. A test with 2,200 edges:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Canvas 2D edges&lt;/th&gt;
&lt;th&gt;fps&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;lineWidth&lt;/code&gt; wider than 1 device pixel&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hairlines (&lt;code&gt;lineWidth = 1&lt;/code&gt;, identity transform)&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Lots of &lt;code&gt;arc()&lt;/code&gt; paths were expensive too. Drawing a pre-rendered circle with &lt;code&gt;drawImage&lt;/code&gt; was cheaper.&lt;/p&gt;

&lt;p&gt;So the bottom layer moved to WebGL: edges as &lt;code&gt;gl.LINES&lt;/code&gt;, nodes, glows and rings as quads that a fragment shader turns into circles. That's three draw calls per frame. Pulses, sparks and labels stay on a 2D canvas on top, because there are few of them.&lt;/p&gt;

&lt;p&gt;The bigger surprise was one flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// without MSAA: at 12,000 edges it cost two thirds of the frame rate.&lt;/span&gt;
&lt;span class="c1"&gt;// The shader smooths the circles itself.&lt;/span&gt;
&lt;span class="n"&gt;gl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'webgl'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;antialias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;premultipliedAlpha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;With the default &lt;code&gt;antialias: true&lt;/code&gt; the graph ran at 16 fps. Without it, 60. The circles still have soft edges because the shader fades them over half a pixel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight glsl"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&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="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&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;One more GPU thing: when you zoom in, hundreds of big glow quads overlap and the fill rate goes through the roof. The glow radius on screen is now capped at 56 CSS pixels.&lt;/p&gt;

&lt;p&gt;If WebGL isn't available, the old 2D path still runs, now with hairlines and pre-rendered disc sprites. Nothing in this section involved Rust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 2: d3-force on the window thread
&lt;/h2&gt;

&lt;p&gt;This is the part Rust fixed.&lt;/p&gt;

&lt;p&gt;The layout used &lt;code&gt;d3-force&lt;/code&gt;. At 3,200 nodes one simulation step took 32 ms, on the window thread, and after every change the graph runs about 200 steps until it settles. A single step is already two frames' worth of time at 60 fps.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vibedesk-layout&lt;/code&gt; is a small Rust crate with the same forces as my d3 configuration: springs for the links, Barnes-Hut repulsion with a quadtree, collision on a grid, a pull towards the center. It has no dependencies and doesn't use &lt;code&gt;wasm-bindgen&lt;/code&gt;. It exports plain functions and raw pointers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cp"&gt;#[unsafe(no_mangle)]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;unsafe&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="s2"&gt;"C"&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;layout_tick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="kd"&gt;mut&lt;/span&gt; &lt;span class="nc"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;unsafe&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="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alpha&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;The worker writes the input straight into WebAssembly memory and reads the positions back the same way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// new views every time: if the memory grows, old views become invalid&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;f64&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Float64Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;layout_x&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;layout_y&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;layout_tick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a Web Worker that's 11 ms per step instead of 32, and the window thread doesn't do any of it.&lt;/p&gt;

&lt;p&gt;I kept the JavaScript version as a fallback, because that's the rule for every piece I move to Rust. Both engines sit behind the same small interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mod&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;wasmEngine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mod&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="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;jsEngine&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="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the WebAssembly module is missing (someone built VibeDesk without Rust) or won't compile (a Content Security Policy without &lt;code&gt;wasm-unsafe-eval&lt;/code&gt;), the worker runs d3. If the worker itself can't start, the same code runs on the window thread like before. The tests run the same checks against both engines: no big overlaps, the graph stays centered, a dragged node stays where you put it. One extra test checks that Rust is faster than d3.&lt;/p&gt;

&lt;p&gt;One Electron detail cost me some time. The renderer loads from &lt;code&gt;file://&lt;/code&gt;, so it can't &lt;code&gt;fetch()&lt;/code&gt; a &lt;code&gt;.wasm&lt;/code&gt; file sitting next to it, and Vite's &lt;code&gt;?inline&lt;/code&gt; import didn't work inside the worker bundle. The build script now writes the module into a TypeScript file as a base64 string. If that file doesn't exist, &lt;code&gt;import.meta.glob&lt;/code&gt; returns an empty object and the worker uses d3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 3: reading 500 files on every call
&lt;/h2&gt;

&lt;p&gt;The third problem wasn't in the window at all.&lt;/p&gt;

&lt;p&gt;The Electron main process has a &lt;code&gt;BrainStore.list()&lt;/code&gt; that returns all notes. It read every note file from disk on every call. On Windows, opening a file costs about 0.6 ms, so 500 notes took 300 to 500 ms. While that runs, the main process is blocked, and with it the whole app. &lt;code&gt;list()&lt;/code&gt; runs on every brain tool call Claude makes, at session start, and whenever the graph reloads.&lt;/p&gt;

&lt;p&gt;Now there's a cache per brain folder. &lt;code&gt;fs.watch&lt;/code&gt; sets a dirty flag. As long as nothing changed, &lt;code&gt;list()&lt;/code&gt; returns the cached list without touching the disk. When something did change, it only re-reads files whose modification time or size differs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&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;hit&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mtime&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mtimeMs&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;note&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;note&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseNote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mtimeMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;mtime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mtimeMs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;note&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;Two small details: the flag is cleared &lt;em&gt;before&lt;/em&gt; reading, so a change during the read marks the list dirty again. And the app's own writes set the flag right away instead of waiting for the watcher.&lt;/p&gt;

&lt;p&gt;While I was in there I found a loop. When Claude read a file that wasn't in the graph, the brain window reloaded the graph, the file still wasn't in it, and the next read reloaded it again. Now that happens at most once per file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before and after
&lt;/h2&gt;

&lt;p&gt;Measured in the real app with Playwright, on my Windows 11 laptop:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fps&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hover, notes only&lt;/td&gt;
&lt;td&gt;6-13&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show files (3,200 nodes)&lt;/td&gt;
&lt;td&gt;3-5&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hover with files&lt;/td&gt;
&lt;td&gt;4-5&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zoom with files&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude reads 40 files&lt;/td&gt;
&lt;td&gt;2-4&lt;/td&gt;
&lt;td&gt;59&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  So how much of this was Rust?
&lt;/h2&gt;

&lt;p&gt;Less than the commit message suggests.&lt;/p&gt;

&lt;p&gt;Hovering and zooming were limited by the GPU (remember the idle CPU profile), so that's where WebGL and the missing MSAA did the work. The blocked main process had nothing to do with drawing at all. Rust made the layout step about three times faster, 32 ms down to 11.&lt;/p&gt;

&lt;p&gt;To be fair to d3: moving it into a worker would have taken it off the window thread too. That's exactly what my fallback does. What Rust adds on top is that the graph needs about a third of the compute time to settle.&lt;/p&gt;

&lt;p&gt;I'd still do it again. But if I had started with "rewrite it in Rust" and skipped the measuring, I'd have a faster layout and the same 1 fps zoom.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One laptop. Other GPUs and drivers take different slow paths. I'd expect the MSAA cost in particular to vary a lot between machines.&lt;/li&gt;
&lt;li&gt;A synthetic brain. It came from a generator script, not from a real project. Real graphs have a different shape, and I didn't measure at which size the old code starts to hurt.&lt;/li&gt;
&lt;li&gt;Noisy numbers. My own VibeDesk was running next to the test instance, which costs GPU time. I measured every version several times and compared A and B in the same run, which is why the "before" column has ranges.&lt;/li&gt;
&lt;li&gt;It's not a language benchmark. My crate does exactly one job, and d3 is a general library. Collision uses a grid in mine and a quadtree in d3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One tip if you measure Electron with Playwright: &lt;code&gt;page.evaluate&lt;/code&gt; sends its return value back over CDP. Returning 1.5 MB from it took seconds and made my numbers worse than the app. Return small values only.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;This is the second piece of VibeDesk that moved to Rust. The first one sits between Claude Code and the app (hooks, statusline, MCP server); more on that in a later post. The layout is on &lt;code&gt;main&lt;/code&gt; now and ships with VibeDesk 2.1 on December 13.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;When an app gets slow, where do you look first?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; the JavaScript / CPU profiler&lt;br&gt;
&lt;strong&gt;B)&lt;/strong&gt; rendering and the GPU&lt;br&gt;
&lt;strong&gt;C)&lt;/strong&gt; I/O, the backend, the database&lt;br&gt;
&lt;strong&gt;D)&lt;/strong&gt; honestly, I start rewriting it&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(I build &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt; on my own: a free, open-source Windows desktop for Claude Code. The layout crate is about 500 lines of Rust plus tests: &lt;a href="https://github.com/fxd-gif/vibedesk/tree/main/native/layout" rel="noopener noreferrer"&gt;native/layout&lt;/a&gt;. The plan for the whole move to Rust is in &lt;a href="https://github.com/fxd-gif/vibedesk/tree/main/native" rel="noopener noreferrer"&gt;&lt;code&gt;native/README.md&lt;/code&gt;&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>webassembly</category>
      <category>performance</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Which of my Claude Code sessions is waiting? I turned them into lights across the street</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Thu, 26 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/which-of-my-claude-code-sessions-is-waiting-i-turned-them-into-lights-across-the-street-5eh</link>
      <guid>https://dev.to/fxdgif/which-of-my-claude-code-sessions-is-waiting-i-turned-them-into-lights-across-the-street-5eh</guid>
      <description>&lt;p&gt;I run three Claude Code sessions most days. One of them is usually waiting for me, and I usually find out fifteen minutes late.&lt;/p&gt;

&lt;p&gt;My first fix was a status dot per session, and a card with buttons when one needs a permission. The card works. The dots I stopped looking at after two days, the way you stop reading a dashboard you never asked for.&lt;/p&gt;

&lt;p&gt;So for the next version of VibeDesk I tried the opposite of another panel. The status goes into something I already look at all day without trying.&lt;/p&gt;

&lt;h2&gt;
  
  
  The window I already stare at
&lt;/h2&gt;

&lt;p&gt;VibeDesk has a rain scene behind the terminals: rain on a glass pane, a blurred city at night behind it. I look at it constantly, between prompts, while Claude thinks.&lt;/p&gt;

&lt;p&gt;In 2.1 every session gets a lit window in that city:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Green&lt;/strong&gt; flickers softly, like a screen in a dark room. It's working.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amber&lt;/strong&gt; breathes slowly, about every 2.4 seconds, and throws warm light onto the glass. It's waiting for you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blue&lt;/strong&gt; is steady. It's done.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Red&lt;/strong&gt; means something failed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Through a raindrop you see the window sharp, with its cross bars. Through the fogged glass it's only a soft glow. You don't read it. You notice that something across the street turned warm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Each session keeps its window
&lt;/h2&gt;

&lt;p&gt;The first one gets the middle, then right, left, right, left, and a second floor above. A session keeps its window for as long as it lives.&lt;/p&gt;

&lt;p&gt;That turned out to matter more than the colors. After a day you know the middle one is the API server without reading anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ctrl+Tab: look outside
&lt;/h2&gt;

&lt;p&gt;When I do want details, Ctrl+Tab makes my windows step back. Every light gets its name and status underneath ("waiting · 3 min"), the arrow keys move between them, and Enter or a click brings that session to the front, ready to type.&lt;/p&gt;

&lt;p&gt;That last part needed a fix. The first version handed the keyboard over one frame late, and anything typed fast right after Enter got lost.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm not sure about
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Color alone is a weak signal.&lt;/strong&gt; The motion helps (flicker, breathing, steady), and the Ctrl+Tab view writes the status out, but I don't know yet how this works for colorblind people. If that's you, I'd really like to hear it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Twelve windows at most.&lt;/strong&gt; Nobody should run twelve sessions. Someone will.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ambient can turn into noise.&lt;/strong&gt; On battery saver the lights stop moving and just glow, and the whole thing has an off switch. I'm still not sure a breathing light is calm enough for everyone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When
&lt;/h2&gt;

&lt;p&gt;VibeDesk 2.1 comes out on Sunday, December 13. It's free and open source, for Windows. This is the short film for it, premiering on release day:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/fOqE1KszEts" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;What would you put in the background of your editor, if anything?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; agent or session status&lt;br&gt;
&lt;strong&gt;B)&lt;/strong&gt; build and CI status&lt;br&gt;
&lt;strong&gt;C)&lt;/strong&gt; nothing, ambient stuff distracts me&lt;br&gt;
&lt;strong&gt;D)&lt;/strong&gt; something else, tell me&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The code is on &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. Wishes for 2.2 go in the issues.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>discuss</category>
      <category>showdev</category>
      <category>ux</category>
    </item>
    <item>
      <title>A Windows toast when Claude Code needs you, with nothing to install (and the dash that broke it)</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/a-windows-toast-when-claude-code-needs-you-with-nothing-to-install-and-the-dash-that-broke-it-3f2m</link>
      <guid>https://dev.to/fxdgif/a-windows-toast-when-claude-code-needs-you-with-nothing-to-install-and-the-dash-that-broke-it-3f2m</guid>
      <description>&lt;p&gt;I usually have two or three Claude Code sessions open. The one that costs me time is never the one that's working. It's the one that has been sitting on a permission prompt for fifteen minutes in a window I'm not looking at.&lt;/p&gt;

&lt;p&gt;Most notification setups I find are written for macOS. On Windows the usual answer is "install the BurntToast module". You don't have to: Windows PowerShell 5.1 ships with Windows and can show a real toast through built-in WinRT classes.&lt;/p&gt;

&lt;p&gt;Here's the setup I tested with real Claude Code sessions (2.1.316, Windows 11), and the three things that broke on the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the right hook
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;You want to know&lt;/th&gt;
&lt;th&gt;Hook&lt;/th&gt;
&lt;th&gt;When it fires&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude needs a permission&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PermissionRequest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the moment the prompt appears&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude is done&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Stop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;at the end of every turn&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude needs a permission (later)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Notification&lt;/code&gt;, matcher &lt;code&gt;permission_prompt&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;after about 6 seconds without typing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude is idle&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Notification&lt;/code&gt;, matcher &lt;code&gt;idle_prompt&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;about 60 seconds after Claude finished&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Notification&lt;/code&gt; timings are from the hooks reference. For "it needs me right now", use &lt;code&gt;PermissionRequest&lt;/code&gt;. A &lt;code&gt;PermissionRequest&lt;/code&gt; hook that prints nothing makes no decision, so the normal prompt in the terminal stays exactly as it was. This hook only adds a toast.&lt;/p&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;Save this as &lt;code&gt;%USERPROFILE%\.claude\notify.ps1&lt;/code&gt;:&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="c"&gt;# notify.ps1 - a Windows toast for Claude Code hooks. Keep this file ASCII-only.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Kind&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'waiting'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="kr"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;In.ReadToEnd&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ConvertFrom-Json&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$project&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Split-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Leaf&lt;/span&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$Kind&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-eq&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'done'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$text&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'Done'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;elseif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool_input&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="c"&gt;# Bash and PowerShell both pass the command here&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool_input&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Length&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-gt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;77&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'...'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$text&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Wants to run: &lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;elseif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$text&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Wants to use &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool_name&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$text&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'Needs you'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;Windows.UI.Notifications.ToastNotificationManager&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Windows.UI.Notifications&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ContentType&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WindowsRuntime&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;Windows.Data.Xml.Dom.XmlDocument&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Windows.Data.Xml.Dom.XmlDocument&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ContentType&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WindowsRuntime&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="nv"&gt;$esc&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Security.SecurityElement&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Escape&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$xml&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;New-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Windows.Data.Xml.Dom.XmlDocument&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$xml&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;LoadXml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;toast&amp;gt;&amp;lt;visual&amp;gt;&amp;lt;binding template='ToastGeneric'&amp;gt;&amp;lt;text&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$esc&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Claude Code - &lt;/span&gt;&lt;span class="nv"&gt;$project&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/text&amp;gt;&amp;lt;text&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$esc&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$text&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/text&amp;gt;&amp;lt;/binding&amp;gt;&amp;lt;/visual&amp;gt;&amp;lt;/toast&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="nv"&gt;$toast&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Windows.UI.Notifications.ToastNotification&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$xml&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="c"&gt;# Same tag for the same session: a new toast replaces the old one&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$tag&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-replace&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'[^a-zA-Z0-9-]'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$tag&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Tag&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$tag&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="nx"&gt;Min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$tag&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Length&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Group&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'claude-code'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="c"&gt;# Borrow the AppUserModelID of Windows PowerShell, so there is nothing to register&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;$app&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Windows.UI.Notifications.ToastNotificationManager&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;CreateToastNotifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$toast&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Which session?&lt;/strong&gt; The title is the project folder from &lt;code&gt;cwd&lt;/code&gt;. With three sessions, "Claude Code - shop-frontend" is the whole point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What does it want?&lt;/strong&gt; For shell commands it shows the command: "Wants to run: npm test".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One toast per session.&lt;/strong&gt; The toast &lt;code&gt;Tag&lt;/code&gt; is the session id, so "Done" replaces "Wants to run: npm test" instead of stacking up. In my test the notification center held exactly one toast per session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It never gets in Claude's way.&lt;/strong&gt; Every error ends in &lt;code&gt;exit 0&lt;/code&gt;, so a broken toast can't turn into a hook error.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The hooks
&lt;/h2&gt;

&lt;p&gt;Merge this into &lt;code&gt;%USERPROFILE%\.claude\settings.json&lt;/code&gt; (replace &lt;code&gt;YOU&lt;/code&gt; with your Windows user name):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PermissionRequest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"powershell.exe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-NoProfile"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-ExecutionPolicy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bypass"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-File"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:/Users/YOU/.claude/notify.ps1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"waiting"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Stop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"powershell.exe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-NoProfile"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-ExecutionPolicy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bypass"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-File"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:/Users/YOU/.claude/notify.ps1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"done"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;args&lt;/code&gt; makes Claude Code start &lt;code&gt;powershell.exe&lt;/code&gt; directly, with no shell in between. Without it, hook commands on Windows run through Git Bash if you have it installed, and Bash expands every &lt;code&gt;$&lt;/code&gt; in an inline PowerShell command before PowerShell ever sees it. A script file plus &lt;code&gt;args&lt;/code&gt; avoids all of that quoting.&lt;/p&gt;

&lt;p&gt;If your Claude Code doesn't know &lt;code&gt;args&lt;/code&gt; yet, use one string and quote the path, not the program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"powershell.exe -NoProfile -ExecutionPolicy Bypass -File &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;C:/Users/YOU/.claude/notify.ps1&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; done"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart your sessions after changing the settings. In my test, a real &lt;code&gt;Stop&lt;/code&gt; showed "Claude Code - demo-project / Done", and a real permission request showed "Wants to run: node -e "console.log(42)"".&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things that broke
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. An en dash killed the whole script.&lt;/strong&gt; A typographic dash in a string (&lt;code&gt;"Claude Code – $project"&lt;/code&gt;) and nothing worked anymore: "The string is missing the terminator". Windows PowerShell 5.1 reads a &lt;code&gt;.ps1&lt;/code&gt; without a byte order mark as ANSI, which is Windows-1252 on my machine. The en dash is three bytes in UTF-8, &lt;code&gt;E2 80 93&lt;/code&gt;, and &lt;code&gt;0x93&lt;/code&gt; in Windows-1252 is a curly opening quote. PowerShell accepts curly quotes as real quotes, so the string ended in the middle of the dash. The same file saved with a BOM works. The simplest fix is the first line of the script: ASCII only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. An empty tag throws.&lt;/strong&gt; When I tested with hand-written JSON that had no &lt;code&gt;session_id&lt;/code&gt;, setting &lt;code&gt;$toast.Tag = ''&lt;/code&gt; threw "The parameter is incorrect", and there was no toast. Hence the &lt;code&gt;if ($tag)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. &lt;code&gt;async: true&lt;/code&gt; showed nothing in headless runs.&lt;/strong&gt; Command hooks can run in the background with &lt;code&gt;"async": true&lt;/code&gt;, and PowerShell takes about 0.6 s to start (607 to 673 ms in three runs on my laptop), so that was my first idea. In &lt;code&gt;claude -p&lt;/code&gt; runs no toast ever appeared. My guess is that the session ended before PowerShell did. Synchronous with a 10-second timeout worked every time, and 0.6 s at the end of a turn doesn't hurt. I haven't tried &lt;code&gt;async&lt;/code&gt; in an interactive session.&lt;/p&gt;

&lt;p&gt;Two smaller ones: I only tested Windows PowerShell 5.1 (&lt;code&gt;powershell.exe&lt;/code&gt;), not PowerShell 7. And if nothing shows up at all, check Do not disturb: Windows then sends toasts straight to the notification center without showing them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it can't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Answer the prompt.&lt;/strong&gt; Buttons on a toast need an app that handles them. If you want to answer from somewhere else, the same &lt;code&gt;PermissionRequest&lt;/code&gt; hook can return a decision. I wrote about that in &lt;a href="https://dev.to/fxdgif/approve-claude-code-permission-prompts-from-anywhere-with-the-permissionrequest-hook-45d9"&gt;Approve Claude Code permission prompts from anywhere&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bring the right terminal to the front&lt;/strong&gt; when you click it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Or let an app do it
&lt;/h2&gt;

&lt;p&gt;Full disclosure: I build &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, a free, open-source Windows app around Claude Code. It shows a status dot per session (yellow means "needs you") and turns permission prompts into cards with Allow and Deny, also on a paired phone. But if a toast is all you want, the script above is all you need. The website has a longer &lt;a href="https://fxd-gif.github.io/vibedesk/guides/claude-code-notifications-windows/" rel="noopener noreferrer"&gt;guide to Claude Code notifications on Windows&lt;/a&gt;, including a beep-only version.&lt;/p&gt;

&lt;p&gt;How do you notice a waiting session today? &lt;strong&gt;A)&lt;/strong&gt; a sound &lt;strong&gt;B)&lt;/strong&gt; a toast &lt;strong&gt;C)&lt;/strong&gt; I check by hand &lt;strong&gt;D)&lt;/strong&gt; I don't, and lose twenty minutes&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>windows</category>
      <category>powershell</category>
      <category>productivity</category>
    </item>
    <item>
      <title>My ASCII hero redrew every frame from scratch. Only 55 of 12,198 cells had changed.</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Thu, 12 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/my-ascii-hero-redrew-every-frame-from-scratch-only-55-of-12198-cells-had-changed-12pk</link>
      <guid>https://dev.to/fxdgif/my-ascii-hero-redrew-every-frame-from-scratch-only-55-of-12198-cells-had-changed-12pk</guid>
      <description>&lt;p&gt;Last week I rebuilt the website for my open-source app. The hero is a rain cloud made of characters (&lt;code&gt;.·:;!/?*%$&amp;amp;8#@&lt;/code&gt;). It drifts, it rains, and it bends a little around your cursor. Plain Canvas 2D, no WebGL, no library.&lt;/p&gt;

&lt;p&gt;I built it with the usual performance tricks. Then I turned each one off and measured. Most of them did less than I thought. The biggest win was one I hadn't built.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the field works
&lt;/h2&gt;

&lt;p&gt;The canvas is a grid of cells, 9 × 15 CSS pixels each. On a 1920 px wide screen the hero canvas is 1920 × 846, so that's 214 × 57 = &lt;strong&gt;12,198 cells&lt;/strong&gt;. Most of them are dark sky. About 700 show a character at any moment.&lt;/p&gt;

&lt;p&gt;Every frame, each cell asks the scene for a brightness between 0 and 1. For the cloud that's a few soft blobs, value noise on top, a flat underside like a real cumulus, and light from above. Brightness picks a character from a density ramp and one of 12 opacity levels. Rain drops are separate particles that write &lt;code&gt;|&lt;/code&gt;, &lt;code&gt;:&lt;/code&gt; and &lt;code&gt;.&lt;/code&gt; into the cells they pass.&lt;/p&gt;

&lt;p&gt;The loop runs at most 30 fps, and only while the hero is on screen and the tab is visible:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;IntersectionObserver&lt;/span&gt;&lt;span class="p"&gt;(([&lt;/span&gt;&lt;span class="nx"&gt;en&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="nx"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;en&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isIntersecting&lt;/span&gt;
  &lt;span class="nf"&gt;start&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="na"&gt;rootMargin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;60px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visibilitychange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The tricks I built in
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. A glyph atlas.&lt;/strong&gt; Every character is pre-rendered once into an offscreen canvas, in 12 opacity levels and 2 colours. Drawing a cell is a single &lt;code&gt;drawImage&lt;/code&gt; from that atlas instead of &lt;code&gt;fillText&lt;/code&gt; with a new &lt;code&gt;fillStyle&lt;/code&gt; and &lt;code&gt;globalAlpha&lt;/code&gt; each time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Interlacing.&lt;/strong&gt; The noise field is cached. The cloud moves slowly, so each frame only recomputes every second or third row:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;K&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;baseFull&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="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;9000&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;frameNo&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;K&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;let&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ph&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;K&lt;/span&gt;&lt;span class="p"&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;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;cols&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;base&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;cols&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;scene&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sample&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="cm"&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;&lt;strong&gt;3. A bounding box.&lt;/strong&gt; Once per frame I compute a rectangle around the cloud. Outside it, a cell skips the noise and only gets the odd dust speck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Cheap cursor effects.&lt;/strong&gt; The lens and the ripples don't sample the noise again. They read the cached field at a shifted position.&lt;/p&gt;

&lt;p&gt;One small bug came with the atlas. My first version showed stray dash-like fragments in the cloud. The fix was to clip every glyph to its own cell while building the atlas, so nothing from one character can end up in the neighbouring cell:&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="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;beginPath&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;acw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ach&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CHARS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;x0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;acw&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;ach&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;restore&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At today's font and cell sizes I checked every glyph, and none of them leaves its cell anymore. The clip stays anyway. It costs nothing, and it matters for the trick at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I measured
&lt;/h2&gt;

&lt;p&gt;Setup: Playwright driving Chromium 153 (headless, but on the real GPU through ANGLE/D3D11), an Intel Iris Xe laptop, viewport 1920 × 1080, device pixel ratio 1, nobody touching the mouse. Two numbers per run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;JS per frame&lt;/strong&gt;: I wrapped &lt;code&gt;requestAnimationFrame&lt;/code&gt; and timed my own callback (update plus all the &lt;code&gt;drawImage&lt;/code&gt; calls).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whole browser&lt;/strong&gt;: CPU time of every Chromium process over 10 seconds, as a percentage of one core. That includes the GPU process and the compositor, which the JS timer never sees.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I ran each variant several times, alternating, and the table shows the medians. The laptop's clock moves a lot, so identical runs differed by up to ±30 %. Read the numbers as rough.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;JS per frame&lt;/th&gt;
&lt;th&gt;Whole browser&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hero switched off&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;~10 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Everything on (what's live)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.5 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~49 %&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recompute every row (no interlacing)&lt;/td&gt;
&lt;td&gt;5.0 ms&lt;/td&gt;
&lt;td&gt;~61 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No bounding box&lt;/td&gt;
&lt;td&gt;3.6 ms&lt;/td&gt;
&lt;td&gt;~44 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;fillText&lt;/code&gt; instead of the atlas&lt;/td&gt;
&lt;td&gt;3.0 ms&lt;/td&gt;
&lt;td&gt;~40 %&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things surprised me:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;My JavaScript was never the problem.&lt;/strong&gt; 3.5 ms at 30 fps is about a tenth of a core. With the hero running, the whole browser used about half a core, against ~10 % without it. The rest of the bill was the browser itself: clearing a 1920 × 846 canvas, repainting about 700 glyphs and compositing the result, 30 times a second.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interlacing helped, the bounding box didn't.&lt;/strong&gt; Interlacing saved about 1.5 ms per frame. The bounding box was within noise, because the blob test it skips was already cheap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The atlas didn't beat &lt;code&gt;fillText&lt;/code&gt;.&lt;/strong&gt; In this Chrome, on this laptop, plain &lt;code&gt;fillText&lt;/code&gt; was the same or a little cheaper. With only about 700 glyphs per frame there isn't much for an atlas to win, and the advice I had in my head is older than the browser I was testing.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The trick I hadn't built: skip what didn't change
&lt;/h2&gt;

&lt;p&gt;So I counted. Between two frames, how many cells actually show a different character, colour or opacity?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A median of 55 out of 12,198.&lt;/strong&gt; The cloud drifts so slowly that almost every cell lands on the same glyph and level as last frame. Most of the changes are rain.&lt;/p&gt;

&lt;p&gt;And every frame I was clearing the whole canvas and drawing about 700 glyphs to show those 55 changes.&lt;/p&gt;

&lt;p&gt;The fix: no full clear anymore. Remember what each cell showed, and only touch the cells whose key changed:&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="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cellKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;// glyph, colour and opacity level, or -1 for empty&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;   &lt;span class="c1"&gt;// same as last frame: leave the pixels alone&lt;/span&gt;
  &lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;cols&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;cols&lt;/span&gt;
  &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clearRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cx&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;acw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cy&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;ach&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;acw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ach&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="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;drawCell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// one drawImage from the atlas&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where the atlas and the clip pay off after all. Every glyph lives exactly inside its cell, so clearing and redrawing one cell can never cut a neighbour in half. With &lt;code&gt;fillText&lt;/code&gt;, a wide glyph could spill over and leave half a character behind.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;JS per frame&lt;/th&gt;
&lt;th&gt;Whole browser&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Everything on (what's live)&lt;/td&gt;
&lt;td&gt;3.5 ms&lt;/td&gt;
&lt;td&gt;~49 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Redraw only changed cells&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2.0 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~27 %&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The whole browser went from about half a core to about a quarter. The renderer and the GPU process both dropped by about half. The visible result is identical, because every cell ends up with exactly the same pixels.&lt;/p&gt;

&lt;p&gt;This version isn't on the live site yet. I wanted the measurement first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reduced motion
&lt;/h2&gt;

&lt;p&gt;With &lt;code&gt;prefers-reduced-motion: reduce&lt;/code&gt;, the field renders one finished frame (rain already placed) and stops. No loop, no cursor reaction:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;matchMedia&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;(prefers-reduced-motion: reduce)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;matches&lt;/span&gt;
&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RM&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;still&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;   &lt;span class="c1"&gt;// one complete frame, then nothing&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's two lines, and nobody who asked for less motion gets a cloud that keeps moving.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One laptop, one Chromium build. Firefox and Safari draw text and images differently, and the atlas-vs-&lt;code&gt;fillText&lt;/code&gt; result may well flip there.&lt;/li&gt;
&lt;li&gt;Nobody moved the mouse. The lens and the ripples can change hundreds of cells per frame, so while you play with the hero, the redraw trick saves much less.&lt;/li&gt;
&lt;li&gt;The JS timer only covers my callback. The real cost was elsewhere, which is the point of the second column.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Measure the whole browser, not just your &lt;code&gt;requestAnimationFrame&lt;/code&gt; callback.&lt;/li&gt;
&lt;li&gt;Cache what moves slowly. Interlacing was worth about 1.5 ms per frame here.&lt;/li&gt;
&lt;li&gt;Don't assume a glyph atlas beats &lt;code&gt;fillText&lt;/code&gt; in a current browser. Measure it.&lt;/li&gt;
&lt;li&gt;Count how many cells really change. Mine: 55 out of 12,198. Then stop clearing the whole canvas.&lt;/li&gt;
&lt;li&gt;Give reduced motion a still frame, not a slower animation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole engine is one file, a bit over 700 lines, no dependencies: &lt;a href="https://github.com/fxd-gif/vibedesk/blob/gh-pages/assets/ascii.js" rel="noopener noreferrer"&gt;assets/ascii.js&lt;/a&gt; (some comments are in German, sorry). You can see it running on the &lt;a href="https://fxd-gif.github.io/vibedesk/" rel="noopener noreferrer"&gt;VibeDesk website&lt;/a&gt;. VibeDesk is a free, open-source Windows app around Claude Code that I build, and the site is where I tried all this.&lt;/p&gt;

&lt;p&gt;If you've built something like this: did a glyph atlas ever beat plain &lt;code&gt;fillText&lt;/code&gt; for you? &lt;strong&gt;A)&lt;/strong&gt; yes, clearly &lt;strong&gt;B)&lt;/strong&gt; about the same &lt;strong&gt;C)&lt;/strong&gt; never measured. And which browser?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>canvas</category>
      <category>performance</category>
    </item>
    <item>
      <title>Starting Claude Code from Node on Windows: 6 things that broke for me</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Tue, 10 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/starting-claude-code-from-node-on-windows-6-things-that-broke-for-me-akb</link>
      <guid>https://dev.to/fxdgif/starting-claude-code-from-node-on-windows-6-things-that-broke-for-me-akb</guid>
      <description>&lt;p&gt;Most Claude Code tooling I read about assumes macOS or Linux. I build a Windows desktop app that starts Claude Code sessions in terminals, writes commit messages with &lt;code&gt;claude -p&lt;/code&gt; and runs hooks all day. Here's what went wrong on Windows, in the order I hit it, so you don't have to.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;claude&lt;/code&gt; isn't an executable
&lt;/h2&gt;

&lt;p&gt;If you installed Claude Code with npm, &lt;code&gt;claude&lt;/code&gt; on Windows is a &lt;code&gt;claude.cmd&lt;/code&gt; shim. &lt;code&gt;spawn('claude', ...)&lt;/code&gt; fails, and since Node's 2024 security fix (CVE-2024-27980) spawning a &lt;code&gt;.cmd&lt;/code&gt; without a shell throws &lt;code&gt;EINVAL&lt;/code&gt; on purpose.&lt;/p&gt;

&lt;p&gt;What works reliably for me is going through &lt;code&gt;cmd.exe&lt;/code&gt; explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--settings&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settingsFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--mcp-config&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mcpFile&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;pty&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;spawn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cmd.exe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/d&lt;/code&gt; skips any AutoRun commands the user has in the registry, so their shell setup can't interfere.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Don't add &lt;code&gt;/s&lt;/code&gt;, and don't quote the first token
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cmd /c&lt;/code&gt; has odd rules for quotes. With &lt;code&gt;/s&lt;/code&gt;, or when the line starts with a quote, it strips the first and last quote character of the whole command line. A settings path like &lt;code&gt;"C:\Users\Jane Doe\...\settings.json"&lt;/code&gt; then loses one of its quotes and splits at the space.&lt;/p&gt;

&lt;p&gt;Keep the first token (&lt;code&gt;claude&lt;/code&gt;) unquoted and leave out &lt;code&gt;/s&lt;/code&gt;. Then cmd leaves the quotes around your paths alone. Users with spaces in their username will thank you.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Everything on that command line is an injection point
&lt;/h2&gt;

&lt;p&gt;Once you go through &lt;code&gt;cmd.exe&lt;/code&gt;, &lt;code&gt;&amp;amp;&lt;/code&gt;, &lt;code&gt;|&lt;/code&gt; and friends mean something. Two rules I now follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Validate anything that becomes an argument.&lt;/strong&gt; A session ID for &lt;code&gt;--resume&lt;/code&gt; has to match &lt;code&gt;^[A-Za-z0-9-]{1,64}$&lt;/code&gt;, or the app refuses to start it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never pass user text as an argument.&lt;/strong&gt; Commit diffs, PR drafts, notes typed on the phone: they all go to &lt;code&gt;claude -p&lt;/code&gt; through &lt;strong&gt;stdin&lt;/strong&gt;. The prompt argument is a fixed sentence like &lt;code&gt;"Follow the instructions in the input."&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;execFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cmd.exe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Write the commit message as instructed in the input.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--model&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;haiku&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--output-format&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// the diff and the instructions are written to the child's stdin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Your Electron environment leaks into Claude
&lt;/h2&gt;

&lt;p&gt;The child inherits your whole environment. If &lt;code&gt;ELECTRON_RUN_AS_NODE&lt;/code&gt; ends up in your app's environment (for example because it was started from a tool that sets it), every Electron-based program started further down runs as plain Node instead. I delete it before spawning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;env&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="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;MY_APP_SESSION_ID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ELECTRON_RUN_AS_NODE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small bonus trap: Windows already has an environment variable called &lt;code&gt;PROMPT&lt;/code&gt; (it's &lt;code&gt;$P$G&lt;/code&gt;, the cmd prompt format). If your app reads its own &lt;code&gt;PROMPT&lt;/code&gt; variable, it gets that.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Hook commands have to survive three shells
&lt;/h2&gt;

&lt;p&gt;A hook command in &lt;code&gt;settings.json&lt;/code&gt; can end up running in cmd, Git Bash or PowerShell, depending on the setup. The form that worked everywhere for me:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;C:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;path with spaces&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;hook-forwarder.js&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program (&lt;code&gt;node&lt;/code&gt;) is unquoted, and only the path is quoted. Quoting the program too breaks in cmd for the same reason as trap 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Line endings, when Claude edits through scripts
&lt;/h2&gt;

&lt;p&gt;This one isn't about spawning, but it bit me hardest. My repo is LF. Sometimes Claude Code decides to change a file with a small Python script instead of its edit tool. Python's &lt;code&gt;open(path, 'w')&lt;/code&gt; on Windows writes &lt;strong&gt;CRLF&lt;/strong&gt;, so a one-line change shows up as a diff of the entire file.&lt;/p&gt;

&lt;p&gt;Things that help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;.gitattributes&lt;/code&gt; with &lt;code&gt;* text=auto eol=lf&lt;/code&gt;, so Git normalises on commit.&lt;/li&gt;
&lt;li&gt;A line in &lt;code&gt;CLAUDE.md&lt;/code&gt;: prefer the edit tool, and when a script is needed, open files with &lt;code&gt;newline=''&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Look at &lt;code&gt;git diff --stat&lt;/code&gt; before every commit. A 900-line change for a typo is your hint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Related: backslashes inside bash heredocs and non-ASCII characters in &lt;code&gt;curl -d&lt;/code&gt; from Git Bash can arrive mangled. If the content matters, write it to a file first and send the file.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't cover
&lt;/h2&gt;

&lt;p&gt;I only use Claude Code installed through npm. The native installer may avoid traps 1 and 2 completely, and newer Claude Code versions run sessions through a background service, which changes how a terminal is attached. Check your own setup before copying any of this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;If you use Claude Code on Windows: &lt;strong&gt;how do you run it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A) PowerShell / Windows Terminal&lt;br&gt;&lt;br&gt;
B) Git Bash&lt;br&gt;&lt;br&gt;
C) WSL&lt;br&gt;&lt;br&gt;
D) inside an editor (VS Code, JetBrains)&lt;/p&gt;

&lt;p&gt;And what's the weirdest Windows-only bug you hit with it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(All of the code above comes from &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, an open-source Windows desktop for Claude Code, if you want to see it in context.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>windows</category>
      <category>node</category>
      <category>electron</category>
    </item>
    <item>
      <title>Claude Code wrote almost all of my app. My job turned into saying no.</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Thu, 05 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/claude-code-wrote-almost-all-of-my-app-my-job-turned-into-saying-no-dda</link>
      <guid>https://dev.to/fxdgif/claude-code-wrote-almost-all-of-my-app-my-job-turned-into-saying-no-dda</guid>
      <description>&lt;p&gt;Three weeks ago I started a desktop app. Since then: 169 commits, about 48,000 lines in &lt;code&gt;src/&lt;/code&gt;, and I typed very little of it myself. Claude Code did. I steered, tested and, more than anything, said no.&lt;/p&gt;

&lt;p&gt;That last part surprised me. I expected the bottleneck to be the model getting things wrong. It wasn't. The bottleneck was me letting too much in.&lt;/p&gt;

&lt;h2&gt;
  
  
  When code is cheap, everything looks worth building
&lt;/h2&gt;

&lt;p&gt;Here's what nobody warned me about. When a feature costs you a sentence and ten minutes, the question "is this worth building?" quietly stops being asked. Everything is worth building, because nothing costs anything.&lt;/p&gt;

&lt;p&gt;So I built everything.&lt;/p&gt;

&lt;p&gt;Between October 13 and 19 I shipped &lt;strong&gt;29 releases in 7 days&lt;/strong&gt;. Version 0.7 to 1.9. Every idea went straight in, every release had something new. It felt amazing. It also made the app loud. New windows popped up on top of the terminal. The dock filled with icons. The first-start screen asked "How much do you want to see?" before people had seen anything at all.&lt;/p&gt;

&lt;p&gt;Nothing was broken. It was just &lt;em&gt;too much&lt;/em&gt;, and I couldn't see it while I was the one adding things.&lt;/p&gt;

&lt;h2&gt;
  
  
  The no's that made it better
&lt;/h2&gt;

&lt;p&gt;Looking back through my commits, the changes I'm proudest of are mostly removals or restraint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"New windows never cover Claude."&lt;/strong&gt; Every new window now finds free space instead of opening on top of the terminal you're working in. One rule, no new features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New features go into a "More" menu, not the dock.&lt;/strong&gt; The dock is for the five things you use every hour.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The "How much do you want to see?" question is gone.&lt;/strong&gt; You start calm, and you find more when you look for it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The stats card ("Vibe Wrapped") lost its AI-style gradients&lt;/strong&gt; and got a calm, printed look instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The phone connection lost one of its two tunnel options.&lt;/strong&gt; Two choices meant two things to explain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No account, no sign-up, no Discord server.&lt;/strong&gt; Questions go to GitHub issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One bigger tested release at a time&lt;/strong&gt; instead of 30 a week. Feature freeze a few days before.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these needed much code. All of them needed someone to say "no, not like that".&lt;/p&gt;

&lt;h2&gt;
  
  
  The model is great at "yes"
&lt;/h2&gt;

&lt;p&gt;Claude Code is extremely good at doing what you ask. That's the problem. Ask for a toggle and you get a well-built toggle with tests. It won't tell you that nobody will ever find it between all the other toggles.&lt;/p&gt;

&lt;p&gt;So these are the questions I try to ask now, before saying "build it":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Who opens this, and how often?&lt;/li&gt;
&lt;li&gt;What does it push off the screen?&lt;/li&gt;
&lt;li&gt;Would I notice if it were missing?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If I can't answer the first one with a real person, it waits. Ideas that people actually ask for in GitHub issues (with a 👍) go into the next release. The rest stays an idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taste is the job now
&lt;/h2&gt;

&lt;p&gt;I don't think "AI will replace developers" or "AI is just autocomplete" describes what I'm doing. It feels more like being an editor with an infinitely fast writer. The writer never gets tired and never pushes back. The editor has to.&lt;/p&gt;

&lt;p&gt;And editing is hard in a new way. You're not judging whether the code works. Usually it does. You're judging whether it should exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;p&gt;This is one solo project with no team, no users to negotiate with and no deadline except my own. In a team, "no" is spread over code review, product people and design. I'm doing all of it alone, so maybe I just feel it more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;If you build with an agent most of the day: &lt;strong&gt;what's the hardest part of your job now?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A) checking the code is actually right&lt;br&gt;&lt;br&gt;
B) deciding what to build at all&lt;br&gt;&lt;br&gt;
C) keeping the codebase understandable for future me&lt;br&gt;&lt;br&gt;
D) something else, tell me&lt;/p&gt;

&lt;p&gt;And what's the last thing you said no to?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The app is &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, a calm desktop for running several Claude Code sessions on Windows. Wishes go in its GitHub issues.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>ai</category>
      <category>productivity</category>
      <category>claudecode</category>
    </item>
    <item>
      <title>I was sure it was a memory leak. It was a glowing border using 131 % of a CPU core</title>
      <dc:creator>Fred 🍓</dc:creator>
      <pubDate>Wed, 04 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/fxdgif/i-was-sure-it-was-a-memory-leak-it-was-a-glowing-border-using-131-of-a-cpu-core-7kn</link>
      <guid>https://dev.to/fxdgif/i-was-sure-it-was-a-memory-leak-it-was-a-glowing-border-using-131-of-a-cpu-core-7kn</guid>
      <description>&lt;p&gt;My app is an Electron desktop for Claude Code: glass windows with &lt;code&gt;backdrop-filter&lt;/code&gt; blur, a WebGL rain background, a few terminals. One day I wrote in my own bug list: &lt;em&gt;"If I leave it running for a while, it gets really slow."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;"Slow after a while" sounds like a memory leak. I was so sure that I nearly went looking for one. Then I measured first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The measurement
&lt;/h2&gt;

&lt;p&gt;One Claude Code session working in a terminal, the app in front. Numbers are CPU time per process, as a percentage of one core:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;GPU process&lt;/th&gt;
&lt;th&gt;Renderer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;installed 1.9&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;131 %&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;30 %&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Memory was flat. Main process around 110 MB, renderer heap around 20 MB, no growth. No leak.&lt;/p&gt;

&lt;p&gt;What actually happened: the laptop (integrated Intel graphics) got hot and throttled after a few minutes. "Slow after a while" was thermals, not memory.&lt;/p&gt;

&lt;p&gt;So what was burning a core and a third on the GPU process while I was just watching a terminal?&lt;/p&gt;

&lt;h2&gt;
  
  
  Suspect 1: the glow
&lt;/h2&gt;

&lt;p&gt;When Claude is working, its window gets a soft, breathing glow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.gwin.claude-working&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;claude-glow&lt;/span&gt; &lt;span class="m"&gt;2.8s&lt;/span&gt; &lt;span class="nb"&gt;ease-in-out&lt;/span&gt; &lt;span class="nb"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;claude-glow&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="m"&gt;50%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;159&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;184&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;.3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;40px&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;124&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;156&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;.26&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;Pretty, harmless, right? Not with glass around it.&lt;/p&gt;

&lt;p&gt;A smooth infinite animation means the compositor has to produce a new frame 60 times a second. And every new frame recomputes the big &lt;code&gt;backdrop-filter&lt;/code&gt; blurs of every glass panel on screen. My rain shader was carefully throttled to 15–30 FPS. One CSS animation quietly overrode that and pushed everything to 60.&lt;/p&gt;

&lt;p&gt;Two things surprised me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size doesn't matter.&lt;/strong&gt; An 8-pixel equalizer icon in the dock cost the same as the big window glow. Any animated pixel means a new frame, and the blur gets recomputed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;transform&lt;/code&gt; instead of &lt;code&gt;box-shadow&lt;/code&gt; didn't help either.&lt;/strong&gt; The usual "animate only transform and opacity" advice is about layout and paint cost. Here the expensive part was the frame itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fix is one word:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.gwin.claude-working&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;claude-glow&lt;/span&gt; &lt;span class="m"&gt;2.8s&lt;/span&gt; &lt;span class="nf"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;infinite&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;&lt;code&gt;steps(5)&lt;/code&gt; makes the glow breathe in five visible stages instead of a smooth curve. Between the steps nothing changes, so no new frames are produced. At normal viewing distance it still reads as "breathing". I moved every long-running infinite animation to &lt;code&gt;steps()&lt;/code&gt;: the waiting dot (which can sit there for hours), the equalizer, a live indicator. Short loading spinners stay smooth, because they disappear after a second.&lt;/p&gt;

&lt;h2&gt;
  
  
  Suspect 2: the rain that wasn't raining
&lt;/h2&gt;

&lt;p&gt;The WebGL rain has an intensity slider. At 0 % you see a still background. But the shader kept rendering 15–30 frames a second of zero raindrops, because the "paused" flag was never passed down.&lt;/p&gt;

&lt;p&gt;Now the frame scheduler returns "no frames" at 0 %:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;frameInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FrameState&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&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="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;paused&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rain&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rain&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;idle&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;FPS_IDLE&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;saver&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;FPS_SAVER&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FPS_FOCUS&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;h2&gt;
  
  
  Suspect 3: every line of terminal output
&lt;/h2&gt;

&lt;p&gt;This one I can't fully fix. A terminal that's streaming output changes pixels all the time, and every change under a glass panel recomputes its blur. For battery mode the glass now turns into plain, nearly opaque panels:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.app.saver&lt;/span&gt; &lt;span class="nc"&gt;.gwin&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.app.saver&lt;/span&gt; &lt;span class="nc"&gt;.dock&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;.9&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;h2&gt;
  
  
  After
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;GPU process&lt;/th&gt;
&lt;th&gt;Renderer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1.9 (smooth glow)&lt;/td&gt;
&lt;td&gt;131 %&lt;/td&gt;
&lt;td&gt;30 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;glow on &lt;code&gt;steps()&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;~26 %&lt;/td&gt;
&lt;td&gt;~14 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rain off really means off&lt;/td&gt;
&lt;td&gt;~20 %&lt;/td&gt;
&lt;td&gt;~12 %&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;battery saver without live blur&lt;/td&gt;
&lt;td&gt;~11 %&lt;/td&gt;
&lt;td&gt;~11 %&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;From 131 % to about 11 %, mostly by deleting frames nobody needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I measured (and two traps)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I started a second, isolated copy with Playwright's &lt;code&gt;_electron&lt;/code&gt;, a copy of my real settings and its own user-data folder, so the measurement didn't touch my working setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trap 1:&lt;/strong&gt; &lt;code&gt;app.getAppMetrics()&lt;/code&gt; reports CPU divided by the number of cores. On 8 cores, "16 %" is actually more than a full core. I switched to measuring the difference in CPU seconds per process from the OS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trap 2:&lt;/strong&gt; a hidden or covered Electron window stops &lt;code&gt;requestAnimationFrame&lt;/code&gt;. My first measurement showed almost 0 % GPU because the test window was behind another one. Bring it to the front (&lt;code&gt;setAlwaysOnTop&lt;/code&gt;, &lt;code&gt;focus&lt;/code&gt;) before you measure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this doesn't prove
&lt;/h2&gt;

&lt;p&gt;It's one app on one laptop with integrated graphics. On a desktop GPU you'd likely never notice the glow. But if your Electron or web app combines &lt;code&gt;backdrop-filter&lt;/code&gt; with any infinite animation, it's worth five minutes with the profiler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;Have you ever chased a "leak" that turned out to be something else? What was it?&lt;/p&gt;

&lt;p&gt;A) thermals / throttling&lt;br&gt;&lt;br&gt;
B) a runaway animation or render loop&lt;br&gt;&lt;br&gt;
C) a cache doing its job&lt;br&gt;&lt;br&gt;
D) an actual leak, finally&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The app is &lt;a href="https://github.com/fxd-gif/vibedesk" rel="noopener noreferrer"&gt;VibeDesk&lt;/a&gt;, open source, so all of the CSS above is in the repo.)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>electron</category>
      <category>performance</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
