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
3-Tier Daily Token Budget Guard & Web Console Meter (每日 Token 预算与熔断护栏)
3-Tier Guard (daily_token_budget.py): Real-time daily tracking from llm_requests against configurable warn_tokens (8M) / downgrade_tokens (15M) / hard_cap_tokens (25M) thresholds with bypass_date daily override and GET /v1/default/daily-token-budget.
Non-Disruptive Backpressure: Background tasks defer cleanly via DeferOperation (memory_engine.py) and budget_paused (retention_worker.py) without losing local queue items; foreground recall / research stay 100% available.
Web Console UI: Live usage bar, status badge, threshold inputs (in 万 tokens), downgrade strategy selector, and one-click daily bypass in runtime-sections-view.tsx.
Dual Downgrade Modes & Local 4B Offload
Two Selectable Downgrade Strategies:
eco_same_model (default): keeps your Primary + Fallback chain intact, defers refresh_mental_model, doubles retain_chunk_size (up to 12,000), caps retain (2048) and consolidation (1536) output tokens, halves consolidation source_facts budget, and doubles local queue batch threshold.
local_4b: routes background retain and consolidation to local Ollama 4B (qwen3:4b) for zero cloud token cost.
Always-On Local 4B Dedup: Automatically routes short consolidation_dedup checks to local Ollama 4B (_local_4b_llm_config) when configured.
Root-Cause Token Burn Fixes
consolidator.py: Downgrades context-only and out-of-batch updates to creates instead of rejecting and retrying entire 40K–60K token batches.
retain/fact_extraction.py: Packs is_source_message turns by actual message content length rather than the ~1.3 KB source_record provenance envelope, eliminating 1-turn micro-chunk inflation while staying 100% idempotent.
hook_bridge_desktop.py & retention_queue.py: Skips <task-notification> XML noise and adds 24h persistent pure-content deduplication (recent_content_hashes) across transcript revisions.