Expose AfterToolUse in hooks.json and support codex_hooks on Windows

Resolved 💬 2 comments Opened Mar 23, 2026 by ctoth Closed Mar 23, 2026

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:

  • AfterToolUse is emitted from tool execution:

core/src/tools/registry.rs

  • hooks.json discovery currently only loads:
  • SessionStart
  • UserPromptSubmit
  • Stop

See:
hooks/src/engine/discovery.rs

  • On Windows, codex_hooks is disabled for the session:

hooks/src/engine/mod.rs

This looks like the remaining gap after #11335, and is related to the broader hooks request in #2109.

What I’m asking for:

  • expose AfterToolUse through hooks.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 use
  • ctoth/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.

View original on GitHub ↗

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