コンテンツにスキップ

Quick Start

このコンテンツはまだ日本語訳がありません。

This guide walks you through your first RTK commands after installation.

RTK is installed and verified:

Terminal window
rtk --version # rtk x.y.z
rtk gain # shows token savings dashboard

If not, see Installation.

Terminal window
# For Claude Code (global — applies to all projects)
rtk init --global
# For a single project only (CLAUDE.md instructions, no hook)
cd /your/project && rtk init

rtk init --global installs the hook that automatically rewrites commands. Restart your AI assistant after this step.

Using something other than Claude Code? Every agent has its own flag:

Terminal window
rtk init -g --gemini # Gemini CLI
rtk init -g --codex # Codex (OpenAI)
rtk init -g --agent cursor # Cursor
rtk init -g --agent windsurf # Windsurf
rtk init --agent cline # Cline / Roo Code

See Supported agents for the full list, including per-agent uninstall and the project-local vs global distinction.

To see exactly what init would change before it touches anything, add --dry-run:

Terminal window
rtk init --global --dry-run

Every would-be file create/update/patch is printed with a [dry-run] would ... prefix, then a [dry-run] Nothing written. footer. Nothing on disk is modified, no settings.json is patched, and the telemetry consent prompt is skipped. Combine with -v to also print the full content RTK would write:

Terminal window
rtk init --global --dry-run -v

--dry-run works for every init flavour (--agent cursor, --gemini, --codex, --copilot, --uninstall, …). It cannot be combined with --show.

Once the hook is installed, nothing changes in how you work. Your AI assistant runs commands as usual — the hook intercepts them transparently and rewrites them before execution.

For example, when Claude Code runs cargo test, the hook rewrites it to rtk cargo test before it executes. The LLM receives filtered output with only the failures — not 500 lines of passing tests. You never see or type rtk.

RTK covers all major ecosystems — Git, Cargo/Rust, JavaScript, Python, Go, Ruby, .NET, Docker/Kubernetes, and more. See What RTK Optimizes for the full list.

After a few commands, see how much was saved:

Terminal window
rtk gain

Illustrative output:

Total commands : 10
Input tokens : 50,000
Output tokens : 5,000
Saved : 45,000 (90.0%)

Simple quoted shell wrappers are rewritten too, without changing the shell they name:

Terminal window
bash -c "head foo && grep -R bar ."
# → bash -c "rtk read foo --head-lines 10 && rtk grep -R bar ."

This covers exact sh -c, bash -c, zsh -c and fish -c wrappers around a quoted script. A fish -c script is read as fish, so fish’s own syntax ((cmd) substitution, and/or/end) is left alone rather than rewritten under POSIX rules:

Terminal window
fish -c 'git status; cargo test' # → fish -c 'rtk git status; rtk cargo test'
fish -c 'git status; and cargo test' # unchanged

Shell expansion inside an outer double quote, extra shell options, redirects to files and nested wrappers pass through unchanged.

Commands RTK doesn’t recognize run through passthrough — output is unchanged, usage is tracked:

Terminal window
rtk bypass make install