

























@@ -400,8 +400,41 @@ openclaw policy check --severity-min error
400400attestation hashes. The same findings also appear in `openclaw doctor --lint`
401401when the Policy plugin is enabled.
402402403-Example clean JSON output includes stable hashes that can be recorded by an
404-operator or supervisor:
403+Compare an operator policy file to an authored baseline policy file:
404+405+```bash
406+openclaw policy compare --baseline official.policy.jsonc
407+openclaw policy compare --baseline official.policy.jsonc --policy policy.jsonc --json
408+```
409+410+`policy compare` compares policy file syntax to policy file syntax. It does not
411+inspect OpenClaw runtime state, evidence, credentials, or secrets. The command
412+uses the same policy rule metadata that governs scoped overlays: allowlists must
413+stay equal or narrower, denylists must stay equal or broader, required booleans
414+must keep their required value, ordered strings must move only toward the more
415+restrictive end of the configured order, and exact lists must match.
416+417+The baseline file can be an organization-authored policy. The checked policy can
418+use stricter values or add extra policy rules. A top-level checked rule can also
419+satisfy a scoped baseline rule when it is equally or more restrictive because
420+top-level policy applies broadly. Scope names do not need to match; scoped
421+comparison is keyed by selector value such as `agentIds` or `channelIds` and by
422+the policy field being checked.
423+424+Example clean compare JSON output reports only policy-file comparison state:
425+426+```json
427+{
428+"ok": true,
429+"baselinePath": "official.policy.jsonc",
430+"policyPath": "policy.jsonc",
431+"rulesChecked": 3,
432+"findings": []
433+}
434+```
435+436+Example clean `policy check --json` output includes stable hashes that can be
437+recorded by an operator or supervisor:
405438406439```json
407440{
@@ -647,6 +680,9 @@ Policy currently verifies:
647680| `policy/policy-jsonc-invalid` | Policy cannot be parsed or contains malformed rule entries. |
648681| `policy/policy-hash-mismatch` | Policy does not match configured `expectedHash`. |
649682| `policy/attestation-hash-mismatch` | Current policy evidence no longer matches the accepted attestation. |
683+| `policy/policy-conformance-invalid` | A baseline or checked policy file has invalid comparison syntax. |
684+| `policy/policy-conformance-missing` | A checked policy file is missing a rule required by the baseline policy file. |
685+| `policy/policy-conformance-weaker` | A checked policy file has a weaker value than the baseline policy file. |
650686| `policy/channels-denied-provider` | An enabled channel matches a channel deny rule. |
651687| `policy/mcp-denied-server` | A configured MCP server is denied by policy. |
652688| `policy/mcp-unapproved-server` | A configured MCP server is outside the allowlist. |
@@ -838,10 +874,11 @@ configured channel:
838874839875## Exit codes
840876841-| Command | `0` | `1` | `2` |
842-| -------------- | ----------------------------------------- | ------------------------------------------------ | ---------------------------- |
843-| `policy check` | No findings at the threshold. | One or more findings met the threshold. | Argument or runtime failure. |
844-| `policy watch` | No findings and accepted hash is current. | Findings exist or accepted attestation is stale. | Argument or runtime failure. |
877+| Command | `0` | `1` | `2` |
878+| ---------------- | ------------------------------------------------------ | ------------------------------------------------------------------- | ---------------------------- |
879+| `policy check` | No findings at the threshold. | One or more findings met the threshold. | Argument or runtime failure. |
880+| `policy compare` | The policy file is at least as strict as the baseline. | The policy file is invalid, missing, or weaker than baseline rules. | Argument or runtime failure. |
881+| `policy watch` | No findings and accepted hash is current. | Findings exist or accepted attestation is stale. | Argument or runtime failure. |
845882846883## Related
847884此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。