← Back to Skills Marketplace
nietzsche247

Context Sentinel

by Nietzsche247 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
1309
Downloads
4
Stars
6
Active Installs
1
Versions
Install in OpenClaw
/install context-sentinel
Description
Monitors session context and automatically manages model switching based on a cascading protocol. Use as part of a heartbeat or cron job to maintain session health and optimize token usage.
README (SKILL.md)

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

  1. Opus 4.6: Use until 80% context, then switch to Opus 4.5.
  2. Opus 4.5: Use until 80% context, then switch to Gemini 2.5 Pro.
  3. Gemini Pro: Use until 80% context, then trigger a handoff.

This skill operationalizes the logic defined in 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

  1. Execute the script: Run the check_context.ps1 script to get the current session status and determine the required action.

    powershell -File scripts/check_context.ps1
    
  2. Evaluate the output: The script will return one of three possible string commands:

    • SWITCH_TO:\x3Cmodel_id>
    • HANDOFF_NOW
    • STATUS_OK
  3. Take Action: Based on the output, execute the appropriate agent command.

    • If SWITCH_TO:\x3Cmodel_id>, run session_status with the new model ID:

      session_status model=\x3Cmodel_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.

Usage Guidance
Do not install or run this skill as-is. The SKILL.md references a PowerShell script (skills/context-sentinel/scripts/check_context.ps1) and MEMORY.md that are not included — the package is incomplete. Before using: (1) ask the author to provide the exact script and MEMORY.md and review their contents line-by-line to ensure they only read the expected session state and write only to explicit, safe paths; (2) confirm what the 'session_status' command does and where the handoff file lives; (3) run any provided script in a sandboxed environment first (or inspect it locally) rather than allowing automatic/cron invocation; (4) avoid granting persistent/autonomous execution until the implementation is complete and you trust the source. Because the instructions are vague and reference system-level actions, treat this skill as potentially risky until its missing artifacts and exact behaviors are provided and reviewed.
Capability Analysis
Type: OpenClaw Skill Name: context-sentinel Version: 1.0.0 The skill instructs the agent to execute a PowerShell script (`scripts/check_context.ps1`) and potentially perform file system writes ("writing to the handoff file") as described in `SKILL.md`. While these actions are plausible for the stated purpose of managing session context and model switching, the content of the PowerShell script is not provided, making it an unknown execution risk. The instructions in `SKILL.md` themselves do not show malicious intent or prompt injection attempts, but the reliance on an unseen executable component and file system interaction elevates the risk beyond benign.
Capability Assessment
Purpose & Capability
The name/description (monitor session context and switch models) matches the requested capabilities, but the SKILL.md expects a PowerShell script (scripts/check_context.ps1) and MEMORY.md to exist and drive behavior — neither are bundled. Asking the agent to run 'session_status' and write to a 'handoff' file is plausible for this purpose, but the absence of the script and referenced docs makes the package incomplete and incoherent.
Instruction Scope
Instructions tell the agent to execute a PowerShell script, evaluate its output, run a 'session_status' command, and potentially write to a handoff file. Those are system-level actions (running scripts, writing files, invoking agent commands). The SKILL.md is vague about the handoff file path, the contents of the script, and what 'session_status' does — granting broad discretion and potential to affect session state or system files without explicit boundaries.
Install Mechanism
This is an instruction-only skill with no install spec and no code files, which is low-risk from an installer/extraction perspective. However, because runtime behavior depends on an external script that isn't included, the skill as-published cannot function as-is.
Credentials
The skill requests no environment variables, credentials, or config paths. That is proportionate to its stated goal. Still, the instructions reference reading/writing session state and handoff files (unspecified), so the skill could interact with system files if the external script or agent commands do so.
Persistence & Privilege
The skill does not request always: true and is user-invocable (defaults). Autonomous invocation (disable-model-invocation: false) is the platform default; combined with the vague runtime actions this increases potential impact if the missing script were later supplied or pointed to a different path. On its own this is not a showstopper, but it amplifies the other concerns.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install context-sentinel
  3. After installation, invoke the skill by name or use /context-sentinel
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of context-sentinel (v1.0.0). - Automates model switching based on the Cascading Model Protocol to optimize session health and token usage. - Provides a PowerShell script (`check_context.ps1`) to monitor session context and recommend switching, handoff, or no action. - Designed for use in agent heartbeats or scheduled cron jobs. - Simplifies workflow and cleans up manual steps in agent maintenance routines.
Metadata
Slug context-sentinel
Version 1.0.0
License
All-time Installs 7
Active Installs 6
Total Versions 1
Frequently Asked Questions

What is Context Sentinel?

Monitors session context and automatically manages model switching based on a cascading protocol. Use as part of a heartbeat or cron job to maintain session health and optimize token usage. It is an AI Agent Skill for Claude Code / OpenClaw, with 1309 downloads so far.

How do I install Context Sentinel?

Run "/install context-sentinel" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Context Sentinel free?

Yes, Context Sentinel is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Context Sentinel support?

Context Sentinel is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Context Sentinel?

It is built and maintained by Nietzsche247 (@nietzsche247); the current version is v1.0.0.

💬 Comments