diff --git a/hooks/antigravity-rtk-rules.md b/hooks/antigravity-rtk-rules.md new file mode 100644 index 00000000..8ee44bcd --- /dev/null +++ b/hooks/antigravity-rtk-rules.md @@ -0,0 +1,32 @@ +# RTK - Rust Token Killer (Google Antigravity) + +**Usage**: Token-optimized CLI proxy for shell commands. + +## Rule + +Always prefix shell commands with `rtk` to minimize token consumption. + +Examples: + +```bash +rtk git status +rtk cargo test +rtk ls src/ +rtk grep "pattern" src/ +rtk find "*.rs" . +rtk docker ps +rtk gh pr list +``` + +## Meta Commands + +```bash +rtk gain # Show token savings +rtk gain --history # Command history with savings +rtk discover # Find missed RTK opportunities +rtk proxy # Run raw (no filtering, for debugging) +``` + +## Why + +RTK filters and compresses command output before it reaches the LLM context, saving 60-90% tokens on common operations. Always use `rtk ` instead of raw commands. diff --git a/hooks/kilocode-rtk-rules.md b/hooks/kilocode-rtk-rules.md new file mode 100644 index 00000000..53d76459 --- /dev/null +++ b/hooks/kilocode-rtk-rules.md @@ -0,0 +1,32 @@ +# RTK - Rust Token Killer (Kilo Code) + +**Usage**: Token-optimized CLI proxy for shell commands. + +## Rule + +Always prefix shell commands with `rtk` to minimize token consumption. + +Examples: + +```bash +rtk git status +rtk cargo test +rtk ls src/ +rtk grep "pattern" src/ +rtk find "*.rs" . +rtk docker ps +rtk gh pr list +``` + +## Meta Commands + +```bash +rtk gain # Show token savings +rtk gain --history # Command history with savings +rtk discover # Find missed RTK opportunities +rtk proxy # Run raw (no filtering, for debugging) +``` + +## Why + +RTK filters and compresses command output before it reaches the LLM context, saving 60-90% tokens on common operations. Always use `rtk ` instead of raw commands. diff --git a/src/init.rs b/src/init.rs index 494bef34..d60079b5 100644 --- a/src/init.rs +++ b/src/init.rs @@ -19,6 +19,9 @@ const OPENCODE_PLUGIN: &str = include_str!("../hooks/opencode-rtk.ts"); const RTK_SLIM: &str = include_str!("../hooks/rtk-awareness.md"); const RTK_SLIM_CODEX: &str = include_str!("../hooks/rtk-awareness-codex.md"); +const KILOCODE_RULES: &str = include_str!("../hooks/kilocode-rtk-rules.md"); +const ANTIGRAVITY_RULES: &str = include_str!("../hooks/antigravity-rtk-rules.md"); + /// Template written by `rtk init` when no filters.toml exists yet. const FILTERS_TEMPLATE: &str = r#"# Project-local RTK filters — commit this file with your repo. # Filters here override user-global and built-in filters. @@ -212,6 +215,8 @@ pub fn run( install_cursor: bool, install_windsurf: bool, install_cline: bool, + install_kilocode: bool, + install_antigravity: bool, claude_md: bool, hook_only: bool, codex: bool, @@ -261,6 +266,14 @@ pub fn run( return run_cline_mode(verbose); } + if install_kilocode { + return run_kilocode_mode(); + } + + if install_antigravity { + return run_antigravity_mode(); + } + // Mode selection (Claude Code / OpenCode) match (install_claude, install_opencode, claude_md, hook_only) { (false, true, _, _) => run_opencode_only_mode(verbose)?, @@ -1237,6 +1250,36 @@ fn run_windsurf_mode(verbose: u8) -> Result<()> { Ok(()) } +fn run_kilocode_mode() -> Result<()> { + let target_dir = std::path::Path::new(".kilocode/rules"); + std::fs::create_dir_all(target_dir)?; + + let rules_path = target_dir.join("rtk-rules.md"); + std::fs::write(&rules_path, KILOCODE_RULES)?; + + println!("\nRTK configured for Kilo Code.\n"); + println!(" Rules: .kilocode/rules/rtk-rules.md (installed)"); + println!(" Kilo Code will now use rtk commands for token savings."); + println!(" Test with: git status\n"); + + Ok(()) +} + +fn run_antigravity_mode() -> Result<()> { + let target_dir = std::path::Path::new(".agent/rules"); + std::fs::create_dir_all(target_dir)?; + + let rules_path = target_dir.join("antigravity-rtk-rules.md"); + std::fs::write(&rules_path, ANTIGRAVITY_RULES)?; + + println!("\nRTK configured for Google Antigravity.\n"); + println!(" Rules: .agent/rules/antigravity-rtk-rules.md (installed)"); + println!(" Antigravity will now use rtk commands for token savings."); + println!(" Test with: git status\n"); + + Ok(()) +} + fn run_codex_mode(global: bool, verbose: u8) -> Result<()> { let (agents_md_path, rtk_md_path) = if global { let codex_dir = resolve_codex_dir()?; diff --git a/src/main.rs b/src/main.rs index 654a2676..154ced4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,6 @@ mod mypy_cmd; mod next_cmd; mod npm_cmd; mod parser; -mod permissions; mod pip_cmd; mod playwright_cmd; mod pnpm_cmd; @@ -86,6 +85,10 @@ pub enum AgentTarget { Windsurf, /// Cline / Roo Code (VS Code) Cline, + /// Kilo Code + Kilocode, + /// Google Antigravity + Antigravity, } #[derive(Parser)] @@ -1710,6 +1713,8 @@ fn main() -> Result<()> { let install_cursor = agent == Some(AgentTarget::Cursor); let install_windsurf = agent == Some(AgentTarget::Windsurf); let install_cline = agent == Some(AgentTarget::Cline); + let install_kilocode = agent == Some(AgentTarget::Kilocode); + let install_antigravity = agent == Some(AgentTarget::Antigravity); let patch_mode = if auto_patch { init::PatchMode::Auto @@ -1725,6 +1730,8 @@ fn main() -> Result<()> { install_cursor, install_windsurf, install_cline, + install_kilocode, + install_antigravity, claude_md, hook_only, codex, diff --git a/src/utils.rs b/src/utils.rs index c1882fa8..8bb7544d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -339,7 +339,7 @@ pub fn resolve_binary(name: &str) -> Result { pub fn resolved_command(name: &str) -> Command { match resolve_binary(name) { Ok(path) => Command::new(path), - Err(e) => { + Err(_e) => { // On Windows, resolution failure likely means a .CMD/.BAT wrapper // wasn't found — always warn so users have a signal. // On Unix, this is less common; only log in debug builds.