{"name":"resume-after-limit","title":"Resume after limit","description":"Make Claude Code sessions that a subscription usage limit stopped continue on their own once the quota returns, without spending tokens to check: a scheduler the user installs runs a tick every few minutes that reads each recent transcript's limit record and reset time, resumes a stopped session through its inbox socket when it is still open or with claude --bg --resume when it has exited, staggers resumes per account, and leaves alone any session dormant longer than the window (five hours by default). Turn it on for every session or only watched ones, ask for its status, change the interval. Use when sessions stall at 'You've hit your session limit', when you keep typing continue after a reset, or for: resume after limit, auto-continue, keep working when the quota resets, watch this session, is auto-resume on. It schedules nothing itself; arming the scheduler is the user's own run of its installer. It does not report progress (report-progress) or supervise child agents (agent-lifecycle).","compatibility":"Claude Code CLI sessions (terminal, VS Code extension, background, -p) on a Claude subscription, macOS (launchd) or Linux (systemd user timer or cron); limit records as observed on Claude Code 2.1.281 to 2.1.295, inbox posts on 2.1.293 (references/evidence.md). Node 22+, nothing else. Reads transcripts, session files and the account; writes only its own state directory. Not for Codex, Windows, cloud sessions or API-key billing.","allowedTools":"Read Bash","license":"MIT","kind":"requestOnly","useWhen":"asked to resume Claude Code sessions after a usage limit resets, or whether auto-resume is on","group":"workflow","lifecycle":"release","version":"1.0.0","author":"crissmoldovan","install":["npx skills add crissmoldovan/agent-skills --skill resume-after-limit"],"asks":["Turn on auto-resume for all my sessions. If a session runs out of quota,\nit should pick up again when the limit resets.","Only watch this session: resume it after the limit, but leave my other sessions alone.","Is auto-resume on? Which sessions are waiting, and when do they reset?"],"commands":["node <skill-folder>/scripts/install-scheduler.mjs --install\nnode <skill-folder>/scripts/resume.mjs on all\nnode <skill-folder>/scripts/resume.mjs watch\nnode <skill-folder>/scripts/resume.mjs interval 10m\nnode <skill-folder>/scripts/resume.mjs status\nnode <skill-folder>/scripts/resume.mjs observe off\nnode <skill-folder>/scripts/resume.mjs off"],"documents":[{"path":"references/evidence.md","slug":"evidence","title":"Evidence: what resume-after-limit relies on, and how sure it is","body":"# Evidence: what resume-after-limit relies on, and how sure it is\n\nEvery behaviour the scripts depend on is tagged here, the way the pack's adapter notes tag\neverything:\n\n- **OBSERVED**: seen on a real machine by the people who built this, with the version named.\n- **DOCUMENTED**: stated by Claude Code's documentation, its `--help`, or text in its own binary,\n  but not yet watched happening here.\n- **NOT OBSERVED**: assumed by the design and not yet checked. The skill ships in observe mode\n  until these are checked on the user's own machine.\n\n## The limit record — OBSERVED\n\nRead from real Claude Code transcripts on macOS, written by **Claude Code 2.1.281 to 2.1.295**\nthrough the VS Code extension (`entrypoint: \"claude-vscode\"`). Ids, paths, branch and time zone are\nreplaced; `usage` is trimmed.\n\n```json\n{\"isSidechain\":false,\"type\":\"assistant\",\"timestamp\":\"2026-10-10T18:23:07.806Z\",\"message\":{\"model\":\"<synthetic>\",\"role\":\"assistant\",\"stop_reason\":\"stop_sequence\",\"content\":[{\"type\":\"text\",\"text\":\"You've hit your weekly limit · resets Oct 15 at 2pm (<zone>)\"}]},\"apiError\":\"usage_limit_reached\",\"apiErrorParams\":{\"rate_limit_info\":{\"status\":\"rejected\",\"resetsAt\":1792062000,\"rateLimitType\":\"seven_day\",\"overageStatus\":\"rejected\",\"overageDisabledReason\":\"org_level_disabled\",\"isUsingOverage\":false}},\"quotaLimits\":{\"status\":\"rejected\",\"resetsAt\":1792062000,\"unifiedRateLimitFallbackAvailable\":false,\"rateLimitType\":\"seven_day\",\"overageStatus\":\"rejected\",\"overageDisabledReason\":\"org_level_disabled\",\"isUsingOverage\":false},\"error\":\"rate_limit\",\"isApiErrorMessage\":true,\"apiErrorStatus\":429,\"entrypoint\":\"claude-vscode\",\"version\":\"2.1.294\"}\n```\n\nWhat held across every record read:\n\n| Field | Seen |\n|---|---|\n| `isApiErrorMessage` | always `true` |\n| `quotaLimits` | always present, with the same seven keys, `status: \"rejected\"` |\n| `quotaLimits.rateLimitType` | `five_hour` or `seven_day` |\n| `quotaLimits.resetsAt` | epoch **seconds** |\n| `error` | always `\"rate_limit\"`; also used for server throttling (below), so not enough alone |\n| `apiError: \"usage_limit_reached\"` | only sometimes; not relied on |\n| message text | `You've hit your session limit · resets <time> (<zone>)`, `You've hit your weekly limit · resets <date> at <time> (<zone>)` |\n| subagent transcripts | carry the same record with `isSidechain: true`; ignored, the main session is what resumes |\n\nWhat came after them: a typed \"continue\" (or \"continue.\" and the like), sometimes before the\nrecorded reset after the person switched accounts, sometimes hours after it. No automatic continue\nwas found after any of them.\n\n**DOCUMENTED elsewhere, not seen here:** a server throttle logged as `\"error\":\"rate_limit\"` with\n`apiErrorStatus: 429` and the text \"Server is temporarily limiting requests (not your usage limit)\"\n(anthropics/claude-code issue 64030), and the older text `Claude AI usage limit reached|<epoch>`\nfrom Claude Code 1.0.x, which `detect.mjs` still reads.\n\n## Live sessions — OBSERVED\n\n`<configDir>/sessions/<pid>.json` on Claude Code 2.1.289 to 2.1.295 (macOS) and 2.1.293 (Linux)\ncarries `pid`, `sessionId`, `cwd`, `kind`, `entrypoint`, `status` (`idle` or `busy`),\n`peerProtocol`, `messagingSocketPath` and `procStart`. Beside it, `<pid>.<64 hex>.key` holds\n`{ peerToken, procStart, pidDomain }`. On Linux, `procStart` equals field 22 of `/proc/<pid>/stat`\n(observed on 2.1.293), which is how `detect.mjs` refuses a reused pid.\n\n## The inbox socket — partly OBSERVED\n\nClaude Code documents the per-session inbox for \"a script or hook to post into a session\"\n(https://code.claude.com/docs/en/cross-session-messaging): an idle session starts a new turn when a\nmessage arrives, a session that prompts for permissions takes messages, and one that bypasses them\nholds them; the VS Code extension cannot show the approval dialog and drops a held message after\n`dialogExpiry`.\n\nThe line format is the binary's own debug text (**DOCUMENTED**, 2.1.293):\n\n```text\n{\"type\":\"auth\",\"token\":\"<token>\"}\n{\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":\"hello\"}}\n```\n\n**OBSERVED** on Linux, Claude Code 2.1.293, receiving session run through the Agent SDK in\nbypass-permissions mode:\n\n| Sender | Auth line | Delivered |\n|---|---|---|\n| the session's own child process | `CLAUDE_CODE_MESSAGING_TOKEN` | yes, shown to the session as a message from another session |\n| a detached process | none | not within the observation |\n| a detached process | `peerToken` from the `.key` file | not within the observation |\n\nThe two that did not arrive match the documented hold for a session that bypasses permissions.\n**NOT OBSERVED:** a post from a detached process into a session that prompts for permissions — the\ncase `deliver.mjs` relies on for an open VS Code or terminal session.\n\n## Resuming an exited session — DOCUMENTED\n\n`claude --help` (2.1.289 on macOS, 2.1.293 on Linux): `--bg` \"with --resume <session-id>,\ncontinues that session in the background under the same ID, or starts a copy and says so when the\nsession is already running\". **NOT OBSERVED:** the exact output text, which `deliver.mjs` reads\nonly for the word \"copy\".\n\n## Claude Code's own wait — DOCUMENTED\n\n`autoContinueAtUsageLimit`, from 2.1.234, on by default for interactive sessions signed in with a\nclaude.ai subscription; not offered for background sessions or `-p` runs; not started on its own\nwhen the reset is more than 24 hours away; not restored on resume; at most two re-arms\n(https://code.claude.com/docs/en/interactive-mode). **NOT OBSERVED:** what a transcript shows when\nit continues a session. The tick waits two minutes past the reset and treats any new entry as\n\"superseded\", so the two do not both resume a session.\n\n## The usage endpoint — DOCUMENTED by others, NOT OBSERVED here\n\n`GET https://api.anthropic.com/api/oauth/usage` with the OAuth access token and\n`anthropic-beta: oauth-2025-04-20` returns `five_hour`, `seven_day`, `seven_day_opus`,\n`seven_day_sonnet`, each `{ utilization, resets_at }` with an ISO time (Claude-Code-Usage-Monitor\nissue 202). It is undocumented, answers 429 readily (anthropics/claude-code issue 30930), and\nClaude Code's own `/usage` falls back to last-known values when it does\n(https://code.claude.com/docs/en/costs). The Keychain service name, and its suffix for a\nnon-default config directory, are read from the binary. Whether macOS prompts when a launchd job\nreads the Keychain item is not known. Hence the probe is **off by default**.\n","bodyHtml":"<h2 id=\"evidence-what-resume-after-limit-relies-on-and-how-sure-it-is\">Evidence: what resume-after-limit relies on, and how sure it is</h2>\n<p>Every behaviour the scripts depend on is tagged here, the way the pack&#39;s adapter notes tag\neverything:</p>\n<ul>\n<li><strong>OBSERVED</strong>: seen on a real machine by the people who built this, with the version named.</li>\n<li><strong>DOCUMENTED</strong>: stated by Claude Code&#39;s documentation, its <code>--help</code>, or text in its own binary,\nbut not yet watched happening here.</li>\n<li><strong>NOT OBSERVED</strong>: assumed by the design and not yet checked. The skill ships in observe mode\nuntil these are checked on the user&#39;s own machine.</li>\n</ul>\n<h3 id=\"the-limit-record-observed\">The limit record — OBSERVED</h3>\n<p>Read from real Claude Code transcripts on macOS, written by <strong>Claude Code 2.1.281 to 2.1.295</strong>\nthrough the VS Code extension (<code>entrypoint: &quot;claude-vscode&quot;</code>). Ids, paths, branch and time zone are\nreplaced; <code>usage</code> is trimmed.</p>\n<pre><code class=\"language-json\">{&quot;isSidechain&quot;:false,&quot;type&quot;:&quot;assistant&quot;,&quot;timestamp&quot;:&quot;2026-10-10T18:23:07.806Z&quot;,&quot;message&quot;:{&quot;model&quot;:&quot;&lt;synthetic&gt;&quot;,&quot;role&quot;:&quot;assistant&quot;,&quot;stop_reason&quot;:&quot;stop_sequence&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;You&#39;ve hit your weekly limit · resets Oct 15 at 2pm (&lt;zone&gt;)&quot;}]},&quot;apiError&quot;:&quot;usage_limit_reached&quot;,&quot;apiErrorParams&quot;:{&quot;rate_limit_info&quot;:{&quot;status&quot;:&quot;rejected&quot;,&quot;resetsAt&quot;:1792062000,&quot;rateLimitType&quot;:&quot;seven_day&quot;,&quot;overageStatus&quot;:&quot;rejected&quot;,&quot;overageDisabledReason&quot;:&quot;org_level_disabled&quot;,&quot;isUsingOverage&quot;:false}},&quot;quotaLimits&quot;:{&quot;status&quot;:&quot;rejected&quot;,&quot;resetsAt&quot;:1792062000,&quot;unifiedRateLimitFallbackAvailable&quot;:false,&quot;rateLimitType&quot;:&quot;seven_day&quot;,&quot;overageStatus&quot;:&quot;rejected&quot;,&quot;overageDisabledReason&quot;:&quot;org_level_disabled&quot;,&quot;isUsingOverage&quot;:false},&quot;error&quot;:&quot;rate_limit&quot;,&quot;isApiErrorMessage&quot;:true,&quot;apiErrorStatus&quot;:429,&quot;entrypoint&quot;:&quot;claude-vscode&quot;,&quot;version&quot;:&quot;2.1.294&quot;}\n</code></pre>\n<p>What held across every record read:</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Seen</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>isApiErrorMessage</code></td>\n<td>always <code>true</code></td>\n</tr>\n<tr>\n<td><code>quotaLimits</code></td>\n<td>always present, with the same seven keys, <code>status: &quot;rejected&quot;</code></td>\n</tr>\n<tr>\n<td><code>quotaLimits.rateLimitType</code></td>\n<td><code>five_hour</code> or <code>seven_day</code></td>\n</tr>\n<tr>\n<td><code>quotaLimits.resetsAt</code></td>\n<td>epoch <strong>seconds</strong></td>\n</tr>\n<tr>\n<td><code>error</code></td>\n<td>always <code>&quot;rate_limit&quot;</code>; also used for server throttling (below), so not enough alone</td>\n</tr>\n<tr>\n<td><code>apiError: &quot;usage_limit_reached&quot;</code></td>\n<td>only sometimes; not relied on</td>\n</tr>\n<tr>\n<td>message text</td>\n<td><code>You&#39;ve hit your session limit · resets &lt;time&gt; (&lt;zone&gt;)</code>, <code>You&#39;ve hit your weekly limit · resets &lt;date&gt; at &lt;time&gt; (&lt;zone&gt;)</code></td>\n</tr>\n<tr>\n<td>subagent transcripts</td>\n<td>carry the same record with <code>isSidechain: true</code>; ignored, the main session is what resumes</td>\n</tr>\n</tbody></table>\n<p>What came after them: a typed &quot;continue&quot; (or &quot;continue.&quot; and the like), sometimes before the\nrecorded reset after the person switched accounts, sometimes hours after it. No automatic continue\nwas found after any of them.</p>\n<p><strong>DOCUMENTED elsewhere, not seen here:</strong> a server throttle logged as <code>&quot;error&quot;:&quot;rate_limit&quot;</code> with\n<code>apiErrorStatus: 429</code> and the text &quot;Server is temporarily limiting requests (not your usage limit)&quot;\n(anthropics/claude-code issue 64030), and the older text <code>Claude AI usage limit reached|&lt;epoch&gt;</code>\nfrom Claude Code 1.0.x, which <code>detect.mjs</code> still reads.</p>\n<h3 id=\"live-sessions-observed\">Live sessions — OBSERVED</h3>\n<p><code>&lt;configDir&gt;/sessions/&lt;pid&gt;.json</code> on Claude Code 2.1.289 to 2.1.295 (macOS) and 2.1.293 (Linux)\ncarries <code>pid</code>, <code>sessionId</code>, <code>cwd</code>, <code>kind</code>, <code>entrypoint</code>, <code>status</code> (<code>idle</code> or <code>busy</code>),\n<code>peerProtocol</code>, <code>messagingSocketPath</code> and <code>procStart</code>. Beside it, <code>&lt;pid&gt;.&lt;64 hex&gt;.key</code> holds\n<code>{ peerToken, procStart, pidDomain }</code>. On Linux, <code>procStart</code> equals field 22 of <code>/proc/&lt;pid&gt;/stat</code>\n(observed on 2.1.293), which is how <code>detect.mjs</code> refuses a reused pid.</p>\n<h3 id=\"the-inbox-socket-partly-observed\">The inbox socket — partly OBSERVED</h3>\n<p>Claude Code documents the per-session inbox for &quot;a script or hook to post into a session&quot;\n(<a href=\"https://code.claude.com/docs/en/cross-session-messaging\" target=\"_blank\" rel=\"noreferrer\">https://code.claude.com/docs/en/cross-session-messaging</a>): an idle session starts a new turn when a\nmessage arrives, a session that prompts for permissions takes messages, and one that bypasses them\nholds them; the VS Code extension cannot show the approval dialog and drops a held message after\n<code>dialogExpiry</code>.</p>\n<p>The line format is the binary&#39;s own debug text (<strong>DOCUMENTED</strong>, 2.1.293):</p>\n<pre><code class=\"language-text\">{&quot;type&quot;:&quot;auth&quot;,&quot;token&quot;:&quot;&lt;token&gt;&quot;}\n{&quot;type&quot;:&quot;user&quot;,&quot;message&quot;:{&quot;role&quot;:&quot;user&quot;,&quot;content&quot;:&quot;hello&quot;}}\n</code></pre>\n<p><strong>OBSERVED</strong> on Linux, Claude Code 2.1.293, receiving session run through the Agent SDK in\nbypass-permissions mode:</p>\n<table>\n<thead>\n<tr>\n<th>Sender</th>\n<th>Auth line</th>\n<th>Delivered</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>the session&#39;s own child process</td>\n<td><code>CLAUDE_CODE_MESSAGING_TOKEN</code></td>\n<td>yes, shown to the session as a message from another session</td>\n</tr>\n<tr>\n<td>a detached process</td>\n<td>none</td>\n<td>not within the observation</td>\n</tr>\n<tr>\n<td>a detached process</td>\n<td><code>peerToken</code> from the <code>.key</code> file</td>\n<td>not within the observation</td>\n</tr>\n</tbody></table>\n<p>The two that did not arrive match the documented hold for a session that bypasses permissions.\n<strong>NOT OBSERVED:</strong> a post from a detached process into a session that prompts for permissions — the\ncase <code>deliver.mjs</code> relies on for an open VS Code or terminal session.</p>\n<h3 id=\"resuming-an-exited-session-documented\">Resuming an exited session — DOCUMENTED</h3>\n<p><code>claude --help</code> (2.1.289 on macOS, 2.1.293 on Linux): <code>--bg</code> &quot;with --resume <session-id>,\ncontinues that session in the background under the same ID, or starts a copy and says so when the\nsession is already running&quot;. <strong>NOT OBSERVED:</strong> the exact output text, which <code>deliver.mjs</code> reads\nonly for the word &quot;copy&quot;.</p>\n<h3 id=\"claude-codes-own-wait-documented\">Claude Code&#39;s own wait — DOCUMENTED</h3>\n<p><code>autoContinueAtUsageLimit</code>, from 2.1.234, on by default for interactive sessions signed in with a\nclaude.ai subscription; not offered for background sessions or <code>-p</code> runs; not started on its own\nwhen the reset is more than 24 hours away; not restored on resume; at most two re-arms\n(<a href=\"https://code.claude.com/docs/en/interactive-mode\" target=\"_blank\" rel=\"noreferrer\">https://code.claude.com/docs/en/interactive-mode</a>). <strong>NOT OBSERVED:</strong> what a transcript shows when\nit continues a session. The tick waits two minutes past the reset and treats any new entry as\n&quot;superseded&quot;, so the two do not both resume a session.</p>\n<h3 id=\"the-usage-endpoint-documented-by-others-not-observed-here\">The usage endpoint — DOCUMENTED by others, NOT OBSERVED here</h3>\n<p><code>GET https://api.anthropic.com/api/oauth/usage</code> with the OAuth access token and\n<code>anthropic-beta: oauth-2025-04-20</code> returns <code>five_hour</code>, <code>seven_day</code>, <code>seven_day_opus</code>,\n<code>seven_day_sonnet</code>, each <code>{ utilization, resets_at }</code> with an ISO time (Claude-Code-Usage-Monitor\nissue 202). It is undocumented, answers 429 readily (anthropics/claude-code issue 30930), and\nClaude Code&#39;s own <code>/usage</code> falls back to last-known values when it does\n(<a href=\"https://code.claude.com/docs/en/costs\" target=\"_blank\" rel=\"noreferrer\">https://code.claude.com/docs/en/costs</a>). The Keychain service name, and its suffix for a\nnon-default config directory, are read from the binary. Whether macOS prompts when a launchd job\nreads the Keychain item is not known. Hence the probe is <strong>off by default</strong>.</p>\n","words":842},{"path":"references/how-it-decides.md","slug":"how-it-decides","title":"How resume-after-limit decides","body":"# How resume-after-limit decides\n\nThe rules live in [`scripts/decide.mjs`](../scripts/decide.mjs) as pure functions; the tick in\n[`scripts/resume.mjs`](../scripts/resume.mjs) feeds them what it read. Each rule below names the\nreason string that `status` and `events.jsonl` show when it applies.\n\n## One tick\n\n1. **Gate.** Mode `off`: exit. Less than the interval since the last tick: exit. Another tick holds\n   the lock: exit. Nothing is read before this.\n2. **Find.** For each config directory, list the main transcripts\n   (`projects/<project>/<session>.jsonl`, never `subagents/`) modified within the window plus the\n   late grace and one interval. Read the last 64 KiB of each (up to 1 MiB if no entry is in it)\n   and take the last main-chain `user` or `assistant` entry.\n3. **Fold.** A limit seen for the first time is a new record, `parked`. The same entry again changes\n   nothing. A new limit after a delivery is a bounce: back to `parked`, attempt kept, and the other\n   sessions on the account are held until the new reset. Limit wording with no recorded reset is\n   `unparsed` and never acted on.\n4. **Follow up.** A waiting record whose session has a newer entry is `superseded`: someone, or\n   Claude Code's own wait, continued it. A delivered record whose session has a newer entry is\n   `confirmed`; with nothing newer after two intervals it is `failed` (`no-activity-after-delivery`).\n   A record left `delivering` by a tick that died is `failed` (`interrupted-delivery`) and never\n   sent again.\n5. **Probe** (only when on): once per period per config directory with a record waiting, sooner\n   (every five minutes at most) when the account changed or a limit is newer than the last probe.\n6. **Decide** each parked record, and check each record already due again (below).\n7. **Act** on due records, oldest limit first, at most `batchPerAccount` per account per tick, for at\n   most four minutes; whatever is left stays due for the next tick.\n8. **Store** every record; delete finished ones after a week; write `tick.json`.\n\n## The rules for a waiting record\n\nIn order; the first that applies wins. The late grace in effect is `lateGraceMinutes` (30) or the\ninterval plus five minutes, whichever is longer, so a long interval does not expire limits a tick\nsimply had not reached yet.\n\n| Rule | Result | Reason |\n|---|---|---|\n| it used `maxAttempts` (2) | failed | `out-of-attempts` |\n| more than the window plus the late grace since the limit | expired | `dormant` |\n| quota not known to be back | stays parked | — |\n| quota came back more than the window after the limit | expired | `reset-beyond-window` |\n| this tick is more than the late grace after quota came back | expired | `checked-too-late` |\n| the mode does not cover the session | stays parked | — |\n| otherwise | due | — |\n\nA record already due is checked again every tick: a hold that appeared sends it back to parked\n(`held`), the mode no longer covering it does too (`no-longer-covered`), and a gap longer than the\ngrace since the tick that last found it due — a machine that slept — expires it (`checked-too-late`).\n\nWhile a hold from a sibling's bounce is in force on the account the session would run under now —\nits own, or the one its config directory switched to — quota is not back, whatever else says so,\nand it is never said to be back earlier than that hold. Otherwise it is known to be back at the\nearliest of:\n\n- the recorded reset, or a later hold from a sibling's bounce, once two minutes have passed;\n- the time a probe of the config directory's current account, taken after the limit was hit, showed\n  the limited window under 100%;\n- the time the tick first saw the account change, when the probe is off.\n\n## Acting on a due record\n\n| The session | Channel | Effect |\n|---|---|---|\n| not covered any more | — | back to parked (`no-longer-covered`) |\n| live and busy | — | `superseded` (`already-busy`) |\n| live, neither idle nor busy | — | left due for the next tick |\n| live and idle | inbox | the prompt on its socket, authenticated with its `peerToken` |\n| not live | background | `claude --bg --resume <id> \"<prompt>\"` in its recorded directory and config directory |\n| observe mode | — | `observed` (`would-resume-via-<channel>`), nothing sent |\n\nThe record is saved as `delivering` before anything is sent, then `delivered` or `failed`. A\nnotification follows each resume and each failure when `notify` is on.\n\n## The state directory\n\n`~/.claude/resume-after-limit/`, or `RESUME_AFTER_LIMIT_HOME`:\n\n| File | Holds |\n|---|---|\n| `config.json` | mode, interval, window, late grace, observe, probe, batch, stagger, attempts, notify, config directories, prompt, recorded paths |\n| `sessions.json` | watched and excluded session ids |\n| `parked/<session>.json` | one record per limited session, with its last 20 state changes |\n| `accounts.json` | the last probe per config directory and account, and holds from bounces |\n| `tick.json` | the last tick's start, end, outcome and counts |\n| `events.jsonl` | one line per decision, rotated once at 1 MiB |\n| `lock` | the running tick's pid; taken over when that pid is gone, or after an hour |\n| `scheduler.log` | what the scheduler's runs printed |\n\nNothing in it is a credential: the probe reads the token for its one request and keeps nothing.\n","bodyHtml":"<h2 id=\"how-resume-after-limit-decides\">How resume-after-limit decides</h2>\n<p>The rules live in <a href=\"../scripts/decide.mjs\"><code>scripts/decide.mjs</code></a> as pure functions; the tick in\n<a href=\"../scripts/resume.mjs\"><code>scripts/resume.mjs</code></a> feeds them what it read. Each rule below names the\nreason string that <code>status</code> and <code>events.jsonl</code> show when it applies.</p>\n<h3 id=\"one-tick\">One tick</h3>\n<ol>\n<li><strong>Gate.</strong> Mode <code>off</code>: exit. Less than the interval since the last tick: exit. Another tick holds\nthe lock: exit. Nothing is read before this.</li>\n<li><strong>Find.</strong> For each config directory, list the main transcripts\n(<code>projects/&lt;project&gt;/&lt;session&gt;.jsonl</code>, never <code>subagents/</code>) modified within the window plus the\nlate grace and one interval. Read the last 64 KiB of each (up to 1 MiB if no entry is in it)\nand take the last main-chain <code>user</code> or <code>assistant</code> entry.</li>\n<li><strong>Fold.</strong> A limit seen for the first time is a new record, <code>parked</code>. The same entry again changes\nnothing. A new limit after a delivery is a bounce: back to <code>parked</code>, attempt kept, and the other\nsessions on the account are held until the new reset. Limit wording with no recorded reset is\n<code>unparsed</code> and never acted on.</li>\n<li><strong>Follow up.</strong> A waiting record whose session has a newer entry is <code>superseded</code>: someone, or\nClaude Code&#39;s own wait, continued it. A delivered record whose session has a newer entry is\n<code>confirmed</code>; with nothing newer after two intervals it is <code>failed</code> (<code>no-activity-after-delivery</code>).\nA record left <code>delivering</code> by a tick that died is <code>failed</code> (<code>interrupted-delivery</code>) and never\nsent again.</li>\n<li><strong>Probe</strong> (only when on): once per period per config directory with a record waiting, sooner\n(every five minutes at most) when the account changed or a limit is newer than the last probe.</li>\n<li><strong>Decide</strong> each parked record, and check each record already due again (below).</li>\n<li><strong>Act</strong> on due records, oldest limit first, at most <code>batchPerAccount</code> per account per tick, for at\nmost four minutes; whatever is left stays due for the next tick.</li>\n<li><strong>Store</strong> every record; delete finished ones after a week; write <code>tick.json</code>.</li>\n</ol>\n<h3 id=\"the-rules-for-a-waiting-record\">The rules for a waiting record</h3>\n<p>In order; the first that applies wins. The late grace in effect is <code>lateGraceMinutes</code> (30) or the\ninterval plus five minutes, whichever is longer, so a long interval does not expire limits a tick\nsimply had not reached yet.</p>\n<table>\n<thead>\n<tr>\n<th>Rule</th>\n<th>Result</th>\n<th>Reason</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>it used <code>maxAttempts</code> (2)</td>\n<td>failed</td>\n<td><code>out-of-attempts</code></td>\n</tr>\n<tr>\n<td>more than the window plus the late grace since the limit</td>\n<td>expired</td>\n<td><code>dormant</code></td>\n</tr>\n<tr>\n<td>quota not known to be back</td>\n<td>stays parked</td>\n<td>—</td>\n</tr>\n<tr>\n<td>quota came back more than the window after the limit</td>\n<td>expired</td>\n<td><code>reset-beyond-window</code></td>\n</tr>\n<tr>\n<td>this tick is more than the late grace after quota came back</td>\n<td>expired</td>\n<td><code>checked-too-late</code></td>\n</tr>\n<tr>\n<td>the mode does not cover the session</td>\n<td>stays parked</td>\n<td>—</td>\n</tr>\n<tr>\n<td>otherwise</td>\n<td>due</td>\n<td>—</td>\n</tr>\n</tbody></table>\n<p>A record already due is checked again every tick: a hold that appeared sends it back to parked\n(<code>held</code>), the mode no longer covering it does too (<code>no-longer-covered</code>), and a gap longer than the\ngrace since the tick that last found it due — a machine that slept — expires it (<code>checked-too-late</code>).</p>\n<p>While a hold from a sibling&#39;s bounce is in force on the account the session would run under now —\nits own, or the one its config directory switched to — quota is not back, whatever else says so,\nand it is never said to be back earlier than that hold. Otherwise it is known to be back at the\nearliest of:</p>\n<ul>\n<li>the recorded reset, or a later hold from a sibling&#39;s bounce, once two minutes have passed;</li>\n<li>the time a probe of the config directory&#39;s current account, taken after the limit was hit, showed\nthe limited window under 100%;</li>\n<li>the time the tick first saw the account change, when the probe is off.</li>\n</ul>\n<h3 id=\"acting-on-a-due-record\">Acting on a due record</h3>\n<table>\n<thead>\n<tr>\n<th>The session</th>\n<th>Channel</th>\n<th>Effect</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>not covered any more</td>\n<td>—</td>\n<td>back to parked (<code>no-longer-covered</code>)</td>\n</tr>\n<tr>\n<td>live and busy</td>\n<td>—</td>\n<td><code>superseded</code> (<code>already-busy</code>)</td>\n</tr>\n<tr>\n<td>live, neither idle nor busy</td>\n<td>—</td>\n<td>left due for the next tick</td>\n</tr>\n<tr>\n<td>live and idle</td>\n<td>inbox</td>\n<td>the prompt on its socket, authenticated with its <code>peerToken</code></td>\n</tr>\n<tr>\n<td>not live</td>\n<td>background</td>\n<td><code>claude --bg --resume &lt;id&gt; &quot;&lt;prompt&gt;&quot;</code> in its recorded directory and config directory</td>\n</tr>\n<tr>\n<td>observe mode</td>\n<td>—</td>\n<td><code>observed</code> (<code>would-resume-via-&lt;channel&gt;</code>), nothing sent</td>\n</tr>\n</tbody></table>\n<p>The record is saved as <code>delivering</code> before anything is sent, then <code>delivered</code> or <code>failed</code>. A\nnotification follows each resume and each failure when <code>notify</code> is on.</p>\n<h3 id=\"the-state-directory\">The state directory</h3>\n<p><code>~/.claude/resume-after-limit/</code>, or <code>RESUME_AFTER_LIMIT_HOME</code>:</p>\n<table>\n<thead>\n<tr>\n<th>File</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>config.json</code></td>\n<td>mode, interval, window, late grace, observe, probe, batch, stagger, attempts, notify, config directories, prompt, recorded paths</td>\n</tr>\n<tr>\n<td><code>sessions.json</code></td>\n<td>watched and excluded session ids</td>\n</tr>\n<tr>\n<td><code>parked/&lt;session&gt;.json</code></td>\n<td>one record per limited session, with its last 20 state changes</td>\n</tr>\n<tr>\n<td><code>accounts.json</code></td>\n<td>the last probe per config directory and account, and holds from bounces</td>\n</tr>\n<tr>\n<td><code>tick.json</code></td>\n<td>the last tick&#39;s start, end, outcome and counts</td>\n</tr>\n<tr>\n<td><code>events.jsonl</code></td>\n<td>one line per decision, rotated once at 1 MiB</td>\n</tr>\n<tr>\n<td><code>lock</code></td>\n<td>the running tick&#39;s pid; taken over when that pid is gone, or after an hour</td>\n</tr>\n<tr>\n<td><code>scheduler.log</code></td>\n<td>what the scheduler&#39;s runs printed</td>\n</tr>\n</tbody></table>\n<p>Nothing in it is a credential: the probe reads the token for its one request and keeps nothing.</p>\n","words":909}],"body":"# Resume after limit\n\nA session on a Claude subscription that reaches its five-hour or weekly limit ends its turn with a\nsynthetic message — \"You've hit your session limit · resets 2pm\" — and then waits for a person.\nClaude Code's own wait for the reset covers interactive terminal sessions only, and not after the\nsession exits, not past two re-arms, and not when the reset is a day away. Sessions in the VS Code\nextension, background sessions and `-p` runs sit stopped until someone types \"continue\".\n\nThis skill is the someone. A tick, run every five minutes by a scheduler the user installs, reads\nthe end of each recent transcript. A session whose last entry is a usage limit is parked with the\nreset time the transcript recorded. When the reset passes, and only if it passed within the\ndormancy window of the limit, the tick puts a continue prompt in front of the session. Checking\nreads files and costs no tokens; the resumed turn is the only thing that does.\n\n## When to Use\n\n- The user wants stopped sessions to continue on their own after a usage limit resets.\n- The user asks whether auto-resume is on, which sessions are waiting, or what it did lately.\n- The user wants it for this session only, for every session, or off; or a different interval or\n  dormancy window.\n\nNot for:\n\n- Resuming after days. A weekly limit that resets days later is outside the window and stays\n  stopped, unless the account changed and quota is there now.\n- Answering permission prompts or changing a session's permissions. A resumed session runs under\n  its own settings; a session that bypasses permissions holds the message (Pitfalls).\n- Telling a person what a long run is doing (`report-progress`), showing what child agents are doing\n  (`agent-lifecycle`), or handing work to another session (`handoff-prompt`).\n- Codex, Windows, Claude Code on the web or in Conductor's cloud, and API-key billing, which has no\n  usage limits.\n\n## Prerequisites\n\n- Node 22 or newer, and the `claude` CLI, on macOS or Linux.\n- The scheduler, installed by the user themselves (step 1). This skill never installs it.\n\n**Complete when:** `node <skill-folder>/scripts/resume.mjs status` prints a `scheduler:` line that\nsays installed.\n\n## Procedure\n\nEvery command is `node <skill-folder>/scripts/resume.mjs <command>`. Run it, then tell the user what\nit printed in a sentence or two; `status` can be shown as printed.\n\n1. **Arm the scheduler — the user does this.** If `status` says the scheduler is not installed, give\n   the user the command and stop. Do not run it for them: the tick it schedules speaks into their\n   sessions, and arming that is their decision.\n\n   ```bash\n   node <skill-folder>/scripts/install-scheduler.mjs --install\n   ```\n\n   It writes a launchd agent on macOS (a systemd user timer or a marked crontab line on Linux),\n   records where `node` and `claude` are, and leaves the watcher **off and in observe mode**. It\n   prints its limits; `--remove` takes out exactly what it wrote.\n\n   **Complete when:** `status` says `scheduler: installed (…)`.\n\n2. **Turn it on, for every session or only watched ones.** `on all`, or `on selected` followed by\n   `watch` in each session to cover. `watch` with no id covers the session the command runs in\n   (from `CLAUDE_CODE_SESSION_ID`). In `all` mode, `unwatch` excludes a session.\n\n   **Complete when:** `status` shows the mode asked for, and `this session …: covered` when the\n   user asked for this session.\n\n3. **Leave observe mode only after it has seen a real limit.** A fresh install logs what it *would*\n   do — `would-resume` lines in `events.jsonl` and `observed` rows in `status` — and resumes\n   nothing. Once the user has seen a correct `observed` row for a real limit, `observe off` makes\n   it act. Say plainly which of the two it is in whenever you report status.\n\n   **Complete when:** the user chose, and `status` says so.\n\n4. **Change the cadence or the window when asked.** `interval 15m` (5 to 60, steps of 5; the\n   scheduler fires every 5 minutes and the tick skips until the interval has passed, so nothing is\n   reinstalled). `dormancy 3h` (1 to 24, default 5). Say what the new window means: a session\n   whose quota returns later than that after its limit is never resumed.\n\n   **Complete when:** `status` shows the new values.\n\n5. **Report status when asked.** `status` (or `status --json`) gives the mode, observe flag,\n   interval, window, probe, scheduler, the last tick's age and outcome, whether this session is\n   covered, the sessions waiting with their limit and reset times, and what finished lately and\n   why. A last tick older than twice the interval means the scheduler is not running: say so.\n\n   **Complete when:** the user has the answer to what they asked, including any stale tick.\n\n6. **Turn it off when asked.** `off` stops every tick from acting at once. Removing the scheduler is\n   the user's `install-scheduler.mjs --remove`, which also turns it off.\n\n   **Complete when:** `status` says `mode: off`.\n\n### What a tick decides\n\nA session is resumed only when all of these hold ([how it decides](references/how-it-decides.md)):\n\n- its transcript's last main-chain entry is a usage limit with a recorded reset (`quotaLimits`,\n  status `rejected`) — limit wording without one is recorded as `unparsed` and never acted on;\n- the mode covers it;\n- quota is back: the reset passed (plus two minutes, so Claude Code's own wait goes first), or the\n  account changed, or the optional usage probe shows the window open;\n- quota came back within the dormancy window of the limit, and this tick is no more than 30 minutes\n  (or one interval plus five, if longer) late — so a laptop that slept through a reset does not wake hours later and resume stale work;\n- nothing newer happened in the session, and it has not used its two attempts.\n\nA live idle session gets the prompt on its inbox socket; a live busy one is left alone; an exited\none is resumed with `claude --bg --resume <id> \"<prompt>\"` in its own directory. At most three per\naccount per tick, oldest limit first. A session that hits the limit again is re-parked once, and the\nother sessions on that account wait for the new reset.\n\n## Usage Examples\n\n```text\nTurn on auto-resume for all my sessions. If a session runs out of quota,\nit should pick up again when the limit resets.\n```\n\n```text\nOnly watch this session: resume it after the limit, but leave my other sessions alone.\n```\n\n```text\nIs auto-resume on? Which sessions are waiting, and when do they reset?\n```\n\n```bash\nnode <skill-folder>/scripts/install-scheduler.mjs --install\nnode <skill-folder>/scripts/resume.mjs on all\nnode <skill-folder>/scripts/resume.mjs watch\nnode <skill-folder>/scripts/resume.mjs interval 10m\nnode <skill-folder>/scripts/resume.mjs status\nnode <skill-folder>/scripts/resume.mjs observe off\nnode <skill-folder>/scripts/resume.mjs off\n```\n\n## What it looks like\n\n```text\nresume-after-limit\n  mode:        on, every session — observe only: logs what it would do, resumes nothing\n  checks:      every 10 min · resume only within 5 h of the limit · at most 30 min late\n  usage probe: off\n  scheduler:   installed (launchd)\n  last tick:   3 min ago (ok)\n  this session 1a2b3c4d: covered\n  waiting:\n    5e6f7a8b  parked     five_hour  hit 13:42 · resets 17:00 · web-app\n  recent:\n    9c0d1e2f  observed   would-resume-via-inbox · 2 h ago · api\n    3a4b5c6d  expired    dormant · 1 h ago · docs\n```\n\n## Pitfalls\n\n- **Running the installer for the user.** It arms something that speaks into every covered\n  session. Give them the command; they run it.\n- **Calling it on while it is in observe mode.** Observe mode resumes nothing. Every status report\n  says which mode it is in.\n- **A session that bypasses permissions.** Claude Code holds an inbox message from outside the\n  session when the receiving session bypasses permission prompts, and the VS Code extension drops a\n  held message after five minutes. The tick reports it delivered; the session never sees it. Such a\n  session is resumed only once it has exited.\n- **Treating `error: \"rate_limit\"` as a usage limit.** Temporary server throttling carries the same\n  error. Only a rejected `quotaLimits` (or the older epoch format) counts.\n- **Trusting the reset clock time in the message text.** \"resets 2pm\" is local time with no date.\n  The tick uses the epoch the transcript records, and never acts on the text alone.\n- **Expecting it to work while the machine sleeps.** Nothing runs then. On wake, a reset more than\n  30 minutes past is not resumed.\n- **Turning the usage probe on casually.** The endpoint is undocumented and answers 429 readily, and\n  on macOS reading the token from the Keychain may prompt. It is off by default; the transcript's\n  reset time is enough for five-hour limits.\n\n## Verification\n\n- [ ] The scheduler was installed by the user, and `status` says installed.\n- [ ] `status` shows the mode the user asked for and whether it is observe-only.\n- [ ] A covered session shows as covered; an excluded or unwatched one does not.\n- [ ] The last tick is younger than twice the interval.\n- [ ] Before `observe off`, the user saw an `observed` row for a real limit with the right channel.\n\n## Deeper reading\n\n- [How it decides](references/how-it-decides.md) — the record states, the rules, the state files.\n- [Evidence](references/evidence.md) — what was observed, what is documented, what is not yet seen.\n- [scripts/resume.mjs](scripts/resume.mjs) and [scripts/install-scheduler.mjs](scripts/install-scheduler.mjs).\n","bodyHtml":"<h2 id=\"resume-after-limit\">Resume after limit</h2>\n<p>A session on a Claude subscription that reaches its five-hour or weekly limit ends its turn with a\nsynthetic message — &quot;You&#39;ve hit your session limit · resets 2pm&quot; — and then waits for a person.\nClaude Code&#39;s own wait for the reset covers interactive terminal sessions only, and not after the\nsession exits, not past two re-arms, and not when the reset is a day away. Sessions in the VS Code\nextension, background sessions and <code>-p</code> runs sit stopped until someone types &quot;continue&quot;.</p>\n<p>This skill is the someone. A tick, run every five minutes by a scheduler the user installs, reads\nthe end of each recent transcript. A session whose last entry is a usage limit is parked with the\nreset time the transcript recorded. When the reset passes, and only if it passed within the\ndormancy window of the limit, the tick puts a continue prompt in front of the session. Checking\nreads files and costs no tokens; the resumed turn is the only thing that does.</p>\n<h3 id=\"when-to-use\">When to Use</h3>\n<ul>\n<li>The user wants stopped sessions to continue on their own after a usage limit resets.</li>\n<li>The user asks whether auto-resume is on, which sessions are waiting, or what it did lately.</li>\n<li>The user wants it for this session only, for every session, or off; or a different interval or\ndormancy window.</li>\n</ul>\n<p>Not for:</p>\n<ul>\n<li>Resuming after days. A weekly limit that resets days later is outside the window and stays\nstopped, unless the account changed and quota is there now.</li>\n<li>Answering permission prompts or changing a session&#39;s permissions. A resumed session runs under\nits own settings; a session that bypasses permissions holds the message (Pitfalls).</li>\n<li>Telling a person what a long run is doing (<code>report-progress</code>), showing what child agents are doing\n(<code>agent-lifecycle</code>), or handing work to another session (<code>handoff-prompt</code>).</li>\n<li>Codex, Windows, Claude Code on the web or in Conductor&#39;s cloud, and API-key billing, which has no\nusage limits.</li>\n</ul>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<ul>\n<li>Node 22 or newer, and the <code>claude</code> CLI, on macOS or Linux.</li>\n<li>The scheduler, installed by the user themselves (step 1). This skill never installs it.</li>\n</ul>\n<p><strong>Complete when:</strong> <code>node &lt;skill-folder&gt;/scripts/resume.mjs status</code> prints a <code>scheduler:</code> line that\nsays installed.</p>\n<h3 id=\"procedure\">Procedure</h3>\n<p>Every command is <code>node &lt;skill-folder&gt;/scripts/resume.mjs &lt;command&gt;</code>. Run it, then tell the user what\nit printed in a sentence or two; <code>status</code> can be shown as printed.</p>\n<ol>\n<li><p><strong>Arm the scheduler — the user does this.</strong> If <code>status</code> says the scheduler is not installed, give\nthe user the command and stop. Do not run it for them: the tick it schedules speaks into their\nsessions, and arming that is their decision.</p>\n<pre><code class=\"language-bash\">node &lt;skill-folder&gt;/scripts/install-scheduler.mjs --install\n</code></pre>\n<p>It writes a launchd agent on macOS (a systemd user timer or a marked crontab line on Linux),\nrecords where <code>node</code> and <code>claude</code> are, and leaves the watcher <strong>off and in observe mode</strong>. It\nprints its limits; <code>--remove</code> takes out exactly what it wrote.</p>\n<p><strong>Complete when:</strong> <code>status</code> says <code>scheduler: installed (…)</code>.</p>\n</li>\n<li><p><strong>Turn it on, for every session or only watched ones.</strong> <code>on all</code>, or <code>on selected</code> followed by\n<code>watch</code> in each session to cover. <code>watch</code> with no id covers the session the command runs in\n(from <code>CLAUDE_CODE_SESSION_ID</code>). In <code>all</code> mode, <code>unwatch</code> excludes a session.</p>\n<p><strong>Complete when:</strong> <code>status</code> shows the mode asked for, and <code>this session …: covered</code> when the\nuser asked for this session.</p>\n</li>\n<li><p><strong>Leave observe mode only after it has seen a real limit.</strong> A fresh install logs what it <em>would</em>\ndo — <code>would-resume</code> lines in <code>events.jsonl</code> and <code>observed</code> rows in <code>status</code> — and resumes\nnothing. Once the user has seen a correct <code>observed</code> row for a real limit, <code>observe off</code> makes\nit act. Say plainly which of the two it is in whenever you report status.</p>\n<p><strong>Complete when:</strong> the user chose, and <code>status</code> says so.</p>\n</li>\n<li><p><strong>Change the cadence or the window when asked.</strong> <code>interval 15m</code> (5 to 60, steps of 5; the\nscheduler fires every 5 minutes and the tick skips until the interval has passed, so nothing is\nreinstalled). <code>dormancy 3h</code> (1 to 24, default 5). Say what the new window means: a session\nwhose quota returns later than that after its limit is never resumed.</p>\n<p><strong>Complete when:</strong> <code>status</code> shows the new values.</p>\n</li>\n<li><p><strong>Report status when asked.</strong> <code>status</code> (or <code>status --json</code>) gives the mode, observe flag,\ninterval, window, probe, scheduler, the last tick&#39;s age and outcome, whether this session is\ncovered, the sessions waiting with their limit and reset times, and what finished lately and\nwhy. A last tick older than twice the interval means the scheduler is not running: say so.</p>\n<p><strong>Complete when:</strong> the user has the answer to what they asked, including any stale tick.</p>\n</li>\n<li><p><strong>Turn it off when asked.</strong> <code>off</code> stops every tick from acting at once. Removing the scheduler is\nthe user&#39;s <code>install-scheduler.mjs --remove</code>, which also turns it off.</p>\n<p><strong>Complete when:</strong> <code>status</code> says <code>mode: off</code>.</p>\n</li>\n</ol>\n<h4 id=\"what-a-tick-decides\">What a tick decides</h4>\n<p>A session is resumed only when all of these hold (<a href=\"references/how-it-decides.md\">how it decides</a>):</p>\n<ul>\n<li>its transcript&#39;s last main-chain entry is a usage limit with a recorded reset (<code>quotaLimits</code>,\nstatus <code>rejected</code>) — limit wording without one is recorded as <code>unparsed</code> and never acted on;</li>\n<li>the mode covers it;</li>\n<li>quota is back: the reset passed (plus two minutes, so Claude Code&#39;s own wait goes first), or the\naccount changed, or the optional usage probe shows the window open;</li>\n<li>quota came back within the dormancy window of the limit, and this tick is no more than 30 minutes\n(or one interval plus five, if longer) late — so a laptop that slept through a reset does not wake hours later and resume stale work;</li>\n<li>nothing newer happened in the session, and it has not used its two attempts.</li>\n</ul>\n<p>A live idle session gets the prompt on its inbox socket; a live busy one is left alone; an exited\none is resumed with <code>claude --bg --resume &lt;id&gt; &quot;&lt;prompt&gt;&quot;</code> in its own directory. At most three per\naccount per tick, oldest limit first. A session that hits the limit again is re-parked once, and the\nother sessions on that account wait for the new reset.</p>\n<h3 id=\"usage-examples\">Usage Examples</h3>\n<pre><code class=\"language-text\">Turn on auto-resume for all my sessions. If a session runs out of quota,\nit should pick up again when the limit resets.\n</code></pre>\n<pre><code class=\"language-text\">Only watch this session: resume it after the limit, but leave my other sessions alone.\n</code></pre>\n<pre><code class=\"language-text\">Is auto-resume on? Which sessions are waiting, and when do they reset?\n</code></pre>\n<pre><code class=\"language-bash\">node &lt;skill-folder&gt;/scripts/install-scheduler.mjs --install\nnode &lt;skill-folder&gt;/scripts/resume.mjs on all\nnode &lt;skill-folder&gt;/scripts/resume.mjs watch\nnode &lt;skill-folder&gt;/scripts/resume.mjs interval 10m\nnode &lt;skill-folder&gt;/scripts/resume.mjs status\nnode &lt;skill-folder&gt;/scripts/resume.mjs observe off\nnode &lt;skill-folder&gt;/scripts/resume.mjs off\n</code></pre>\n<h3 id=\"what-it-looks-like\">What it looks like</h3>\n<pre><code class=\"language-text\">resume-after-limit\n  mode:        on, every session — observe only: logs what it would do, resumes nothing\n  checks:      every 10 min · resume only within 5 h of the limit · at most 30 min late\n  usage probe: off\n  scheduler:   installed (launchd)\n  last tick:   3 min ago (ok)\n  this session 1a2b3c4d: covered\n  waiting:\n    5e6f7a8b  parked     five_hour  hit 13:42 · resets 17:00 · web-app\n  recent:\n    9c0d1e2f  observed   would-resume-via-inbox · 2 h ago · api\n    3a4b5c6d  expired    dormant · 1 h ago · docs\n</code></pre>\n<h3 id=\"pitfalls\">Pitfalls</h3>\n<ul>\n<li><strong>Running the installer for the user.</strong> It arms something that speaks into every covered\nsession. Give them the command; they run it.</li>\n<li><strong>Calling it on while it is in observe mode.</strong> Observe mode resumes nothing. Every status report\nsays which mode it is in.</li>\n<li><strong>A session that bypasses permissions.</strong> Claude Code holds an inbox message from outside the\nsession when the receiving session bypasses permission prompts, and the VS Code extension drops a\nheld message after five minutes. The tick reports it delivered; the session never sees it. Such a\nsession is resumed only once it has exited.</li>\n<li><strong>Treating <code>error: &quot;rate_limit&quot;</code> as a usage limit.</strong> Temporary server throttling carries the same\nerror. Only a rejected <code>quotaLimits</code> (or the older epoch format) counts.</li>\n<li><strong>Trusting the reset clock time in the message text.</strong> &quot;resets 2pm&quot; is local time with no date.\nThe tick uses the epoch the transcript records, and never acts on the text alone.</li>\n<li><strong>Expecting it to work while the machine sleeps.</strong> Nothing runs then. On wake, a reset more than\n30 minutes past is not resumed.</li>\n<li><strong>Turning the usage probe on casually.</strong> The endpoint is undocumented and answers 429 readily, and\non macOS reading the token from the Keychain may prompt. It is off by default; the transcript&#39;s\nreset time is enough for five-hour limits.</li>\n</ul>\n<h3 id=\"verification\">Verification</h3>\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> The scheduler was installed by the user, and <code>status</code> says installed.</li>\n<li><input disabled=\"\" type=\"checkbox\"> <code>status</code> shows the mode the user asked for and whether it is observe-only.</li>\n<li><input disabled=\"\" type=\"checkbox\"> A covered session shows as covered; an excluded or unwatched one does not.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The last tick is younger than twice the interval.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Before <code>observe off</code>, the user saw an <code>observed</code> row for a real limit with the right channel.</li>\n</ul>\n<h3 id=\"deeper-reading\">Deeper reading</h3>\n<ul>\n<li><a href=\"references/how-it-decides.md\">How it decides</a> — the record states, the rules, the state files.</li>\n<li><a href=\"references/evidence.md\">Evidence</a> — what was observed, what is documented, what is not yet seen.</li>\n<li><a href=\"scripts/resume.mjs\">scripts/resume.mjs</a> and <a href=\"scripts/install-scheduler.mjs\">scripts/install-scheduler.mjs</a>.</li>\n</ul>\n","outline":["When to Use","Prerequisites","Procedure","Usage Examples","What it looks like","Pitfalls","Verification","Deeper reading"],"words":1537}
