Add human-origin-only prompt submit hooks

Open 💬 0 comments Opened Jun 23, 2026 by PaulRBerg

What variant of Codex are you using?

CLI

What feature would you like to see?

I'd like a stricter hook/event surface for prompts that are actually submitted by the human user, distinct from prompts Codex itself submits internally when delegating work to subagents.

Today, UserPromptSubmit can appear to fire for both human-authored prompts and Codex-originated subagent prompts. That makes hooks which react to user intent hard to write safely. For example, I have a local hook that copies submitted prompts to my clipboard for reuse. It correctly handles my own prompts, but it also saw an internal subagent-control prompt and copied that instead.

A few possible shapes that would solve this:

  • Add a separate hook such as HumanPromptSubmit that only fires for direct human input.
  • Add reliable metadata to UserPromptSubmit, e.g. origin: human | codex | subagent | tool, and document it as stable.
  • Allow hook matchers to filter on that origin before invoking the hook process.

The important bit is that hook authors should not have to infer human intent from prompt text. Heuristics like looking for subagent wording, repo/thread prefixes, or "no edits" style control text are brittle and can fail in both directions.

Additional information

The practical impact is privacy and automation safety. Clipboard sync, logging, auditing, metrics, prompt archives, or notification hooks often want only human-authored input. Internal delegated prompts can contain implementation details, summaries, repo context, or task-control language that the user did not explicitly submit as their own prompt.

My local workaround is to skip obvious subagent notifications/control prompts and non-human-looking source metadata when present, but that's necessarily best-effort. A first-class human-origin-only event would be much cleaner.

View original on GitHub ↗