Skip to content

feat(hooks): add Codex hook#2973

Open
maxdestors wants to merge 2 commits into
rtk-ai:developfrom
maxdestors:feat/hook-codex
Open

feat(hooks): add Codex hook#2973
maxdestors wants to merge 2 commits into
rtk-ai:developfrom
maxdestors:feat/hook-codex

Conversation

@maxdestors

@maxdestors maxdestors commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • Adds Codex hook

Because Codex only supports allow, we auto-allow only simple, read-only commands from a fixed whitelist:

  • git / yadm: status, log, diff, show
  • cat, head, tail, ls, tree, grep, wc

Everything else falls back to Codex’s native approval flow.

Partially closes #1003 and checked the work on #1550.

More work needs to be done once Codex support full rewriting.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

I also installed it in my current WSL vscode setup and it works well. The hook must be trusted.
Also to have rtk gain --history show the commands you have to add thoses lines to ~/.codex/config.toml :

sandbox_mode = "workspace-write"

[sandbox_workspace_write]
writable_roots = ["/home/maxou/.local/share/rtk"]

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@CLAassistant

CLAassistant commented Jul 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Hikarea

Hikarea commented Jul 13, 2026

Copy link
Copy Markdown

I asked Codex to do this globally, for old and new chats; it worked:

rtk gain
RTK Token Savings (Global Scope)
════════════════════════════════════════════════════════════

Total commands: 858
Input tokens: 3.8M
Output tokens: 761.0K
Tokens saved: 3.1M (80.2%)
Total exec time: 77m55s (avg 5.4s)
Efficiency meter: ███████████████████░░░░░ 80.2%

By Command
───────────────────────────────────────────────────────────────────────

Command Count Saved Avg% Time Impact

───────────────────────────────────────────────────────────────────────

  1. rtk rg 182 3.0M 23.9% 485ms ██████████
  2. rtk git diff -- packa... 1 17.3K 76.6% 547ms ░░░░░░░░░░
  3. rtk find 11 4.3K 47.0% 50ms ░░░░░░░░░░
  4. rtk git diff -- app/a... 1 1.5K 27.7% 450ms ░░░░░░░░░░
  5. rtk git diff -- app/a... 1 1.4K 20.0% 186ms ░░░░░░░░░░
  6. rtk git diff -- app/a... 2 1.4K 15.1% 164ms ░░░░░░░░░░
  7. rtk git diff -- app/a... 1 1.3K 39.1% 299ms ░░░░░░░░░░
  8. rtk git diff -- app/a... 1 939 19.2% 298ms ░░░░░░░░░░
  9. rtk git diff -- app/a... 1 925 19.8% 225ms ░░░░░░░░░░
  10. rtk git diff -- app/a... 1 914 20.8% 183ms ░░░░░░░░░░
    ───────────────────────────────────────────────────────────────────────
    Top 10 command categories shown; 656 lower-impact command(s) omitted.

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.

Add hook to Codex

3 participants