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

    Occontext Thinking Trim

    v1.0.3可观测与分析
    @old-mikser/occontext-thinking-trim

    OpenCode plugin to trim thinking/reasoning from context to reduce token usage

    GitHub 星标

    0

    月装机量

    28

    近 7 天 11

    综合评分SCORE

    6.7

    生态多维模型

    最近提交

    6 个月前

    2026-02-18

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@old-mikser/occontext-thinking-trim@1.0.3"]
    }

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

    OpenCode plugin that trims thinking/reasoning from context while preserving display.

    Why?

    Models with extended thinking (Claude, DeepSeek, etc.) send reasoning back in context on each request. This can:

    • Increase token usage
    • Potentially influence model behavior in unwanted ways

    This plugin removes reasoning from the context sent to the model, while keeping it visible in the UI.

    Installation

    Add to your opencode.json:

    {
      "plugins": ["@old-mikser/occontext-thinking-trim"]
    }
    

    On first run, the plugin creates ~/.config/opencode/OCTT.jsonc with default settings.

    Configuration

    Edit ~/.config/opencode/OCTT.jsonc:

    {
      // Enable or disable thinking trim
      "enabled": true,
      
      // Number of recent turns to preserve thinking
      // 0 = trim all thinking from context
      // 2 = keep thinking in last 2 assistant messages
      "keepTurns": 0
    }
    

    Options

    Option Type Default Description
    enabled boolean true Enable/disable the plugin
    keepTurns number 0 Number of recent turns to preserve thinking. 0 = trim all

    Example

    With keepTurns: 2, the last 2 assistant messages will keep their reasoning intact, while older reasoning is removed.

    License

    MIT