add-heartbeat
Skill91 starsChanged 7 months agoMITView on GitHub
Add a heartbeat system that periodically checks a HEARTBEAT.md checklist and only alerts the user when something needs attention. Inspired by OpenClaw's heartbeat pattern.
In this repository55 other files it gives its agents.
- ab-test-setupSkill
- ad-creativeSkill
- add-discordSkill
- add-gmail-agentSkill
- add-morning-briefingSkill
- add-slackSkill
- add-telegramSkill
- add-telegram-swarmSkill
- add-update-checkSkill
- add-voice-replySkill
- add-voice-transcriptionSkill
- ai-seoSkill
- analytics-trackingSkill
- churn-preventionSkill
- cold-emailSkill
- competitor-alternativesSkill
- content-strategySkill
- copy-editingSkill
- copywritingSkill
- customizeSkill
- debugSkill
- designSkill
- domain-checkSkill
- email-sequenceSkill
- form-croSkill
- free-tool-strategySkill
- get-qodo-rulesSkill
- launch-strategySkill
- marketing-ideasSkill
- marketing-psychologySkill
- migrate-memorySkill
- onboarding-croSkill
- page-croSkill
- paid-adsSkill
- paywall-upgrade-croSkill
- popup-croSkill
- pr-babysitterSkill
- pricing-strategySkill
- product-marketing-contextSkill
- programmatic-seoSkill
- qodo-pr-resolverSkill
- referral-programSkill
- revopsSkill
- run-ralphSkill
- sales-enablementSkill
- schema-markupSkill
- seo-auditSkill
- setup-ghostclawSkill
- setup-shared-folderSkill
- setupSkill
- signup-flow-croSkill
- site-architectureSkill
- social-contentSkill
- update-ghostclawSkill
- update-nanoclawSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Check if groups/main/HEARTBEAT.md exists.
- Distinctive: line 74
Use AskUserQuestion to ask:
- Distinctive: line 78
Update HEARTBEAT.md with their answers.
- Distinctive: line 82
Write an IPC task file to register the heartbeat:
- Distinctive: line 101
Wait for the next cron trigger (or manually create a test by adding a failing check to HEARTBEAT.md), then check logs:
- Distinctive: line 115
Check Gmail for emails from specific senders
- Distinctive: line 116
Check crypto prices via API
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Heartbeat
Adds a periodic heartbeat that wakes the agent on a cron schedule, runs through a checklist of cheap checks, and only messages the user if something needs attention.
What it does
- Creates
groups/main/HEARTBEAT.mdwith a template checklist - Registers a scheduled task that runs the heartbeat on a cron (default: every 30 minutes)
- The agent reads the checklist, runs each check, and stays silent if everything is fine
Setup
1. Create HEARTBEAT.md (if not exists)
Check if groups/main/HEARTBEAT.md exists. If not, create it with this template:
# Heartbeat Checks
Run these checks silently. Only message the user if something actually needs their attention.
## Checks
### 1. Error Log
\`\`\`bash
tail -20 ~/nanoclaw/logs/errors.log
\`\`\`
- Each line is JSON with a `"time"` field (Unix ms).
- Calculate cutoff: `Date.now() - (35 * 60 * 1000)`.
- **Ignore** any entry where `time < cutoff`. Don't mention ignored entries at all.
- If the file is empty or all entries are old, this check passes silently.
- If recent errors exist, summarise the actual problem in one line.
### 2. Runaway Processes
\`\`\`bash
ps aux -r | head -5
\`\`\`
- Check if any process is using >90% CPU.
- Chrome/agent-browser processes that have been running for hours are zombies — kill them:
\`\`\`bash
pkill -9 -f "agent-browser-chrome"
\`\`\`
- Alert the user: "Killed zombie Chrome process (was using X% CPU)."
- Also check load average (`uptime`). If load >4, mention it.
### 3. Disk Space
\`\`\`bash
df -h /
\`\`\`
- Alert if usage >80%. State the percentage and partition.
## Rules
- **Silent by default.** If everything is fine: `<internal>All checks passed</internal>` — nothing else.
- **Never explain your reasoning.** Just do the checks and report problems.
- **Never report old/filtered entries.** If an entry is too old, pretend it doesn't exist.
- When alerting, state the problem in plain English, one or two lines max.
- Don't repeat alerts already visible in recent conversation history.2. Ask the user
Use AskUserQuestion to ask:
- How often should the heartbeat run? (Every 30 minutes / Every hour / Every 2 hours)
- Any specific checks to add? (URLs to ping, services to monitor, etc.)
Update HEARTBEAT.md with their answers.
3. Register the scheduled task
Write an IPC task file to register the heartbeat:
mkdir -p data/ipc/main/tasks
cat > "data/ipc/main/tasks/heartbeat_$(date +%s).json" << 'EOF'
{
"type": "schedule_task",
"prompt": "Read $GHOSTCLAW_GROUP_DIR/HEARTBEAT.md (or ./HEARTBEAT.md in the current directory) and run each check listed. Only message the user if something needs attention. If everything is fine, respond with <internal>All checks passed</internal> and nothing else.",
"schedule_type": "cron",
"schedule_value": "*/30 * * * *",
"context_mode": "isolated"
}
EOFAdjust the cron value based on the user's preference.
4. Verify
Wait for the next cron trigger (or manually create a test by adding a failing check to HEARTBEAT.md), then check logs:
grep -i "heartbeat\|All checks passed" ~/nanoclaw/logs/ghostclaw.log | tail -5Customisation
Users can edit HEARTBEAT.md at any time to add, remove, or modify checks. The agent reads it fresh each time. No restart needed.
Examples of checks to add:
curl -s https://yoursite.com -o /dev/null -w '%{http_code}'— website uptimegh pr list --state open --repo yourorg/yourrepo— open PRscat /path/to/some/log | grep ERROR | tail -5— application errors- Check Gmail for emails from specific senders
- Check crypto prices via API
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

