Cron Gate for Openclaw

A zero-token Python gatekeeper that prevents expensive LLM crons from running unless new session activity is detected for your Openclaw Skills.

ori-claw
v1.0.0
Mar 3, 2026
0
818
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install cron-gate

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install cron-gate using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Cron Gate?

Cron Gate is a specialized optimization utility designed to prevent the unnecessary consumption of LLM tokens in automated workflows. In many deployments of Openclaw Skills, scheduled tasks (crons) wake up LLM sessions periodically to process data. Even when there is no new activity, these sessions burn thousands of tokens on prompt loading, tool calls, and environment setup. This skill provides a lightweight, pure-Python logic layer that acts as a sentinel.

By sitting between the system crontab and the LLM gateway, Cron Gate ensures that expensive model calls are only executed when genuine updates are found. This approach aligns with modern DevOps practices by implementing a 'check cheap, wake expensive' philosophy, making your Openclaw Skills significantly more cost-effective without sacrificing responsiveness.

Cron Gate Use Cases

  • Reducing token burn for memory integration tasks across multiple chat sessions.
  • Gating email or notification checks so the LLM only triggers when unread messages exist.
  • Optimizing social media monitoring rounds where updates may be infrequent.
  • Managing high-frequency periodic tasks that only need LLM intervention on specific data triggers.

How Cron Gate Works

  1. A system-level cron job executes the lightweight Python gate script at zero LLM cost.
  2. The script scans the local sessions metadata to identify the updatedAt timestamps for configured sessions.
  3. It compares these timestamps against a persistent state file that records the last time each specific cron was triggered.
  4. If new activity is detected since the last run, the script sends a request to the Openclaw Skills gateway API to trigger the associated cron.
  5. If no new activity is found, the script exits silently, ensuring no LLM tokens are consumed for idle sessions.

Cron Gate Setup

Follow these steps to integrate the gatekeeper into your environment:

  1. Copy the gate script to your scripts directory:
cp gate.py /opt/scripts/cron-gate.py
chmod +x /opt/scripts/cron-gate.py
  1. Configure your session-to-cron mapping in the SESSION_CRONS dictionary within the script. You can find your session keys in ~/.openclaw/agents/main/sessions/sessions.json.

  2. Disable the original scheduled crons within the agent to prevent them from firing automatically:

/cron update <cron-id> enabled=false
  1. Add entries to your system crontab (crontab -e) to run the gate script at your preferred intervals:
# Example for an evening check
5 6 * * * /usr/bin/python3 /opt/scripts/cron-gate.py evening >> /var/log/cron-gate.log 2>&1

Cron Gate Data Schema & Taxonomy

The skill utilizes two primary data structures to manage the gating logic efficiently:

File Name Description Key Metadata
sessions.json The core Openclaw Skills session registry. updatedAt, sessionKey, interactionCount
cron-gate-state.json A local persistence file tracking trigger history. lastTriggeredAt, status, cronIdMapping

Cron Gate Advanced Features

  • Dry Run Mode: Test your configuration and see which crons would trigger without actually calling the API.
  • Time Window Overrides: Manually force morning or evening slots via command-line arguments to bypass UTC window detection.
  • Flexible State Management: Easily reset the trigger history by deleting the state JSON to re-sync all sessions.
  • Multi-Agent Support: Can be configured to monitor session activity across different agent profiles simultaneously.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*