Expose AfterToolUse in hooks.json and support codex_hooks on Windows
AfterToolUse appears to be wired internally, but it is not currently available through hooks.json. That makes it hard to build local tooling around Codex tool activity without carrying a private patch.
What I found in the current codebase:
AfterToolUseis emitted from tool execution:
hooks.jsondiscovery currently only loads:SessionStartUserPromptSubmitStop
See:
hooks/src/engine/discovery.rs
- On Windows,
codex_hooksis disabled for the session:
This looks like the remaining gap after #11335, and is related to the broader hooks request in #2109.
What I’m asking for:
- expose
AfterToolUsethroughhooks.json - support command hooks for that event
- document the event input/output shape
- support it on Windows, or narrow the current blanket disable if the command-runner path is the real constraint
Why this matters:
SessionStart, UserPromptSubmit, and Stop are useful, but they are too coarse for tool-level integrations.
A configurable AfterToolUse hook would make it possible to build local tooling around Codex execution without patching Codex itself, for example:
- post-tool policy checks for
local_shell - repo-specific workflow enforcement
- local notifications and observability around tool use
- wrappers and companion tools that react to what the agent is doing
Concrete examples from my own setup:
ctoth/ward: rule-based guardrails for agent tool usectoth/claudio: audio notifications so you can hear what an agent is doing
Both need tool-level lifecycle events. The current hook surface is not enough for that.
If this is acceptable, I’m happy to put together a small patch for hooks.json discovery and event registration.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗