← 返回 Skills 市场
nietzsche247

Context Sentinel

作者 Nietzsche247 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
1309
总下载
4
收藏
6
当前安装
1
版本数
在 OpenClaw 中安装
/install 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.
使用说明 (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.

安全使用建议
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.
功能分析
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.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-sentinel
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-sentinel 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug context-sentinel
版本 1.0.0
许可证
累计安装 7
当前安装数 6
历史版本数 1
常见问题

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. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1309 次。

如何安装 Context Sentinel?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install context-sentinel」即可一键安装,无需额外配置。

Context Sentinel 是免费的吗?

是的,Context Sentinel 完全免费(开源免费),可自由下载、安装和使用。

Context Sentinel 支持哪些平台?

Context Sentinel 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context Sentinel?

由 Nietzsche247(@nietzsche247)开发并维护,当前版本 v1.0.0。

💬 留言讨论