กลับไปหน้า Tools

GetNotes Tools

rtk-ai/rtk

Tool นี้คืออะไร

`rtk` เป็นพร็อกซี CLI ประสิทธิภาพสูงที่ช่วยลดการใช้โทเค็นของ LLM ลง 60-90% โดยการกรองและบีบอัดผลลัพธ์คำสั่ง เหมาะสำหรับนักพัฒนาที่ใช้เครื่องมือ AI เพื่อประหยัดค่าใช้จ่ายและเพิ่มความเร็วในการโต้ตอบกับ LLM

ข้อมูลโปรเจกต์

ดาว

87.4K

Forks

5.6K

License

Apache-2.0

อัปเดต GitHub ล่าสุด

21 พ.ย. 2569

เพิ่มใน GetNotes

14 ก.ค. 2569

Repository

rtk-ai/rtk

รูปแบบ

CLI / Terminal

เหมาะกับงาน

AI และ AgentsCoding AgentsDeveloper Toolsเพิ่ม Productivity

เหมาะกับอาชีพ

Ecosystem

Rust

แปลและเรียบเรียงโดย AI

เนื้อหาฉบับภาษาไทย

ใช้อ่านเพื่อทำความเข้าใจเบื้องต้น โปรดตรวจสอบรายละเอียดสำคัญกับเอกสารต้นฉบับด้านล่าง

RTK - Rust Token Killer
CIReleaseLicense: Apache 2.0DiscordHomebrew

rtk กรองและบีบอัดผลลัพธ์คำสั่งก่อนที่จะส่งไปยังบริบท LLM ของคุณ ไบนารี Rust เดี่ยว รองรับ 100+ คำสั่ง มีโอเวอร์เฮดน้อยกว่า 10ms

การประหยัดโทเค็น (เซสชัน Claude Code 30 นาที)

การดำเนินการความถี่มาตรฐานrtkการประหยัด
ls / tree10x2,000400-80%
cat / read20x40,00012,000-70%
grep / rg8x16,0003,200-80%
git status10x3,000600-80%
git diff5x10,0002,500-75%
git log5x2,500500-80%
git add/commit/push8x1,600120-92%
cargo test / npm test5x25,0002,500-90%
ruff check3x3,000600-80%
pytest4x8,000800-90%
go test3x6,000600-90%
docker ps3x900180-80%
รวม~118,000~23,900-80%

ประมาณการอิงจากโปรเจกต์ TypeScript/Rust ขนาดกลาง การประหยัดจริงจะแตกต่างกันไปตามขนาดโปรเจกต์

การติดตั้ง

Homebrew (แนะนำ)

bash
brew install rtk

ติดตั้งด่วน (Linux/macOS)

bash
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

ติดตั้งไปที่ ~/.local/bin เพิ่มลงใน PATH หากจำเป็น:

bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc  # หรือ ~/.zshrc

Cargo

bash
cargo install --git https://github.com/rtk-ai/rtk

ไบนารีที่สร้างไว้ล่วงหน้า

ดาวน์โหลดจาก releases:

  • macOS: rtk-x86_64-apple-darwin.tar.gz / rtk-aarch64-apple-darwin.tar.gz
  • Linux: rtk-x86_64-unknown-linux-musl.tar.gz / rtk-aarch64-unknown-linux-gnu.tar.gz
  • Windows: rtk-x86_64-pc-windows-msvc.zip

ผู้ใช้ Windows: แตกไฟล์ zip และวาง rtk.exe ไว้ใน PATH ของคุณ (เช่น C:\Users\<you>\.local\bin) รัน RTK จาก Command Prompt, PowerShell, หรือ Windows Terminal — อย่าดับเบิลคลิกที่ .exe (มันจะกะพริบแล้วปิดไป) ระบบ hook เต็มรูปแบบทำงานได้ตามปกติบน Windows (และใน WSL) ดูรายละเอียดที่ การตั้งค่า Windows ด้านล่าง

ตรวจสอบการติดตั้ง

bash
rtk --version   # ควรแสดง "rtk 0.28.2"
rtk gain        # ควรแสดงสถิติการประหยัดโทเค็น

คำเตือนการชนกันของชื่อ: มีโปรเจกต์อื่นชื่อ "rtk" (Rust Type Kit) อยู่บน crates.io หาก rtk gain ล้มเหลว แสดงว่าคุณได้แพ็กเกจผิด ใช้ cargo install --git ด้านบนแทน

เริ่มต้นใช้งานอย่างรวดเร็ว

bash
# 1. ติดตั้งสำหรับเครื่องมือ AI ของคุณ
rtk init -g                     # Claude Code / Copilot (ค่าเริ่มต้น)
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
rtk init --agent kilocode       # Kilo Code
rtk init --agent antigravity    # Google Antigravity
rtk init -g --agent pi          # Pi
rtk init --agent hermes         # Hermes
rtk init -g --agent droid       # Factory Droid

# 2. รีสตาร์ทเครื่องมือ AI ของคุณ แล้วทดสอบ
git status  # ถูกเขียนใหม่โดยอัตโนมัติเป็น rtk git status

เอเจนต์ที่ใช้ hook จะเขียนคำสั่ง Bash ใหม่ (เช่น git status -> rtk git status) ก่อนการดำเนินการ เอเจนต์ที่ใช้ปลั๊กอิน รวมถึง Hermes จะใช้ API ปลั๊กอินเพื่อเขียนคำสั่งใหม่ก่อนการดำเนินการ เอเจนต์จะได้รับผลลัพธ์ที่กระชับโดยไม่จำเป็นต้องเรียก rtk โดยตรง

สำคัญ: hook จะทำงานเฉพาะกับการเรียกใช้เครื่องมือ Bash เท่านั้น เครื่องมือในตัวของ Claude Code เช่น Read, Grep, และ Glob จะไม่ผ่าน Bash hook ดังนั้นจึงไม่ถูกเขียนใหม่โดยอัตโนมัติ หากต้องการผลลัพธ์ที่กระชับของ RTK สำหรับเวิร์กโฟลว์เหล่านั้น ให้ใช้คำสั่ง shell (cat/head/tail, rg/grep, find) หรือเรียก rtk read, rtk grep, หรือ rtk find โดยตรง

วิธีการทำงาน

code
  Without rtk:                                    With rtk:

  Claude  --git status-->  shell  -->  git         Claude  --git status-->  RTK  -->  git
    ^                                   |            ^                      |          |
    |        ~2,000 tokens (raw)        |            |   ~200 tokens        | filter   |
    +-----------------------------------+            +------- (filtered) ---+----------+

สี่กลยุทธ์ที่ใช้กับแต่ละประเภทคำสั่ง:

  1. 1การกรองอัจฉริยะ (Smart Filtering) - ลบสิ่งรบกวน (ความคิดเห็น, ช่องว่าง, boilerplate)
  2. 2การจัดกลุ่ม (Grouping) - รวบรวมรายการที่คล้ายกัน (ไฟล์ตามไดเรกทอรี, ข้อผิดพลาดตามประเภท)
  3. 3การตัดทอน (Truncation) - เก็บเฉพาะบริบทที่เกี่ยวข้อง, ตัดส่วนที่ซ้ำซ้อน
  4. 4การลบรายการซ้ำ (Deduplication) - ยุบรายการบันทึกที่ซ้ำกันพร้อมจำนวนนับ

คำสั่ง

ไฟล์

bash
rtk ls .                        # โครงสร้างไดเรกทอรีที่ปรับให้เหมาะสมกับโทเค็น
rtk read file.rs                # การอ่านไฟล์อัจฉริยะ
rtk read file.rs -l aggressive  # เฉพาะลายเซ็น (ตัดเนื้อหาออก)
rtk smart file.rs               # สรุปโค้ดแบบ 2 บรรทัดตามหลักการฮิวริสติก
rtk find "*.rs" .               # ผลลัพธ์การค้นหาที่กระชับ
rtk grep "pattern" .            # ผลลัพธ์การค้นหาที่จัดกลุ่ม
rtk diff file1 file2            # diff แบบย่อ (ออก 1 หากไฟล์แตกต่างกัน)

Git

bash
rtk git status                  # สถานะแบบกระชับ
rtk git log -n 10               # คอมมิตแบบบรรทัดเดียว
rtk git diff                    # diff แบบย่อ
rtk git add                     # -> "ok"
rtk git commit -m "msg"         # -> "ok abc1234"
rtk git push                    # -> "ok main"
rtk git pull                    # -> "ok 3 files +10 -2"

GitHub CLI

bash
rtk gh pr list                  # รายการ PR แบบกระชับ
rtk gh pr view 42               # รายละเอียด PR + การตรวจสอบ
rtk gh issue list               # รายการ issue แบบกระชับ
rtk gh run list                 # สถานะการรันเวิร์กโฟลว์

ตัวรันการทดสอบ

bash
rtk jest                        # Jest แบบกระชับ (เฉพาะข้อผิดพลาด)
rtk vitest                      # Vitest แบบกระชับ (เฉพาะข้อผิดพลาด)
rtk playwright test             # ผลลัพธ์ E2E (เฉพาะข้อผิดพลาด)
rtk pytest                      # การทดสอบ Python (-90%)
rtk go test                     # การทดสอบ Go (NDJSON, -90%)
rtk cargo test                  # การทดสอบ Cargo (-90%)
rtk rake test                   # Ruby minitest (-90%)
rtk rspec                       # การทดสอบ RSpec (JSON, -60%+)
rtk err <cmd>                   # กรองเฉพาะข้อผิดพลาดจากคำสั่งใดๆ
rtk test <cmd>                  # ตัวห่อการทดสอบทั่วไป - เฉพาะข้อผิดพลาด (-90%)

Build & Lint

bash
rtk lint                        # ESLint จัดกลุ่มตามกฎ/ไฟล์
rtk lint biome                  # รองรับ linters อื่นๆ
rtk tsc                         # ข้อผิดพลาด TypeScript จัดกลุ่มตามไฟล์
rtk next build                  # Next.js build แบบกระชับ
rtk prettier --check .          # ไฟล์ที่ต้องการการจัดรูปแบบ
rtk cargo build                 # Cargo build (-80%)
rtk cargo clippy                # Cargo clippy (-80%)
rtk ruff check                  # Python linting (JSON, -80%)
rtk golangci-lint run           # Go linting (JSON, -85%)
rtk rubocop                     # Ruby linting (JSON, -60%+)

ตัวจัดการแพ็กเกจ

bash
rtk pnpm list                   # โครงสร้างการพึ่งพาแบบกระชับ
rtk uv run pytest               # รักษาสภาพแวดล้อม uv, เฉพาะข้อผิดพลาด
rtk pip list                    # แพ็กเกจ Python (ตรวจจับ uv อัตโนมัติ)
rtk pip outdated                # แพ็กเกจที่ล้าสมัย
rtk bundle install              # Ruby gems (ตัดบรรทัด Using ออก)
rtk prisma generate             # การสร้าง Schema (ไม่มี ASCII art)

AWS

bash
rtk aws sts get-caller-identity # ข้อมูลประจำตัวแบบบรรทัดเดียว
rtk aws ec2 describe-instances  # รายการอินสแตนซ์แบบกระชับ
rtk aws lambda list-functions   # ชื่อ/รันไทม์/หน่วยความจำ (ตัดข้อมูลลับออก)
rtk aws logs get-log-events     # เฉพาะข้อความที่มีการประทับเวลา
rtk aws cloudformation describe-stack-events  # ข้อผิดพลาดก่อน
rtk aws dynamodb scan           # คลายการห่อคำอธิบายประเภท
rtk aws iam list-roles          # ตัดเอกสารนโยบายออก
rtk aws s3 ls                   # ถูกตัดทอนพร้อมการกู้คืนด้วย tee

### Containers
```bash
rtk docker ps                   # รายการ container แบบย่อ
rtk docker images               # รายการ image แบบย่อ
rtk docker logs <container>     # logs แบบตัดข้อมูลซ้ำ
rtk docker compose ps           # บริการของ Compose
rtk kubectl pods                # รายการ pod แบบย่อ
rtk kubectl logs <pod>          # logs แบบตัดข้อมูลซ้ำ
rtk kubectl services            # รายการ service แบบย่อ
rtk oc get pods                 # สรุปรายการ pod ของ OpenShift
rtk oc get services             # รายการ service ของ OpenShift
rtk oc logs <pod>               # logs แบบตัดข้อมูลซ้ำ

Infrastructure as Code

bash
rtk pulumi preview              # ตัดส่วนหัว/URL/ระยะเวลาที่ไม่จำเป็นออก
rtk pulumi up                   # ผลลัพธ์การ apply แบบย่อ
rtk pulumi destroy              # ผลลัพธ์การ destroy แบบย่อ
rtk pulumi refresh              # สรุปการเปลี่ยนแปลง (Drift summary)
rtk pulumi stack                # เมทาดาตาของ Stack (ตัดเจ้าของ/เวลาออก)

Data & Analytics

bash
rtk json config.json            # แสดงโครงสร้างโดยไม่มีค่าข้อมูล
rtk deps                        # สรุป Dependencies
rtk env -f AWS                  # กรองตัวแปร env
rtk log app.log                 # logs แบบตัดข้อมูลซ้ำ
rtk curl <url>                  # ตัดส่วนท้าย + บันทึกผลลัพธ์ฉบับเต็ม
rtk wget <url>                  # ดาวน์โหลดโดยตัดแถบแสดงความคืบหน้าออก
rtk summary <long command>      # สรุปผลลัพธ์ด้วย Heuristic
rtk proxy <command>             # ส่งผ่านข้อมูลดิบ + ติดตามผล

Token Savings Analytics

bash
rtk gain                        # สถิติสรุป
rtk gain --graph                # กราฟ ASCII (30 วันล่าสุด)
rtk gain --history              # ประวัติคำสั่งล่าสุด
rtk gain --daily                # รายละเอียดแบบรายวัน
rtk gain --all --format json    # ส่งออกเป็น JSON สำหรับแดชบอร์ด

rtk discover                    # ค้นหาโอกาสในการประหยัด token ที่พลาดไป
rtk discover --all --since 7    # ทุกโปรเจกต์ ในช่วง 7 วันล่าสุด

rtk session                     # แสดงการใช้งาน RTK ในเซสชันล่าสุด

Global Flags

bash
-u, --ultra-compact    # ใช้ไอคอน ASCII, รูปแบบ inline (ประหยัด token เพิ่มขึ้น)
-v, --verbose          # เพิ่มระดับความละเอียด (-v, -vv, -vvv)

Examples

การแสดงรายการไดเรกทอรี:

code
# ls -la (45 บรรทัด, ~800 tokens)        # rtk ls (12 บรรทัด, ~150 tokens)
drwxr-xr-x  15 user staff 480 ...       my-project/
-rw-r--r--   1 user staff 1234 ...       +-- src/ (8 files)
...                                      |   +-- main.rs
                                         +-- Cargo.toml

การทำงานกับ Git:

code
# git push (15 บรรทัด, ~200 tokens)       # rtk git push (1 บรรทัด, ~10 tokens)
Enumerating objects: 5, done.             ok main
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
...

ผลลัพธ์การทดสอบ (Test output):

code
# cargo test (200+ บรรทัดเมื่อล้มเหลว)     # rtk test cargo test (~20 บรรทัด)
running 15 tests                          FAILED: 2/15 tests
test utils::test_parse ... ok               test_edge_case: assertion failed
test utils::test_format ... ok              test_overflow: panic at utils.rs:18
...

Auto-Rewrite Hook

วิธีที่มีประสิทธิภาพที่สุดในการใช้ rtk โดย hook จะดักจับคำสั่ง Bash และเขียนคำสั่งใหม่ให้เป็นรูปแบบของ rtk โดยอัตโนมัติก่อนการประมวลผล

ผลลัพธ์: ใช้งาน rtk ได้ 100% ในทุกการสนทนาและ subagents โดยไม่มี token overhead

หมายเหตุเรื่องขอบเขต: สิ่งนี้ใช้ได้กับ Bash tool calls เท่านั้น เครื่องมือในตัวของ Claude Code เช่น Read, Grep, และ Glob จะไม่ผ่าน hook นี้ ดังนั้นให้ใช้คำสั่ง shell หรือคำสั่ง rtk โดยตรงเมื่อต้องการการกรองของ RTK ในส่วนดังกล่าว

Setup

bash
rtk init -g                 # ติดตั้ง hook + RTK.md (แนะนำ)
rtk init -g --opencode      # ปลั๊กอิน OpenCode (แทนที่ Claude Code)
rtk init -g --auto-patch    # แบบไม่ต้องโต้ตอบ (สำหรับ CI/CD)
rtk init -g --hook-only     # ติดตั้งเฉพาะ hook โดยไม่มี RTK.md
rtk init --show             # ตรวจสอบการติดตั้ง

หลังจากติดตั้ง ให้ รีสตาร์ท Claude Code

Windows

RTK ทำงานได้อย่างสมบูรณ์บน Windows แบบ native ตั้งแต่ v0.37.2 auto-rewrite hook จะทำงานเป็น native binary command (rtk hook claude) โดยไม่ต้องใช้ Unix shell, bash หรือ jq ดังนั้นคำสั่งจะถูกเขียนใหม่โดยอัตโนมัติบน Command Prompt, PowerShell และ Windows Terminal เช่นเดียวกับบน Linux และ macOS

Native Windows

powershell
# 1. ดาวน์โหลดและแตกไฟล์ rtk-x86_64-pc-windows-msvc.zip จากหน้า releases
# 2. เพิ่ม rtk.exe ลงใน PATH (เช่น C:\Users\<you>\.local\bin)
# 3. เริ่มต้นการทำงาน — ติดตั้ง native binary hook
rtk init -g

อัปเกรดจากการติดตั้งเวอร์ชันเก่า? หากคุณติดตั้ง RTK ก่อน v0.37.2 คุณอาจยังมี shell hook แบบเก่า rtk-rewrite.sh (ซึ่งจำเป็นต้องใช้ Unix shell) ให้รัน rtk init -g อีกครั้งเพื่อย้ายมาใช้ native binary hook

สิ่งที่จำเป็น: ฟิลเตอร์บางตัวต้องเรียกใช้ ripgrep (rg) โปรดติดตั้งและเพิ่มลงใน PATH (เช่น winget install BurntSushi.ripgrep.MSVC) เพื่อหลีกเลี่ยงคำเตือน Binary 'rg' not found on PATH

สำคัญ: ห้ามดับเบิลคลิก rtk.exe เนื่องจากเป็นเครื่องมือ CLI ที่จะแสดงวิธีใช้งานและจบการทำงานทันที ให้รันผ่านเทอร์มินัลเสมอ (Command Prompt, PowerShell หรือ Windows Terminal)

WSL

WSL สามารถใช้งานได้และทำงานเหมือนกับ Linux ทุกประการ:

bash
# ภายใน WSL
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
rtk init -g
ฟีเจอร์Native WindowsWSL
Filters (cargo, git, etc.)สมบูรณ์สมบูรณ์
Auto-rewrite hookใช่ (native binary)ใช่
rtk init -gHook modeHook mode
rtk gain / analyticsสมบูรณ์สมบูรณ์

Supported AI Tools

RTK รองรับเครื่องมือ AI coding 15 รายการ โดยการรวมเข้ากับแต่ละเครื่องมือจะเขียนคำสั่ง shell ใหม่ให้เป็นรูปแบบ rtk เพื่อประหยัด token ได้ 60-90% ในกรณีที่ agent รองรับการดักจับคำสั่ง (command interception)

เครื่องมือการติดตั้งวิธีการ
Claude Codertk init -gPreToolUse hook (native binary)
GitHub Copilot (VS Code)rtk init -g --copilotPreToolUse hook — rewrite แบบโปร่งใส
GitHub Copilot CLIrtk init -g --copilotPreToolUse deny-with-suggestion (ข้อจำกัดของ CLI)
Cursorrtk init -g --agent cursorpreToolUse hook (hooks.json)
Gemini CLIrtk init -g --geminiBeforeTool hook
Codexrtk init -g --codexคำแนะนำใน AGENTS.md + RTK.md
Windsurfrtk init -g --agent windsurf.windsurfrules (ระดับโปรเจกต์)
Cline / Roo Codertk init --agent cline.clinerules (ระดับโปรเจกต์)
OpenCodertk init -g --opencodePlugin TS (tool.execute.before)
OpenClawopenclaw plugins install ./openclawPlugin TS (before_tool_call)
Pirtk init -g --agent pi (global)TypeScript extension (tool_call)
Hermesrtk init --agent hermesPython plugin adapter (เปลี่ยนคำสั่งเทอร์มินัลผ่าน rtk rewrite)
Mistral Vibeกำลังดำเนินการ (#800)รอการอัปเดตจาก upstream
Kilo Codertk init --agent kilocode.kilocode/rules/rtk-rules.md (ระดับโปรเจกต์)
Google Antigravityrtk init --agent antigravity.agents/rules/antigravity-rtk-rules.md (ระดับโปรเจกต์)
Factory Droidrtk init -g --agent droid (หรือรายโปรเจกต์)PreToolUse hook ใน ~/.factory/hooks.json (matcher Execute)

สำหรับรายละเอียดการตั้งค่าราย agent, การควบคุมการ override และการลดระดับการทำงาน (graceful degradation) โปรดดูที่ Supported Agents guide ซอร์สโค้ดและแบบทดสอบของปลั๊กอิน Hermes อยู่ใน hooks/hermes/ และไฟล์ runtime ของ Hermes ที่ติดตั้งแล้วจะอยู่ที่ ~/.hermes/plugins/rtk-rewrite/

Configuration

~/.config/rtk/config.toml (macOS: ~/Library/Application Support/rtk/config.toml):

toml
[hooks]
exclude_commands = ["curl", "playwright"]  # ข้ามการ rewrite สำหรับคำสั่งเหล่านี้

[tee]
enabled = true          # บันทึกผลลัพธ์ดิบเมื่อเกิดข้อผิดพลาด (ค่าเริ่มต้น: true)
mode = "failures"       # "failures", "always", หรือ "never"

เมื่อคำสั่งล้มเหลว RTK จะบันทึกผลลัพธ์ฉบับเต็มที่ไม่ได้กรอง เพื่อให้ LLM สามารถอ่านได้โดยไม่ต้องรันคำสั่งซ้ำ:

code
FAILED: 2/15 tests
[full output: ~/.local/share/rtk/tee/1707753600_cargo_test.log]

สำหรับข้อมูลอ้างอิงการตั้งค่าฉบับเต็ม (ทุกส่วน, env vars, ฟิลเตอร์รายโปรเจกต์) โปรดดูที่ Configuration guide

Uninstall

bash
rtk init -g --uninstall     # ลบ hook, RTK.md, และรายการใน settings.json
cargo uninstall rtk          # ลบ binary
brew uninstall rtk           # หากติดตั้งผ่าน Homebrew

Documentation

  • rtk-ai.app/guide — คู่มือผู้ใช้ฉบับเต็ม (การติดตั้ง, agent ที่รองรับ, สิ่งที่ถูกปรับแต่ง, การวิเคราะห์, การตั้งค่า, การแก้ไขปัญหา)
  • INSTALL.md — ข้อมูลอ้างอิงการติดตั้งโดยละเอียด
  • ARCHITECTURE.md — การออกแบบระบบและการตัดสินใจทางเทคนิค
  • CONTRIBUTING.md — คู่มือการมีส่วนร่วม
  • SECURITY.md — นโยบายความปลอดภัย

ความเป็นส่วนตัวและการเก็บข้อมูลการใช้งาน (Privacy & Telemetry)

RTK อาจมีการเก็บ ข้อมูลการใช้งานแบบรวมกลุ่มและไม่ระบุตัวตน (anonymous, aggregate usage metrics) วันละหนึ่งครั้ง โดยระบบ Telemetry จะถูก ปิดการใช้งานเป็นค่าเริ่มต้น และต้องได้รับ ความยินยอมอย่างชัดเจน (explicit opt-in consent) (ตาม GDPR Art. 6, 7) ในระหว่างขั้นตอน rtk init หรือผ่านคำสั่ง rtk telemetry enable ข้อมูลนี้ช่วยให้เราพัฒนาผลิตภัณฑ์ให้ดียิ่งขึ้น เช่น การระบุว่าคำสั่งใดที่จำเป็นต้องมี filter, filter ตัวไหนที่ต้องปรับปรุง และ RTK สร้างมูลค่าได้มากน้อยเพียงใด สำหรับรายการฟิลด์ข้อมูลทั้งหมด การจัดการข้อมูล และแนวทางสำหรับผู้ร่วมพัฒนา สามารถดูได้ที่ docs/TELEMETRY.md

ข้อมูลที่ถูกเก็บและเหตุผล:

หมวดหมู่ข้อมูลเหตุผล
ตัวตน (Identity)Salted device hash (SHA-256, ไม่สามารถย้อนกลับได้)เพื่อนับจำนวนการติดตั้งที่ไม่ซ้ำกันโดยไม่ติดตามรายบุคคล
สภาพแวดล้อม (Environment)RTK version, OS, architecture, วิธีการติดตั้งเพื่อให้ทราบว่าควรสนับสนุนและทดสอบบนแพลตฟอร์มใดบ้าง
ปริมาณการใช้งาน (Usage volume)จำนวนคำสั่ง (24 ชม.), จำนวนคำสั่งทั้งหมด, จำนวน token ที่ประหยัดได้ (24 ชม./30 วัน/ทั้งหมด)เพื่อวัดการนำไปใช้งานและมูลค่าที่ส่งมอบ
คุณภาพ (Quality)5 อันดับคำสั่งที่ส่งผ่านทั้งหมด (ประหยัด 0%), จำนวนครั้งที่ parse ล้มเหลว, คำสั่งที่ประหยัดได้ <30%เพื่อระบุ filter ที่ขาดหายไปหรือตัวที่ประสิทธิภาพต่ำเพื่อนำมาปรับปรุง
ระบบนิเวศ (Ecosystem)การกระจายหมวดหมู่คำสั่ง (เช่น git 45%, cargo 20%, js 15%)เพื่อจัดลำดับความสำคัญในการพัฒนา filter สำหรับระบบนิเวศที่ได้รับความนิยม
การรักษาผู้ใช้ (Retention)จำนวนวันนับตั้งแต่ใช้งานครั้งแรก, จำนวนวันที่ใช้งานใน 30 วันล่าสุดเพื่อทำความเข้าใจความผูกพันของผู้ใช้และตรวจจับการเลิกใช้งาน (churn)
การนำไปใช้ (Adoption)ประเภท AI agent hook (claude/gemini/codex), จำนวน custom TOML filterเพื่อติดตามความครอบคลุมของการเชื่อมต่อและการนำ DSL ไปใช้งาน
การตั้งค่า (Configuration)การมีอยู่ของ config.toml, จำนวนคำสั่งที่ยกเว้น, จำนวนโปรเจกต์เพื่อทำความเข้าใจระดับความเชี่ยวชาญของผู้ใช้และรูปแบบการปรับแต่ง
ฟีเจอร์ (Features)จำนวนการใช้งาน meta-commands (gain, discover, proxy, verify)เพื่อให้ทราบว่าฟีเจอร์ใดของ RTK ที่มีประโยชน์และฟีเจอร์ใดที่ไม่มีคนใช้
ความคุ้มค่า (Economics)ประมาณการมูลค่าที่ประหยัดได้เป็น USD (อ้างอิงจากราคา API token)เพื่อวัดมูลค่าเชิงปริมาณที่ RTK มอบให้กับผู้ใช้

ข้อมูลทั้งหมดจะเป็น จำนวนแบบรวมกลุ่มหรือชื่อคำสั่งที่ไม่ระบุตัวตน (เก็บเพียง 3 คำแรก และไม่มี arguments) สำหรับคำสั่งยอดนิยมจะรายงานเพียงชื่อเครื่องมือ (เช่น "git", "cargo") และจะไม่มีการเก็บคำสั่งแบบเต็มบรรทัดโดยเด็ดขาด

สิ่งที่ไม่ถูกเก็บ: ซอร์สโค้ด, พาธของไฟล์, arguments ของคำสั่ง, ความลับ (secrets), environment variables, ข้อมูลส่วนบุคคล หรือเนื้อหาใน repository

การจัดการ telemetry:

bash
rtk telemetry status     # ตรวจสอบสถานะการยินยอมในปัจจุบัน
rtk telemetry enable     # ให้ความยินยอม (ผ่าน interactive prompt)
rtk telemetry disable    # ถอนความยินยอม — หยุดการเก็บข้อมูลทั้งหมดทันที
rtk telemetry forget     # ถอนความยินยอม + ลบข้อมูลท้องถิ่นทั้งหมด + ร้องขอให้ลบข้อมูลฝั่งเซิร์ฟเวอร์

การบังคับปิดผ่าน environment variable:

bash
export RTK_TELEMETRY_DISABLED=1   # บล็อก telemetry โดยไม่คำนึงถึงการยินยอม

Star History

Star History Chart

StarMapper

StarMapper

ทีมงานหลัก (Core team)

การมีส่วนร่วม (Contributing)

ยินดีรับการสนับสนุน! โปรดเปิด issue หรือ PR บน GitHub

เข้าร่วมชุมชนได้ที่ Discord

ไลเซนส์ (License)

Apache License 2.0 - ดูรายละเอียดได้ที่ LICENSE

ข้อสงวนสิทธิ์ (Disclaimer)

ดูรายละเอียดที่ DISCLAIMER.md

เอกสารโปรเจกต์

อ่านเอกสารต้นฉบับ

README วิธีติดตั้ง วิธีใช้งาน และข้อกำหนดจาก repository ต้นฉบับ

ดูไฟล์บน GitHub
RTK — Rust Token Killer. Fewer tokens, more possibilities.
CIReleaseLicense: Apache-2.0 and BUSL-1.1DiscordHomebrew
Star History RankGitHub Trending Repository of the Day
Starred by developers at Microsoft, Google, Amazon, Meta, Apple, NVIDIA, IBM, Tencent, ByteDance, Alibaba, Shopify, Datadog, SAP, Adobe, Intel, Samsung, Bosch, Cisco, JPMorgan Chase, Oracle, Netflix, Toyota, Salesforce, Siemens, Accenture, Uber, Spotify, and 1,100+ more companies

① Install & forget: up to 90% less command output. Test runs, diffs, logs and builds are compressed before your agent reads them. 100+ commands, under 25 ms per command, no config, nothing changes in how you work. rtk gain shows what you saved.

② Go further with pipelines, as far as you take it. Hand heavy reads to a cheaper model, compress more than bash, clean the API traffic without breaking the prompt cache. One agent-agnostic file: start from a built-in, install one someone shared, or write and share your own. The community built the bash compressor 85k developers starred. Now it is building pipelines: the best one listed today cuts total cost by 20.2% in its author's benchmark.

Agents across the whole company? RTK Pro is the control layer for every AI agent: one gateway for every AI call, costs, secrets and personal data, policies, team catalog, audit. Discover RTK Pro ↓

A real terminal session, sped up. rtk init -g registers the hook. claude -p is asked to run the test suite and answers that 3 of 281 tests fail, naming each one with its assertion. rtk gain then shows 2 commands, 3.4K tokens saved, 93.3%: rtk cargo test at 94.2% and rtk ls at 82.3%.

Install & forget

macOS, and Linux with Homebrew

bash
brew install rtk

Windows, with winget

bash
winget install rtk-ai.rtk

Linux, macOS, WSL, or Git Bash on Windows, with the install script

bash
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Then plug it into your agent

bash
rtk init -g                      # Claude Code; every other agent: see "Works in your agent"

Restart your agent. That's it: when it runs git status, RTK runs rtk git status and the agent reads a 3-line summary instead of 40 lines. Nothing to learn, nothing to call, and upgrading RTK never changes this.

Another project named "rtk" exists on crates.io. Check you have this one: rtk gain must show the savings dashboard, not "command not found".

Cargo, pre-built binaries, native Windows, WSL and uninstall: Installation guide · per-agent setup and --dry-run: Quick Start

Measure it: rtk gain

Every command RTK touches is counted on your machine. One command shows what it saved, today and since you installed it.

bash
rtk gain                        # Summary stats
rtk gain --graph                # ASCII graph (last 30 days)
rtk gain --history              # Recent command history
rtk gain --daily                # Day-by-day breakdown
rtk gain --all --format json    # JSON export for dashboards

rtk discover                    # Find missed savings opportunities
rtk discover --all --since 7    # All projects, last 7 days

rtk session                     # Show RTK adoption across recent sessions

What the numbers mean. The compressor reduces the command output your agent reads, which is one part of the input tokens, which are one part of the bill: a 90% cut in command output is not a 90% cut in cost. Token counts are estimated as bytes / 4, so the percentages are reliable and the absolute numbers are approximate.

After a week of data, rtk gain ends with one line about RTK Pro, at most once a day and only on a terminal. pro_hint = false under [display] in config.toml turns it off.

Full explanation: How RTK Savings Work · attribution, the live dashboard and export formats: Token Savings Analytics

Out of the box: the bash compressor

The part 85k developers starred. Built by 200+ contributors, written against real command output, and every filter has to cut at least 20% to ship.

cargo test on a 48-test crate: 71 lines of raw output on the left; on the right, the 11 lines the agent reads with rtk: the failing test
OperationWhat the agent reads
cargo test / npm test / pytest / go testFailures only, with their assertion; passing tests collapsed to a count
git status / git diff / git logCompact status, reduced diff context, one line per commit
git add/commit/pushA confirmation line instead of progress output
ls / tree / grep / rgTrees with counts, matches grouped by file, long lines cut
ruff check / eslint / cargo clippyGrouped by rule and file
docker ps / kubectlEssential fields only

100+ commands across Git, GitHub CLI, Cargo/Rust, JavaScript (npm, pnpm, vitest, jest, tsc, Next.js, Angular, Playwright, Prisma), Python (ruff, pytest, mypy, pip), Go (go test, golangci-lint), Ruby, .NET, JVM (Gradle, Maven), PHP, Docker, Kubernetes, AWS, Terraform, and the file/search builtins. Every command and its filter: What RTK Optimizes

Three promises

  • Never blocks. If a filter fails, you get the raw output, and the command's exit code is passed through unchanged.
  • Never worse. RTK never prints more than the command did.
  • Nothing hidden. Output that is cut says where the full version is, and rtk bypass runs any command unfiltered, still tracked in rtk gain:
bash
rtk bypass git log --oneline -20        # full git log, no truncation
rtk bypass npm install express          # raw npm output

The hook rewrites shell commands. Built-in tools such as Read, Grep and Glob pass through untouched out of the box; in Claude Code, a pipeline compresses them too (see Pipelines below).

Does RTK break the prompt cache? No: output is filtered once, before it enters the conversation. Details.

Want to go further? Pipelines.

Out of the box, RTK compresses command output and stops there. A pipeline is how you ask it for more: one small file that tells RTK what to do with what your agent reads and sends. No file means the compressor above and nothing else; a pipeline adds one thing at a time, and you can take it back out.

Four things a pipeline turns on, one line each: less command output (on by default, up to 90% less); every tool compressed, not just the shell (Claude Code); big files read by a cheaper model you choose (Claude Code, your API key); clean API traffic through the optional proxy. Below: install a pipeline someone shared or share yours; the best one listed cuts total cost by 20.2% in its author

What people turn on first

  • Compress everything the agent reads, not just shell output: grep results, web pages, lockfiles, any output RTK has no filter for (Claude Code).
  • Hand big file reads to a cheaper model you choose. The file never enters your agent's context (Claude Code, with your API key).
  • Clean the API traffic your agent re-sends every turn, with the prompt cache kept intact (through the optional proxy, below).
  • Make the agent write less: terse prose, with code, paths, commands and errors kept in full (every agent).

Each of these is a built-in pipeline, one line to turn on. rtk-ai.app/pipelines lists them next to the pipelines the community shares, each with what it saved and how that was measured. Installing one is a single command:

bash
rtk pipeline add github:user/repo        # check and install a shared pipeline

A pipeline can rewrite commands and send content to the models it declares, so read its file before you install it. Written once, a pipeline works in every agent RTK supports, as far as that agent's hooks allow: Agent Coverage shows what runs where.

Start here: Pipelines · the built-ins, explained: Reference Pipelines · write and share your own: Writing a Pipeline, Pipeline Commands

RTK Proxy (optional)

The rtk-proxy daemon runs the same pipeline on your agent's provider-API traffic: it strips bytes no model ever needed without breaking the prompt cache, and carries the calls your pipeline routes to cheaper models on the credential your agent already sends, so they show up in rtk gain. rtk init -g offers to set it up; rtk claude starts it and launches Claude through it with no configuration at all.

bash
rtk claude              # start the daemon if needed, then launch Claude through it
rtk llm-proxy status    # is it up
rtk gain                # savings, command filtering and proxy side by side

Separate binary, separate licence (BUSL-1.1), its own rtk-proxy-<target> archive: rtk never links it. Not the same thing as rtk bypass, which runs one local command unfiltered.

Setup and subcommands: RTK Proxy · what it compresses: What the Proxy Compresses · settings and endpoints: Proxy Configuration


Agents across the whole company? Know what they cost, what they touch, and who ran what.

RTK Pro: scale AI agents, stay in control. The control layer for every AI agent in your company. Gateway: every AI call in one place, whichever provider; spend by team, person and model; budgets that warn, then stop. Shield: secrets and personal data masked before any model sees them. Policies: risky commands stopped before they run. Team catalog: skills, MCP servers and pipelines, assigned per team and project. Audit: who did what, and whether it was allowed, every action on record. Runs on each developer

RTK runs on each developer's machine. RTK Pro connects them into one control layer for the whole company:

  • Gateway. Every AI call goes through one place, whichever provider each team uses.
  • Cost control. Spend by team, person and model. Waste found and removed. Budgets that warn, then stop.
  • Shield. Secrets and personal data masked before any model sees them.
  • Policies. Risky commands stopped before they run.
  • Team catalog. Skills, MCP servers and pipelines, assigned per team and project.
  • Audit log. Who did what, and whether it was allowed.

Nothing changes for the developer. No secret value ever leaves the machine. The CLI stays free and open source.

Just you?Your team, or the whole company?
The Dev plan: guardrails and analytics for one developer. Your own dashboard of spend per project and per model, the Shield and policies on your machine, nothing to administer.Teams, Business and Enterprise: the full control layer for every developer, with SSO and the audit log, scaled across the organisation, up to on-premise deployment and a custom SLA.
Plans and what each includes →See what it is worth for your team → · Talk to us →

Works in your agent

RTK supports 18 AI coding tools. With a hook or plugin, rtk init installs it and compression is automatic. With a rules file, RTK asks the model to prefer rtk commands instead.

ToolInstallHow
Claude Codertk init -ghook
GitHub Copilot (VS Code, CLI)rtk init -g --copilothook
Cursorrtk init -g --agent cursorhook
Gemini CLIrtk init -g --geminihook
Codexrtk init -g --codexhook
Mistral Vibertk init -g --agent vibehook
Factory Droidrtk init -g --agent droidhook
Traertk init --agent trae (or -g)hook
OpenCode (1.18.29+)rtk init -g --opencodeplugin
OpenClawopenclaw plugins install ./openclawplugin
Pi / Oh My Pirtk init -g --agent pi / --agent ompplugin
Hermesrtk init --agent hermesplugin
Windsurfrtk init -g --agent windsurfrules file
Cline / Roo Codertk init --agent clinerules file
Kilo Codertk init --agent kilocoderules file
Google Antigravityrtk init --agent antigravity (or -g)rules file
Kimi AIrtk init --agent kimirules file

Per-agent setup, what each hook API allows, override controls: Supported Agents · Agent Coverage

Documentation

rtk-ai.app/docs is the full user guide.

Installationevery install method, Windows, WSL, uninstall
Quick Startper-agent init, --dry-run, first savings
Supported Agentssetup detail, override controls, degradation
Agent Coveragewhat each agent's hook API lets RTK do
What RTK Optimizesevery command and its filter
Configurationconfig.toml, env vars, recall recovery
Token Savings Analyticsrtk gain in full
Pipelinesthe engine: pipeline.toml, rules, judges, tasks, sharing
RTK Proxythe daemon: setup, what it compresses, settings
Editions and Licensingwhat each download contains
Telemetry & Privacywhat is collected, how to opt in, your GDPR rights
Troubleshootingcommon issues, prompt-cache questions

Repository references: engine/README.md · proxy/README.md · ARCHITECTURE.md · CONTRIBUTING.md · SECURITY.md

RTK collects no command content and no file contents. Telemetry is anonymous and off by default — it sends nothing until you opt in with explicit consent (GDPR Art. 6 & 7) via rtk telemetry enable, and documented in Telemetry & Privacy.

Editions and licence

RTK ships as three downloads. The two rtk editions install a binary with the same name — hooks, scripts and agent config work unchanged across both — so they cannot be installed together. Uninstall one before installing the other.

DownloadLicenceContains
rtk-<target>Apache-2.0 + BUSL-1.1Hook core, every command filter, and the pipeline engine
rtk-oss-<target>Apache-2.0 onlyHook core and every command filter. No engine.
rtk-proxy-<target>BUSL-1.1The RTK Proxy daemon. Never bundled with either rtk.

Production use is free, engine and daemon included. What the BUSL grant does not cover is offering RTK or a derivative to third parties as a commercial product or service — for that, contact contact@rtk-ai.app.

bash
curl -fsSL .../install.sh | RTK_EDITION=oss sh    # Apache-2.0 edition
brew install rtk-ai/tap/rtk-oss
mermaid
flowchart TD
    agent["Your coding agent"]

    subgraph editions["Pick one · both install a binary named rtk"]
        direction LR
        full["<b>rtk</b><br/>Apache-2.0 + BUSL-1.1<br/>hooks · filters · engine"]
        oss["<b>rtk-oss</b><br/>Apache-2.0 only<br/>hooks · filters"]
    end

    proxy["<b>rtk-proxy</b><br/>BUSL-1.1<br/>compresses API traffic"]

    agent -->|"command output"| full
    agent -->|"command output"| oss
    agent -.->|"API traffic"| proxy

    classDef apache stroke:#2da44e,stroke-width:2px,fill:none
    classDef busl stroke:#0969da,stroke-width:2px,fill:none
    classDef mixed stroke:#8250df,stroke-width:2px,fill:none
    classDef plain stroke:#8c959f,stroke-width:1px,fill:none
    class full mixed
    class oss apache
    class proxy busl
    class agent plain
    style editions fill:none,stroke:#d0d7de,stroke-dasharray:4 4

The rtk CLI is Apache-2.0 — see LICENSE. It links one component under a different licence: rtk-engine (engine/) is BUSL-1.1, source-available: see engine/LICENSE. Its Additional Use Grant permits production use as part of the rtk binary, so running rtk is covered; using the engine on its own, or inside another product, is not until the Change Date. The rtk-proxy daemon (proxy/) is BUSL-1.1 on the same terms and ships as its own archive with its licence alongside — rtk never links it.

What the Apache-2.0 edition omits and where the licence boundary falls: Editions and Licensing


Community

Star History Chart
StarMapper

Core team

Contributing

Contributions welcome: a new filter, a fix, or a pipeline you publish with rtk pipeline share publish. Open an issue or PR on GitHub and read CONTRIBUTING.md first.

Join the community on Discord.

Disclaimer

See DISCLAIMER.md.

#agentic-coding#ai-coding#anthropic#claude-code#cli#command-line-tool#cost-reduction#developer-tools#llm#open-source#productivity#rust