Setting Up Automated Cron Jobs with OpenClaw Heartbeat.md | Alpha | PandaiTech

Setting Up Automated Cron Jobs with OpenClaw Heartbeat.md

How to configure the heartbeat.md file to run background tasks automatically every 30 minutes, such as auto-updating daily to-do lists and performing memory maintenance.

Learning Timeline
Key Insights

Managing Token Usage (Usage Limits)

Ensure the instructions in the heartbeat file are not too long or complex. Since it runs continuously every 30 minutes, large instructions will consume your API usage limits very quickly.

Workflow Personalization Tips

Customize the content of heartbeat.md to suit your daily needs. While 'memory maintenance' is highly useful, adding a 'cron health check' is also recommended to ensure the system runs smoothly without errors.
Prompts

Heartbeat Automation Instruction Example

Target: OpenClaw (heartbeat.md)
Analyze my recent activity logs and update my to-do list automatically. Mark tasks as done if they were completed in the last 30 minutes and highlight the next priority items for my current session.

Memory Maintenance Prompt

Target: OpenClaw (heartbeat.md)
Perform memory maintenance by summarizing key takeaways from recent interactions. Prune redundant data and organize the long-term memory to keep the context window efficient.
Step by Step

Configuring the heartbeat.md File for Cron Job Automation

  1. Access your OpenClaw project's root directory.
  2. Locate the file named 'heartbeat.md' in the project file list.
  3. Open the 'heartbeat.md' file using your preferred text editor (such as VS Code or Cursor).
  4. Enter the specific instructions or tasks you want the AI to run automatically every 30 minutes (e.g., memory maintenance or auto-updating your to-do list).
  5. Save the changes to the file.
  6. Run or re-trigger your OpenClaw system to ensure the heartbeat file starts operating on its scheduled cycle.

More from Build & Deploy Autonomous AI Agents

View All