governance-guard
Governance guard enforces structural authority separation on all agent actions through a PROPOSE-DECIDE-PROMOTE pipeline.
When to activate
Before performing any write, execute, network, create, or delete action. The governance pipeline MUST be invoked before the action executes. Read actions may also be governed under standard or strict policies.
How to use
1. Full pipeline (recommended)
Run the complete PROPOSE → DECIDE → PROMOTE pipeline in a single call:
CODEBLOCK0
The intent JSON must include:
- -
skill: skill identifier - INLINECODE1 : tool/function being invoked
- INLINECODE2 : LLM model name
- INLINECODE3 : one of
read, write, execute, network, create, INLINECODE9 - INLINECODE10 : resource being acted upon
- INLINECODE11 : tool parameters (object)
- INLINECODE12 : data categories accessed (array, e.g.
["personal", "financial"]) - INLINECODE14 : current conversation ID
- INLINECODE15 : current message ID
- INLINECODE16 : the user message that triggered this action
2. Handle the verdict
The pipeline returns a JSON response:
- - If
"governance": "approved" — proceed with the action - If
"governance": "deny" — do NOT proceed; inform the user with the INLINECODE19 - If
"governance": "escalate" — present the action to the user for approval:
CODEBLOCK1
Then resolve:
CODEBLOCK2
3. Audit decisions
CODEBLOCK3
Policy presets
| Preset | Default | Description |
|---|
| INLINECODE21 | approve | Blocks only credentials and destructive commands. Lowest friction. |
| INLINECODE22 |
deny | Allows common ops, escalates network and data access. Recommended. |
|
strict | deny | Reads only. Everything else requires explicit approval. Maximum safety. |
Fail-closed guarantee
If any error occurs during governance evaluation, the default verdict is DENY. Missing policy files result in DENY ALL. This is by design. The system fails safe, never open.
Configuration
Governance data is stored in ~/.openclaw/governance/:
- -
policy.yaml — active policy file - INLINECODE26 — append-only, hash-chained audit log
Verify witness chain
CODEBLOCK4
Any tampering with historical records is detected by recomputing the hash chain from genesis.
governance-guard
治理守卫通过一个“提议-决策-推进”管道,对所有智能体行为强制执行结构性权限分离。
何时激活
在执行任何写入、执行、网络、创建或删除操作之前。治理管道必须在操作执行前被调用。读取操作也可能在标准或严格策略下受到治理。
如何使用
1. 完整管道(推荐)
在单次调用中运行完整的提议→决策→推进管道:
bash
npx tsx scripts/governance.ts pipeline --policy policies/standard.yaml
意图JSON必须包含:
- - skill:技能标识符
- tool:被调用的工具/函数
- model:LLM模型名称
- actionType:read、write、execute、network、create、delete之一
- target:被操作的资源
- parameters:工具参数(对象)
- dataScope:访问的数据类别(数组,例如 [personal, financial])
- conversationId:当前对话ID
- messageId:当前消息ID
- userInstruction:触发此操作的用户消息
2. 处理裁决结果
管道返回一个JSON响应:
- - 如果 governance: approved — 继续执行操作
- 如果 governance: deny — 不要继续;向用户说明reason
- 如果 governance: escalate — 将操作呈现给用户审批:
操作需要您的批准:
技能:
操作: 作用于
原因:
回复 APPROVE 或 DENY
然后解决:
bash
npx tsx scripts/governance.ts resolve-escalation approve
或
npx tsx scripts/governance.ts resolve-escalation deny
3. 审计决策
bash
npx tsx scripts/governance.ts audit --last 10
策略预设
| 预设 | 默认值 | 描述 |
|---|
| minimal | approve | 仅阻止凭证和破坏性命令。摩擦最低。 |
| standard |
deny | 允许常见操作,升级网络和数据访问。推荐。 |
| strict | deny | 仅允许读取。其他所有操作都需要明确批准。安全性最高。 |
故障关闭保证
如果在治理评估过程中发生任何错误,默认裁决结果为拒绝。缺少策略文件将导致全部拒绝。这是有意设计的。系统以安全方式失效,绝不开放。
配置
治理数据存储在 ~/.openclaw/governance/:
- - policy.yaml — 活动策略文件
- witness.jsonl — 仅追加、哈希链式审计日志
验证见证链
bash
npx tsx scripts/governance.ts verify
任何对历史记录的篡改都将通过从创世块重新计算哈希链而被检测到。