跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    VincentHardouin

    Snip

    v1.6.1工具与命令
    opencode-snip

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

    GitHub 星标

    136

    近 30 天 +2

    月装机量

    1,295

    近 7 天 226

    综合评分SCORE

    54.2

    生态多维模型

    最近提交

    3 个月前

    2026-05-18

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

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

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    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 prefix all commands with snip

    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