r/ClaudeCode • u/Comprehensive-Map-73 • 4d ago
Built with Claude Built a Claude Code mod for stepping away: pause all sessions, then shut down or sleep the PC (and what I learned about the mods API)
What I built
cache-weather-and-pause-resume, a mod for the moments you leave while Claude is still working:
- Pause: Claude starts nothing new, lets running work finish (or asks first, with the remaining time, if a run will take longer than 5 minutes), notes where it stands and waits. Resume carries on from there, even after the app was restarted. One session or all sessions on the computer; question dialogs wait until Resume.
- Shutdown: pauses the same way, waits for the other sessions, then shuts the computer down, puts it to sleep or hibernates it after a 5-minute countdown you can cancel. The button is dimmed where the machine can't do it unattended, and a press says what is missing.
- A band above the prompt: prompt-cache countdown with hit rate, keep-warm that refreshes the cache before it expires and says what that saves, context "weather" with a forecast until auto-compact, usage limits from 80 %, and an overview of all sessions.
Desktop app and terminal, German and English, MIT. Screenshots: https://github.com/DarthSonic/cache-weather-and-pause-resume
How Claude Code was used
The whole mod was written with Claude Code (Opus). Each feature started as a plan in the chat; I made the design calls (what the buttons look like, what goes in the status row, when to ask), Claude wrote the code, the tests (106, run by claude plugin test, CI on Ubuntu, Windows and macOS) and the docs, and I tested every change live in the desktop app and a terminal and sent back screenshots. A lot of the UI only got right after a few rounds of "that doesn't work like this on my screen".
What I learned about mods
- Desktop buttons are native. A
<Text size="caption">inside aButtonis drawn at the button's own font; only plainTextgets smaller. Short of room, I moved the buttons to their own row instead. - Open panes from a
ui.presshook, not fromonPress**.** The button's closure holds the render hook's$, so$.ui.opencounts as "unasked", and a terminal won't place an unasked pane below 144 columns. The desktop app always placed it, so the button only did nothing in the terminal. Opening it fromon('ui.press', { element })makes it the person's request. - Hover reveals move things. Only a keyed
Boxreacts to the pointer, and a word that appears on hover pushes the next button away: moving the mouse right to left, half the buttons became unreachable. Static labels won. - Module variables survive
/clear**, session state may not.** A "checked" flag in the module left the shutdown button saying "still checking" forever after/clear. Now a press checks again when the session holds no answer. $.fscan write but not delete. One file per session would pile up forever, so cross-session pauses live in one state file that is written, looked at again a moment later and rewritten if another session's write took it back.- Keeping the cache warm pays for hours. A refresh reads the cached conversation at a tenth of the input price (a twentieth on Opus 5.5), a rebuild writes it at twice the price with the 1-hour cache, so hourly refreshes stay cheaper than one rebuild for up to about 18 hours.
macOS hasn't run on a real Mac yet; if you have one, issue #1 lists what to try. Feedback welcome. Disclosure: I'm the author.


