Skip to content
    ↑↓ select↵ openesc close
    VincentHardouin

    Snip

    opencode-snip·v2.0.0·Tools & Commands

    OpenCode plugin that prefixes shell commands with snip to reduce LLM token consumption

    GitHub stars

    146

    +5 in 30 days

    Monthly installs

    1,725

    802 in 7 days

    Composite score

    61.7

    Multi-signal model

    Last commit

    3 days ago

    2026-10-01

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-snip@2.0.0"]
    }

    OpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    OpenCode plugin that automatically prefixes shell commands with snip to reduce LLM token consumption by 60-90%.

    What is snip?

    snip is a CLI proxy that filters shell output before it reaches your LLM context window.

    Command Before After Savings
    go test ./... 689 tokens 16 tokens 97.7%
    git log 371 tokens 53 tokens 85.7%
    cargo test 591 tokens 5 tokens 99.2%

    Installation

    1. Install snip

    brew install edouard-claude/tap/snip
    # or
    go install github.com/edouard-claude/snip/cmd/snip@latest
    

    2. Configure OpenCode

    Add the plugin to your OpenCode config (~/.config/opencode/opencode.json):

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-snip@latest"]
    }
    

    How It Works

    The plugin uses the tool.execute.before hook to forward each bash command to snip hook, the same rewrite engine snip uses for Claude Code and other agents (tested with snip v0.25.2):

    • only commands snip has a filter for are rewritten to snip run -- <command>, each segment of &&, ||, ; chains separately
    • commands whose output feeds a pipe or a file redirection, heredocs, shell blocks and command substitutions are left untouched
    • if snip hook fails, the command runs unchanged

    Development

    This package uses semantic-release for automated releases. Commit messages should follow the Conventional Commits format:

    • fix: → patch release
    • feat: → minor release
    • feat!:, fix!: → major release

    License

    MIT

    Similar plugins