Add support for post-run hooks to execute custom scripts after each task

Resolved 💬 3 comments Opened Nov 29, 2025 by ffbdm Closed Nov 29, 2025

What feature would you like to see?

I would like to request a new feature for the Codex CLI: native post-run hooks that allow users to automatically execute a command or script whenever a Codex task finishes.

Currently, the CLI does not provide any official mechanism to trigger actions after a task completes. The only workaround today is to manually chain commands using && (e.g., codex "task" && ./script.sh) or to create custom wrapper commands in settings.json, but these are partial solutions and do not offer the convenience or reliability of a built-in post-run hook system.

Why this is useful:

Post-run hooks would enable automation for multiple scenarios, such as:

Playing a notification sound when Codex finishes a long task

Triggering OS notifications

Running cleanup scripts or formatting tools

Logging task completions

Refreshing external services or triggering build processes

Performing actions conditionally based on task success or failure

This becomes especially valuable when Codex is used for long-running operations, full-file rewrites, refactors, or code generation workflows — situations where the user wants an automatic side effect when the job is done.

Thank you for considering this! Let me know if I can help clarify use cases or testing scenarios.

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗