Skip to content
cccskills
FreePublished on GitHub

self-monitor

Proactive self-monitoring of infrastructure, services, and health. Tracks disk/memory/load, service health, cron job status, recent errors. Auto-fixes safe issues. Triggers on: health check, heartbeat, monitor status, service status, infrastructure check.

The English summary is being prepared. Showing the original description.

Works withYouTube

Run score Not tested

See how to install

Files included (2)

  • SKILL.md9.6 KB
  • README.md1.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Compatible with Claude Code, Codex CLI, Cursor, Windsurf, and any SKILL.md-compatible agent.

Self Monitor

Proactive self-monitoring: infrastructure, services, and health.

Usage

Run during heartbeats or scheduled checks.

1. Infrastructure Health

# Disk usage
df -h / | awk 'NR==2 {print $5}' | tr -d '%'

# Memory usage  
free -m | awk 'NR==2 {printf "%.0f", $3/$2*100}'

# Load average
uptime | awk -F'load average:' '{print $2}' | awk -F',' '{print $1}'

# Top processes by memory
ps aux --sort=-%mem | head -10

# Top processes by CPU
ps aux --sort=-%cpu | head -10

Thresholds:

MetricWarningCritical
Disk> 80%> 90%
Memory> 85%> 95%
Load> 2.0> 4.0

2. Service Health

# Check if a process is running
pgrep -f "your_process_name" >/dev/null && echo "OK" || echo "FAIL"

# Check HTTP endpoint
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/health

# Check systemd service
systemctl is-active --quiet nginx && echo "OK" || echo "FAIL"

# Check Docker container
docker ps --filter "name=mycontainer" --filter "status=running" -q | grep -q . && echo "OK" || echo "FAIL"

# Tailscale (if using)
tailscale status --json 2>/dev/null | jq -r '.Self.Online' || echo "FAIL"

3. Cron Job Health

# Check recent cron executions
grep CRON /var/log/syslog | tail -20

# Count failures in last 24h
grep -c "CRON.*error\|CRON.*fail" /var/log/syslog

# List scheduled jobs
crontab -l

4. Recent Errors

# Check system logs for errors
journalctl -p err --since "1 hour ago" 2>/dev/null | tail -20

# Check application logs
tail -50 ~/workspace/projects/*/logs/*.log 2>/dev/null | grep -i "error"

# Check dmesg for hardware/kernel issues
dmesg | tail -20 | grep -i "error\|fail\|warn"

Quick Health Check (for heartbeat)

#!/bin/bash
# Quick health snapshot

DISK=$(df -h / | awk 'NR==2 {print $5}' | tr -d '%')
MEM=$(free -m | awk 'NR==2 {printf "%.0f", $3/$2*100}')
LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk -F',' '{print $1}' | xargs)

echo "Disk: ${DISK}% | Mem: ${MEM}% | Load: ${LOAD}"

# Alert if thresholds exceeded
[ "$DISK" -gt 90 ] && echo "⚠️ Disk critical!"
[ "$MEM" -gt 95 ] && echo "⚠️ Memory critical!"

Root Cause Iron Law (inspired by gstack /investigate)

Never apply a fix without identifying the root cause first.

When an issue is detected:

  1. Investigate -- collect evidence (logs, metrics, timeline)
  2. Analyze -- identify the root cause, not just the symptom
  3. Hypothesize -- state the cause in one sentence before acting
  4. Fix -- apply the smallest targeted fix
  5. Verify -- confirm the fix resolved the root cause, not just the symptom

If root cause is unclear after 2 attempts:

  • Log what you tried and what you observed
  • Escalate to owner with evidence, not guesses
  • Do NOT apply speculative fixes that could mask the real issue

Anti-patterns:

  • Restarting a service without checking why it died
  • Clearing disk without checking what filled it
  • Killing a process without checking what caused high usage

Destructive Command Guard (inspired by gstack /guard)

Before executing any of these commands, stop and verify:

PatternRiskRequired Check
rm -rfData lossVerify path is correct, not /, not home
DROP TABLE / DROP DATABASEData lossConfirm backup exists
git push --forceHistory lossConfirm branch and remote
kill -9CorruptionTry graceful stop first
chmod 777SecurityUse minimal permissions instead
truncate / > fileData lossConfirm file is a log, not config
docker system prune -aImage lossList what will be removed first

Subagents MUST NOT execute destructive commands. Return the command to main session for approval.

Proactive Actions

When issues detected:

IssueAuto-ActionAlert?
Disk > 90%Investigate what grew, then cleanYes
Key process downCheck logs first, then restartYes
Cron 3+ failuresRoot cause analysis, then reportYes
Memory > 95%Identify leak/offender, then actYes

Auto-fixable (safe, only after root cause check):

# Clean old logs (> 7 days)
find /var/log -name "*.log" -mtime +7 -delete 2>/dev/null
find ~/.cache -type f -mtime +7 -delete 2>/dev/null

# Clean temp files
rm -f /tmp/agent-temp-* 2>/dev/null
rm -rf ~/.cache/pip 2>/dev/null

Report Format

## 🔍 Self-Monitor Report - [TIME]

### Health Summary
| Metric | Value | Status |
|--------|-------|--------|
| Disk | XX% | ✅/⚠️/🔴 |
| Memory | XX% | ✅/⚠️/🔴 |
| Load | X.X | ✅/⚠️/🔴 |
| Services | X/Y up | ✅/⚠️ |

### Issues Found
- [Issue 1]: [Action taken or recommended]

### Top Resource Consumers
| Process | CPU% | MEM% |
|---------|------|------|
| ... | ... | ... |

Integration with Scheduled Tasks

Add to your crontab or task scheduler:

# Run health check every 30 minutes
*/30 * * * * /path/to/health-check.sh >> /var/log/health-check.log 2>&1

Or run manually as part of your workflow:

./health-check.sh

Security Checks

Run daily (or alongside any health check). Uses only sha256sum/shasum, grep, find, jq. Designed to complete in under 5 seconds.

Critical Files to Monitor

/path/to/workspace/SOUL.md
/path/to/workspace/IDENTITY.md
/path/to/workspace/MEMORY.md
/path/to/workspace/AGENTS.md
/path/to/workspace/TOOLS.md

1. File Integrity (SHA256 Baseline)

See ../security-guardian/scripts/check_integrity.sh for the full script.

Logic:

  • On first run: generate data/security-baseline.json with SHA256 of each critical file
  • On subsequent runs: compare current hashes against baseline; report any drift
  • Manual reset: "reset security baseline" → regenerate baseline (do this after intentional edits to SOUL.md/MEMORY.md)

Baseline format:

{
  "generated_at": "2026-04-02T07:00:00Z",
  "files": {
    "/path/to/workspace/SOUL.md": "sha256:<hash>"
  }
}

2. Prompt Injection Scan

See ../security-guardian/scripts/scan_injections.sh for the full script.

Scans last 3 days of memory/*.md files for patterns like:

  • "ignore previous instructions"
  • "you are now" / "pretend you are"
  • "forget everything" / "override your"
  • "new system prompt"

3. Credential Leak Scan

See ../security-guardian/scripts/scan_credentials.sh for the full script.

Scans workspace *.md, *.json, *.txt, *.yaml (excluding .git/, node_modules/) for:

  • api_key = 'xxx' / token = 'xxx'
  • sk-... (OpenAI/Anthropic keys)
  • ghp_... (GitHub tokens)
  • Hardcoded passwords

Security Report Format

🛡️ Security Report — YYYY-MM-DD HH:MM UTC

✅ File Integrity: OK (5/5 files match baseline)
⚠️  Injection Scan: 1 suspicious pattern in memory/2026-04-01.md
✅ Credential Scan: Clean

 Summary: 1 warning — review flagged file

Severity & Alerting

LevelMeaningAction
✅ OKAll clearLog only
⚠️ WARNINGSuspicious but not confirmedNote in report
🚨 CRITICALConfirmed drift or credential exposedAlert owner immediately

CRITICAL triggers:

  • SOUL.md or IDENTITY.md hash changed without "reset baseline" command
  • Credential pattern found in a committed/shared file
  • Injection pattern found in a file that was then acted upon

On CRITICAL: alert owner via WhatsApp.

Cron Schedule

Run daily at 06:00 UTC (before morning briefing). Silent unless CRITICAL found.

{
  "id": "security-daily",
  "schedule": "0 6 * * *",
  "timezone": "UTC",
  "task": "Run self-monitor security checks: file integrity, injection scan, credential scan. Alert owner via WhatsApp if CRITICAL.",
  "delivery": { "mode": "silent" }
}

📊 Skill Analytics Section

Include this in the daily self-monitor report (after security checks).

LOG="/path/to/workspace/data/skill-analytics.jsonl"
TODAY=$(date -u +%Y-%m-%d)

if [ ! -f "$LOG" ] || [ $(wc -l < "$LOG") -eq 0 ]; then
  echo "### 📊 Skill Analytics\n_No data yet._"
else
  echo "### 📊 Skill Analytics (last 24h)"
  echo ""
  
  # Total today
  TOTAL=$(grep "$TODAY" "$LOG" | wc -l)
  echo "**Invocations:** $TOTAL"
  echo ""
  
  # Top 5 skills today
  echo "**Top skills:**"
  grep "$TODAY" "$LOG" \
    | jq -r '.skill' \
    | sort | uniq -c | sort -rn \
    | head -5 \
    | awk '{printf "- %s (%d)\n", $2, $1}'
  echo ""
  
  # Unused skills (never logged)
  KNOWN="ai-pa billing-monitor calendar-setup eval hebrew-nikud maintenance meetings memory-tiering monday-for-agents owner-briefing pa-onboarding self-learning self-monitor skill-master skill-scout supervisor whatsapp youtube-watcher skill-analytics"
  UNUSED=""
  for s in $KNOWN; do
    COUNT=$(jq -r '.skill' "$LOG" | grep -c "^${s}$" 2>/dev/null || echo 0)
    [ "$COUNT" -eq 0 ] && UNUSED="$UNUSED $s"
  done
  [ -n "$UNUSED" ] && echo "**Never used:**$UNUSED" || echo "**Never used:** none"
fi

Output Example

### 📊 Skill Analytics (last 24h)

**Invocations:** 11

**Top skills:**
- supervisor (4)
- owner-briefing (2)
- meetings (2)
- whatsapp (2)
- self-monitor (1)

**Never used:** hebrew-nikud youtube-watcher

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

ai-pa

Free

AI Personal Assistant network skill for multi-agent PA coordination. Use when: contacting another PA, coordinating with peer agents, scheduling meetings between owners, broadcasting messages to PA groups, or looking up contacts from the local PA directory. Reads contact data from data/pa-directory.json in the workspace.

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

ai-pa

Free

Route and execute inter-PA coordination tasks in the OpenClaw multi-agent PA network. Triggers when: contacting another PA, passing a message between owners, broadcasting to a PA group, handling group lead/silence rules, or adding a new PA to the directory. NOT for: contact lookups (use contact-list skill), calendar invites (use meetings skill), or billing issues (use billing-monitor skill).

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

ai-pa

Free

AI Personal Assistant network skill. Use when: contacting another PA, coordinating with peer agents, scheduling meetings between owners, broadcasting messages, looking up contacts from the local PA directory, or performing any cross-PA task. Reads contact data from data/pa-directory.json in the workspace. Does NOT contain hardcoded contact data — each PA maintains their own directory file.

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

OpenClaw API gateway proxy for authenticated SaaS calls (100+ services in references/SERVICES.md). Use ONLY when making an HTTP request to a third-party service that requires the gateway's stored credentials. NOT for direct API calls with bearer tokens already in scope, NOT for monday.com (use monday-for-agents), NOT for WhatsApp (use heleni-whatsapp). Triggers: "call the X API", "fetch from <service>", "send to Slack via gateway", "use the gateway for".

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

Automatically creates new skills from complex problem-solving sessions. Triggers at the end of multi-step tasks that required novel approaches, debugging sessions, or workflow creation. Use when: a task took 3+ tool calls, involved a non-obvious solution, or established a pattern likely to recur. Also triggers on: "create a skill from this", "save this as a skill", "this should be a skill".

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

Monitor for API billing errors and alert the owner and admin immediately. Use when: an API billing error is detected, a peer PA reports a billing error, or during routine health checks. Handles detection, notification, and fallback model switching. Model-agnostic: works with any LLM provider (Anthropic, OpenAI, Google, etc.).

The English summary is being prepared. Showing the original description.

netanel-abergel/pa-skills6Updated May 10, 2026

See all skills by netanel-abergel

Report a problem with this skill