rtk-ai/rtk

enhancement: add RTK_DISABLED=1 environment variable to bypass all hooks

Open

#1153 opened on Apr 10, 2026

View on GitHub
 (2 comments) (2 reactions) (0 assignees)Rust (48,085 stars) (2,914 forks)batch import
effort-smallenhancementgood first issue

Description

Problem

AI coding agents (Claude Code, Codex, Gemini CLI, etc.) have no way to temporarily disable the RTK hook without uninstalling it. When an agent needs raw, unfiltered command output -- for debugging, API inspection, or commands RTK does not handle well -- it has no escape hatch.

Use cases

  1. Debugging: Agent needs to see full unfiltered output to diagnose a problem
  2. API inspection: Agent is reading API responses where RTK schema conversion destroys values
  3. Temporary bypass: Agent wants raw `git diff` for a specific file, not the condensed version
  4. Compatibility: Some tools or scripts produce output that RTK filtering corrupts

Proposed solution

Add an `RTK_DISABLED=1` environment variable check in the hook rewrite path. When set:

  • `rtk rewrite ` returns exit code 1 (no RTK equivalent) without doing any rewriting
  • The hook passes the original command through unchanged
  • No tracking or telemetry is affected (those remain active)

Implementation sketch

In `src/hooks/rewrite_cmd.rs`, add at the start of `run()`:

```rust if std::env::var("RTK_DISABLED").unwrap_or_default() == "1" { std::process::exit(1); // No rewrite, passthrough } ```

This mirrors the existing pattern used for `RTK_TELEMETRY_DISABLED` in `src/core/telemetry.rs` (line 26).

Why not just use `exclude_commands`?

`exclude_commands` requires editing a config file and only works for specific commands. `RTK_DISABLED` gives the agent a temporary, session-scoped kill switch that can be toggled per-conversation without file system changes.

Related

  • This complements a potential `--raw` flag for individual commands (separate issue)
  • Similar to how `NODE_ENV`, `DEBUG`, and other env vars provide runtime control

Contributor guide