Add `codex inject` to send prompts to existing sessions (automation + orchestration)

Resolved 💬 3 comments Opened Feb 11, 2026 by Prathyushmnchla Closed Feb 12, 2026

What variant of Codex are you using?

CLI

What feature would you like to see?

Title
Add codex inject to send prompts to existing sessions (automation + orchestration)

### Summary
Please add a direct CLI command to inject a user message into an existing Codex session from outside the TUI.

Current workflow for external automation is awkward (codex resume ... "prompt").
### Core CLI Proposal
``bash
codex inject <session_name_or_id> --text "..."
`
Also accept alias:
`bash
codex inject <session_name_or_id> --text_file /path/to/prompt.txt
``

### Expected Behavior

  • If the target session is running: append the message as a new user turn.

### Example Use Cases
#### End-of-Train Script
``bash
codex inject <session_name> --text "Training finished. Read logs/train.log and propose next run config."
``

#### Coder-Architect Pattern
```bash
# Architect -> Coder
codex inject <coder_session_name> --text "Implement API pagination for /v1/items and add tests."

# Coder -> Architect
codex inject <architect_session_name> --text "Implementation complete on branch feat/pagination. Review diff and propose follow-up refactors."
```

#### CI Failure Triage
``bash
codex inject <session_name> --text "CI failed on test_auth_refresh. Read latest test logs and propose minimal fix."
``

### CLI Enhancements (Future)

  • --hook-name <name> for automation/audit labels.
  • --text - (stdin support).
  • Delivery control: --queue (default) and --interrupt.
  • Session behavior flags: --resume, --create-if-missing, --if-running.
  • Scriptability: --json, --wait, --timeout.
  • Reliability: --idempotency-key + replay protection.
  • Safety: --dry-run preflight output.
  • Access/security: session ownership checks, authenticated caller checks, and encrypted local transport for injection requests.
  • Optional local automation listener backend (socket/localhost port), while keeping codex inject as the primary UX.

### Scope
Cross-platform CLI feature (Linux/macOS/Windows), independent of shell or terminal multiplexer.

### Note
Drafted by Codex (AI assistant).

Additional information

_No response_

View original on GitHub ↗

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