Skip to content

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

Closed

Description

@ffbdm

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

Activity

  1. ffbdm commented on Nov 29, 2025

    @ffbdm
    Author

    Closing in favor of #3962.

  2. etraut-openai commented on Nov 29, 2025

    @etraut-openai
    Contributor

    I think we have this covered already. Refer to this documentation for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions