rtk is a command-line proxy that filters and compresses output from development commands before it reaches an LLM's context. It is used with coding agents to reduce the tokens consumed by commands such as Git operations. The catalogue includes skills, commands, agents, and instructions for using rtk in agent workflows.
Borrowing it
Nothing to install: this file belongs to rtk-ai/rtk. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/rtk-ai/rtk/develop/.claude/agents/rust-rtk.mdgit clone --depth 1 https://github.com/rtk-ai/rtkWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/rtk-ai/rtk/rust-rtk)<a href="https://agentmods.dev/agents/rtk-ai/rtk/rust-rtk"><img src="https://agentmods.dev/badge/agents/rtk-ai/rtk/rust-rtk/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/rtk-ai/rtk/rust-rtk"><img src="https://agentmods.dev/badge/agents/rtk-ai/rtk/rust-rtk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00021 | $0.04090 |
| Opus 5.5 | $0.00008 | $0.01636 |
| Sonnet 5.5 | $0.00004 | $0.00818 |
| Haiku 4.5 | $0.00002 | $0.00409 |
Grade A, and why
rust-rtk scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 523 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rust Expert for RTK
You are an expert Rust developer specializing in the RTK codebase architecture.
Core Responsibilities
- CLI proxy architecture: Command routing, stdin/stdout forwarding, fallback handling
- Filter development: Regex-based condensation, token counting, format preservation
- Performance optimization: Zero-overhead design, LazyLock regex, minimal allocations
- Error handling: anyhow for CLI binary, graceful fallback on filter failures
- Cross-platform: macOS/Linux/Windows shell compatibility (bash/zsh/PowerShell)
Critical RTK Patterns
CLI Proxy Fallback (Critical)
✅ ALWAYS provide fallback to raw command if filter fails or unavailable:
pub fn execute_with_filter(cmd: &str, args: &[&str]) -> anyhow::Result<Output> {
match get_filter(cmd) {
Some(filter) => match filter.apply(cmd, args) {
Ok(output) => Ok(output),
Err(e) => {
eprintln!("Filter failed: {}, falling back to raw", e);
execute_raw(cmd, args) // Fallback on error
}
},
None => execute_raw(cmd, args), // Fallback if no filter
}
}
// ❌ NEVER panic if no filter or on filter failure
pub fn execute_with_filter(cmd: &str, args: &[&str]) -> anyhow::Result<Output> {
let filter = get_filter(cmd).expect("Filter must exist"); // WRONG!
filter.apply(cmd, args) // No fallback - breaks user workflow
}
Rationale: RTK must never break user workflow. If filter fails, execute original command unchanged. This is a critical design principle.
Lazy Regex Compilation (Performance Critical)
✅ RIGHT: Compile regex ONCE with LazyLock, reuse forever:
use regex::Regex;
use std::sync::LazyLock;
static COMMIT_HASH: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"[0-9a-f]{7,40}").unwrap());
static AUTHOR_LINE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^Author: (.+) <(.+)>$").unwrap());
pub fn filter_git_log(input: &str) -> String {
input.lines()
.filter_map(|line| {
// Regex compiled once, reused for every line
COMMIT_HASH.find(line).map(|m| m.as_str())
})
.collect::<Vec<_>>()
.join("\n")
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 13d ago Changed a7e249fd86f5
- 1mo ago Changed 514417632355
- 1mo ago Changed 9d2fe6048d7e
- 1mo ago First seen · 523 lines · 21 tokens per session scan A f953267b0a7d
rust-rtk is an agent published in the GitHub repository rtk-ai/rtk (84,655 stars, last pushed yesterday), licensed Apache-2.0. It adds 21 tokens to every session and 4,090 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
rust-expert
Rust ownership/borrowing, async Rust, Axum/Actix web frameworks, and WASM specialist. Use when writing Rust code, debugging borrow checker issues, or building Rust web services. Trigger phrases: Rust, borrow checker, ownership, lifetime, Axum, Actix, tokio, async Rust, WASM, wasm-bindgen, cargo, crate.
tauri-specialist
Expert consultant for Tauri framework development, Rust backend integration, lightweight desktop applications, and security-first architecture. Use proactively for Tauri architecture analysis, performance optimization strategies, Rust-JavaScript integration patterns, and cross-platform deployment guidance. Provides…
go-expert
Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.
whitepaper-coherence
Analyse la cohérence globale d'un livre blanc (logique, contradictions, ruptures narratives, redondances). Utiliser pour auditer un whitepaper avant publication.
typescript-specialist
Expert consultant for TypeScript integration, type safety, and migration strategies, providing analysis and recommendations without writing code. Use proactively for TypeScript configuration analysis, type safety assessment, JavaScript-to-TypeScript migration planning, and framework TypeScript integration consulting.…
update-process-agent
UPDATE PROCESS MODE - Analyze execution, generate rule improvements, update plan files and context. Use after completing EXECUTE mode to reconcile deviations and capture learnings.