Skip to content

Add prompt hooks#24174

Draft
abhinav-oai wants to merge 1 commit into
mainfrom
abhinav/prompt-type-hooks
Draft

Add prompt hooks#24174
abhinav-oai wants to merge 1 commit into
mainfrom
abhinav/prompt-type-hooks

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

@abhinav-oai abhinav-oai commented May 23, 2026

Why

Prompt hooks let hook authors express review criteria as model-evaluated prompts while preserving Codex hook semantics. Codex should default these checks to the active thread model instead of a fixed hook model.

What

  • Add type = "prompt" hook handler config, app-server API, generated schemas, and hook list support with optional model, timeout, and continueOnBlock.
  • Wire prompt hooks into the hook engine for PreToolUse, PermissionRequest, PostToolUse, UserPromptSubmit, and Stop while skipping unsupported events with warnings.
  • Add a core prompt-hook runner that calls the model with no tools, defaults to the thread model, and expects { "ok": boolean, "reason": string }.
  • Map ok: false to Codex event-specific outcomes: deny pre-tool-use, block/continue post-tool-use according to continueOnBlock, block user prompt and stop hooks, and no-op permission requests.
  • Add a Stop integration test in the style of Claude multi-criteria hooks, requiring the assistant to revise once before the prompt hook returns ok.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant