hook-preemptive-compaction
CommunityProactive context to cut token waste.
Software Engineering#ai-agent#context-management#token-cost#context-window#workflow-optimization#preemptive-compaction
Authorxuezhaojun
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Monitors context window usage and triggers preemptive compaction prompts to avoid hitting the context limit.
Core Features & Use Cases
- Monitors context window usage and prompts preemptive compaction to prevent token-waste emergencies.
- Periodically injects a short reminder message (~50 tokens) suggesting the user run /compact.
- Configurable threshold (default 0.7) and optional prompt to customize the reminder.
Quick Start
Configure the hook with your preferred threshold and optional prompt, then enable it in your harness.
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: hook-preemptive-compaction Download link: https://github.com/xuezhaojun/oh-your-opencode/archive/main.zip#hook-preemptive-compaction 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 471,000+ vetted skills library on demand.