Skip to content

Commit 6999696

Browse files
committed
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)
1 parent cb09a4d commit 6999696

23 files changed

Lines changed: 7140 additions & 29 deletions

packages/core/src/accounts.ts

Lines changed: 230 additions & 11 deletions
Large diffs are not rendered by default.

packages/core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export * from './logger.ts'
1414
export * from './logging.ts'
1515
export * from './models.ts'
1616
export * from './pkce.ts'
17+
export * from './prime.ts'
1718
export * from './provider.ts'
1819
export * from './quota-manager.ts'
1920
export * from './quotas.ts'

packages/core/src/models.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
export const CLAUDE_FABLE_5_MODEL_ID = 'claude-fable-5'
22
export const CLAUDE_MYTHOS_5_MODEL_ID = 'claude-mythos-5'
33

4+
/**
5+
* Haiku 4.5 model identifier used by `/claude-prime` to start each OAuth
6+
* account's five-hour quota window with a minimal request (~20 input + 1
7+
* output tokens). Kept distinct from the Fable/Mythos pricing block above so
8+
* per-million-token cost estimation for prime does not conflate families.
9+
*/
10+
export const CLAUDE_HAIKU_4_5_MODEL_ID = 'claude-haiku-4-5'
11+
12+
/**
13+
* Per-million-token USD pricing for Haiku 4.5. Used to project the cumulative
14+
* cost of prime requests from persisted usage counters — never persisted on
15+
* disk; derive at display time so future pricing revisions land in one place.
16+
*/
17+
export const CLAUDE_HAIKU_4_5_PRICING = {
18+
input: 1,
19+
output: 5,
20+
} as const
21+
422
export const CLAUDE_FABLE_MYTHOS_5_MODEL_IDS = [
523
CLAUDE_FABLE_5_MODEL_ID,
624
CLAUDE_MYTHOS_5_MODEL_ID,

0 commit comments

Comments
 (0)