hook-context-window-monitor

Monitor context window usage and emit warnings when thresholds are exceeded.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-context-window-monitor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-context-window-monitor
Source: https://github.com/xuezhaojun/oh-your-opencode/tree/main/.opencode/skills/hook-context-window-monitor
Command: npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-context-window-monitor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Lightweight monitor that injects reminders when context window usage exceeds configurable thresholds. Unlike preemptive-compaction, this does NOT trigger compaction — it only warns the LLM to be more concise and suggests running /compact.

Core Features & Use Cases

  • Monitor and warn when context usage crosses warnThreshold (default 0.7) or criticalThreshold (default 0.85).
  • Non-invasive reminders to improve dialogue efficiency and avoid hidden token overflows.
  • Useful for long-running sessions or when tight token budgets apply.

Quick Start

Configure the monitor with your desired thresholds to start receiving warnings.

Frequently Asked Questions about hook-context-window-monitor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I monitor context window usage to prevent token overload in long-running LLM sessions?

To monitor context window usage, configure threshold-based warnings that trigger when token consumption exceeds defined limits. This approach injects non-invasive reminders during long-running LLM sessions to prevent hidden token overflows without automatically triggering context compaction.

What is the difference between context window monitoring and preemptive compaction?

Context window monitoring only observes usage and emits warnings when thresholds are exceeded, whereas preemptive compaction actively summarizes and discards previous conversation turns. Monitoring suggests running compaction but leaves the actual execution to the user.

How do I set up token budget warnings for multi-turn AI conversations?

Set up token budget warnings by configuring the warnThreshold and criticalThreshold parameters. When context usage crosses these configured limits during multi-turn AI conversations, the system injects reminders to improve dialogue efficiency and avoid overflows.

Can I adjust the warning interval for context window alerts in tight token budgets?

Yes, you can adjust the warning interval for context window alerts. Configurable parameters allow you to control the warningInterval alongside critical and warning thresholds to manage alert frequency during sessions with tight token budgets.

When should I use a non-invasive context monitor instead of automatic compaction?

Use a non-invasive context monitor when you need to preserve the full conversation history for multi-turn planning but want alerts before hitting token limits. It prompts the LLM to be more concise and suggests manual compaction only when necessary.