opencode-context-warningOpenCode plugin that warns agents about context window consumption and nudges handoff
1
328
3 in 7 days
34.2
Multi-signal model
2 months ago
2026-06-07
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-context-warning@0.1.0"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-context-warning@0.1.0"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-context-warningopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
OpenCode plugin that warns agents about context window consumption and nudges handoff
Installation
npm install opencode-context-warning
Features
- Monitors the LLM context window token usage during the session.
- Provides customizable warnings (e.g., at 70% capacity) to prompt the agent to summarize.
- Forces sub-agent handoffs when context approaches maximum limits (e.g., 90%).
- Prevents degradation of reasoning quality caused by bloated context windows.
Usage
This is a plugin for OpenCode.
You can easily enable this plugin globally by adding it to your opencode.json (or opencode.jsonc) configuration file under the plugins array.
{
"plugins": [
"opencode-context-warning"
]
}
Once added to your configuration, OpenCode will automatically load and activate the plugin whenever it starts.
Alternatively, if you are configuring OpenCode programmatically via the SDK, you can register it like this:
import { configureAgent } from '@opencode-ai/sdk';
import plugin from 'opencode-context-warning';
const agent = configureAgent({
plugins: [
plugin({
// Provide configuration options here
})
]
});