From context-guard
Show Context Guard health dashboard — snapshots, recovery state, and system status. Trigger: "context status", "guard status", "snapshot status", "context health", "check context guard", "/cg-context-status"
How this skill is triggered — by the user, by Claude, or both
Slash command
/context-guard:cg-context-statusThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Show context health dashboard with snapshot inventory, hook installation, and system status.
Show context health dashboard with snapshot inventory, hook installation, and system status.
Run these checks:
echo "=== Context Guard Status ==="
echo ""
SNAP_COUNT=$(ls "$HOME/.claude/compact-guard"/snapshot-*.md 2>/dev/null | wc -l | tr -d ' ')
echo "Snapshots: $SNAP_COUNT"
LATEST=$(ls -t "$HOME/.claude/compact-guard"/snapshot-*.md 2>/dev/null | head -1)
if [ -n "$LATEST" ]; then
MTIME=$(stat -c %Y "$LATEST" 2>/dev/null || stat -f %m "$LATEST" 2>/dev/null || echo "0")
NOW=$(date +%s)
AGE=$(( NOW - MTIME ))
echo "Latest: $(basename "$LATEST") (${AGE}s ago)"
fi
if [ -f "$HOME/.claude/compact-guard/session-bookmark.md" ]; then
BM_MTIME=$(stat -c %Y "$HOME/.claude/compact-guard/session-bookmark.md" 2>/dev/null || echo "0")
BM_AGE=$(( $(date +%s) - BM_MTIME ))
echo "Session bookmark: exists (${BM_AGE}s ago)"
else
echo "Session bookmark: none"
fi
SESSION=$(cat "$HOME/.claude/compact-guard/.session-counter" 2>/dev/null || echo "?")
echo "Session counter: #$SESSION"
echo ""
echo "=== Installation ==="
for f in compact-guard-lib.sh compact-guard-pre.sh compact-guard-post.sh compact-guard-stop.sh; do
[ -f "$HOME/.claude/hooks/$f" ] && echo "OK: $f (manual)" || true
done
grep -q "compact-guard-pre" "$HOME/.claude/settings.json" 2>/dev/null && echo "OK: PreCompact hook configured" || echo "MISSING: PreCompact hook"
grep -q "compact-guard-stop" "$HOME/.claude/settings.json" 2>/dev/null && echo "OK: Stop hook configured" || echo "MISSING: Stop hook"
grep -q "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE" "$HOME/.claude/settings.json" 2>/dev/null && echo "OK: Autocompact override set" || echo "MISSING: Autocompact override"
echo ""
echo "=== Plugin ==="
if [ -f "$HOME/.claude/plugins/installed_plugins.json" ]; then
grep -q "context-guard" "$HOME/.claude/plugins/installed_plugins.json" 2>/dev/null && echo "OK: Installed as plugin" || echo "INFO: Not installed as plugin (manual mode)"
fi
echo ""
echo "=== Telemetry ==="
source "$HOME/.claude/hooks/compact-guard-lib.sh" 2>/dev/null
if [ -f "$COMPACT_GUARD_TELEMETRY" ]; then
cg_telemetry_stats
echo ""
echo "Last 5 events:"
tail -5 "$COMPACT_GUARD_TELEMETRY"
else
echo "No telemetry data yet."
fi
echo ""
echo "=== Active Task Detection ==="
source "$HOME/.claude/hooks/compact-guard-lib.sh" 2>/dev/null
TASK=$(cg_detect_active_task)
if [ -n "$TASK" ]; then
echo "$TASK" | tr '|' '\n' | sed 's/^ */- /'
else
echo "No active task detected (no git repo or clean state)."
fi
echo ""
echo "=== Disk Usage ==="
du -sh "$HOME/.claude/compact-guard" 2>/dev/null || echo "Dir not found"
ANNOT_BASE="$HOME/.claude/annotations"
if echo "$PWD" | grep -qi "cedra"; then PROJECT_KEY="C--cedra"; else PROJECT_KEY=$(basename "$PWD"); fi
ANNOT_DIR="$ANNOT_BASE/$PROJECT_KEY"
echo ""
echo "=== Annotations ($PROJECT_KEY) ==="
if [ -d "$ANNOT_DIR" ]; then
for f in "$ANNOT_DIR"/*.md; do
[ -f "$f" ] || continue
TOPIC=$(basename "$f" .md)
LINES=$(wc -l < "$f" | tr -d ' ')
MODIFIED=$(stat -c %y "$f" 2>/dev/null | cut -d' ' -f1 || stat -f "%Sm" -t "%Y-%m-%d" "$f" 2>/dev/null)
echo " $TOPIC — ${LINES} lines, last updated: $MODIFIED"
done
else
echo " No annotations yet. Use /cg-annotate <topic> to start."
fi
| Check | Status | Details |
|---|---|---|
| Snapshots | {count} | Latest: {age} ago |
| Bookmark | {yes/no} | {age} ago |
| Session | #{n} | |
| PreCompact hook | OK/MISSING | |
| Stop hook | OK/MISSING | |
| Autocompact | {value}% | |
| Telemetry | {total events} | Success rate: {%} |
| Active task | {detected/none} | |
| Disk usage | {size} | |
| Annotations | {count} topics | {topic list} |
Flag any MISSING items and suggest fixes.
npx claudepluginhub jlceaser/context-guard --plugin context-guardDisplays ContextShield status, protected files with 3+ waste sessions, estimated tokens saved, and co-occurrence groups from usage patterns.
Monitors Claude Code context token usage and auto-triggers compaction at 65% via Bash hooks: snapshots transcripts, summarizes, restores state to prevent overload.
Preserves critical context data before Claude Code's automatic compaction using snapshots, integrity verification, and zero-loss extraction protocols for complex projects.