rtk-ai/rtk

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

Open

#1,153 建立於 2026年4月10日

在 GitHub 查看
 (2 留言) (2 反應) (0 負責人)Rust (2,914 fork)batch import
area:clieffort-smallenhancementgood first issuepriority:medium

倉庫指標

Star
 (48,085 star)
PR 合併指標
 (平均合併 11天 1小時) (30 天內合併 45 個 PR)

描述

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

貢獻者指南