e3186ede5d
Implements critical safeguards for OpenRouter integration: - Context truncation: sliding window keeps max 20 messages (configurable) - Token limits: hard cap at 100k estimated tokens per request - Cost tracking: logs token usage and estimated cost per API call - High-usage warnings: alerts when single request exceeds 50k tokens New settings: - CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES (default: 20) - CLAUDE_MEM_OPENROUTER_MAX_TOKENS (default: 100000) Prevents exponential context growth that caused $300 runaway charges in initial testing. Context now automatically truncates to most recent messages within token budget, with detailed logging for monitoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>