@old-mikser/occontext-thinking-trimOpenCode plugin to trim thinking/reasoning from context to reduce token usage
0
28
近 7 天 11
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"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@old-mikser/occontext-thinking-trim@1.0.3"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @old-mikser/occontext-thinking-trimopencode 启动时会通过内嵌运行时自动加载 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