contextgate
ContextGate — a context-folding gate plugin for DeepSeek Harness (DSH) / Cordis. Intercepts LLM request streams and folds oversized conversation history into a summary to keep context length under control.
AI Analysis
核心用途是控制长对话的 Token 消耗。适合频繁进行超长会话、希望自动压缩历史记录以节省费用并维持模型专注度的用户。
Install
This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗
README
Read the full README ↗配置
在 apply(ctx) 开头的 CONFIG 对象中调整:
| 配置项 | 默认值 | 说明 |
|---|---|---|
enabled | true | 总开关 |
thresholdTokens | 12000 | 估算 token 超过此值才触发 |
keepHead | 1 | 保留开头 N 条消息(通常是任务陈述) |
keepRecent | 8 | 保留最近 N 条消息 |
gatekeeper.enabled | true | 是否启用 LLM gatekeeper(false = 始终规则折叠) |
gatekeeper.model | undefined | 显式指定 gatekeeper 模型;未指定时自动选择(优先 flash/light/lite/mini/turbo,回退当前模型) |
gatekeeper.confidence | 0.85 | 高置信阈值:drop 项最低置信度 ≥ 此值才自动折叠 |
gatekeeper.maxTokens | 800 | gatekeeper 输出上限 |
gatekeeper.timeoutMs | 15000 | gatekeeper 调用超时(超时回退规则折叠) |
gatekeeper.truncate | 150 | 每条候选消息发送给 gatekeeper 前的截断字符数 |
gatekeeper.askHuman | true | 低置信时询问用户;false = 低置信直接按规则折叠 |