Summary
Vibe currently has no mechanism to intercept or transform bash commands before they are executed. Adding a BeforeTool hook (similar to Gemini CLI's BeforeTool hook) would allow external tools to transparently rewrite commands before execution.
Use Case: RTK (Rust Token Killer)
RTK is a CLI proxy that saves 60-90% of LLM tokens by filtering and compressing command output before it reaches the model context. It works by rewriting commands:
git status → rtk git status # ~70% fewer tokens
ls src/ → rtk ls src/ # ~60% fewer tokens
cargo test → rtk cargo test # ~90% fewer tokens
gh pr list → rtk gh pr list # ~87% fewer tokens
RTK already has transparent hook support for:
- Claude Code — via
PreToolUse hook in settings.json
- Gemini CLI — via
BeforeTool hook in settings.json
For Vibe, the current workaround is a system prompt instructing the model to use rtk commands. This is unreliable — the model sometimes ignores it.
Proposed API
In ~/.vibe/config.toml or a new hooks section:
[hooks]
before_tool = "~/.vibe/hooks/before-tool.sh"
The hook receives tool call info via stdin (JSON) and can return a rewritten command or allow/block execution:
{
"tool": "bash",
"input": { "command": "git status" }
}
Output (stdout):
{ "action": "rewrite", "input": { "command": "rtk git status" } }
or
Reference Implementations
Impact
This would make Vibe a first-class citizen in token-optimized AI workflows, and would enable the RTK integration to work transparently without relying on model instruction-following.
Summary
Vibe currently has no mechanism to intercept or transform bash commands before they are executed. Adding a
BeforeToolhook (similar to Gemini CLI'sBeforeToolhook) would allow external tools to transparently rewrite commands before execution.Use Case: RTK (Rust Token Killer)
RTK is a CLI proxy that saves 60-90% of LLM tokens by filtering and compressing command output before it reaches the model context. It works by rewriting commands:
RTK already has transparent hook support for:
PreToolUsehook insettings.jsonBeforeToolhook insettings.jsonFor Vibe, the current workaround is a system prompt instructing the model to use
rtkcommands. This is unreliable — the model sometimes ignores it.Proposed API
In
~/.vibe/config.tomlor a newhookssection:The hook receives tool call info via stdin (JSON) and can return a rewritten command or allow/block execution:
{ "tool": "bash", "input": { "command": "git status" } }Output (stdout):
{ "action": "rewrite", "input": { "command": "rtk git status" } }or
{ "action": "allow" }Reference Implementations
~/.gemini/settings.jsonImpact
This would make Vibe a first-class citizen in token-optimized AI workflows, and would enable the RTK integration to work transparently without relying on model instruction-following.