snip  by edouard-claude

AI token optimizer for shell commands

Created 3 months ago
270 stars

Top 95.1% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project addresses the significant cost of LLM token usage by filtering verbose shell output before it reaches AI coding assistants. Targeting developers and power users of tools like Claude Code, Cursor, and Copilot, snip acts as a CLI proxy to reduce token consumption by 60-90%, providing only essential signal to the AI for improved efficiency and cost savings.

How It Works

snip employs a unique "filters are data, not code" philosophy. It intercepts shell commands, processes their output through declarative YAML filter pipelines, and forwards only the condensed, relevant information to the AI. This Go-based engine allows filters to evolve independently of the core binary, fostering rapid extensibility. Unlike solutions requiring code recompilation for filter updates, snip enables users to write or modify filters in YAML, significantly lowering the barrier to contribution and customization. Key design principles include sub-10ms startup latency, graceful degradation to raw output on filter failure, exit code preservation, and zero CGO dependencies for static binaries and easy cross-compilation.

Quick Start & Requirements

  • Primary install / run command:
    • macOS/Linux: curl -fsSL https://raw.githubusercontent.com/edouard-claude/snip/master/install.sh | sh
    • Homebrew: brew install edouard-claude/tap/snip
    • Go: go install github.com/edouard-claude/snip/cmd/snip@latest
    • From source: git clone https://github.com/edouard-claude/snip.git && cd snip && make install
  • Non-default prerequisites: Go 1.25+ is required for building from source.
  • Estimated setup time: Installation scripts are designed for quick setup, typically within minutes. Integration with AI tools involves a single snip init command.
  • Links: Installation script (install.sh), Homebrew tap (edouard-claude/tap), GitHub Releases for binaries.

Highlighted Details

  • Achieves 60-90% LLM token usage reduction.
  • Ships with over 127 built-in declarative YAML filters for major developer tools (Git, Go, Rust, JS, Docker, K8s, Cloud, etc.).
  • Features 19 composable pipeline actions (e.g., keep_lines, regex_extract, json_extract) for flexible filtering logic.
  • Integrates with numerous AI coding assistants (Claude Code, Cursor, Copilot, Gemini, etc.) via native hooks or prompt injection methods.
  • Designed for sub-10ms startup latency.

Maintenance & Community

The README does not detail specific contributors, sponsorships, or community channels (e.g., Discord, Slack). The project is inspired by rtk (Rust Token Killer) by the rtk-ai team.

Licensing & Compatibility

  • License type: MIT License.
  • Compatibility: The MIT license is highly permissive, allowing for commercial use and linking within closed-source projects without significant restrictions.

Limitations & Caveats

Installation scripts are primarily targeted at macOS and Linux; Windows users may need to rely on manual binary downloads or building from source. Building from source requires Go version 1.25 or later. While designed for minimal overhead, complex filter pipelines could introduce processing time, though the project emphasizes sub-10ms startup latency.

Health Check
Last Commit

14 hours ago

Responsiveness

Inactive

Pull Requests (30d)
14
Issues (30d)
11
Star History
92 stars in the last 30 days

Explore Similar Projects

Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), and
8 more.

qwen-code by QwenLM

0.8%
25k
AI coding agent for complex codebases
Created 11 months ago
Updated 10 hours ago
Feedback? Help us improve.