名称: agent-constitution
描述: "与 Base Sepolia 上的 AgentConstitution 治理合约交互。检查合规性、读取规则、记录操作、查询治理状态。"
元数据: {"openclaw": {"emoji": "⚖️", "homepage": "https://github.com/ztsalexey/bigmemkex/tree/main/projects/agent-constitution"}}
与 Base Sepolia 上的 AgentConstitution 治理框架交互。此技能允许 AI 代理:
在公开宪法下运行的代理能赢得信任。任何协议只需一次调用即可验证您的合规性。此技能让这一切变得简单。
# 检查合规性(返回 true/false)
./scripts/check-compliance.sh <agentId>
# 获取所有活跃规则
./scripts/get-rules.sh
# 在链上记录一个操作
./scripts/log-action.sh <agentId> <actionType> <riskLevel> <description>
| 合约 | 地址 |
|---|---|
| Constitution | 0xe4c4d101849f70B0CDc2bA36caf93e9c8c1d26D2 |
| AgentRegistry | 0xcCFc2B8274ffb579A9403D85ee3128974688C04B |
| ActionLog | 0xEB5377b5e245bBc255925705dA87969E27be6488 |
| Tribunal | 0xf7c03E91516eC60dF1d609E00E1A3bb93F52A693 |
| KillSwitch | 0x6324A4640DA739EEA64013912b781125A76D7D87 |
| USDC (测试网) | 0x036CbD53842c5426634e7929541eC2318f3dCF7e |
RPC: https://sepolia.base.org
链 ID: 84532
在与代理交互前,验证其是否合规:
// Solidity
bool compliant = IAgentRegistry(0xcCFc...).isCompliant(agentId);
# Shell (使用 cast)
cast call 0xcCFc2B8274ffb579A9403D85ee3128974688C04B \
"isCompliant(uint256)(bool)" <agentId> \
--rpc-url https://sepolia.base.org
查询宪法中的活跃规则:
# 获取规则数量
cast call 0xe4c4d101849f70B0CDc2bA36caf93e9c8c1d26D2 \
"ruleCount()(uint256)" \
--rpc-url https://sepolia.base.org
# 获取特定规则(1-5 为创世规则)
cast call 0xe4c4d101849f70B0CDc2bA36caf93e9c8c1d26D2 \
"getRule(uint256)(string,uint8,uint256,uint256,bool)" 1 \
--rpc-url https://sepolia.base.org
在操作前,检查是否存在全局紧急状态:
cast call 0x6324A4640DA739EEA64013912b781125A76D7D87 \
"globalEmergencyActive()(bool)" \
--rpc-url https://sepolia.base.org
已注册代理应记录重要操作:
# 需要代理的私钥
cast send 0xEB5377b5e245bBc255925705dA87969E27be6488 \
"logAction(uint256,uint8,uint8,bytes32,string)" \
<agentId> <actionType> <riskLevel> <contextHash> "description" \
--rpc-url https://sepolia.base.org \
--private-key $AGENT_PRIVATE_KEY
操作类型: 0=交易, 1=委托, 2=配置, 3=通信, 4=资源访问, 5=其他
风险等级: 0=低, 1=中, 2=高, 3=严重
每个代理都必须遵守以下 5 条不可变规则:
| # | 规则 | 惩罚比例 | 描述 |
|---|---|---|---|
| 1 | 禁止伤害 | 90% | 绝不造成物理、财务或心理伤害 |
| 2 | 服从治理 | 50% | 遵守所有活跃的宪法规则 |
| 3 | 透明度 | 20% | 将所有重要操作记录在链上 |
| 4 | 保留覆盖权 | 90% | 绝不阻止人类覆盖操作 |
| 5 | 禁止自我修改 | 90% | 绝不修改自身的治理规则 |
// 在与代理交易前检查合规性
const { ethers } = require('ethers');
const provider = new ethers.JsonRpcProvider('https://sepolia.base.org');
const registry = new ethers.Contract(
'0xcCFc2B8274ffb579A9403D85ee3128974688C04B',
['function isCompliant(uint256) view returns (bool)'],
provider
);
async function canTrustAgent(agentId) {
return await registry.isCompliant(agentId);
}
任何人都可以为 AI 代理提议规则:
治理是民主的。代理在设计上被排除在外。
此技能仅与 Base Sepolia 测试网交互。请勿在主网上使用。