Skip to main content

Configuration File

RTK reads configuration from ~/.config/rtk/config.toml. The file is optional — RTK uses sensible defaults if not present.

Location

On macOS/Linux, this resolves to:
  • macOS: /Users/<username>/.config/rtk/config.toml
  • Linux: /home/<username>/.config/rtk/config.toml

View Current Config

Output:

Create Default Config

This writes the default configuration to ~/.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 in rtk 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.
Priority: RTK_DB_PATH > config.toml:tracking.database_path > default location

Tee Configuration

RTK_TEE: Enable/disable tee feature.
RTK_TEE_DIR: Override tee output directory.

Hook Audit Logging

RTK_HOOK_AUDIT: Enable hook audit logging.
RTK_AUDIT_DIR: Override audit log directory.

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

Add to shell profile (.bashrc, .zshrc) to persist:

Method 2: Config File

Edit ~/.config/rtk/config.toml:

Priority Order

  1. RTK_DB_PATH environment variable (highest priority)
  2. config.toml tracking.database_path field
  3. 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:
  1. Writes full unfiltered output to ~/.local/share/rtk/tee/<timestamp>_<cmd>.log
  2. Prints a hint: [full output: ~/.local/share/rtk/tee/1707753600_cargo_test.log]
  3. LLM reads the file instead of re-running the command
Result: Token savings without losing error context.

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
Default: 20 files, 1MB each (20MB total).

Installation Modes and Flags

RTK supports multiple installation modes for Claude Code integration.

Installation Modes

Settings.json Patching Flags

Control how rtk init --global handles ~/.claude/settings.json:

Mode Flags

Uninstall Flag

Removes:
  • ~/.claude/hooks/rtk-rewrite.sh
  • ~/.claude/RTK.md
  • @RTK.md reference from ~/.claude/CLAUDE.md
  • RTK hook entry from ~/.claude/settings.json
Restart Claude Code after uninstalling.

Verification

Check current installation:
Output shows:
  • Hook status (installed, executable, guards present)
  • RTK.md status
  • Integrity verification
  • CLAUDE.md status (global and local)
  • settings.json status

Uninstall Procedure

Complete Removal

This removes:
  1. ✅ Hook script (~/.claude/hooks/rtk-rewrite.sh)
  2. ✅ Integrity hash (SHA-256 baseline for hook verification)
  3. ✅ RTK.md (~/.claude/RTK.md)
  4. ✅ @RTK.md reference from ~/.claude/CLAUDE.md
  5. ✅ Hook entry from ~/.claude/settings.json
Restart Claude Code after uninstalling.

Restore from Backup

If uninstall causes issues, restore settings.json from backup:
Backups are created automatically by 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
To remove all data:

Configuration Examples

Example 1: Minimal Context, No Tracking

Use case: CI/CD, no persistent state.

Example 2: Maximum Debugging

Environment:
Use case: Debugging RTK behavior, investigating filter issues.

Example 3: Team Shared Analytics

Use case: Centralized token savings analytics for a team.

Example 4: Per-Project Tracking

Use case: Track token savings per-project without mixing data.

Next Steps

Claude Code Setup

Install RTK hook for Claude Code

Hook Architecture

Learn how auto-rewrite hooks work