Token导航 LogoToken导航TokenDH.com
开发敏感数据clawhub未标认证来源可访问clear审计提醒

session-health-monitor会话健康监视器

Agent Skill

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

总安装

16,506

周安装

709

GitHub Stars

公开资料未说明

下载量

5,785
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:session-health-monitor(会话健康监视器)
来源仓库:https://github.com/assistantheinrich-prog/session-health-monitor
安装命令:
openclaw skills install session-health-monitor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

ClawHubOpenClaw
openclaw skills install session-health-monitor

简介

OpenClaw 代理的上下文窗口健康状况监控 - 通过 Telegram、预压缩快照和内存轮换发出阈值警告。

SKILL.md

name
session-health-monitor
description
Context window health monitoring for OpenClaw agents — threshold warnings via Telegram, pre-compaction snapshots, and memory rotation.
allowed-tools
version
1.1.0
author
heinrichclawdster

Session Health Monitor

Monitor your OpenClaw agent context window health, get warnings via Telegram when usage is high, save critical facts before compaction, and keep memory directories clean.

Overview

Four capabilities for OpenClaw agent sessions:

  1. Context Threshold Warnings — Agents append usage footer to Telegram messages and warn at configurable thresholds
  2. Compaction Detection — Track usage drops to infer when context was compacted
  3. Pre-Compaction Snapshots — Save key facts and decisions to daily memory files before they're lost
  4. Memory Rotation — Archive old daily memory files to prevent clutter

Quick Setup (OpenClaw)

1. Add shared skill reference

Add to your shared/INDEX.md:

| Context window health, compaction detection, pre-compaction snapshots | `skill-session-health.md` |

2. Create shared skill doc

Create shared/skill-session-health.md:

# Session Health Monitor

## Context Health Thresholds
| Level  | Condition                          | Action                        |
|--------|------------------------------------|-------------------------------|
| GREEN  | <50% used AND 0 compactions        | Normal operation              |
| YELLOW | >=50% used OR >=1 compaction       | Save key facts via snapshot   |
| RED    | >=75% used OR >=2 compactions      | Save facts NOW, session ending|

## Behavioral Rules
1. When context reaches YELLOW+, extract 3-5 key facts (decisions, files changed, blockers)
2. Run: `bash scripts/snapshot.sh "fact1" "fact2"`
3. Append footer to Telegram messages at YELLOW+: `X% Context Window | Nx compacted`
4. Do this BEFORE session ends or context gets compacted
5. After any detected compaction, immediately snapshot what you remember

3. Add heartbeat step

Add to your agent heartbeat/loop:

**Context health check**: Run `session_status` → always append context % to Telegram messages
as footer: `📊 X% Context Window`. If Context >50% OR Compactions >=1, add:
"⚠️ consider /restart after current task." If Context >75% OR Compactions >=2, flag as urgent.

Context Health Thresholds

LevelConditionAction
GREEN<50% used AND 0 compactionsNormal operation
YELLOW>=50% used OR >=1 compactionConsider saving key facts
RED>=75% used OR >=2 compactionsSave facts NOW, session ending

Telegram Message Footer

Agents append a footer to every outgoing Telegram message:

📊 42% Context Window                          # GREEN — no extra warning
📊 63% Context Window | 1x compacted           # YELLOW — consider restart
⚠️ 📊 81% Context Window | 2x compacted        # RED — urgent, save facts

This keeps the user informed about session health without requiring manual checks.

Pre-Compaction Snapshot Protocol

When context reaches YELLOW or above, the agent SHOULD:

  1. Extract 3-5 key facts from the current session (decisions made, files changed, blockers found)
  2. Write them to memory/YYYY-MM-DD.md using scripts/snapshot.sh
  3. Include any unfinished work or next steps
  4. Do this BEFORE the session ends or context is compacted

Example snapshot content:

## Pre-Compaction Snapshot (14:32)
- Refactored auth module to use JWT instead of sessions (files: src/auth.ts, src/middleware.ts)
- Bug found in rate limiter: counter resets on deploy, not on TTL expiry
- Next: write tests for new auth flow, fix rate limiter reset logic
- Decision: using RS256 for JWT signing (user preference)

When to trigger:

  • Context hits 50%+ for the first time in a session
  • After any detected compaction
  • Before ending a long session
  • When the agent detects it has accumulated significant context

Scripts Reference

context-check.sh

Standalone health check, useful in heartbeat loops.

bash scripts/context-check.sh                    # Human-readable output
bash scripts/context-check.sh --json              # Machine-readable JSON
echo '{"context_window":{"used_percentage":72}}' | bash scripts/context-check.sh
# Exit codes: 0=GREEN, 1=YELLOW, 2=RED

snapshot.sh

Save facts to daily memory file.

bash scripts/snapshot.sh "Fact one" "Fact two" "Fact three"
echo -e "Fact one\
Fact two" | bash scripts/snapshot.sh -

rotate.sh

Archive old daily memory files.

bash scripts/rotate.sh           # Archives files older than 3 days (default)
KEEP_DAYS=7 bash scripts/rotate.sh  # Keep 7 days instead

Configuration

All configuration is via environment variables with sensible defaults:

VariableDefaultDescription
MEMORY_DIRAuto-detect (see below)Where to write daily memory files
KEEP_DAYS3Days to keep before archiving
HEALTH_GREEN_MAX50Max % for GREEN status
HEALTH_RED_MIN75Min % for RED status
COMPACTION_DROP30% drop that indicates compaction

Memory directory auto-detection order:

  1. $MEMORY_DIR environment variable
  2. ~/.openclaw/workspace/memory (if exists)
  3. ~/.claude/memory (fallback)

Troubleshooting

jq not installed

# macOS
brew install jq
# Linux
sudo apt-get install jq

Reset compaction state

rm /tmp/session-health-*.json

Agent not appending footer

  1. Check shared/INDEX.md references skill-session-health.md
  2. Check heartbeat includes the context health step
  3. Verify session_status tool is available to the agent

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

OpenClaw

81.1%
按下载量换算4,692

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

未展示

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

来源信息

继续浏览同类 Skills