Sends "continue" once a usage limit resets, so a turn cut off by the limit picks up where it stopped.

Live panes, prompt bands, status line entries, toasts, and hooks for Claude Code, each shipped as a plugin.
/plugin marketplace add tartinerlabs/claude-code-mods
/plugin install <mod> --marketplace tartinerlabs/claude-code-mods
| | Mod | Where it shows | In one line | | :-: | --- | --- | --- | | ⏸ | auto-resume | Status line, toast | Picks a turn back up once a usage limit resets | | 🏷 | auto-session-name | Session title | Names each session from its first prompt | | ⏱ | cache-clock | Band above the prompt | Counts down to the prompt cache going cold | | 📊 | limit-watch | Band above the prompt, toasts | Shows the 5-hour and weekly usage limits | | 🛫 | pr-pilot | Band above the prompt, toasts | Shows the branch's PR checks and merges it with /merge | | 🗜 | smart-compact | Toast | Compacts between turns, sooner at checkpoints or when the cache is cooling | | ⛅ | token-weather | Band above the prompt | Forecasts how full the context window is |
When a turn stops on a usage limit, waits until the limit resets and sends continue. Typing a prompt yourself or running /auto-resume cancel stops the wait.
⏸ auto-resume in 1h 12m ← status line
Usage limit reset, resuming ← toast
<sub>📁 plugins/auto-resume</sub>
Names each session from its first prompt using Haiku and can give it a prompt bar colour, so it is easy to find with claude -r after a crash. Sessions already named with -n or /rename are left alone. Set the color option to red, blue, green, yellow, purple, orange, pink or cyan to colour named sessions; default leaves the colour alone.
> fix the flaky retry test in the upload worker
→ session titled "Fix flaky upload retry test"
<sub>📁 plugins/auto-session-name</sub>
Draws a countdown above the prompt to when the prompt cache goes cold, with the last request's hit rate. Once cold, it shows how much the next turn re-writes. Set the ttl option to 1h when extended caching is on.
cache ● 3:42 left · 96% hit ← green, yellow under a minute
cache ○ cold · next turn re-writes 84.3k ← red
<sub>📁 plugins/cache-clock</sub>
Draws the 5-hour and weekly usage limits above the prompt with live reset countdowns, green under 60%, yellow to 80% and red past it. Toasts once a window passes 80% and again at 95%. Any other window the API reports, such as a gateway spend limit, shows under its own name.
5h 42% · 2h17m 7d 81% · 3d4h ← band
7d limit at 81%, resets in 3d4h ← toast
<sub>📁 plugins/limit-watch</sub>
Draws the current branch's open pull request above the prompt with its checks and whether it can merge, refreshed each minute and after every turn. Toasts when a run of checks finishes. /merge merges it with gh and deletes the branch, but only once every check has passed and nothing blocks it. On a gh-stack layer the band shows its place in the stack, and /merge merges the whole stack with gh stack merge once every unmerged layer has passed its checks and has no unpushed commits, then switches to the trunk and deletes every layer's branch, local and remote, once all of them have merged. Set the method option to merge (default), squash or rebase. Needs the GitHub CLI, signed in.
PR #42 ◐ 3/5 checks waiting ← band
PR #42 ✗ 1 failing: SonarCloud blocked ← red
PR #42 ✓ 5/5 checks ready · /merge ← green
PR #42 stack 2/3 ✓ 5/5 checks ready · /merge ← a gh-stack layer
PR #42 checks passed, ready to /merge ← toast
<sub>📁 plugins/pr-pilot</sub>
Compacts the conversation between turns, never during one, weighing several factors against the context's fill. Past the threshold option (60, 70 default, or 80%) it compacts about ten seconds after a turn ends. It compacts sooner when compacting is cheapest or most worth it:
gh pr, gh stack), had a plan approved, finished its todo list, or switched branch or worktree. The summary is told what to keep for each, such as the approved plan verbatim. A checkpoint counts only until the next turn starts. Set checkpoints to off to ignore them.Nothing takes it under the floor option (30, 40 default, or 50%), and it tries at most once per idle stretch. Set ttl to 1h when extended prompt caching is on.
Compacted at 52%: committed ← toast
Compacted at 55%: cache cooling ← toast
Compacted at 74%: context high, 5h limit at 86% ← toast
<sub>📁 plugins/smart-compact</sub>
Draws a forecast of the context window above the prompt, with tokens used, a sparkline of the last 12 turns and the change since the last turn.
☁ Cloudy 38% of context 76.4k / 200k last turns ▁▂▂▃▄▄▅▆ ▲ +4.1k last turn
| ☀ Clear | ☁ Cloudy | ☂ Showers | ☇ Storm | ↯ Compact soon | | :-: | :-: | :-: | :-: | :-: | | under 25% | under 50% | under 75% | under 90% | 90% and up |
<sub>📁 plugins/token-weather</sub>
hooks/register.ts 105 lines1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register, SessionRateLimit, Timer } from 'claude-code'
3
4import type { ResumeAt } from '../types'
5
6const PROMPT = 'continue'
7// Give the limit a moment past its reset before trying again.
8const BUFFER_MS = 60_000
9// When no exhausted window says when it resets, try again after this long.
10const FALLBACK_MS = 5 * 60_000
11
12// Held by the host, so a pending resume survives a hot reload of this file.
13const resumeAt = atom({ plugin: 'auto-resume', key: 'resumeAt' } as const, null as ResumeAt)
14
15// The module's own timer: a reload drops it, and session.start arms it again.
16let timer: Timer | undefined
17
18async function cancel($: EngineInterface) {
19 timer?.cancel()
20 timer = undefined
21 $.ui.status(undefined)
22 await update($, resumeAt, () => null)
23}
24
25async function arm($: EngineInterface, at: number) {
26 timer?.cancel()
27 await update($, resumeAt, () => at)
28 const now = await $.clock.now()
29 $.ui.status(`⏸ auto-resume in ${span(at - now)}`)
30 timer = $.clock.after(Math.max(0, at - now), () => void resume($))
31}
32
33async function resume($: EngineInterface) {
34 await cancel($)
35 $.ui.toast('Usage limit reset, resuming')
36 await $.prompt.submit({ text: PROMPT })
37}
38
39export const register: Register = (on) => {
40 on('session.start', async ($, e, next) => {
41 const result = await next(e)
42 await $.command.register({
43 name: 'auto-resume',
44 description: 'Show when the session resumes after a usage limit; "cancel" to stop it',
45 argumentHint: '[cancel]',
46 })
47 // Re-arm a resume planned before a reload.
48 const at = await read($, resumeAt)
49 if (at !== null) await arm($, at)
50
51 return result
52 })
53
54 on('classic.StopFailure', async ($, e, next) => {
55 const result = await next(e)
56 if (e.error !== 'rate_limit') return result
57
58 const { rateLimits } = await $.session.usage()
59 const now = await $.clock.now()
60 const reset = resetOf(rateLimits)
61 await arm($, reset === null ? now + FALLBACK_MS : Math.max(reset, now) + BUFFER_MS)
62
63 return result
64 }).catch(($, e, next) => next(e))
65
66 // The person picked the session back up themselves.
67 on('prompt.submit', async ($, e, next) => {
68 if (e.origin.kind === 'composer' || e.origin.kind === 'bridge') {
69 if ((await read($, resumeAt)) !== null) await cancel($)
70 }
71
72 return next(e)
73 }).catch(($, e, next) => next(e))
74
75 on('command.run', { command: 'auto-resume' }, async ($, e) => {
76 const at = await read($, resumeAt)
77 if (e.args?.trim() === 'cancel') {
78 if (at === null) return { text: 'No resume pending.' }
79 await cancel($)
80
81 return { text: 'Auto-resume cancelled.' }
82 }
83 if (at === null) return { text: 'No resume pending.' }
84
85 return { text: `Resuming in ${span(at - (await $.clock.now()))}.` }
86 })
87}
88
89/** When the last exhausted window resets, in ms since the epoch; null when none says. */
90export function resetOf(limits: readonly SessionRateLimit[]) {
91 const resets = limits
92 .filter(limit => limit.percentUsed >= 100 && limit.resetsAt)
93 .map(limit => Date.parse(limit.resetsAt!))
94 .filter(ms => !Number.isNaN(ms))
95
96 return resets.length ? Math.max(...resets) : null
97}
98
99export function span(ms: number) {
100 const m = Math.max(0, Math.ceil(ms / 60_000))
101 if (m < 60) return `${m}m`
102
103 return `${Math.floor(m / 60)}h ${m % 60}m`
104}
105types/index.d.ts 9 lines1/** When the pending resume fires, in ms since the epoch; null when none is pending. */
2export type ResumeAt = number | null
3
4declare module 'claude-code' {
5 interface PluginState {
6 'auto-resume': { resumeAt: ResumeAt }
7 }
8}
9