feat: watch mode

Resolved 💬 0 comments Opened Apr 22, 2025 by stefanoamorelli Closed Nov 27, 2025

Currently, when using Codex, I have to switch between my editor and the CLI running Codex to type out my prompts. This tends to create micro-interruptions and disrupt my flow.

Proposed solution

Add a watch mode with a simple flag --watch that monitors file changes in the codebase for special comment patterns like:

// Fix this bug, AI!
  function brokenFunction() {
    // code with issues
  }

When Codex sees a new comment with "AI!" or "AI?" at the end, it automatically:

  • Grabs context from the surrounding code
  • Processes the request
  • Shows the response in the CLI

NB: This functionality is already implemented by other agentic CLI tools such as aider, and users have shown an appetite for it in other ones (ie. Claude code)

Benefits

  • Leverage Codex while staying in your editor - just add a comment
  • No context switching required
  • Flexible as it supports any IDE

Usage

codex --watch

Then in any file:

  // What does this function do, AI?
  # Optimize this code, AI!
  /* Fix this bug, AI! */

I see this as a simple, unobtrusive, and flexible feature for day-to-day coding in any IDE.

View original on GitHub ↗