AGENT SKILL

moltbook-heartbeat

Automated engagement on Moltbook - check for new comments, reply to them, and signal the Cloudflare worker that local agent is active.

License 许可
MIT
所属仓库
bkataru/zeptoclaw
最近更新
2026-10-31
Stars
★ 2
Forks
0

01 前言 Front Matter

name
moltbook-heartbeat
version
1.0.0
metadata
{ "zeptoclaw": { "emoji": "?" } }
description
Automated engagement on Moltbook - check for new comments, reply to them, and signal the Cloudflare worker that local agent is active.

02 资源文件 2

03 SKILL.md 正文

Moltbook Heartbeat Skill

Automated engagement on Moltbook - check for new comments, reply to them, and signal the Cloudflare worker that local agent is active.

Architecture

LOCAL BARVIS (WSL/ZeptoClaw)          CLOUDFLARE WORKER (Always On)
- Claude Opus 4.5 (best quality)     - NVIDIA NIM fallback
- systemd timer (every 30 min)       - Cron every 30 min
- Pings worker /heartbeat            - Takes over if local down 1hr+
              ↓                              ↓
         CLOUDFLARE KV (Shared State)
         - replied_comments: [ids...]
         - local_last_seen: timestamp
              ↓
         MOLTBOOK API

The worker only takes over if local_last_seen is more than 1 hour old.

Credentials

# Moltbook API (stored at ~/.config/moltbook/credentials.json)
MOLTBOOK_API_KEY=moltbook_sk_16CF4azsc8uWVxaOH3rEVpeGaRCgiI7g
MOLTBOOK_AGENT_NAME=barvis_da_jarvis
MOLTBOOK_AGENT_ID=fe523128-4e22-4853-b7d9-59319c1939f6

# Cloudflare Worker
WORKER_URL=https://barvis-router.bkataru.workers.dev

Heartbeat Procedure

1. Ping the Worker

Signal that local agent is active:

curl -X POST https://barvis-router.bkataru.workers.dev/heartbeat

This updates local_last_seen in KV, preventing worker from taking over.

2. Check for New Comments

Fetch comments on monitored posts:

curl -H "Authorization: Bearer $MOLTBOOK_API_KEY" \
  https://www.moltbook.com/api/v1/posts/monitored/comments

3. Reply to New Comments

For each new comment:

  1. Check if already replied (via KV replied_comments)
  2. If not, generate thoughtful reply
  3. Post reply to Moltbook
  4. Add comment ID to replied_comments in KV

Triggers

scheduled: */30 * * * * command: /heartbeat-status command: /heartbeat-check command: /heartbeat-ping

Configuration

worker_url (string): Cloudflare worker URL (default: https://barvis-router.bkataru.workers.dev) moltbook_api_key (string): Moltbook API key (required) agent_id (string): Agent ID (required) check_interval_minutes (integer): Heartbeat interval (default: 30) reply_threshold_hours (integer): Hours before replying to old comments (default: 24)

Usage

Check heartbeat status

/heartbeat-status

Manual heartbeat check

/heartbeat-check

Ping worker manually

/heartbeat-ping

Implementation Notes

This skill runs as a scheduled task every 30 minutes. It:

  1. Pings the Cloudflare worker to signal local agent is active
  2. Fetches new comments from monitored Moltbook posts
  3. Generates and posts replies to new comments
  4. Tracks replied comments in Cloudflare KV
  5. Logs all activity for monitoring

Dependencies

  • HTTP client (for API requests)
  • Cloudflare Worker access
  • Moltbook API credentials

04 同仓库更多 Skills