native-scheduler
The native-scheduler plugin lets OpenClaw agents manage OS-level scheduled jobs — launchd on macOS, systemd timers on Linux, cron as a fallback, and Windows Task Scheduler on Windows.
Why native scheduling?
OpenClaw's built-in cron system runs tasks through the agent loop, consuming LLM tokens on every tick. For deterministic scripts (health checks, notifications, data collection), that's wasteful. native-scheduler runs scripts directly through the OS scheduler and only invokes the agent when the script's output demands it.
How it works
- The agent calls the
native_schedulertool with anupsertaction and a job definition. - The plugin materializes a wrapper runner script that handles stdin/stdout contract enforcement, health tracking, and failure callbacks.
- The wrapper + job are registered with the platform's native scheduler.
- On each trigger, the wrapper pipes a
NativeSchedulerRunContextto the script's stdin and parses the script's stdout as aNativeSchedulerResult. - Based on the result type (
noop,prompt, ormessage), the wrapper either does nothing, triggers an agent session, or delivers a message directly to a channel — all without burning tokens for the decision logic.
Key features
- Cross-platform: launchd, systemd, cron, Windows Task Scheduler
- Typed script contract: Scripts receive structured input and return structured output via
@spectratools/native-scheduler-types - Zero-token message delivery:
messageresults go directly to channels without an LLM turn - Health tracking: Per-job health files with success/failure counts, streaks, and timestamps
- Failure callbacks: Configurable actions on script crash or timeout (run a command or fire an OpenClaw event)
- 12 tool actions: Full lifecycle management from the agent
Next steps
- Script Contract — Input/output types your scripts must follow
- Tool Actions — All 12 actions with parameters
- Examples — Annotated example scripts
- Platform Support — Backend-specific notes