Skip to content

Add task scheduler and heartbeat for autonomous operation #1

Closed

Description

@melvincarvalho

Problem

The MCP schedule_task tool writes task IPC files, but nothing on the host executes scheduled tasks — the loop is incomplete. jsclaw also has no equivalent of openclaw's heartbeat, the periodic wake-up that makes an agent autonomous rather than purely reactive.

Proposal (Phase 1 of openclaw parity)

New zero-dependency host-side modules:

  • src/cron.js — minimal 5-field cron expression parser (* , - / support)
  • src/task-store.js — JSON file-backed task persistence with atomic writes; writes current_tasks.json snapshots into group folders so the list_tasks MCP tool works
  • src/task-scheduler.js — polls for due tasks, executes them via a consumer-provided runner, computes next run (cron/interval/once), logs runs
  • src/heartbeat.js — periodic agent wake reading HEARTBEAT.md from the group folder, HEARTBEAT_OK suppression, quiet hours, manual trigger
  • Default IPC task handler wiring schedule_task / pause_task / resume_task / cancel_task into the task store

Config additions: schedulerPollInterval, heartbeatInterval, plus JSCLAW_* env vars.

Ships as v0.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions