Configuration File
RTK reads configuration from~/.config/rtk/config.toml. The file is optional — RTK uses sensible defaults if not present.
Location
- macOS:
/Users/<username>/.config/rtk/config.toml - Linux:
/home/<username>/.config/rtk/config.toml
View Current Config
Create Default Config
~/.config/rtk/config.toml if it doesn’t exist.
Configuration Sections
Tracking
Controls token savings tracking and analytics.Options
- enabled (boolean): Enable token tracking. Default:
true - history_days (integer): How long to retain tracking data. Default:
90 - database_path (string): Custom database location. Default:
~/.local/share/rtk/history.db
Disabling tracking (
enabled = false) disables rtk gain and all analytics commands.Display
Controls output formatting.Options
- colors (boolean): Use ANSI colors. Default:
true - emoji (boolean): Use emoji in output. Default:
true - max_width (integer): Max line width before wrapping. Default:
120
Filters
Controls which files/directories to ignore inrtk ls, rtk grep, etc.
Options
- ignore_dirs (array of strings): Directory names to skip
- ignore_files (array of strings): File patterns to skip (supports
*wildcards)
Tee
Controls full output recovery for commands that fail.Options
- enabled (boolean): Enable tee feature. Default:
true - mode (string): When to save output:
"failures": Only on non-zero exit code (default)"always": Save all command outputs"never": Disable tee completely
- max_files (integer): Max files to keep. Default:
20 - max_file_size (integer): Max bytes per file. Default:
1048576(1MB) - directory (string): Custom tee directory. Default:
~/.local/share/rtk/tee/
Tee saves raw unfiltered output to a file when commands fail, so LLMs can read the full error instead of re-running the command.
Environment Variables
Environment variables override config file settings.Database Path
RTK_DB_PATH: Override tracking database location.RTK_DB_PATH > config.toml:tracking.database_path > default location
Tee Configuration
RTK_TEE: Enable/disable tee feature.Hook Audit Logging
RTK_HOOK_AUDIT: Enable hook audit logging.Custom Database Path
By default, RTK stores tracking data in~/.local/share/rtk/history.db. You can customize this in two ways:
Method 1: Environment Variable
.bashrc, .zshrc) to persist:
Method 2: Config File
Edit~/.config/rtk/config.toml:
Priority Order
- RTK_DB_PATH environment variable (highest priority)
- config.toml
tracking.database_pathfield - Default:
~/.local/share/rtk/history.db
Use Cases
- Per-project tracking:
export RTK_DB_PATH="./rtk-project.db" - Shared team analytics:
export RTK_DB_PATH="/mnt/shared/rtk.db" - Testing:
export RTK_DB_PATH="/tmp/rtk-test.db"
Tee Configuration
When RTK filters command output, LLM agents lose failure details (stack traces, assertion messages). The tee feature saves raw output to a file on failure.How It Works
On command failure (exit code ≠ 0), RTK:- Writes full unfiltered output to
~/.local/share/rtk/tee/<timestamp>_<cmd>.log - Prints a hint:
[full output: ~/.local/share/rtk/tee/1707753600_cargo_test.log] - LLM reads the file instead of re-running the command
Configuration
Edit~/.config/rtk/config.toml:
Modes
Environment Overrides
Supported Commands
Tee works with:- Cargo:
build,test,clippy,check,install,nextest - JavaScript:
vitest,playwright,tsc,lint,prettier - Python:
pytest,ruff,mypy - Go:
go test,go build,go vet,golangci-lint - Generic:
rtk test,rtk err
File Rotation
Tee files are automatically rotated:- max_files: Oldest files deleted when limit reached
- max_file_size: Outputs larger than limit are truncated
Installation Modes and Flags
RTK supports multiple installation modes for Claude Code integration.Installation Modes
Settings.json Patching Flags
Control howrtk init --global handles ~/.claude/settings.json:
Mode Flags
Uninstall Flag
~/.claude/hooks/rtk-rewrite.sh~/.claude/RTK.md@RTK.mdreference from~/.claude/CLAUDE.md- RTK hook entry from
~/.claude/settings.json
Verification
Check current installation:- Hook status (installed, executable, guards present)
- RTK.md status
- Integrity verification
- CLAUDE.md status (global and local)
- settings.json status
Uninstall Procedure
Complete Removal
- ✅ Hook script (
~/.claude/hooks/rtk-rewrite.sh) - ✅ Integrity hash (SHA-256 baseline for hook verification)
- ✅ RTK.md (
~/.claude/RTK.md) - ✅ @RTK.md reference from
~/.claude/CLAUDE.md - ✅ Hook entry from
~/.claude/settings.json
Restore from Backup
If uninstall causes issues, restore settings.json from backup:rtk init --global.
Local Projects
For local installations (rtk init without --global):
Binary Removal
To remove the RTK binary:Data Removal
RTK stores data in:- Tracking database:
~/.local/share/rtk/history.db - Tee files:
~/.local/share/rtk/tee/ - Config file:
~/.config/rtk/config.toml - Hook audit logs:
~/.local/share/rtk/hook-audit.log
Configuration Examples
Example 1: Minimal Context, No Tracking
Example 2: Maximum Debugging
Example 3: Team Shared Analytics
Example 4: Per-Project Tracking
Next Steps
Claude Code Setup
Install RTK hook for Claude Code
Hook Architecture
Learn how auto-rewrite hooks work
