Skip to content

feat(codex): add integrated PreToolUse plugin support#2069

Open
xuegaoge wants to merge 3 commits into
rtk-ai:developfrom
xuegaoge:codex/integrated-codex-plugin
Open

feat(codex): add integrated PreToolUse plugin support#2069
xuegaoge wants to merge 3 commits into
rtk-ai:developfrom
xuegaoge:codex/integrated-codex-plugin

Conversation

@xuegaoge
Copy link
Copy Markdown

Summary

This PR combines the stronger native Codex plugin direction from #2063 with the safer behavior and user-facing setup guidance from #2068.

  • Adds the RTK Codex plugin package and rtk hook codex lifecycle integration from feat(codex): route shell commands through plugin hooks #2063.
  • Preserves Codex's original Bash tool_input when rewriting commands, replacing only command so fields such as timeout and description are not dropped.
  • Adds docs/usage/CODEX_PRETOOLUSE_ADAPTER.md with first-install guidance that reuses an existing RTK install when rtk gain works and installs RTK only when missing or incorrect.
  • Updates Codex docs to describe the plugin hook, Windows command handling, hook trust, and allow + updatedInput behavior.

Why

The previous prompt-only Codex setup depends on the model remembering to prefix shell commands with rtk. The native Codex plugin hook moves that rewrite to the tool-call layer. This PR keeps that product-level integration while carrying over the safer adapter behavior tested in #2068: preserve the rest of Codex's tool_input and provide a clear usage guide for new and already-installed RTK users.

Credit: this builds on the implementation direction from #2063 and folds in the manual-adapter safeguards from #2068.

Validation

  • cargo test test_codex_rewrite_preserves_tool_input_fields -- --nocapture initially failed before the preservation fix.
  • cargo test test_codex_rewrite_preserves_tool_input_fields -- --nocapture passed after the fix.
  • cargo test codex -- --nocapture passed: 28 passed.
  • cargo fmt --all -- --check passed.
  • cargo clippy --all-targets -- -D warnings passed.
  • cargo test --all passed: 1947 passed, 6 ignored.
  • git diff --check HEAD~3..HEAD passed.
  • Ran cargo run -- init -g --codex with isolated HOME and CODEX_HOME; verified plugin package, marketplace entry, and hooks/hooks.json were written and rtk init --show --codex detected them.
  • Verified the quick setup block in docs/usage/CODEX_PRETOOLUSE_ADAPTER.md with bash -n.

AZ-LL added 2 commits May 23, 2026 20:35
Add an RTK Codex plugin package with bundled skill guidance, hook lifecycle configuration, and a thin launcher that delegates Codex PreToolUse payloads to the native RTK hook processor.

Teach rtk init --codex to install local and global plugin packages, register marketplace entries, report plugin and feature state, and uninstall only RTK-managed plugin or legacy guidance state.

Add native rtk hook codex handling for Bash rewrites with fail-open behavior, supported allow-with-updatedInput responses, and tests for plugin packaging, lifecycle migration, unsupported inputs, heredocs, and missing RTK executables.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 24, 2026

CLA assistant check
All committers have signed the CLA.

@xuegaoge xuegaoge force-pushed the codex/integrated-codex-plugin branch from 2afc3d0 to f4b506d Compare May 24, 2026 11:31
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.

3 participants