gate-switchlisted
Install: claude install-skill xu-jin-cs/dsh-skills
# gate-switch — 通用概率执行门禁骨架(实证族 L2 引擎)
## 用途(解决什么问题)
LLM 执行流程时有三类高频失信:**该做的没做**(声称跑了测试其实没跑)、**缺斤短两**(18 项自检扫一眼就声明通过)、**伪造声称**(没读报告就写"验收通过")。prompt 里写"必须/禁止"拦不住——因为判定权在模型自己手里。
gate-switch 把判定权从模型手里拿走:**你只写一份 spec JSON(要核验什么),引擎逐项机械核验,模型只能照抄结论**。新场景 = 写新 spec,引擎零改动。
与单刀双掷开关(parallel-dispatch 的 dispatch_switch,路由族:A/B 路径选择)互补:本引擎管"实证族"(声称 X → 机械核验 X)。
## 安装
把整个 `gate-switch/` 目录拷入 `~/.agents/skills/gate-switch/`(Kimi Code 技能目录)即生效。零依赖(纯 Python stdlib)。
## 用法
```bash
python3 ~/.agents/skills/gate-switch/scripts/gate_switch.py --spec <spec.json> [--set key=value ...]
```
退出码:`0`=A 全部通过放行 / `2`=B 有违例阻断(violations 即理由)/ `3`=CLARIFY 输入信号不足 / `4`=VIOLATION spec 非法。
留痕:`~/.agents/logs/gate_switch.jsonl`(可用 --log 改路径)。
## spec 格式(填充物,骨架冻结)
```json
{
"gate": "门禁名",
"desc": "用途与 A/B 语义说明",
"checks": [
{"type": "file_exists", "path": "...", "label": "..."},
{"type": "file_min_size", "path": "...", "bytes": 100},
{"type": "json_field", "path": "...", "field": "a.b.0.c", "op": "exists|not_empty|equals|in|min_len|min|max", "value": ...},
{"type": "glob_count", "pattern": "...", "op": "min|max|eq", "value": 1},
{"type": "grep_count", "pattern": "...", "path": "...", "op": "min|max|eq", "value": 1},
{"type": "mtime_after", "path": "...", "ref_path": "..."},
{"type": "script_exit", "cmd": "...", "expect": 0}
]
}
```
`{key}` 占位符由 `--set key=value` 注入。新增检查原语需 ≥2 独立场景举证(骨架冻结纪律���。
## 配套 spec(独立技能)
本商店版中每个闸 spec 均为独立技能文件夹(如 `zero_residu