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 분석
核心用途是控制长对话的 Token 消耗。适合频繁进行超长会话、希望自动压缩历史记录以节省费用并维持模型专注度的用户。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 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 = 低置信直接按规则折叠 |