Tells Claude to wrap up when the 5-hour or weekly usage window is nearly used.

Small Claude Code mods.
/plugin marketplace add PhilRoli/claude-mods
For TrainTracker. Shortly before your tracked train arrives (default: 10 minutes), every session is told to stop starting new work, leave the code in a consistent state and report what's done and what remains, so you can switch locations or turn off wifi without cutting a session off mid-task.
/plugin install train-pause@claude-mods
Requires TrainTracker (≥ 1.3.0), which writes the arrival time to ~/.traintracker/arrival.json ({"arrival": <epoch seconds, delay included>}) while a train is tracked. Idle sessions pick up the instruction on their next prompt; the status line shows a countdown. Change the window with WRAP_UP_MINUTES in plugins/train-pause/hooks/register.ts.
Same idea for usage limits: once the 5-hour or weekly window is ≥ 95% used, the session is told to wrap up. A window that resets within 5 minutes is ignored. Needs a subscription (the engine reports no limits otherwise).
/plugin install session-limit-pause@claude-mods
Tune with WRAP_UP_PERCENT and IGNORE_IF_RESET_WITHIN_MIN in plugins/session-limit-pause/hooks/register.ts.
/nosleep keeps the Mac awake with the lid closed (pmset -a disablesleep 1) and restores sleep when the session ends. /nosleep on|off sets it explicitly; the status line shows lid-closed awake while active.
/plugin install nosleep@claude-mods
macOS only. One-time setup so sudo doesn't prompt:
echo "$USER ALL=(root) NOPASSWD: /usr/bin/pmset -a disablesleep 1, /usr/bin/pmset -a disablesleep 0" | sudo tee /etc/sudoers.d/nosleep >/dev/null && sudo chmod 0440 /etc/sudoers.d/nosleep && sudo visudo -cf /etc/sudoers.d/nosleep
A hard-killed session leaves sleep disabled until the next session starts (or sudo pmset -a disablesleep 0).
For ClaudePulse. After your first prompt, Haiku gives the session a short title (/rename) and a color is picked from the session id (/color), so the menu bar app can show both.
/plugin install session-label@claude-modshooks/register.ts 41 lines1import type { Register, SessionRateLimit } from 'claude-code'
2
3const WRAP_UP_PERCENT = 95
4const IGNORE_IF_RESET_WITHIN_MIN = 5
5
6const LABELS: Record<string, string> = { five_hour: '5-hour session', seven_day: 'weekly', spend_limit: 'spend' }
7
8const resetsSoon = (l: SessionRateLimit, nowMs: number) =>
9 l.resetsAt !== undefined && Date.parse(l.resetsAt) - nowMs <= IGNORE_IF_RESET_WITHIN_MIN * 60_000
10
11export const nearLimit = (limits: SessionRateLimit[], nowMs: number): SessionRateLimit | undefined =>
12 limits
13 .filter(l => l.percentUsed >= WRAP_UP_PERCENT && !resetsSoon(l, nowMs))
14 .sort((a, b) => b.percentUsed - a.percentUsed)[0]
15
16const describe = (l: SessionRateLimit) => {
17 const label = LABELS[l.kind] ?? l.kind
18 const reset = l.resetsAt ? ` (resets ${new Date(l.resetsAt).toLocaleTimeString()})` : ''
19 return `${label} limit ${Math.round(l.percentUsed)}% used${reset}`
20}
21
22export const register: Register = on => {
23 on('session.measure', async ($, e, next) => {
24 const hit = nearLimit(e.rateLimits, await $.clock.now())
25 $.ui.status(hit ? `⏳ ${describe(hit)} — wrap up` : undefined)
26 return next(e)
27 })
28
29 // prompt.compose is bypassed by cc-plugin-sec-default, so attach the nudge as hidden prompt context
30 on('prompt.submit', async ($, e, next) => {
31 const hit = nearLimit((await $.session.usage()).rateLimits, await $.clock.now())
32 if (!hit) return next(e)
33 const text =
34 `The user's ${describe(hit)}; they are about to be cut off. ` +
35 `Do not start new work. Finish the current step only if it can be done in a minute or two, leave the code in a ` +
36 `consistent, working state (no half-applied edits), commit or note progress if appropriate, then stop and tell ` +
37 `the user briefly what is done and what remains so they can resume after the limit resets.`
38 return next({ ...e, context: [...(e.context ?? []), text] })
39 })
40}
41