← 返回
AI智能 中文

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.
监控会话上下文,根据级联协议自动切换模型。可作为心跳或定时任务的一部分,以维持会话健康并优化令牌使用。
nietzsche247
AI智能 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 4
Stars
📥 1,808
下载
💾 102
安装
1
版本
#latest

概述

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

powershell -File scripts/check_context.ps1

```

  1. Evaluate the output:

The script will return one of three possible string commands:

  • SWITCH_TO:
  • HANDOFF_NOW
  • STATUS_OK
  1. Take Action:

Based on the output, execute the appropriate agent command.

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

```

session_status model=

```

  • 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.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 23:25 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 417 📥 115,209
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,358 📥 318,341
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 712 📥 243,815