<?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: Apps by Mo</title>
    <description>The latest articles on DEV Community by Apps by Mo (@appsbymo).</description>
    <link>https://dev.to/appsbymo</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%2F4201203%2Faca484e7-37eb-44f4-a57a-d9f7d272299d.png</url>
      <title>DEV Community: Apps by Mo</title>
      <link>https://dev.to/appsbymo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/appsbymo"/>
    <language>en</language>
    <item>
      <title>NSApp.activate raised every window of my Mac app, so scroll capture scrolled the wrong one</title>
      <dc:creator>Apps by Mo</dc:creator>
      <pubDate>Sat, 14 Nov 2026 13:17:37 +0000</pubDate>
      <link>https://dev.to/appsbymo/nsappactivate-raised-every-window-of-my-mac-app-so-scroll-capture-scrolled-the-wrong-one-c2m</link>
      <guid>https://dev.to/appsbymo/nsappactivate-raised-every-window-of-my-mac-app-so-scroll-capture-scrolled-the-wrong-one-c2m</guid>
      <description>&lt;p&gt;I make Scry, a screenshot app for the Mac. One of its tools is scroll capture: you draw a box around part of a page, and Scry scrolls that page and stitches one long image.&lt;/p&gt;

&lt;p&gt;For a while it had a bug that looked random. You drew the box over a web page, and Scry scrolled its own Library window instead. Sometimes it scrolled the Settings window. Never the page you asked for.&lt;/p&gt;

&lt;p&gt;The cause was one line I had added on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  The line that raised everything
&lt;/h2&gt;

&lt;p&gt;The capture overlay is a borderless, full-screen, transparent window. To take key and receive keystrokes, the app has to be active, so the overlay called:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="nc"&gt;NSApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;activate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ignoringOtherApps&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That does make the overlay key. It also orders &lt;strong&gt;every&lt;/strong&gt; ordinary window of the app above every other app. With a transparent overlay covering the whole screen, nobody sees it happen. You only see the result afterwards: the Library is now the top window under your box, and that is what gets scrolled.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix, part one: keep your own windows back
&lt;/h2&gt;

&lt;p&gt;Before activating, I lower every visible ordinary window of the app by one level, remember the old level, and put it back when the overlay closes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;below&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;NSWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Level&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;NSWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Level&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;normal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rawValue&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;saved&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="nc"&gt;NSWindow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;NSWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Level&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="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nc"&gt;NSApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windows&lt;/span&gt; &lt;span class="k"&gt;where&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;isVisible&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;normal&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;overlay&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&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;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;)&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;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;below&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;NSApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;activate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ignoringOtherApps&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="c1"&gt;// on dismiss:&lt;/span&gt;
&lt;span class="k"&gt;for&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;level&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;saved&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;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Window level beats activation order, so the windows stay exactly where they were on screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix, part two: don’t ask who is frontmost
&lt;/h2&gt;

&lt;p&gt;The second half was quieter. At hotkey time I asked &lt;code&gt;NSWorkspace.shared.frontmostApplication&lt;/code&gt; which app to scroll. But Scry is often already frontmost at that moment, so the answer was Scry itself.&lt;/p&gt;

&lt;p&gt;Now the target is the app that owns the window under the box: &lt;code&gt;CGWindowListCopyWindowInfo&lt;/code&gt;, layer 0 windows only, with the point flipped into window-list coordinates. If nothing is found, it falls back to the frontmost app that is not Scry.&lt;/p&gt;

&lt;p&gt;One more trap there: the rect from a selection overlay is in that screen’s own coordinates. Add &lt;code&gt;screen.frame.origin&lt;/code&gt; before flipping, or the lookup can land on the wrong window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test both halves together
&lt;/h2&gt;

&lt;p&gt;Both halves are needed, so Scry’s self-test checks them together. To trust it, I commented out the level change and watched the test fail with “Scry’s windows jumped in front”. A test you have never seen fail is not telling you much.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I’d tell my past self
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;NSApp.activate&lt;/code&gt; is not “make this window key”. It is “bring the whole app forward”.&lt;/li&gt;
&lt;li&gt;An invisible overlay hides window-order bugs completely. Check what is under it, not what is on it.&lt;/li&gt;
&lt;li&gt;“Frontmost app” is a bad question to ask from inside the app that just got the hotkey.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you build Mac tools that act on other apps’ windows, I hope this saves you an afternoon.&lt;/p&gt;

&lt;p&gt;I write about building Mac apps alone, and send a short email when one of my apps ships or gets a big update, twice a month at most: &lt;a href="https://appsbymo.app/?ref=devto#signup-h" rel="noopener noreferrer"&gt;https://appsbymo.app/?ref=devto#signup-h&lt;/a&gt;&lt;/p&gt;

</description>
      <category>macos</category>
      <category>swift</category>
      <category>debugging</category>
      <category>appkit</category>
    </item>
    <item>
      <title>Two SwiftUI animation loops that burned CPU on my Mac with nothing on screen</title>
      <dc:creator>Apps by Mo</dc:creator>
      <pubDate>Tue, 10 Nov 2026 18:14:40 +0000</pubDate>
      <link>https://dev.to/appsbymo/two-swiftui-animation-loops-that-burned-cpu-on-my-mac-with-nothing-on-screen-4d6j</link>
      <guid>https://dev.to/appsbymo/two-swiftui-animation-loops-that-burned-cpu-on-my-mac-with-nothing-on-screen-4d6j</guid>
      <description>&lt;p&gt;A looping animation looks free. On macOS, two of mine were not. Both shipped in my own apps, and both were measured on release builds, not Debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A glow that kept running after its popover closed
&lt;/h2&gt;

&lt;p&gt;Soluna is my menu bar calendar. Today’s cell had a slow “breathing” glow, a &lt;code&gt;.repeatForever&lt;/code&gt; animation on one flag. My own Mac health app, What Happened, reported Soluna using about 134 core-minutes a day in the background.&lt;/p&gt;

&lt;p&gt;The cause: AppKit keeps an &lt;code&gt;NSPopover&lt;/code&gt;’s hosting view alive between opens. So after the popover closed, SwiftUI went on re-rendering its whole view tree every frame. &lt;code&gt;sample&lt;/code&gt; showed the main thread in &lt;code&gt;NSHostingView.layout&lt;/code&gt; and &lt;code&gt;ViewGraphRootValueUpdater.render&lt;/code&gt; with nothing on screen.&lt;/p&gt;

&lt;p&gt;I proved it by toggling. Open and close the popover: 17 to 19% of a core, and it stays. Close it on a month that does not contain today’s cell: 0.0%. Back to today: 17% again.&lt;/p&gt;

&lt;p&gt;The rule I took from it: any looping animation inside a popover or panel has to stop when it closes.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A TimelineView in every list row
&lt;/h2&gt;

&lt;p&gt;Wick is my deadline tracker, and a deadline can show a small flame. Each flame was a &lt;code&gt;TimelineView(.animation)&lt;/code&gt; drawing into a &lt;code&gt;Canvas&lt;/code&gt;. With the window in front and idle, the app sat at 32% of a core. With flame motion off: 0%. A single flame: about 12%.&lt;/p&gt;

&lt;p&gt;I tried the obvious fixes first. Moving the per-frame math out of the Canvas, splitting a still layer from a live one, and shrinking the live Canvas to a 92 pt box did not help. The drawing was never the cost. Every &lt;code&gt;TimelineView(.animation)&lt;/code&gt; tick made SwiftUI update and lay out the whole window.&lt;/p&gt;

&lt;p&gt;What worked was handing the loop to Core Animation: an &lt;code&gt;NSViewRepresentable&lt;/code&gt; holding &lt;code&gt;CAShapeLayer&lt;/code&gt;s, with the path animated by a &lt;code&gt;CAKeyframeAnimation&lt;/code&gt; over 24 precomputed frames. The app went from 32% to 0.3%.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check your own app
&lt;/h2&gt;

&lt;p&gt;Open the view, close it, then watch the process for a minute. &lt;code&gt;ps -o time= -p &amp;lt;pid&amp;gt;&lt;/code&gt; should barely move. If it climbs, run &lt;code&gt;sample &amp;lt;pid&amp;gt;&lt;/code&gt; and look for &lt;code&gt;NSHostingView.layout&lt;/code&gt; on the main thread.&lt;/p&gt;

&lt;p&gt;One-shot SwiftUI transitions are fine. It is the loops that need a second look.&lt;/p&gt;

&lt;p&gt;I make Soluna, Wick and What Happened on my own as AppsByMo. If you want a short email when I ship a Mac app or a big update, twice a month at most: &lt;a href="https://appsbymo.app/?ref=devto#signup-h" rel="noopener noreferrer"&gt;https://appsbymo.app/?ref=devto#signup-h&lt;/a&gt;&lt;/p&gt;

</description>
      <category>macos</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>performance</category>
    </item>
    <item>
      <title>Why your Mac stays awake after you close the lid: two sleep traps</title>
      <dc:creator>Apps by Mo</dc:creator>
      <pubDate>Wed, 04 Nov 2026 07:22:54 +0000</pubDate>
      <link>https://dev.to/appsbymo/why-your-mac-stays-awake-after-you-close-the-lid-two-sleep-traps-jj6</link>
      <guid>https://dev.to/appsbymo/why-your-mac-stays-awake-after-you-close-the-lid-two-sleep-traps-jj6</guid>
      <description>&lt;p&gt;I make Vigil, a Mac app that keeps the machine awake for long jobs, even with the lid closed. Most of the work turned out to be the opposite problem: getting the Mac to sleep again afterward. Here are two traps I measured, and the commands to check your own Mac.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trap 1: turning sleep back on doesn’t put the Mac to sleep
&lt;/h2&gt;

&lt;p&gt;Vigil holds the Mac awake with &lt;code&gt;pmset disablesleep 1&lt;/code&gt; and lets go with &lt;code&gt;disablesleep 0&lt;/code&gt;. On 4 Sep I tested it on an M4 MacBook Air. I closed the lid at 20:27 and the hold ended at 20:42. At 22:50 the Mac was still awake, and hot, in a bag.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pmset -g&lt;/code&gt; explained it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sleep 1 (sleep prevented by Claude, coreaudiod, powerd, sharingd, Sada)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lid-close sleep is a one-time event at the moment the lid closes. If something blocks it then, macOS doesn’t try again when the block lifts. All that’s left is idle sleep, and any app holding an idle assertion stops that too.&lt;/p&gt;

&lt;p&gt;The fix: when a hold ends while the lid is closed (&lt;code&gt;AppleClamshellState&lt;/code&gt; is true), run &lt;code&gt;pmset sleepnow&lt;/code&gt; as root right after &lt;code&gt;disablesleep 0&lt;/code&gt;. Skip it if an external display is connected, because that person is using clamshell mode on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trap 2: &lt;code&gt;.userInitiated&lt;/code&gt; quietly blocks sleep
&lt;/h2&gt;

&lt;p&gt;Sada, another of my apps, sat in that list above. Vigil later reported it had held the Mac awake for over 100 hours, and &lt;code&gt;pmset -g assertions&lt;/code&gt; agreed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pid 69298(Sada): 100:38:27 PreventUserIdleSystemSleep named: Sada sync responder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cause was one line at launch, meant only to stop automatic termination:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kt"&gt;ProcessInfo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;processInfo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;beginActivity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nv"&gt;options&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;userInitiated&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;automaticTerminationDisabled&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="nv"&gt;reason&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.userInitiated&lt;/code&gt; is a composite. It includes &lt;code&gt;.idleSystemSleepDisabled&lt;/code&gt;, and nothing at the call site says so. A menu bar app that never ends the activity keeps your Mac from idle sleeping for as long as it runs.&lt;/p&gt;

&lt;p&gt;To keep an app alive without touching sleep, use this instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;suddenTerminationDisabled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;automaticTerminationDisabled&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take &lt;code&gt;.idleSystemSleepDisabled&lt;/code&gt; only for bounded work, and end the activity on every exit path. My release script for Sada now fails the build if &lt;code&gt;.userInitiated&lt;/code&gt; shows up in &lt;code&gt;beginActivity&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check your own Mac
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pmset &lt;span class="nt"&gt;-g&lt;/span&gt; | &lt;span class="nb"&gt;grep sleep
&lt;/span&gt;pmset &lt;span class="nt"&gt;-g&lt;/span&gt; assertions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first shows who is blocking sleep. The second shows how long each one has held. A resident app with a timer in the hours is the one to look at.&lt;/p&gt;

&lt;p&gt;If you run long jobs on a laptop, or just want to know what kept your Mac awake, &lt;a href="https://appsbymo.app/vigil/?ref=devto" rel="noopener noreferrer"&gt;Vigil&lt;/a&gt; is my app for both. I also send a short note when one of my Mac apps ships or gets a big update, twice a month at most: &lt;a href="https://appsbymo.app/?ref=devto#signup-h" rel="noopener noreferrer"&gt;join the list here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>macos</category>
      <category>swift</category>
      <category>debugging</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I stopped my Claude Code plan running out midweek</title>
      <dc:creator>Apps by Mo</dc:creator>
      <pubDate>Tue, 27 Oct 2026 07:20:19 +0000</pubDate>
      <link>https://dev.to/appsbymo/how-i-stopped-my-claude-code-plan-running-out-midweek-2cmc</link>
      <guid>https://dev.to/appsbymo/how-i-stopped-my-claude-code-plan-running-out-midweek-2cmc</guid>
      <description>&lt;p&gt;I make Mac apps on my own, about twenty of them now, and I build them with Claude Code. For months my plan ran out on Wednesday or Thursday. I assumed I was simply using it a lot. When I finally read Claude Code's own logs on my Mac, most of the spend went to three things I could change.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Long sessions cost more than they look
&lt;/h2&gt;

&lt;p&gt;Every reply in a conversation carries the whole conversation with it. In my logs, a reply late in a long session cost about 3.3 times a reply in a short one, for the same kind of work. A session that runs all afternoon gets more expensive with every message, even when the messages are small.&lt;/p&gt;

&lt;p&gt;The fix was boring: when a session grows long, the coder writes a short handover (what it did, what is left, what to watch out for) and a fresh session starts from that. The new session knows enough to carry on, and it pays for a few hundred words of context instead of the whole afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Reviews were the most expensive thing I did
&lt;/h2&gt;

&lt;p&gt;I ask for a review before I ship anything that touches saving, sync or payments. Having Claude read a whole diff and hunt for problems is costly. Now a second model, Codex on my ChatGPT plan, does the hunting read-only, and Claude only judges each finding: real, or a false alarm. Across 68 reviews that used about 71% fewer Claude tokens per review, and 120 of the 128 findings were real bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Starting from nothing every time
&lt;/h2&gt;

&lt;p&gt;The third cost was hidden. Every new session spent its first minutes rediscovering how the app is built, which command builds it, and the trap I hit last week. Now each app has a short memory (how it is built, the exact commands, the traps), each session starts with a brief, and each one ends by writing a page about what it did and what slowed it down. The next session reads that first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it added up to
&lt;/h2&gt;

&lt;p&gt;In the week I measured, the same work would have used about 478M tokens with Claude Code alone. It used 280M. That is 41% of the plan saved, read from Claude Code's own logs, and the plan now lasts the week.&lt;/p&gt;

&lt;p&gt;You can do all three by hand: keep sessions short and write your own handover notes, use a cheaper model for the first pass of a review, and keep a notes file per project that every session reads first. I got tired of doing it by hand, so I built a Mac app that does it for me, Atelier. Disclosure: it is mine. &lt;a href="https://appsbymo.app/atelier/?ref=devto" rel="noopener noreferrer"&gt;https://appsbymo.app/atelier/?ref=devto&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like a short email when I ship a new Mac app or a big update (twice a month at most, unsubscribe in one click), you can join here: &lt;a href="https://appsbymo.app/?ref=devto#signup-h" rel="noopener noreferrer"&gt;https://appsbymo.app/?ref=devto#signup-h&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What eats your plan? I am curious whether others see the same long-session effect.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>productivity</category>
      <category>ai</category>
      <category>macos</category>
    </item>
  </channel>
</rss>
