Token导航 LogoToken导航TokenDH.com
效率只读clawhub未标认证来源可访问clear审计提醒

context-guardiancontext guardian 效率

Agent Skill

context-guardian 用于补充效率相关能力,适合在 OpenClaw 中需要让 Agent 承接效率相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

10,454

周安装

440

GitHub Stars

公开资料未说明

下载量

3,661
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:context-guardian(context guardian 效率)
来源仓库:https://github.com/brucey0017-cloud/context-guardian
安装命令:
openclaw skills install context-guardian
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install context-guardian

简介

context-guardian 通过智能三级警报实现主动上下文监控,帮助识别何时需要重启会话以维持输出质量。

  • 适用于长时间运行任务或复杂推理场景,防止因上下文退化导致错误累积。
  • 自动检测上下文使用率并发出预警,辅助用户及时干预。
  • 安装命令为 openclaw skills install context-guardian,需授权进程监控权限。
  • 注意该技能可能涉及系统级资源读取,建议在可信环境中部署。

SKILL.md

name
context-guardian
version
1.0.1
description
Proactive context monitoring with smart 3-level alerts. Know when to restart before quality degrades.
author
brucey0017
tags
[monitoring, context, alerts, proactive, quality]

Context Guardian 🛡️

Your context guardian. Alerts before errors happen.

Proactive context monitoring that warns you at 60%, 70%, and 85% usage — before context pollution causes errors and hallucinations.


Why You Need This

The Problem:

  • Long conversations lead to context pollution
  • Quality degrades silently as context fills up
  • You don't know when to restart until it's too late
  • Errors and hallucinations increase after ~70% usage

The Solution:

  • Continuous monitoring of context usage
  • Smart 3-level alerts (⚠️ 60%, 🟠 70%, 🔴 85%)
  • Actionable suggestions at each level
  • Prevents duplicate alerts

Quick Start

For Agents: Heartbeat Integration

When you receive a heartbeat poll, include this check:

  1. Call session_status tool to get current context usage
  2. Parse the context percentage from the output
  3. Compare against thresholds: 60% (warning), 70% (danger), 85% (critical)
  4. If threshold exceeded and not a duplicate alert, display the appropriate alert message
  5. Update state file to track alert history

Implementation:

During heartbeat:
1. Get context usage from session_status
2. Check if usage >= 60%, 70%, or 85%
3. Load state from memory/context-guardian-state.json
4. Determine if alert should be sent (prevent duplicates)
5. If yes, display alert and update state

For Users: Enable in HEARTBEAT.md

Add to your HEARTBEAT.md:

## Context Monitoring
- Check context usage
- Alert if thresholds exceeded (60%, 70%, 85%)

The agent will automatically handle the rest.


How It Works

Monitoring

The skill calls session_status to check your current context usage percentage.

Alert Levels

⚠️ Warning (60%)

⚠️ Context: 60%
Getting full. Consider wrapping up or starting fresh soon.

🟠 Danger (70%)

🟠 Context: 70%
Pollution risk rising. Recommend:
• Finish current task
• Start new session for next task
• Or compress with context-optimizer

🔴 Critical (85%)

🔴 Context: 85% - CRITICAL
High error risk. STRONGLY recommend:
• Save work
• Start new session NOW
• Quality degradation likely

Smart Duplicate Prevention

The skill tracks alert history and only alerts when:

  1. First time reaching a threshold
  2. Alert level upgrades (60% → 70% → 85%)
  3. Usage drops below threshold then rises again

Configuration

Edit config/default.json or create config/user.json:

{
  "enabled": true,
  "checkInterval": "heartbeat",
  "thresholds": {
    "warning": 60,
    "danger": 70,
    "critical": 85
  },
  "alertMethod": "message",
  "alertStyle": "emoji",
  "preventDuplicates": true,
  "trackHistory": true,
  "suggestions": {
    "autoSuggest": true,
    "suggestCompression": true,
    "suggestRestart": true
  }
}

Options

checkInterval:

  • "heartbeat" - Check during heartbeat polls (default)
  • "cron" - Independent cron job (future)
  • number - Check every N minutes (future)

thresholds:

  • Customize alert levels (default: 60, 70, 85)

alertMethod:

  • "message" - Send as message (default)
  • "log" - Log only
  • "notification" - System notification (future)

alertStyle:

  • "emoji" - Emoji + concise text (default)
  • "text" - Plain text
  • "detailed" - Full explanation

Manual Check

You can manually check context status:

bash {baseDir}/scripts/check.sh

Integration with Other Skills

context-optimizer

When you reach 70%, the skill suggests using context-optimizer to compress your context instead of restarting.

context-recovery

After context recovery, the skill automatically resumes monitoring.


Implementation Guide for Agents

Step-by-Step Process

1. Get Context Usage

Call session_status tool and parse the output:

Example output: "Context: 54k/200k (27%)"
Extract: 27

2. Determine Alert Level

if (usage >= 85) level = "critical"
else if (usage >= 70) level = "danger"
else if (usage >= 60) level = "warning"
else level = null

3. Load State

Read {workspace}/memory/context-guardian-state.json:

{
  "lastCheck": 1709452800,
  "lastUsage": 54,
  "lastAlertLevel": "warning",
  "lastAlertTime": 1709452500,
  "history": [...]
}

4. Check if Should Alert

Prevent duplicate alerts:

shouldAlert = false

// First time reaching threshold
if (!lastAlertLevel && level) shouldAlert = true

// Level upgrade (warning → danger → critical)
if (levelNum[level] > levelNum[lastAlertLevel]) shouldAlert = true

// Usage dropped below threshold and rose again
if (lastUsage < threshold - 5 && usage >= threshold) shouldAlert = true

5. Send Alert

If shouldAlert, display the appropriate message:

⚠️ Context: 60%
Getting full. Consider wrapping up or starting fresh soon.

6. Update State

Save new state to memory/context-guardian-state.json:

{
  "lastCheck": <current_timestamp>,
  "lastUsage": <current_usage>,
  "lastAlertLevel": <level_if_alerted>,
  "lastAlertTime": <timestamp_if_alerted>,
  "history": [..., {"timestamp": <now>, "usage": <usage>}]
}

Alert Messages

Warning (60%):

⚠️ Context: 60%
Getting full. Consider wrapping up or starting fresh soon.

Danger (70%):

🟠 Context: 70%
Pollution risk rising. Recommend:
• Finish current task
• Start new session for next task
• Or compress with context-optimizer

Critical (85%):

🔴 Context: 85% - CRITICAL
High error risk. STRONGLY recommend:
• Save work
• Start new session NOW
• Quality degradation likely

State Management

State is stored in {workspace}/memory/context-guardian-state.json:

{
  "lastCheck": 1709452800,
  "lastUsage": 54,
  "lastAlertLevel": null,
  "lastAlertTime": null,
  "history": [
    {"timestamp": 1709452800, "usage": 54}
  ]
}

Troubleshooting

No alerts appearing:

  • Check that HEARTBEAT.md includes context monitoring
  • Verify heartbeat is running
  • Check state file for errors

Too many alerts:

  • Increase thresholds in config
  • Check preventDuplicates is enabled

Alerts not accurate:

  • Verify session_status is working
  • Check OpenClaw version compatibility

Examples

Heartbeat Integration

Add to HEARTBEAT.md:

## Context Monitoring
- Check context usage
- Alert if thresholds exceeded

Custom Thresholds

Create config/user.json:

{
  "thresholds": {
    "warning": 50,
    "danger": 65,
    "critical": 80
  }
}

Technical Details

Dependencies:

  • OpenClaw 2026.2.0+
  • session_status tool
  • Bash

Performance:

  • Zero overhead (only checks during heartbeat)
  • Minimal state storage (~1KB)

Privacy:

  • All data stored locally
  • No external calls
  • No telemetry

Roadmap

v1.1.0:

  • Historical trend tracking
  • Usage prediction
  • Independent cron mode

v1.2.0:

  • Auto-trigger context-optimizer
  • Visual trend graphs
  • Multi-session monitoring

Contributing

Found a bug? Have a suggestion? Open an issue or PR on GitHub.


License

MIT

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

86.74%
按下载量换算3,176

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

未展示

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills