openclaw - 💡(How to fix) Fix Agent prefers system crontab over built-in cron tool — needs system prompt guidance [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#54341Fetched 2026-04-08 01:28:44
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

  • Warn the agent: "Detected crontab usage. Consider using the built-in cron.add tool instead."

Root Cause

  1. No system prompt guidance: OpenClaw injects the cron.add tool schema but does not include any instruction telling the model to prefer it over exec + crontab
  2. LLM training bias: Models have seen millions of crontab examples vs near-zero OpenClaw cron examples, so crontab is the default instinct
  3. exec is a universal escape hatch: The model can accomplish "set a timer" via exec using familiar Linux knowledge, bypassing the purpose-built tool

Fix Action

Fix / Workaround

Current Workaround

Code Example

For scheduled tasks, reminders, and recurring jobs, use the built-in cron tool 
(cron.add / cron.update / cron.remove). Do not use exec with system crontab.

---

"This is the recommended way to create scheduled tasks. Do not use system crontab via exec."

---

## Scheduling Rules
- Always use OpenClaw built-in cron (cron.add), never use system crontab
- Set delivery.mode="announce" with channel and target for notifications
- Always specify timezone with --tz
RAW_BUFFERClick to expand / collapse

Problem

When a user asks an agent to set up a scheduled task (e.g., "remind me every day at 8am"), the agent consistently uses exec("crontab -e ...") instead of the built-in cron.add tool.

This leads to:

  • Environment issues: crontab runs with minimal PATH/HOME, causing openclaw CLI commands to fail silently
  • No delivery: system crontab has no integration with OpenClaw delivery (announce/webhook), so users never receive notifications
  • Management fragmentation: tasks split between crontab -l and openclaw cron list
  • Shell compatibility: scripts may fail due to sh vs bash differences (e.g., set -o pipefail)

Root Cause

  1. No system prompt guidance: OpenClaw injects the cron.add tool schema but does not include any instruction telling the model to prefer it over exec + crontab
  2. LLM training bias: Models have seen millions of crontab examples vs near-zero OpenClaw cron examples, so crontab is the default instinct
  3. exec is a universal escape hatch: The model can accomplish "set a timer" via exec using familiar Linux knowledge, bypassing the purpose-built tool

Expected Behavior

When a user requests a scheduled task, the agent should:

  1. Use cron.add (built-in cron tool) by default
  2. NOT use exec("crontab ...") for scheduling

Suggested Fix

Option A: Auto-inject system prompt guidance (minimal, recommended)

When cron tools are available, automatically include in the system prompt:

For scheduled tasks, reminders, and recurring jobs, use the built-in cron tool 
(cron.add / cron.update / cron.remove). Do not use exec with system crontab.

This is zero-config for users and solves the problem at the source.

Option B: exec-layer detection (defense in depth)

Detect crontab in exec commands and either:

  • Warn the agent: "Detected crontab usage. Consider using the built-in cron.add tool instead."
  • Or block with a redirect message

Option C: Improve cron tool schema description

Add to the cron.add tool description:

"This is the recommended way to create scheduled tasks. Do not use system crontab via exec."

Ideal: Combine A + C

Auto-inject guidance in system prompt AND improve tool schema description. This provides both proactive guidance and in-context reinforcement.

Current Workaround

Users must manually add guidance to their AGENTS.md or TOOLS.md:

## Scheduling Rules
- Always use OpenClaw built-in cron (cron.add), never use system crontab
- Set delivery.mode="announce" with channel and target for notifications
- Always specify timezone with --tz

Environment

  • OpenClaw v2026.3.13
  • Multiple agents affected (any agent with exec + cron tools available)
  • Models tested: Claude Opus 4.6 (Bedrock)

extent analysis

Fix Plan

To address the issue, we will implement Option A: Auto-inject system prompt guidance and Option C: Improve cron tool schema description. This approach provides both proactive guidance and in-context reinforcement.

Step-by-Step Solution

  1. Auto-inject system prompt guidance:
    • Add the following text to the system prompt when cron tools are available:
      For scheduled tasks, reminders, and recurring jobs, use the built-in cron tool 
      (cron.add / cron.update / cron.remove). Do not use exec with system crontab.
    • Example code snippet (in Python):
      def generate_system_prompt():
          prompt = ""
          # ... other prompt generation logic ...
          if cron_tools_available:
              prompt += "For scheduled tasks, reminders, and recurring jobs, use the built-in cron tool (cron.add / cron.update / cron.remove). Do not use exec with system crontab."
          return prompt
  2. Improve cron tool schema description:
    • Update the cron.add tool description to include:
      "This is the recommended way to create scheduled tasks. Do not use system crontab via exec."
    • Example code snippet (in Python):
      def get_cron_tool_description():
          return {
              "name": "cron.add",
              "description": "This is the recommended way to create scheduled tasks. Do not use system crontab via exec."
          }

Verification

To verify that the fix worked, test the following scenarios:

  • Create a new scheduled task using the agent.
  • Verify that the agent uses the built-in cron.add tool instead of exec("crontab ...").
  • Check that the task is successfully created and notifications are delivered as expected.

Extra Tips

  • Regularly review and update the system prompt guidance to ensure it remains relevant and effective.
  • Consider implementing Option B: exec-layer detection as an additional defense mechanism to detect and prevent crontab usage via exec.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING