Skip to main content

What is Proxy Mode?

Proxy mode executes commands without RTK filtering while still recording usage metrics in the tracking database. It provides a safety valve when RTK’s filtering causes issues or you need the full, unfiltered output.
Proxy mode runs the raw command and passes through output unchanged. Token savings are 0%, but execution metrics (command count, timing) are still tracked.

Usage

Examples:

Benefits

1. Bypass RTK Filtering Bugs

If RTK’s filter produces incorrect output:

2. Track Metrics Without Filtering

Record which commands you use without modifying output:

3. Guaranteed Compatibility

Proxy mode works with any command, even if RTK doesn’t implement a filter for it:

4. Debugging & Comparison

Compare RTK-filtered vs raw output:

Tracking Behavior

Proxy mode tracks commands with 0% savings:
View proxy usage in analytics:
Proxy commands appear in rtk gain output with 0% savings, which dilutes overall averages. Use sparingly for production workflows.

When to Use Proxy Mode

Use Proxy Mode When:

✅ RTK filter produces incorrect output
✅ You need full debugging information
✅ RTK doesn’t support the command
✅ You want to track usage without filtering

Don’t Use Proxy Mode When:

❌ You want token savings — Use regular RTK commands instead
❌ RTK filter works correctly — Proxy wastes LLM context

Examples

Example 1: Debug RTK Filter

Example 2: Full Test Output for Debugging

Example 3: Unsupported Command

Example 4: Track Usage Without Filtering

Example 5: Compare Filtered vs Raw

Comparison with Regular RTK Commands

Implementation Details

From RTK’s architecture:
  1. Command parsing: rtk proxy <command> is parsed by Clap
  2. Execution: RTK executes <command> directly via std::process::Command
  3. Output passthrough: stdout/stderr are passed unchanged to the terminal
  4. Tracking: Input and output tokens are the same (estimated from raw output)
  5. Exit code: Preserved from the underlying command
Proxy mode is essentially:
Tracking records:
  • original_cmd = <command> <args>
  • rtk_cmd = rtk proxy <command> <args>
  • input_tokens = output_tokens (no filtering)
  • saved_tokens = 0
  • savings_pct = 0.0

Troubleshooting

Proxy Mode Not Tracking

Symptom: rtk proxy <command> runs but doesn’t appear in rtk gain --history. Solution: Check database path and permissions.

Exit Code Not Preserved

Symptom: rtk proxy <command> always exits with 0, even on failure. Solution: This is a bug. Report at github.com/rtk-ai/rtk/issues. Workaround:

Command Not Found

Symptom: rtk proxy terraform plan → “terraform: command not found” Solution: Proxy mode requires the underlying command to be in PATH.

See Also