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.
What You’ll Walk Away With
Section titled “What You’ll Walk Away With”- A step-by-step guide to creating, testing, and scheduling automations in the Codex App
- 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
How Automations Work
Section titled “How Automations Work”Automations are scheduled Codex threads that run locally in the background. The Codex App must be running and the selected project must be available on disk. For Git repositories, each automation run starts in a dedicated worktree so it never interferes with your 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.
-
Create the automation by clicking the Automations section in the sidebar and defining a schedule and prompt.
-
Test the prompt manually first. Start a regular thread with the same prompt and verify the results are useful and scoped correctly.
-
Configure the schedule — hourly, daily, weekly, or custom cron-style intervals.
-
Review the first few runs closely. Adjust the prompt or cadence based on the quality of results.
-
Combine with skills by using
$skill-namein your automation prompt for structured, repeatable workflows.
Production-Ready Automation Recipes
Section titled “Production-Ready Automation Recipes”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-bugfixdescription: 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 changes2. Look for failures in tests, lint, or runtime errors tied to those changes3. Implement a minimal fix following project conventions4. Run the smallest relevant verification step5. Report the root cause, fix, and verificationThen create an automation with this prompt:
Check my commits from the last 24h and submit a $recent-code-bugfix.Recipe 2: Dependency and Security Scan
Section titled “Recipe 2: Dependency and Security Scan”Scan package.json, Cargo.toml, and requirements.txt for dependencieswith known CVEs. For each vulnerable dependency, check if a patchedversion exists that is compatible with our version constraints. If asafe upgrade path exists, update the dependency and run the test suite.Report all findings with severity levels.Recipe 3: Automatic Skill Creation
Section titled “Recipe 3: Automatic Skill Creation”Scan all of the ~/.codex/sessions files from the past day. If therehave been any issues using particular skills, update the skills to bemore helpful. If we've been doing something often that we should saveas a skill, create it. Only update skills if there's a good reason.Let me know if you make any.Security Configuration
Section titled “Security Configuration”Automations run unattended, so security settings matter more than for interactive threads:
| Sandbox Mode | Risk Level | Recommendation |
|---|---|---|
| Read-only | Lowest | Good for reporting and analysis automations |
| Workspace-write | Medium | Recommended for most automations; allows file edits within the project |
| Full access | Highest | Avoid for automations; the agent can modify files, run arbitrary commands, and access the network without asking |
Automations use approval_policy = "never" when your organization allows it. If your admin has restricted this, automations fall back to the approval behavior of your selected mode.
Worktree Cleanup for Automations
Section titled “Worktree Cleanup for Automations”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
- Codex auto-cleans worktrees older than 4 days or when you exceed 10 total
- A snapshot is saved before cleanup so you can restore later if needed
When This Breaks
Section titled “When This Breaks”- Automation does not run: The Codex App must be running and your computer must be awake. Enable “Prevent sleep while running” in App settings for overnight automations.
- 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/worktreesfor orphaned directories.
What’s Next
Section titled “What’s Next”- Worktrees — Understand the worktree system that automations rely on
- App Mastery — Skills, multi-project management, and the full App workflow
- Cost Management — Automations consume credits; learn to budget them effectively