You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add /claude-prime — start 5h quota windows right after reset
Adds an opt-in PrimeManager that fires one minimal claude-haiku-4-5
request (~20 input tokens) about a minute after an account's 5h quota
window resets, so the window starts immediately instead of lagging
until the user's first real prompt.
- Cross-process single-fire via atomic wx marker files; markers are
namespaced per account-storage fingerprint (realpath sha256/12) so
multiple configs on one machine prime independently
- Keyed manager registry: one PrimeManager per (process x storage
fingerprint); plugin reloads adopt and rebind injected seams,
path changes stop and evict the old manager
- Self-healing bootstrap for idle accounts with no persisted resetsAt,
throttled and sentinel-guarded against cross-process amplification
- Freshness contract: prime decisions only on network-fetched quota
({ quota, fetched }), never re-stamped cache
- /claude-prime command (opencode modal + Pi display-only), sidebar
status rows, per-account usage counters in runtime state
- Killswitch-aware (model-scoped thresholds apply to the haiku probe)
| Quota sidebar widget | OpenCode TUI plugin via `tui.json`| Not available |
25
25
| Fallback accounts, quota routing, killswitch, relay, dumps, fast mode | Supported | Supported through the same shared core and Pi sidecar |
26
26
@@ -31,6 +31,7 @@ This repo is a Bun workspace monorepo with two user-facing integrations and one
31
31
-**Quota-aware routing**: skip main or fallback accounts when their 5-hour or 7-day Claude quota falls below your configured minimum.
32
32
-**Persistent Claude cache controls**: manage Anthropic 1-hour prompt caching from `/claude-cache` with explicit, automatic, or hybrid modes.
33
33
-**Cache keepalive**: use `/claude-cachekeep always` or `/claude-cachekeep HH-HH` to pre-warm hybrid cache anchors for active sessions before the 1-hour TTL expires.
34
+
-**Quota window priming**: opt in with `/claude-prime on` to start each 5-hour quota window about one minute after it resets instead of waiting for the next normal prompt.
34
35
-**Fast mode toggle**: use `/claude-fast on|off` to request Anthropic fast mode for supported Opus models.
35
36
-**Fable/Mythos reasoning visibility**: request summarized adaptive thinking for Claude Fable 5 and Mythos 5 so agents can display reasoning summaries instead of blank signed-thinking blocks.
36
37
-**Fable content-filter recovery (OpenCode)**: when Fable ends a session response with Anthropic's `refusal` content-filter reason, transparently retry with Opus 4.8 for 10 successful model responses. After each Opus response, a zero-output Fable prewarm advances the same prompt cache using the OAuth account that served the filtered Fable request. The latest Opus cache boundary is retained so a later refusal can bridge back to Opus even after more than 20 Fable content blocks; the selected OpenCode model remains Fable. The TUI sidebar shows the per-session recovery countdown and return to Fable, while OpenCode Desktop receives ignored `promptAsync` notices for both transitions.
@@ -49,7 +50,7 @@ This repo is a Bun workspace monorepo with two user-facing integrations and one
49
50
- Support fallback Claude accounts stored in a local per-agent sidecar file.
50
51
- Keep fallback OAuth tokens fresh in the background.
51
52
- Apply quota thresholds before routing to main or fallback accounts.
52
-
- Add `/claude-cache`, `/claude-cachekeep`, `/claude-fast`, `/claude-quota`, and `/claude-dump` commands.
53
+
- Add `/claude-cache`, `/claude-cachekeep`, `/claude-prime`, `/claude-fast`, `/claude-quota`, and `/claude-dump` commands.
53
54
- Optionally relay large requests through a Cloudflare Worker owned by the user.
54
55
55
56
## Install
@@ -334,6 +335,7 @@ In the OpenCode TUI, the `/claude-*` commands open interactive modal dialogs ins
334
335
-`/claude-dump` — toggle request dump capture on or off.
335
336
-`/claude-cache` — select the 1-hour cache mode (off, explicit, automatic, or hybrid).
336
337
-`/claude-cachekeep` — select `always`, enter a cache keepalive window (`HH-HH`), or turn it `off`.
338
+
-`/claude-prime` — turn quota-window priming on or off, or view its status and usage.
337
339
-`/claude-killswitch` — enable or disable the killswitch, or edit per-account `5h,1w,scoped` thresholds.
338
340
339
341
Applying a change in a modal persists it through the same configuration the slash arguments use, so the modal and the typed command (`/claude-routing fallback-first`, etc.) are equivalent. Outside the OpenCode TUI (OpenCode desktop or headless), the commands print their text summary as before; Pi is unaffected.
@@ -471,6 +473,22 @@ Request bodies, headers, and tokens remain in memory. A lease-backed file under
471
473
472
474
Pre-warm requests preserve explicit cache anchors but remove response-only fields that Anthropic rejects with `max_tokens: 0`, such as streaming, enabled thinking, structured output format, and forced/any tool choice. The feature works only while OpenCode or Pi is running and the machine is awake, and cache writes are still billed when the cache entry is no longer warm.
473
475
476
+
## Claude quota window priming
477
+
478
+
Quota-window priming is off by default. OpenCode controls it with:
479
+
480
+
```text
481
+
/claude-prime
482
+
/claude-prime on
483
+
/claude-prime off
484
+
```
485
+
486
+
When enabled, the plugin watches each OAuth account's 5-hour quota reset. About one minute after a confirmed reset, it sends one real `claude-haiku-4-5` request so the next window starts without waiting for a normal prompt. The request uses about 20 input tokens and 1 output token, approximately `$0.000025` at the pricing recorded by this package.
487
+
488
+
Scheduled fires happen only after the quota window has reset. If an idle account has no cached reset time, the plugin sends one bootstrap request to establish its first observed window. Atomic temporary-file claims ensure that multiple OpenCode processes sharing the same account config send only one request per account and reset.
489
+
490
+
Pi exposes `/claude-prime` as a status-only command. Its `on` and `off` arguments are ignored; enable or disable priming from OpenCode.
491
+
474
492
## Claude fast mode
475
493
476
494
Both OpenCode and Pi packages can persistently request Anthropic fast mode for supported Opus models:
0 commit comments