Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rtk-ai/rtk/llms.txt
Use this file to discover all available pages before exploring further.
What is Tee Recovery?
When RTK filters command output to save tokens, critical debugging information (stack traces, assertion messages) can be lost. If a command fails, LLM agents may re-run the same command multiple times to retrieve the full output. The tee recovery feature solves this by automatically saving raw, unfiltered output to a file when commands fail. Instead of re-executing the command, the agent reads the saved file — saving tokens and time.How It Works
On command failure (exit code ≠ 0), RTK saves the full unfiltered output to
~/.local/share/rtk/tee/ and prints a one-line hint for the LLM to read.~/.local/share/rtk/tee/1707753600_cargo_test.log directly instead of running cargo test again.
File Naming
Tee files use the format:{epoch}_{sanitized_command}.log
- Epoch timestamp: Sorts files chronologically
- Sanitized command: Alphanumeric/underscore/hyphen only, truncated at 40 chars
- Example:
1707753600_cargo_test.log
Minimum Output Size
Tee skips outputs smaller than 500 bytes — these are short enough to re-run without significant overhead.Configuration
Default Settings
Create or edit~/.config/rtk/config.toml:
Tee Modes
Environment Overrides
Environment variables take precedence overconfig.toml:
RTK_TEE / RTK_TEE_DIR > config.toml > defaults
File Rotation and Size Limits
Automatic Cleanup
Tee maintains a fixed number of files (default: 20). When this limit is exceeded:- Files are sorted by timestamp (oldest first)
- Oldest files are deleted to maintain the limit
- Only
.logfiles in the tee directory are affected
max_files = 20, if you run 25 failing commands, the first 5 tee files are automatically deleted.
Size Truncation
Outputs larger thanmax_file_size (default: 1MB) are truncated:
Supported Commands
Tee recovery is available for these RTK commands:Build & Test Tools
Build & Test Tools
cargo buildcargo testcargo clippycargo checkcargo installcargo nextestvitest runpytestgo testgo buildgo vet
Linters & Type Checkers
Linters & Type Checkers
lint(eslint/biome)tscruff checkruff formatpylintmypygolangci-lint run
Generic Wrappers
Generic Wrappers
err <command>— errors/warnings onlytest <command>— failures only
Examples
Example 1: Default Behavior (Failures Only)
Example 2: Always Save Output
Example 3: Disable Tee Temporarily
Example 4: Custom Tee Directory
Example 5: Large Output Truncation
Troubleshooting
Tee Files Not Created
Check tee is enabled:Disk Space Issues
Reduce retention:Tee Hint Not Visible
Tee hints are printed to stdout after the filtered output. If you’re capturing output to a file, check both:Implementation Details
Tee failures never affect command output or exit codes. If tee cannot write the file (permissions, disk full, etc.), RTK silently continues without interrupting the user workflow.
src/tee.rs:
- Checks
RTK_TEE=0first (fastest exit) - Skips outputs < 500 bytes (hardcoded
MIN_TEE_SIZE) - Respects mode (failures/always/never)
- Returns
Noneon any error (graceful degradation)
See Also
- Custom Database Path — Configure tracking database location
- Proxy Mode — Bypass RTK filtering while tracking metrics
