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

    Dcp Dynamic Limits

    v0.1.1记忆与上下文
    opencode-dcp-dynamic-limits

    OpenCode plugin that syncs DCP context limits to the active model and quiets chat reminder spam.

    GitHub 星标

    5

    月装机量

    30

    近 7 天 6

    综合评分SCORE

    31.1

    生态多维模型

    最近提交

    2 个月前

    2026-05-27

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-dcp-dynamic-limits@0.1.1"]
    }

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

    npm version backend: llm-server license: MIT

    OpenCode plugin for one specific annoyance: DCP should follow the context window of the model you are actually using.

    I wrote this for my local llm-server setup, where OpenCode switches between GGUF models served by ik_llama.cpp / llama.cpp and normal cloud models. When the active model changes, DCP can be left with stale limits. That is when it starts pruning at the wrong time, or worse, keeps dropping dcp-system-reminder messages into the chat.

    This plugin runs on real chat requests, figures out the active model context, and updates the DCP config before DCP needs it.

    Install

    npm install -g opencode-dcp-dynamic-limits
    

    Add it after DCP in your OpenCode config:

    {
      "plugin": [
        "@tarquinen/opencode-dcp@latest",
        "opencode-dcp-dynamic-limits"
      ]
    }
    

    DCP needs to load first. This plugin only adjusts DCP's config.

    llm-server

    The main target is llm-server:

    llm-server model.gguf --port 8081 --ctx-size 262144
    

    Point OpenCode at that local OpenAI-compatible endpoint as usual. The plugin will read the active provider/model and, for llama.cpp-style backends, use the running server's context instead of guessing from a static number.

    It also works with plain llama.cpp-style servers, Ollama-style local providers, and cloud models from the OpenCode model manifest.

    What It Changes

    The plugin writes both common DCP config files when they exist:

    ~/.config/opencode/dcp.jsonc
    ~/.opencode/dcp.jsonc
    

    It updates:

    • activeModel
    • minContextLimit
    • maxContextLimit
    • notification/nudge settings that keep reminders out of the chat

    It ignores non-chat calls like the title agent, so a title-generation request cannot shrink your DCP limits.

    Context Rules

    For local llama.cpp-style servers:

    • prefer runtime --ctx-size
    • fall back to /v1/models metadata
    • treat --parallel slot size as diagnostics, not the full context window

    For cloud models:

    • use OpenCode's model manifest context

    The DCP limit is set to 85% of the detected context. Quiet mode sets minContextLimit equal to maxContextLimit, which avoids the repeated soft-warning zone while still letting DCP prune at the hard limit.

    The quiet settings are:

    {
      "pruneNotificationType": "toast",
      "compress": {
        "nudgeForce": "soft",
        "nudgeFrequency": 50,
        "iterationNudgeThreshold": 50
      }
    }
    

    Development

    npm install
    npm test
    npm pack
    

    License

    MIT