<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prateek Mohanty on Medium]]></title>
        <description><![CDATA[Stories by Prateek Mohanty on Medium]]></description>
        <link>https://medium.com/@itsprateekmohanty?source=rss-eb6f6ca7d87d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DpcBFSUPFe1rB-mQ</url>
            <title>Stories by Prateek Mohanty on Medium</title>
            <link>https://medium.com/@itsprateekmohanty?source=rss-eb6f6ca7d87d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 15:27:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@itsprateekmohanty/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Make Claude Code Call Your Phone]]></title>
            <link>https://medium.com/@itsprateekmohanty/make-claude-code-call-your-phone-48f2428c1624?source=rss-eb6f6ca7d87d------2</link>
            <guid isPermaLink="false">https://medium.com/p/48f2428c1624</guid>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[agentic-coding]]></category>
            <dc:creator><![CDATA[Prateek Mohanty]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 12:04:38 GMT</pubDate>
            <atom:updated>2026-06-26T12:04:38.954Z</atom:updated>
            <content:encoded><![CDATA[<h4>Voice notifications for when a long run finishes, when your agent is stuck on you, and when your token quota finally resets — built with hooks, Bolna, and one tiny launchd agent.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vxIq4CkcrNNWgxV45sRing.png" /></figure><p>I kicked off a big refactor in Claude Code, watched the first few tool calls scroll by, and went to make coffee. Twenty-five minutes later I came back to a terminal that had been sitting idle for twenty-three of them — it had stopped after two minutes, politely waiting for me to approve a single Bash command.</p><p>That’s the thing about coding agents: they’re autonomous right up until they aren’t. They finish long jobs while you’re in another room. They get blocked on a yes/no and just… wait. And on a Pro/Max plan, they hit a usage limit at the worst possible moment and leave you guessing when you’ll get your capacity back.</p><p>Desktop notifications don’t fix any of this. A toast in the corner of a screen I’ve walked away from is worthless. I wanted something that would reach me anywhere.</p><p>So I made my coding agent <strong>phone me</strong>.</p><p>Not a push notification. An actual phone call, with a voice that says <em>“Hey — your agent finished the refactor on the payments project, it’s ready for you to review.”</em> The whole thing is about 250 lines of bash, a voice-AI service called Bolna, and the hook system already built into Claude Code and Codex. Here’s how it works — and the one genuinely tricky part that a hook <em>can’t</em> solve on its own.</p><h3>Three moments worth a phone call</h3><p>I only want the phone to ring when it actually earns it:</p><ol><li><strong>A long task finished.</strong> A run that took ten-plus minutes coming to a stop.</li><li><strong>The agent is stuck on me.</strong> Blocked on a permission prompt or a question, and I haven’t responded.</li><li><strong>My quota reset.</strong> I hit my limit at 2:30pm; I want a call the moment I’m back to 100%.</li></ol><p>Three different triggers, three different mechanisms. The first two are easy. The third is where it gets interesting.</p><h3>The easy part: hooks</h3><p><a href="https://docs.claude.com/en/docs/claude-code/hooks">Claude Code hooks</a> let you run a shell command on lifecycle events — UserPromptSubmit, PreToolUse, Notification, Stop. Your command gets JSON on stdin. That’s the whole API.</p><p>My one ironclad rule: <strong>every hook exits </strong><strong>0, always.</strong> A notification system that gets in the way of the work is worse than no system at all. Everything is fire-and-forget, with a one-touch mute switch every script checks first.</p><h3>“A long task finished”</h3><p>A duration gate. A UserPromptSubmit hook stamps the start time; the Stop hook measures elapsed and only calls if it crossed my threshold:</p><pre>START=$(cat &quot;$STATE_DIR/$SESSION_ID&quot;)<br>ELAPSED=$(( $(date +%s) - START ))<br>[ &quot;$ELAPSED&quot; -lt &quot;${NOTIFY_MIN_SECONDS:-600}&quot; ] &amp;&amp; exit 0   # short run -&gt; stay quiet</pre><h3>“The agent is stuck on you”</h3><p>This one has a subtlety I like. The Notification event fires the instant Claude blocks — but I don’t want a call if I answer in five seconds. So it uses a <strong>grace delay with a sentinel</strong>:</p><ol><li>When Claude blocks, drop a sentinel file with a timestamp nonce and sleep ~45s. The hook runs async, so Claude isn’t blocked.</li><li>The moment I respond, Claude’s next tool fires a PreToolUse hook that <strong>deletes the sentinel</strong>.</li><li>When the sleeper wakes, it only calls if the sentinel still exists with its own nonce. Answered fast? It’s gone — silence. Walked away? It survived — the phone rings.</li></ol><p>A per-session cooldown means a burst of prompts is <em>one</em> call, not five. Distributed-systems thinking in a 50-line shell script — the difference between “useful” and “annoying.”</p><h3>The hard part: calling me when my quota resets</h3><p>A hook only runs <strong>while Claude is open</strong>. But my quota resets <em>hours</em> later — Claude might be closed, my Mac asleep. So the design splits in two: a <strong>detector</strong> that notices the limit and <strong>schedules</strong> a call, and an always-on <strong>firer</strong> that <strong>places</strong> it at reset time, independent of Claude.</p><p>For the firer I used a launchd agent that ticks every 60 seconds and drains a queue file. launchd survives what a background sleep can’t: app exit, logout, reboot, and system sleep (it fires on the next wake). That half was solid.</p><pre>&lt;key&gt;ProgramArguments&lt;/key&gt;<br>&lt;array&gt;<br>  &lt;string&gt;/bin/bash&lt;/string&gt;<br>  &lt;string&gt;/Users/you/.claude/hooks/bolna-scheduler.sh&lt;/string&gt;<br>&lt;/array&gt;<br>&lt;key&gt;StartInterval&lt;/key&gt;&lt;integer&gt;60&lt;/integer&gt;<br>&lt;key&gt;RunAtLoad&lt;/key&gt;&lt;true/&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2Hru69gofwIOPIjGEBWPA.png" /></figure><h3>My first detector was wrong</h3><p>The detector is where I got it wrong. I <em>assumed</em> Claude’s “usage limit … resets at X” message arrives through a Notification hook, so I wrote a hook to parse the time and schedule the call. I flagged it honestly — I couldn’t trigger a real limit to test, so I shipped it <em>armed but unverified</em>, and made it <strong>log every notification it received</strong>.</p><p>Then I actually hit my limit. <strong>No call came.</strong></p><p>The log told the whole story: every notification the hook ever received was a permission prompt or an idle ping — <em>never</em> a limit message. Claude Code’s Notification hook simply doesn’t carry rate-limit events, and the reset time isn’t written to any local file either — it’s rendered straight from the API’s 429 into the terminal and gone. My detector was listening on a channel the signal never travels on.</p><h3>The fix: StopFailure</h3><p>The right signal is a different hook: StopFailure, which fires when a turn <em>ends because of an API error</em> — and it tags the type. rate_limit means you’re out of quota (act on it); overloaded means Anthropic’s servers are busy (transient — ignore it). So the working detector is a catch-all StopFailure hook that self-filters for rate_limit, captures the payload, calls you immediately, and — if the payload carries the reset time — schedules the “back to 100%” call.</p><p>And the lesson came back stronger. “Make the unverifiable <strong>observable</strong>” wasn’t just a hedge — that notification log is <em>exactly</em> what diagnosed the failure and pointed at the real fix. The instrumentation didn’t soften the miss; it found the answer. (One aside that still bites: my time parser once turned “resets 9pm” into <strong>9:28pm</strong>, because macOS date fills a missing minutes field from the <em>current</em> clock. Test parsers against ugly real input, not the clean one you imagined.)</p><h3>The voice on the other end</h3><p>Bolna handles the telephony. One voice agent, one system prompt that branches on the reason I send in user_data:</p><pre>reason &quot;waiting_for_input&quot;  -&gt; &quot;Your agent is blocked and waiting on you...&quot;<br>reason &quot;quota_reset&quot;        -&gt; &quot;Good news - your limit reset, you&#39;re back to 100%...&quot;<br>reason &quot;finished&quot; / empty   -&gt; &quot;Your agent finished the long task on {project}...&quot;</pre><p>The same plumbing is wired into Codex CLI — a fun study in API differences: Codex has no Notification event, so “Codex is waiting on you” is detected when a turn <em>ends</em> with a question, via last_assistant_message on Stop.</p><h3>Takeaways</h3><ul><li><strong>Fire-and-forget is a discipline, not a default.</strong> Exit 0 everywhere.</li><li><strong>When a hook can’t do the job, find the seam.</strong> Split <em>detection</em> from <em>firing</em>.</li><li><strong>Make the unverifiable observable.</strong> Honesty plus instrumentation beats wishful thinking.</li></ul><p>The full setup — every script, the Bolna agent prompt, the launchd plist, and a from-scratch Bolna walkthrough — is in the gist:</p><p><a href="https://gist.github.com/StrangeNoob/ff8cf6bcd488920cd9405122dbbf8a62"><strong>👉 The complete setup gist</strong></a></p><p><em>Built, fittingly, with Claude Code — to make Claude Code call me.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48f2428c1624" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Docker Build Times with Essential NPM Commands]]></title>
            <link>https://medium.com/@itsprateekmohanty/optimizing-docker-build-times-with-essential-npm-commands-e386b160dc86?source=rss-eb6f6ca7d87d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e386b160dc86</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Prateek Mohanty]]></dc:creator>
            <pubDate>Sun, 19 May 2024 06:45:22 GMT</pubDate>
            <atom:updated>2024-05-19T06:45:22.495Z</atom:updated>
            <content:encoded><![CDATA[<p>As a backend developer, my experience with Docker has been somewhat limited. While I appreciate the concept of containerization, the substantial memory usage of running Docker has always been a deterrent for me. However, when my Tech Lead insisted on using Docker for deployment through AWS ECS, I had no choice but to dive in.</p><p>Initially, the Docker image we built was around 500–600 MB, with a build time of 8–9 minutes. This wasn’t ideal, but it was manageable. However, we soon encountered issues with our CI/CD pipeline, where the build would sometimes fail at the npm install stage within Docker.</p><p>My Tech Lead recommended reading an article on Docker-slimmer, but it didn’t provide the solutions I was looking for. Determined to improve our build process, I took it upon myself to reduce the build time and image size.</p><p>In our package.json file, I noticed several packages installed as devDependencies, such as @types, husky, eslint, lint-staged, and nodemon. These packages are essential for development but not needed in production. This observation led me to discover the underappreciated command:</p><pre>npm install --omit=dev</pre><p>This command installs only the necessary dependencies, excluding the development dependencies. By using npm install --omit=dev, I was able to reduce the Docker image size by 200-300 MB and cut the build time from 8-9 minutes down to 2-3 minutes. This significant improvement not only made our pipeline more reliable but also optimized our deployment process.</p><p>Here’s a simple breakdown of how you can use NPM commands to optimize your Docker build:</p><h3>Install Production Dependencies Only</h3><p>Use the --omit=dev flag with the npm install command to exclude dev dependencies during the Docker build.</p><pre>npm install --omit=dev</pre><h3>2. Update Dockerfile</h3><p>Ensure your Dockerfile uses the npm install --omit=dev command to install only the necessary dependencies for production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hg5cuK3ditV7jFzW4ShRzA.png" /></figure><h3>3. Optimize Docker Image Size and Build Time</h3><p>By excluding unnecessary packages, you can significantly reduce the size of your Docker image and decrease build times, leading to more efficient deployments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iml4savGJ5z0eyiV0dMAaA.png" /></figure><p>Taking these steps not only streamlined our deployment process but also highlighted the importance of using the right NPM commands to optimize Docker builds. If you find yourself facing similar challenges, give npm install --omit=dev a try and see the difference it can make.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e386b160dc86" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>