GitHub - Mineru98/codex-cron-skill: Cron for your Codex prompts — loop or schedule any codex exec job locally. A Codex plugin bundling loop + schedule skills.
Key Points
- 1Codex Cron is a terminal-based utility that enables the scheduling and looping of Codex prompts through two specific skills: loop for fixed intervals and schedule for cron-based or one-shot executions.
- 2The tool ensures operational reliability by implementing a single-runner lock mechanism to prevent duplicate executions and a safety allowlist that restricts potentially dangerous sandbox flags.
- 3Designed as a local-first alternative to cloud-based automations, it supports flexible delivery methods including tmux integration, custom command hooks, and standard execution for seamless development workflows.
Codex Cron is a terminal-native, zero-dependency plugin for the Codex development environment designed to provide scheduled execution of Codex prompts. Unlike standard Codex runs, which execute once, Codex Cron enables repeating tasks via a local daemon, utilizing an atomic locking mechanism to prevent race conditions and duplicate executions.
Core Functionality and Architecture
The tool provides two primary skill modules:loop: Manages tasks based on fixed intervals (e.g., , , ).schedule: Manages tasks based on standard 5-field cron expressions or absolute ISO-8601 timestamps using the--atflag.
These skills are managed by a daemon that oversees a state root directory (e.g., .codex/loop/ or .codex/schedule/). The state is managed through an atomic read-write cycle where tasks are updated in a tasks.json file using a temporary-file-and-rename pattern, ensuring data integrity.
Technical Methodology
- Single-Runner Lock: To prevent concurrent execution (double-firing), the system implements an atomic lock using a
mkdiracquisition strategy combined with a compare-and-swap mechanism. If a daemon crashes, the lock is recovered safely rather than being forcibly deleted, preventing orphaned processes. - Execution Runners: When a prompt is due, the system routes the execution through three hierarchical modes:
tmux-send: Injects the prompt directly into a specified tmux pane.resume-command: Executes a local hook with the prompt piped tostdin.codex-exec: Falls back to a standard Codex execution environment if the former methods are unavailable.
- Security: The plugin enforces a default-deny allowlist for all
codex-argpassthroughs. Potentially dangerous flags (e.g.,--sandbox danger-full-accessor--full-auto) are explicitly stripped to prevent sandbox escalation or config-bypass attacks. - Logging and Observability: Unlike basic logging, Codex Cron preserves full output logs in files, ensuring that exit codes are preserved and preventing the truncation often found in standard capture systems.
Management Commands
Users interact with the system through CLI commands:add/cancel/list: CRUD operations on scheduled tasks.daemon: The main process that polls for due tasks. The polling interval can be tuned via--poll-ms.doctor: A read-only diagnostic utility that validates the state root, lock status, and local environment configuration.
The implementation relies strictly on Node.js ESM and node:test, deliberately avoiding OS-level scheduling (like cron or launchd) to remain contained within the user's terminal session and shell environment. All execution states are local-only and are intended to be excluded from version control systems.