sage-context-management
CommunityMaster LLM context: optimize tokens and history.
Authormajiayu000
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Sage context management provides a structured approach to controlling the LLM's context window by estimating tokens, pruning non-critical messages, and auto-compacting history to preserve important context while staying within limits.
Core Features & Use Cases
- Token estimation: accurately calculate tokens for messages, including system/user/assistant roles.
- Pruning: drop older non-system messages while retaining recent context and system prompts.
- Auto-compact: summarize long histories to fit within context budgets, with optional LLM-assisted summaries.
- Use Case: When you have extended conversations in coding sessions or planning tasks, this tool keeps the dialogue concise without losing critical information.
Quick Start
Invoke the ContextManager with provider/model configuration, then call estimate_tokens, prune, and check for compaction as needed during a session.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: sage-context-management Download link: https://github.com/majiayu000/sage/archive/main.zip#sage-context-management Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.