Scheduling AI Agents for Night‑Shift Work: Turning Prompts into Reliable Loops
The article explains how to transform AI agents from single‑prompt responders into reliable night‑shift workers by defining clear goals, state files, evidence, and permission boundaries, using /goal, /loop and scheduled tasks, and provides concrete steps, examples, and a scheduling template for stable unattended execution.
Key Takeaways
Night‑time automation is valuable not because it saves money but because it moves repeatable, verifiable work into a low‑peak window.
An Agent must evolve from a one‑shot prompt to a loop‑based process that includes a goal, state, evidence, and permissions.
Four markdown files – GOAL.md, STATE.md, EVIDENCE.md, PERMISSIONS.md – capture the necessary information for unattended execution.
Teams should start with a small, low‑risk task, run it manually, then codify it with /goal and /loop before promoting it to a Routine or Skill.
Low‑Peak Window
Just as factories move batch jobs to off‑peak electricity periods, cloud compute also offers off‑peak pricing. For example, Qoder’s Qwen 3.7‑Max runs at 0.1× credits from 22:00 UTC to 08:00 UTC. Scheduling long‑running tasks to these windows reduces cost while keeping the work deterministic.
From Prompt to Loop
A prompt is a single model call; a loop is a structured process with a goal, state, checks, and stop conditions. Claude Code’s /goal defines a completion condition, while /loop schedules periodic checks. The evaluator only sees evidence that the Agent explicitly records; it cannot read files or run commands on its own.
prompt is a single model invocation;
loop is a process with goal, state, verification, and stop condition.Choosing Tasks for Unattended Execution
Suitable tasks have clear acceptance criteria, stable inputs, hand‑offable state, verifiable results, and low‑risk permissions. Examples include:
Adding missing tests, migrating APIs, checking links, gathering data, scanning issues.
Generating draft reports or source‑verified summaries.
Tasks that require high‑level judgment, extensive discussion, or irreversible actions (e.g., deleting data, sending production emails, making payments) should remain manual.
Four Essential Files
GOAL.md : Defines the objective, acceptance criteria, and boundaries.
STATE.md : Records current progress (done/blocked/needs‑me) and hand‑off information.
EVIDENCE.md : Stores test commands, exit codes, diffs, screenshots, CI links, and any failed items.
PERMISSIONS.md : Lists actions that can be automated, actions that need human approval, and actions that are prohibited.
Example GOAL.md for a billing module:
Goal: Add tests for refund, retry, and duplicate‑webhook cases.
Acceptance:
- <code>npm test -- billing</code> passes.
- No production logic changes unless a real bug is found.
- Draft patches are recorded but not merged automatically.
Boundaries:
- Do not modify DB schema.
- Do not touch payment‑provider configuration.
- Do not delete existing tests.Scheduling Sheet (Markdown Form)
Instead of a complex system, a simple markdown table can capture all required fields:
Task Name : What will run overnight.
Work Window : Start‑end time and maximum rounds.
Input Location : Code directory, issue link, or data source.
Completion Condition : When the task is considered done.
Check Command : How to verify the result.
Evidence Location : Path to EVIDENCE.md, PR, screenshots, CI links.
State Location : Path to STATE.md (or LOOP-STATE.md).
Permission Boundary : What can run automatically vs. what needs human sign‑off.
Stop Conditions : Consecutive failures, need for real credentials, or environment issues.
Morning Owner : Who reviews the results the next day.
Tool Selection
The three capabilities are not interchangeable but form a hierarchy: /goal – for long‑running tasks with a measurable end state. /loop – for periodic checks within a single session.
Routines – for persistent, schedule‑driven workflows (research preview).
Day‑time Handoff
Before leaving, engineers should prepare four pieces of information: what decisions were made, which tasks are handed to the Agent, which inputs are stable, the acceptance criteria, and which actions require human confirmation. This handoff replaces a vague “write a longer prompt” with concrete, actionable artifacts.
Morning Review Process
When the Agent finishes, the morning review follows a five‑minute checklist:
Inspect STATE.md for done/blocked/needs‑me entries.
Check EVIDENCE.md for test results, links, screenshots, and CI logs.
Review the diff for unexpected file changes.
Verify the permission list for any actions that need human approval.
Classify failures as input, permission, environment, or model‑logic issues.
If any of these items are missing, the task is considered incomplete and must be re‑run or fixed manually.
Final Thoughts
Successful night‑shift automation hinges on making work hand‑offable: clear goals, explicit state, verifiable evidence, and well‑defined permission boundaries. Start with a tiny, low‑risk task, iterate until the loop stabilizes, then promote the process to a Routine, Skill, or team‑wide workflow.
References
OpenAI – “Codex‑maxxing for long‑running work” (https://openai.com/index/codex-maxxing-long-running-work/)
OpenAI Whitepaper PDF (https://cdn.openai.com/pdf/8a9f00cf-d379-4e20-b06f-dd7ba5196a11/OAI_WhitePaper_Codex-maxxing26.pdf)
Jason Liu – “Codex‑maxxing” (https://jxnl.co/writing/2026/05/10/codex-maxxing/)
Claude Code Docs – Keep Claude working toward a goal (https://code.claude.com/docs/en/goal)
Claude Code Docs – Run prompts on a schedule (https://code.claude.com/docs/en/scheduled-tasks)
Claude Code Docs – Automate work with routines (https://code.claude.com/docs/en/routines)
Qoder Docs – Qwen 3.7 Discount Rates (https://docs.qoder.com/events/offpeakrate)
Addy Osmani – “Loop Engineering” (https://addyosmani.com/blog/loop-engineering/)
Armin Ronacher – “The Coming Loop” (https://lucumr.pocoo.org/2026/6/23/the-coming-loop/)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
