agent-self-care

Autonomous agent health, optimization, and cleanup. Use when: (1) running scheduled cron jobs for agent maintenance, (2) responding to "optimize", "cleanup", "health check", "clear stalls", or "self-maintain" requests, (3) performing BMAD-style retrospective and continuous improvement, (4) checking sub-agent sessions, process health, memory usage, and context bloat, (5) ensuring fast response times and autonomous operation. This skill handles all self-optimization workflows including stale session cleanup, context compaction, and performance monitoring.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "agent-self-care" with this command: npx skills add robshabbir/agent-self-care

Agent Self-Care

Autonomous health monitoring and optimization for OpenClaw agents. Runs on cron or triggers manually.

Workflow

1. Check Sub-Agents

subagents action=list

Kill any stale sub-agents:

  • Running >30 min without progress
  • In "waiting" state
  • Failed/errored

2. Check Processes

process action=list

Kill hanging processes:

  • Running >10 min in background
  • No output in 5 min

3. Check Session Health

session_status

Metrics to watch:

  • Context usage >80% → trigger compaction
  • Tokens growing unbounded
  • Session age >2 hours → suggest refresh

4. Run Optimization Script

Execute scripts/optimize.sh which:

  • Clears completed cron job artifacts
  • Rotates logs if >50MB
  • Reports health metrics

5. BMAD Retrospective (every 10 runs)

After 10 executions, run:

  • Score last task 1-10
  • Identify gaps
  • Document improvements in memory/daily/YYYY-MM-DD.md
  • Feed learnings into next run

Cron Schedule

Recommended: Every 5 minutes for active agents.

{
  "name": "agent-self-care",
  "schedule": {"kind": "every", "everyMs": 300000},
  "payload": {"kind": "agentTurn", "message": "Run agent-self-care skill"},
  "sessionTarget": "isolated",
  "enabled": true
}

Output Format

Report after each run:

🔧 Self-Care Report
- Sub-agents: X active, Y killed
- Processes: X running, Y cleared
- Context: X% used
- Health: ✅ GOOD / ⚠️ WARNING
- Retrospective: SKIP / COMPLETE

Key Principles

  1. Always clean - Never leave stalled sub-agents or processes
  2. Proactive - Don't wait for user to ask
  3. Document - Log issues and improvements
  4. BMAD - Continuous self-evaluation every 10 runs
  5. Fast - Complete in <30 seconds

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

S2-DaoKernel: Agent Safety & Ethics Rules for SOUL.md

Ensures AI agents uphold the Three Laws of Silicon Intelligence within the Taohuayuan physical context for safe, ethical, and identity-anchored behavior.

Registry SourceRecently Updated
Automation

Gene Engine

Gene系统自动化引擎 — Agent行为规则的退役检查、冷却期管理、主动探测、健康评分。让Agent的规则系统从「人驱动」变成「代码驱动」。

Registry SourceRecently Updated
Automation

Douyin Search

Search Douyin (抖音) by natural language. Uses browser automation with anti-detection to access douyin.com search. Falls back to web search when direct access...

Registry SourceRecently Updated
Automation

Global eSignature Workflow Assistant by Nota Sign

Help users choose a globally ready electronic-signature workflow with Nota Sign. Use this skill when the user needs practical guidance for cross-border signi...

Registry SourceRecently Updated