feat: add auto trigger CD on quota reset#143
Conversation
Add a decoupled CD scheduler that automatically sends a minimal message to start the cooldown timer when quota windows reset. This avoids the need to wait for a user message to begin the countdown. - Add CdScheduler as an independent background task (60s polling) - Use usage API to detect expired quota windows (session, weekly, sonnet, opus) - Add trigger_cd() method to ClaudeCodeState (haiku, max_tokens=1) - Add auto_trigger_cd config toggle with frontend UI support - Zero modifications to cookie_actor.rs
|
You don't understand.... You could ask /usage to api.anthropic.com or https://claude.ai/settings/usage , then you don't need to send message to /message |
|
My implementation already uses |
you don't need to send a message to make a credential healthy! |
Summary
auto_trigger_cdconfig option that automatically sends a minimal message to Claude API when quota resets,pre-starting the 5-hour cooldown timer to reduce wait time when quota is later exhausted
window
How it works
Claude's 5h session quota timer starts from the first message sent, not when quota runs out. By sending a trigger
message right when quota resets (or when a new cookie is added), the next 5h window starts immediately — reducing
effective wait time from hours to minutes.
Changes
src/config/clewdr_config.rs: Addauto_trigger_cdboolean config field (default: false)src/services/cd_scheduler.rs: New independent background scheduler (60s polling) that detects expired quotawindows via usage API and triggers CD
src/claude_code_state/chat.rs: Addtrigger_cd()method that authenticates and sends a minimal requestsrc/router.rs: Spawn scheduler after CookieActorHandle creationsrc/services/mod.rs: Register new moduleauto_trigger_cdtoggle in Config UI with en/zh translations