Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Context window health monitoring for OpenClaw agents — threshold warnings via Telegram, pre-compaction snapshots, and memory rotation.
allowed-tools
["Bash","Read","Write"]
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:
Context Threshold Warnings — Agents append usage footer to Telegram messages and warn at configurable thresholds
Compaction Detection — Track usage drops to infer when context was compacted
Pre-Compaction Snapshots — Save key facts and decisions to daily memory files before they're lost
Memory Rotation — Archive old daily memory files to prevent clutter
# 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 Rules1. 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
Level
Condition
Action
GREEN
<50% used AND 0 compactions
Normal operation
YELLOW
>=50% used OR >=1 compaction
Consider saving key facts
RED
>=75% used OR >=2 compactions
Save 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:
Extract 3-5 key facts from the current session (decisions made, files changed, blockers found)
Write them to memory/YYYY-MM-DD.md using scripts/snapshot.sh
Include any unfinished work or next steps
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.