Context Sentinel
Monitors session context and automatically manages model switching based on a cascading protocol.
- Rating
- 4.5 (111 reviews)
- Downloads
- 7,076 downloads
- Version
- 1.0.0
Overview
Monitors session context and automatically manages model switching based on a cascading protocol.
Complete Documentation
View Source →
Context Sentinel
This skill provides a script to automate the "Cascading Model Protocol," ensuring the agent gracefully degrades from high-cost models to high-context models as the session grows.
Protocol Summary
- Opus 4.6: Use until 80% context, then switch to Opus 4.5.
- Opus 4.5: Use until 80% context, then switch to Gemini 2.5 Pro.
- Gemini Pro: Use until 80% context, then trigger a handoff.
MEMORY.md.How to Use
This skill is designed to be run periodically, either via a cron job or as part of the main agent's HEARTBEAT.md checklist.
Workflow
- Execute the script:
check_context.ps1 script to get the current session status and determine the required action.
powershell -File scripts/check_context.ps1
- Evaluate the output:
SWITCH_TO:HANDOFF_NOWSTATUS_OK- Take Action:
- If
SWITCH_TO:, runsession_statuswith the new model ID:
session_status model=<model_id>
- If
HANDOFF_NOW, trigger the handoff process by writing to the handoff file. This is typically done by running a specific, pre-defined prompt or script. - If
STATUS_OK, no action is needed.
Example Usage in HEARTBEAT.md
You can replace the manual checks in your HEARTBEAT.md with a call to this skill's script.
Old HEARTBEAT.md:
## Cascading Model Protocol (Check Every Heartbeat)
1. **Check Status:** Get current model and context %.
2. **Opus 4.6:** If model is `Opus 4.6` and context > 80% -> Switch to `Opus 4.5`.
...
New HEARTBEAT.md using this skill:
## Context Sentinel (Check Every Heartbeat)
1. Run `powershell -File skills/context-sentinel/scripts/check_context.ps1`.
2. Evaluate the output and take action (`SWITCH_TO`, `HANDOFF_NOW`, or `STATUS_OK`).
This makes the logic reusable and keeps the HEARTBEAT.md file clean and focused on execution.
Installation
openclaw install context-sentinel
💻Code Examples
**Old `HEARTBEAT.md`:**
## Cascading Model Protocol (Check Every Heartbeat)
1. **Check Status:** Get current model and context %.
2. **Opus 4.6:** If model is `Opus 4.6` and context > 80% -> Switch to `Opus 4.5`.
...**New `HEARTBEAT.md` using this skill:**
## Context Sentinel (Check Every Heartbeat)
1. Run `powershell -File skills/context-sentinel/scripts/check_context.ps1`.
2. Evaluate the output and take action (`SWITCH_TO`, `HANDOFF_NOW`, or `STATUS_OK`).Tags
Quick Info
Ready to Install?
Get started with this skill in seconds
Related Skills
4claw
4claw — a moderated imageboard for AI agents.
Aap Passport
Agent Attestation Protocol - The Reverse Turing Test.
Acestep Lyrics Transcription
Transcribe audio to timestamped lyrics using OpenAI Whisper or ElevenLabs Scribe API.
Adaptive Suite
A continuously adaptive skill suite that empowers Clawdbot.