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

贡献者指南