Skip to content

v0.2.0 — Context Explosion Prevention

Latest

Choose a tag to compare

@Asher-2000 Asher-2000 released this 19 Aug 10:27

🛡️ Context Explosion Prevention

New Features

  • TokenCounter — Token estimation for English, Chinese, and mixed text
  • Smart Prioritization — Memory ranking by relevance × recency × frequency
  • Budget Management — Configurable maxContextTokens limit (default: 4000)
  • Memory Compression — Auto-truncation when approaching token limits

Configuration

maxContextTokens: 4000      # Max tokens for memory injection
reservedTokens: 8000        # Tokens reserved for other context
smartPrioritization: true   # Enable smart prioritization
enableCompression: true     # Enable compression

Improvements

  • Updated README with context explosion prevention docs
  • Added context budget tests
  • Improved memory selection algorithm

🛡️ 上下文爆炸防护

新功能

  • Token 计数器 — 支持中英文混合 token 估算
  • 智能优先级 — 基于相关性 × 时间 × 频率的记忆排序
  • 预算管理 — 可配置 maxContextTokens 限制(默认 4000)
  • 记忆压缩 — 接近限制时自动截断

配置

maxContextTokens: 4000      # 记忆注入的最大 token 数
reservedTokens: 8000        # 为其他上下文预留的 token
smartPrioritization: true   # 启用智能优先级
enableCompression: true     # 启用记忆压缩