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

    Context Warning

    v0.1.0记忆与上下文
    opencode-context-warning

    OpenCode plugin that warns agents about context window consumption and nudges handoff

    GitHub 星标

    1

    月装机量

    328

    近 7 天 3

    综合评分SCORE

    34.2

    生态多维模型

    最近提交

    2 个月前

    2026-06-07

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-context-warning@0.1.0"]
    }

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

    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
        })
      ]
    });
    

    License

    MIT