Skip to content

feat: Comprehensive hooks system for tool, file, and event lifecycle#9796

Closed
am-will wants to merge 1 commit intoopenai:mainfrom
am-will:main
Closed

feat: Comprehensive hooks system for tool, file, and event lifecycle#9796
am-will wants to merge 1 commit intoopenai:mainfrom
am-will:main

Conversation

@am-will
Copy link

@am-will am-will commented Jan 23, 2026

Summary

  • Implements a comprehensive hooks system allowing external commands to be triggered at various lifecycle events
  • Adds support for tool hooks (before/after tool execution), file hooks (before/after file writes), and event hooks
  • Includes prompt gating, stop hooks, compact mode, and notification hooks
  • Global hooks ordering for predictable execution
  • Full test coverage for hook events and tool hooks

Test plan

  • Unit tests for hook_events
  • Unit tests for tool_hooks
  • Build validation passes
  • Manual testing of hooks in various scenarios

@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@am-will
Copy link
Author

am-will commented Jan 23, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jan 23, 2026
Implements a hooks system that allows external commands to be triggered
at various lifecycle events during Codex execution:

- Tool hooks: before/after tool execution with input/output access
- File hooks: before/after file write operations
- Event hooks: prompt gating, stop hooks, compact mode, notifications
- Global hooks ordering for predictable execution
- Project-level hook configuration via codex.json

Includes full test coverage for hook events and tool hooks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@etraut-openai
Copy link
Collaborator

Our contribution guidelines state that we're not accepting feature contributions at this time. We need to make sure that all new features are well designed, compose well with both existing and upcoming features, fit into our roadmap, and are consistent across all Codex surfaces (CLI, IDE extension, web). If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.

@am-will
Copy link
Author

am-will commented Jan 24, 2026

Sorry boss, I didn't read it 😆 Codex was the one that replied to you. Thanks though. Love the new features you've dropped 🙌

Our contribution guidelines state that we're not accepting feature contributions at this time. We need to make sure that all new features are well designed, compose well with both existing and upcoming features, fit into our roadmap, and are consistent across all Codex surfaces (CLI, IDE extension, web). If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.

@am-will am-will mentioned this pull request Jan 25, 2026
jmchantrein pushed a commit to jmchantrein/Meta-prompt-LLM that referenced this pull request Feb 2, 2026
…odex)

Extend generate.sh to support hooks generation for multiple AI platforms:

- Cursor: .cursor/hooks.json with beforeShellExecution, afterFileEdit, stop
- OpenCode: .opencode/hooks/lifecycle.sh for session events
- Codex CLI: codex.toml with notify configuration

Platform hooks support matrix:
| Platform    | Config                    | Events |
|-------------|---------------------------|--------|
| Claude Code | .claude/settings.json     | 6 events (full support) |
| Cursor      | .cursor/hooks.json        | 6 events (full support) |
| OpenCode    | .opencode/hooks/*.sh      | 4 events (via oh-my-opencode) |
| Codex CLI   | codex.toml                | 1 event (agent-turn-complete) |
| Aider       | .aider.conf.yml           | indirect (auto_lint, test_cmd) |
| Continue    | .continuerc.json          | data events only |

Sources:
- Cursor: https://cursor.com/docs/agent/hooks
- OpenCode: https://deepwiki.com/code-yeongyu/oh-my-opencode
- Codex: openai/codex#9796

https://claude.ai/code/session_01SZuzCsugSMHuU62fbTNBUv
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.

2 participants