Back to catalog

cron-prompt-patterns

Cron prompt guardrails against LLM over-generation.

Category ⚡ Productivity
Version v1.0.0
cronpromptsschedulingguardrails

Cron Prompt Patterns

Lessons from real cron jobs that went wrong. Apply these when authoring or editing cron job prompts via cronjob(action='create') or cronjob(action='update').

The Over-Helpfulness Problem

LLM agents generating files will pattern-match existing directory structures and "helpfully" create files where they shouldn't. If a cron prompt says "write to auto/" but the agent sees a sibling curated/ directory with similar files, it may create files in curated/ too — even though the prompt never asked for it.

This is the #1 cron prompt failure mode. The agent interprets the task as "produce a complete output" rather than "produce output in this exact location."

Rule: Always Add Negative Constraints Next to Write Instructions

Wherever the prompt tells the agent to write a file, add an explicit "DO NOT" immediately after:

3. Write the auto-weekly retro to retros/auto/YYYY/YYYY-WXX.md ...

   ⚠️ DO NOT write anything to retros/curated/. That directory is reserved for Joseph's hand-written retros only.

Why this works

  • LLMs weight instructions by proximity. A "DO NOT" right next to the write instruction overrides the general pattern-matching impulse.
  • Vague constraints ("only write to auto") are weaker than explicit prohibitions ("DO NOT write to curated").
  • The reason ("reserved for Joseph's hand-written retros") gives the agent a semantic anchor for why the constraint exists, which improves compliance.

Checklist for Any Cron Prompt That Generates Files

1. Name the exact output path — not a directory, the full file pattern (auto/YYYY/YYYY-WXX.md).

2. Add a ⚠️ DO NOT guard for every sibling directory the agent could see but should never write to.

3. State who owns the forbidden path — "reserved for Joseph's hand-written X" is stronger than "don't write there."

4. Review the prompt from the agent's perspective — if you removed the negative constraint, would the agent still only write to the right place? If not, the guard is necessary.

Example: Retro Prompt Guard

Bad:

> Write the weekly retro to retros/auto/YYYY/YYYY-WXX.md.

Good:

> Write the weekly retro to retros/auto/YYYY/YYYY-WXX.md.

>

> ⚠️ DO NOT write anything to retros/curated/. That directory is reserved for Joseph's hand-written retros only.

Related Pitfalls

  • Implicit scope expansion: Agent sees monthly/, quarterly/, yearly/ subdirectories and decides to generate those too, even if the prompt only asked for weekly. Add: "Generate ONLY the weekly file. Do not create monthly, quarterly, or yearly files."
  • Template mimicry: Agent copies the structure of existing files (headers, sections) rather than following the prompt's specified structure. Pin down the exact output format in the prompt.
  • "Completing" the picture: Agent adds a README or index file to a directory because it "looks incomplete." Guard against this if the directory management is someone else's job.