openclaw - 💡(How to fix) Fix [Feature]: Allow cron agentTurn prompts to load from files [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#58834Fetched 2026-04-08 02:32:08
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Allow cron agentTurn jobs to load payload.message from a file instead of requiring the full prompt inline in jobs.json.

Root Cause

My preference would be an explicit field like messageFile because it is clearer and easier to validate.

Code Example

{
  "payload": {
    "kind": "agentTurn",
    "messageFile": "/path/to/prompt.md"
  }
}

---

{
  "payload": {
    "kind": "agentTurn",
    "messageFile": "prompts/meeting_intake.md"
  }
}
RAW_BUFFERClick to expand / collapse

Summary

Allow cron agentTurn jobs to load payload.message from a file instead of requiring the full prompt inline in jobs.json.

Problem to solve

Right now cron jobs require the full payload.message to be embedded as a plain string in the job definition. That gets awkward quickly for larger prompts, especially when jobs are doing non-trivial agent work.

In practice this creates a few problems:

  • long prompts are hard to read and maintain inside jobs.json
  • prompt edits require rewriting the job definition instead of just editing a file
  • prompt text is harder to version, diff, and review cleanly
  • it encourages duplicated prompt text across jobs
  • repo-based prompt files cannot be treated as the canonical source for scheduled job behavior

Current behavior is workable for short prompts, but for larger recurring workflows it becomes brittle and high-friction.

Proposed solution

Support a file-backed prompt option for cron agentTurn jobs.

A few possible designs:

Option A: explicit file field

Allow something like:

{
  "payload": {
    "kind": "agentTurn",
    "messageFile": "/path/to/prompt.md"
  }
}

Option B: relative file field

Allow repo/workspace-relative paths, for example:

{
  "payload": {
    "kind": "agentTurn",
    "messageFile": "prompts/meeting_intake.md"
  }
}

Option C: inline string with file include semantics

Allow payload.message to accept a file reference format such as @prompts/meeting_intake.md.

My preference would be an explicit field like messageFile because it is clearer and easier to validate.

Expected behavior:

  • when the job runs, OpenClaw reads the file contents and uses that as the message
  • support either absolute paths or well-defined relative paths
  • fail clearly if the file does not exist or cannot be read
  • ideally preserve backward compatibility with existing inline message jobs
  • ideally define precedence if both message and messageFile are present

Alternatives considered

  • Keep embedding the full prompt inline in payload.message
    • works, but becomes hard to maintain for larger jobs
  • Keep a short inline prompt that tells the agent to read a file at runtime
    • workable, but indirect and less ergonomic than native support
    • pushes prompt-loading behavior into the agent layer instead of the scheduler config layer
  • Use external tooling to regenerate cron jobs whenever prompt files change
    • possible, but unnecessary complexity for something that feels like a natural scheduler capability

Impact

Affected: Users building larger scheduled agent workflows, especially repo-backed knowledge or automation systems Severity: Medium Frequency: Frequent for non-trivial cron jobs Consequence: Extra manual work, harder prompt maintenance, worse diffs/review, and more brittle scheduler configuration

This is especially noticeable when cron jobs are effectively running reusable operational workflows and the actual prompt should live in version-controlled files alongside the repo.

Evidence/examples

Concrete use case: scheduled jobs for a product/docs knowledge system where the prompts are long, frequently edited, and logically belong in versioned repo files.

Examples of jobs where this would help:

  • meeting intake / routing jobs
  • issue reconciliation jobs
  • research consolidation jobs
  • weekly knowledge sweep jobs

In these cases the natural source of truth is a prompt file in the repo, but the current cron schema forces the prompt into the job JSON.

Additional information

A native file-backed prompt option would pair well with existing workspace/repo-centric OpenClaw usage.

Even limited support for agentTurn.messageFile would be a big quality-of-life improvement, as long as the behavior is explicit and validation/errors are clear.

extent analysis

TL;DR

Implement a messageFile field in the cron job definition to allow loading payload.message from a file instead of requiring it to be embedded inline.

Guidance

  • Introduce a new field messageFile in the payload object to support file-backed prompts, allowing for either absolute or relative paths.
  • Define clear precedence rules when both message and messageFile are present in the job definition to avoid ambiguity.
  • Implement error handling to fail clearly if the specified file does not exist or cannot be read, ensuring robustness.
  • Consider preserving backward compatibility with existing inline message jobs to minimize disruption to current workflows.

Example

{
  "payload": {
    "kind": "agentTurn",
    "messageFile": "/path/to/prompt.md"
  }
}

This example illustrates how the messageFile field could be used to reference a prompt file.

Notes

The implementation should balance flexibility with clarity and validation to ensure the new feature is both useful and easy to use. It's also important to document the expected behavior and any limitations clearly.

Recommendation

Apply a workaround by introducing a messageFile field, as it directly addresses the issue of cumbersome inline prompts and aligns with the proposed solution, offering a more manageable and version-controlled approach to prompt management.

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