Skip to content

feat: add Codex PreToolUse hook integration - #2402

Closed
T0UGH wants to merge 1 commit into
rtk-ai:developfrom
T0UGH:feat/codex-pretooluse-hook
Closed

T0UGH wants to merge 1 commit into
rtk-ai:developfrom
T0UGH:feat/codex-pretooluse-hook

Conversation

@T0UGH

@T0UGH T0UGH commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • add rtk hook codex for Codex PreToolUse JSON payloads
  • return permissionDecision: "allow" with updatedInput.command for transparent shell command rewrites
  • install the hook into Codex hooks.json, preserve third-party hooks, and migrate legacy RTK Claude/shell hook entries
  • keep AGENTS.md/RTK.md fallback guidance and update docs to mark Codex as a full hook integration
  • suppress telemetry/hook health noise for rtk hook ... subcommands so hook stdout stays machine-readable

Verification

  • /opt/homebrew/bin/cargo fmt --check
  • /opt/homebrew/bin/cargo check
  • /opt/homebrew/bin/cargo test --all
  • /opt/homebrew/bin/cargo clippy --all-targets
  • printf '%s' '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"git status"}}' | /opt/homebrew/bin/cargo run --quiet -- hook codex\n

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@costleya costleya left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/rtk-ai/rtk/tree/develop/src/hooks

  • hook_check.rs is not updated
  • integrity.rs is not updated

Both of these seem to be required for the hook install to work. Was this PR tested?

@TaKO8Ki TaKO8Ki self-assigned this Jul 18, 2026
@KuSh

KuSh commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this work. Codex PreToolUse support landed on develop with #3552 (merged 2026-09-13): rtk hook codex rewrites through updatedInput, and rtk init --codex installs, reports and removes the hook in hooks.json while keeping other hooks. The hook command, installer and docs this PR adds are already covered there. Develop does not remove a legacy rtk hook claude or rtk-rewrite.sh entry that is already in Codex hooks.json, which this PR did; an issue or a narrow PR against src/hooks/init/codex.rs would be welcome. rtk hook subcommands also still run the daily telemetry ping and hook-status warning in src/main.rs, which this PR skipped; that could be a small separate PR too. If I missed something this PR covers, please comment or reopen.

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.

5 participants