Skip to content

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

@Prathyushmnchla

Description

@Prathyushmnchla

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

codex inject <session_name_or_id> --text "..."

Also accept alias:

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

codex inject <session_name> --text "Training finished. Read logs/train.log and propose next run config."

Coder-Architect Pattern

# 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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions