Expose AfterToolUse in hooks.json and support codex_hooks on Windows

Resolved 💬 2 comments Opened Mar 23, 2026 by ctoth Closed Mar 23, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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 ↗

2 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #15486
  • #14882
  • #14754

Powered by Codex Action

oxysoft · 3 months ago

Indexed this hook ticket in the umbrella tracker: #21753

Goal: collect the scattered Codex hook requests and bugs into one parity matrix for Full Claude Code Hook Parity (29+), while preserving this issue as the detailed thread for its specific behavior.