Skip to content

Scheduled Recurring Automations

Every morning you open Slack to find three new bug reports from overnight users. You spend the first hour of your day just triaging — reproducing issues, locating relevant code, and prioritizing fixes. Codex automations can do this triage for you while you sleep, presenting you with a curated inbox of findings (and sometimes fixes) when you sit down at your desk.

  • A step-by-step guide to creating, testing, and scheduling local tasks in ChatGPT desktop
  • Three production-ready automation recipes: bug fix triage, daily briefings, and skill creation
  • Security configuration that keeps automations safe even when running unattended
  • Cleanup strategies that prevent worktree sprawl from frequent automation runs

The April 30, 2026 release added persistent /goal workflows — a first-class API for long-running, stateful objectives that survive across sessions. Unlike Claude Code’s /goal (which is session-scoped and clears on /clear), Codex’s /goal round-trips through the app-server and can be paused, inspected, and resumed from a different machine.

In current Codex, persisted goals and automatic continuation are stable and enabled by default. Use codex features list to verify the installed build; codex features disable goals is an explicit opt-out, not a setup prerequisite.

Terminal window
# Set a goal that persists across resume
codex
> /goal every TODO in src/billing/ is resolved or stop after 25 turns
# Later, from a different terminal — resume is a subcommand, not a flag
codex resume <thread-id> # or: codex resume --last
# Goal is still active; turn count, condition, evaluator history all preserved

TUI controls (CLI v0.128+):

CommandAction
/goal <cond>Set or replace the active goal
/goalShow status (condition, turns, tokens, evaluator’s last reason)
/goal pausePause without clearing; preserves state for codex resume
/goal resumeResume a paused goal
/goal clearClear the active goal

Goals integrate with MultiAgentV2 (also v0.128+): a parent agent can set a goal that subagents work toward as a stable target rather than receiving per-turn directives.

Fit: Multi-step migrations, daily maintenance loops, long-running QA passes, content/docs pipelines, multi-agent work that needs a stable target.

CLI v0.129.0 (May 7, 2026) added a /hooks browser inside the TUI — comprehensive plugin and hook management with workspace sharing, share access controls, source filtering, and local share-path tracking. Hooks also gained pre/post-compaction execution, so you can run cleanup or validation when the model compacts conversation context.

Terminal window
# Inside the TUI
/hooks
# Lists all configured hooks, lets you toggle/edit/share

Hooks are stable as of v0.124 and configurable inline in config.toml and requirements.toml.

CLI v0.128.0 made MultiAgentV2 explicit and configurable instead of silently unbounded. The [multi_agent_v2] table exposes settings such as a cap on parallel subagents, a minimum delay between dispatches, a maximum spawn depth, and hints for which roots and subagent classes prefer v2. Confirm the exact key names against the current config reference before you commit them, since the surface is still evolving:

# config.toml — keys are illustrative; verify against the config reference
[multi_agent_v2]
thread_caps = 8 # max parallel subagents
wait_time_ms = 250 # min delay between dispatches
max_depth = 3 # how deep subagents can spawn subagents

Pair with permission profiles (also v0.128) to give different subagent classes different sandbox profiles.

This guide focuses on local scheduled tasks in ChatGPT desktop. The app must be running and the selected project available on disk. ChatGPT web can also create and manage scheduled tasks, but web runs cannot work directly in a folder on your computer. For Git repositories, choose a dedicated worktree when you want isolation from the main checkout.

Results appear in the Triage section of your sidebar inbox. If an automation finds nothing to report, it auto-archives. If it finds something actionable, it lands in your inbox as an unread item.

  1. Create the automation by clicking the Automations section in the sidebar and defining a schedule and prompt.

  2. Test the prompt manually first. Start a regular thread with the same prompt and verify the results are useful and scoped correctly.

  3. Configure the schedule — hourly, daily, weekly, or custom cron-style intervals.

  4. Review the first few runs closely. Adjust the prompt or cadence based on the quality of results.

  5. Combine with skills by using $skill-name in your automation prompt for structured, repeatable workflows.

Recipe 1: Automatic Bug Fix from Your Own Commits

Section titled “Recipe 1: Automatic Bug Fix from Your Own Commits”

First, create a skill that finds and fixes bugs from your recent changes:

---
name: recent-code-bugfix
description: Find and fix a bug introduced by the current author
within the last week. Root cause must map directly to the
author's own changes.
---
# Recent Code Bugfix
1. Use git log --since=1.week --author=<author> to find recent changes
2. Look for failures in tests, lint, or runtime errors tied to those changes
3. Implement a minimal fix following project conventions
4. Run the smallest relevant verification step
5. Report the root cause, fix, and verification

Then create an automation with this prompt:

Check my commits from the last 24h and submit a $recent-code-bugfix.
Scan package.json, Cargo.toml, and requirements.txt for dependencies
with known CVEs. For each vulnerable dependency, check if a patched
version exists that is compatible with our version constraints. If a
safe upgrade path exists, update the dependency and run the test suite.
Report all findings with severity levels.
Scan all of the ~/.codex/sessions files from the past day. If there
have been any issues using particular skills, update the skills to be
more helpful. If we've been doing something often that we should save
as a skill, create it. Only update skills if there's a good reason.
Let me know if you make any.

Automations run unattended, so security settings matter more than for interactive threads:

Sandbox ModeRisk LevelRecommendation
Read-onlyLowestGood for reporting and analysis automations
Workspace-writeMediumRecommended for most automations; allows file edits within the project
Full accessHighestAvoid for automations; the agent can modify files, run arbitrary commands, and access the network without asking

Scheduled tasks run unattended with your default sandbox settings. Start with the narrowest sandbox that succeeds; approvals and sandboxing are separate, and managed requirements can further restrict both.

Frequent automations create many worktrees. Without cleanup, this eats disk space fast. Best practices:

  • Archive automation runs you have already reviewed
  • Do not pin automation runs unless you intend to keep the worktree permanently
  • ChatGPT desktop keeps the 15 most recent Codex-managed worktrees by default; adjust retention in Worktree settings
  • A snapshot is saved before cleanup so you can restore later if needed
  • Local scheduled task does not run: ChatGPT desktop must be running and your computer awake. Enable “Prevent sleep while running” for overnight local tasks; web tasks have separate cloud availability and context.
  • Results are too noisy: The prompt is too broad. Narrow the scope — specify exact directories, file patterns, or timeframes.
  • Automation modifies wrong files: Check your sandbox mode. Read-only mode prevents accidental edits. Use workspace-write with explicit rules for what the automation should be allowed to change.
  • Worktrees pile up: Archive old runs and unpin automations that are no longer needed. Check $CODEX_HOME/worktrees for orphaned directories.
  • Worktrees — Understand the worktree system that automations rely on
  • ChatGPT Desktop Codex Mastery — Skills, multi-project management, and the full ChatGPT desktop workflow in Codex mode
  • Cost Management — Automations consume credits; learn to budget them effectively