feat: transparent rtk filter for bash tool #86

Merged
ph merged 2 commits from feature/rtk-bash into master 2026-06-15 05:39:19 +00:00
Owner

Summary

Pass bash commands through rtk (Rust Token Killer) for 60-90% token consumption reduction on common dev commands.

Design

  • Transparent proxy — bash tool internally prepends rtk before command execution, model needs no behavior change
  • Config togglertk_enabled in GlobalConfig, nil=auto-detect(自动检测 rtk 是否安装),true=强制启用,false=强制禁用
  • Escape hatch — model can pass no_rtk: true to bypass rtk for full raw output
  • Graceful degradation — silent fallback to raw command when rtk is not installed or fails
  • Frontend UI — toggle switch in Settings > Tools tab
  • System prompt — conditional notice tells model when rtk is active

Changes

File Type
internal/config/config.go +RtkEnabled field, +IsRtkEnabled()
internal/api/handler.go +RtkEnabled in request/response
internal/agent/system.go +rtk hint in tool guidelines
internal/tools/bash_tools.go +NoRtk param, +rtk wrapping, +fallback
web/src/api/config.ts +rtk_enabled type
web/src/components/SettingsDialog.tsx +RTK toggle in Tools tab

Closes #69

## Summary Pass bash commands through [rtk](https://github.com/rtk-ai/rtk) (Rust Token Killer) for 60-90% token consumption reduction on common dev commands. ## Design - **Transparent proxy** — bash tool internally prepends `rtk ` before command execution, model needs no behavior change - **Config toggle** — `rtk_enabled` in GlobalConfig, nil=auto-detect(自动检测 rtk 是否安装),true=强制启用,false=强制禁用 - **Escape hatch** — model can pass `no_rtk: true` to bypass rtk for full raw output - **Graceful degradation** — silent fallback to raw command when rtk is not installed or fails - **Frontend UI** — toggle switch in Settings > Tools tab - **System prompt** — conditional notice tells model when rtk is active ## Changes | File | Type | |------|------| | `internal/config/config.go` | +RtkEnabled field, +IsRtkEnabled() | | `internal/api/handler.go` | +RtkEnabled in request/response | | `internal/agent/system.go` | +rtk hint in tool guidelines | | `internal/tools/bash_tools.go` | +NoRtk param, +rtk wrapping, +fallback | | `web/src/api/config.ts` | +rtk_enabled type | | `web/src/components/SettingsDialog.tsx` | +RTK toggle in Tools tab | Closes #69
Pass bash commands through rtk for 60-90% token reduction.
Controlled by rtk_enabled global config (nil=auto-detect).
Model can bypass with no_rtk: true parameter.

Closes #69
- learning: transparent proxy pattern for tool filters
- decision: external CLI filters integration architecture
- update ARCHITECTURE.md with new decision entry
ph merged commit 64343cf910 into master 2026-06-15 05:39:19 +00:00
ph deleted branch feature/rtk-bash 2026-06-15 05:39:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ph/agentic!86
No description provided.