Door governor: runtime-agent judge (Kimi-as-judge on the subscription)
The §15 governor can now be judged by a ZeroClaw runtime agent instead of a server-side registry/API model. ZeroClawDriveExecutor::judge drives an agent with the governor prompt and parses ALLOW/DENY (fail-open). mcp_door routes to it when CLAWMATES_JUDGE_MODEL=runtime:<alias>. This unblocks Kimi-as-judge with NO Kimi Platform key: Kimi runs on the membership via kimi_cli, so CLAWMATES_JUDGE_MODEL=runtime:judge_kimi makes the coding agent the governor. (Same path works for any subscription-only model.) cm-runtime re-exports judge_model. clippy clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2fcec622fb
commit
3402a3b56d
@@ -153,7 +153,18 @@ async fn policy_decide(
|
||||
category.map(|c| c.as_str()).unwrap_or("none"),
|
||||
serde_json::to_string(args).unwrap_or_default()
|
||||
);
|
||||
let (allow, reason) = state.runtime.judge(system, &request).await;
|
||||
// `CLAWMATES_JUDGE_MODEL=runtime:<alias>` routes the governor through a
|
||||
// ZeroClaw runtime agent (e.g. Kimi via kimi_cli on the subscription) —
|
||||
// no platform API key needed. Otherwise the server-side registry judge.
|
||||
let judge_model = cm_runtime::judge_model();
|
||||
let (allow, reason) = if let Some(alias) = judge_model.strip_prefix("runtime:") {
|
||||
match crate::topology_exec::ZeroClawDriveExecutor::from_env() {
|
||||
Ok(exec) => exec.judge(alias.trim(), system, &request).await,
|
||||
Err(e) => (true, format!("governor unreachable (fail-open): {e}")),
|
||||
}
|
||||
} else {
|
||||
state.runtime.judge(system, &request).await
|
||||
};
|
||||
if !allow {
|
||||
return PolicyOutcome::Deny(format!("governor agent vetoed — {reason}"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user