The Two Architectures of Scheduled Automation
Automation in LLM systems often suffers from unnecessary complexity. The core decision for scheduled work in Codex boils down to thread management:
- Scheduled Tasks (Fresh Threads): These create a new thread for every execution. This is ideal for recurring jobs that are independent of previous outputs, such as daily summaries or status reports. Because each run is isolated, it prevents context bloat and ensures that the model operates on current data without being influenced by stale history.
- Scheduled Messages (Persistent Threads): These inject new inputs into an existing, ongoing thread. This is essential for iterative processes like PR monitoring or research tasks where the system must track progress, remember previous decisions, and identify changes over time. The thread acts as the stateful memory for the automation.
The Context Decision Rule
To determine the correct architecture, ask one question: If this ran tomorrow, would it need the earlier conversation?
If the answer is no, use a Scheduled Task. This requires a durable, self-contained prompt that provides all necessary instructions for a fresh start. If the answer is yes, use a Scheduled Message to maintain the continuity of the work. The schedule itself is secondary; the primary engineering concern is where the useful context should reside.
Automating the Workflow Selection
Rather than manually configuring these workflows, you can build a 'loop skill' to handle the classification. By providing a meta-prompt to the agent, you can force it to:
- Classify the request as a Task or Message based on the need for context.
- Identify missing parameters (frequency, stopping conditions, reporting triggers).
- Generate a durable prompt that remains effective across multiple executions.
This approach simplifies the development of complex automations by focusing on the state requirements of the job rather than the mechanics of the scheduler.