Skip to content

[doc-gate] recall-gate 的 deny 触发与展示列表共用同一阈值,0.3x 无关命中也会拦截 #155

Description

@WooDragon

现象

recall-gate 在首次编辑 .md 时的 deny,经常由相关度很低、与目标文件基本无关的召回结果触发。

实测数据(同一个会话,三次编辑)

编辑的目标文件 召回结果与得分 deny 是否有价值
ops-commons/docs/intelligent-audit-system-guide.md IaC设计文档.md 0.3422、infrastructure-services.md 0.3384、rollout-rollback-patterns.md 0.3037 。最高分才 0.34,三条都与"审计 hook 工具指南"无实质重叠
company-upwan/CLAUDE.md tool-usage-complete.md 0.6778、claude-md-modification-standards 0.5961、infrastructure-services 0.5167、library-modules-guide 0.4702、add-new-host-guide 0.4292 。首条 0.68 确实是相关文档
company-upwan/operations/playbooks/add-new-host-guide.md tool-usage-complete.md 0.75、其余 0.51 / 0.47 / 0.43 / 0.41 。首条 0.75 确实相关

规律很清楚:首条得分 ≥ ~0.6 时 deny 有信息量;首条只有 0.3x 时纯属噪音,而 0.3x 的命中恰好卡在默认阈值地板上。

根因定位

scripts/recall-gate.sh:100-109

--threshold "${RECALL_GATE_THRESHOLD:-0.30}" \
--top-n "${RECALL_GATE_TOP_N:-5}" \
--json gate
...
HAS_FINDINGS=$(... '.has_findings // false' ...)
[ "$HAS_FINDINGS" = "true" ] || return

recall-gate.py:151combined >= threshold 既决定哪些条目进展示列表,也决定 has_findings——即是否拦截。两个语义共用一个 0.30 阈值,于是任意一条 0.30 的边缘命中都足以触发一次完整 deny。

建议

把「拦截判据」与「展示判据」拆成两个阈值:

  • deny 触发:只看首条(最高分)是否超过一个更高的门槛(实测 0.5-0.6 之间是合理分界)
  • 展示列表:仍用现在的 0.30,把尾部低分条目作为参考信息一并列出

这样保留 recall 的信息价值,同时消掉"八竿子打不着也拦一次"的摩擦。若不想改判据结构,至少把默认 threshold 从 0.30 上调。

附带

RECALL_GATE_THRESHOLD / RECALL_GATE_TOP_N 这两个环境变量在 SKILL.md 里没有任何记载。使用者不读 scripts/recall-gate.sh 源码就不知道可调,建议补进文档。

环境

doc-gate 1.7.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions