agent-wallet
它能做什么
这项技能为 AI 智能体设置加密钱包,由只有管理员能更改的规则控制。每笔支出在签名前都会由代码对照策略文件进行检查,因此即使智能体被操纵,规则依然有效。
适用场景
- ✓当你希望智能体在你设定的限额内用自己的钱包付款的时候。
- ✓当你需要即使智能体被恶意消息欺骗,钱包依然安全时。
- ✓当你想为智能体的支出设置允许地址列表或紧急开关的时候。
技能链接
https://github.com/internet-court/internet-court-skill/blob/main/vendored/chaingpt/agent-wallet/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想给我的智能体配一个自己的钱包,但只允许它向我批准的地址转账。”
每周 5 个新技能,1 分钟读完。
工作原理
管理员会创建加密钱包和一份包含规则的策略文件,规则例如允许地址和最高金额。每次智能体尝试转账时,工具都会用代码检查策略,只要有一条规则不符就拒绝。智能体没有可以修改策略的工具。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ChainGPT Agent Wallet Skill
The agent has its own EOA wallet on every EVM chain it supports. The admin (you, in your shell) sets policies that the agent cannot violate or revoke — even if a malicious prompt convinces the LLM to try.
Threat model
The attacker's goal: prompt-inject the agent to drain its wallet to an attacker address.
The plugin's defense: the policy check is in code, not in the LLM's prompt. Every chaingpt_agent_wallet_sign_and_send call:
- Loads the policy file fresh from disk (no caching — admin can update mid-session).
- Runs
checkPolicy(intent)— pure deterministic code that doesn't see the LLM's context. - Refuses if any rule fails, with a clear reason the agent surfaces back to the user.
The attacker can convince the LLM to call sign_and_send(to=attacker, value=ALL) — but the tool layer refuses because attacker isn't in allowedToAddresses or value exceeds maxTxValueWei or killSwitch=true. The trust boundary is the tool code, not the LLM.
There is no MCP tool that writes the policy file. The admin edits it directly with a text editor. There is no MCP tool that reads or sets the passphrase. The passphrase lives only in the shell env var or the OS keychain — never in the keystore file, never in the LLM's context.
Setup (admin steps — done once)
The keystore passphrase resolves in this priority order:
CHAINGPT_AGENT_WALLET_PASSPHRASEenv var — explicit override. Best for CI / headless / power users who want zero process-list and zero keychain exposure.- OS keychain — auto-managed. On macOS (Keychain via
security) or Linux (libsecret viasecret-tool), if no env var is set,chaingpt_agent_wallet_initgenerates a strong 256-bit passphrase and stores it in the keychain. You never type or remember it; the MCP server reads it back on each load.
Option A — zero-setup (macOS / Linux with a keychain) — recommended for most
# Just init — a strong passphrase is generated + stored in your OS keychain.
claude
> initialize the agent wallet
The init output tells you it used the keychain and how to export the passphrase for backup.
Option B — explicit env var (CI / headless / max control)
# Set a strong passphrase BEFORE starting the MCP server (>= 16 chars)
export CHAINGPT_AGENT_WALLET_PASSPHRASE="your-strong-passphrase-here-min-16-chars"
claude
> initialize the agent wallet
Back up the passphrase either way. Keychain entry:
service=chaingpt-mcp-agent-wallet account=keystore-passphrase. Export on macOS withsecurity find-generic-password -s chaingpt-mcp-agent-wallet -a keystore-passphrase -w. Lose it (and any backup) → the keystore is unrecoverable. There is no recovery path.
Security tradeoff of the keychain option: the secret stays out of plaintext-on-disk and out of the LLM context, but the keychain is unlocked while you're logged in — a local attacker on an unlocked session could read it. That's a much higher bar than a plaintext file and appropriate for a low-value bounded hot wallet. For zero local exposure, use Option B.
This creates two files:
| File | Contents | Who edits it |
|---|---|---|
~/.chaingpt-mcp/agent-wallet/keystore.json |
AES-256-GCM encrypted private key | Generated once by the init tool. Never edit by hand. Back it up. |
~/.chaingpt-mcp/agent-wallet/policy.json |
Plain JSON rules | You, the admin, with a text editor. The agent has NO tool that writes this file. |
Both default to ~/.chaingpt-mcp/agent-wallet/ but can be overridden via CHAINGPT_KEYSTORE_FILE and CHAINGPT_AGENT_POLICY_FILE.
Tools
| Tool | Mutates state? | Notes |
|---|---|---|
chaingpt_agent_wallet_init |
Creates keystore | One-shot. Refuses if file exists. |
chaingpt_agent_wallet_address |
No | Returns the agent's EOA address. Use this to receive funds. |
chaingpt_agent_wallet_status |
No | Address + policy digest + kill-switch state. Run this before any signing. |
chaingpt_agent_wallet_balances |
No | Native-coin balances across requested chains. |
chaingpt_agent_wallet_policy |
No (read-only) | Shows the current policy JSON. Cannot modify it. |
chaingpt_agent_wallet_sign_and_send |
Signs + broadcasts a tx | The only tool that can move funds. Gated by policy. |
chaingpt_agent_wallet_serve_ui |
Starts a local HTTP server | Dashboard on http://127.0.0.1:8787. Read-only view. |
Policy file format
Default policy.json (lazily
常见问题
智能体能修改自己的支出规则吗?
不能。智能体没有写入策略文件的工具,只有管理员可以直接编辑它。
钱包密码保存在哪里?
保存在 shell 环境变量或操作系统密钥串中,而不在钱包文件里。
如果一笔付款违反规则会怎样?
工具会拒绝签名,并给出一个原因,智能体可以把该原因反馈给你。
详情
作者的原始描述
Give the AI agent its own EVM wallet with admin-controlled policies the agent CANNOT bypass even under prompt injection. Encrypted keystore (AES-256-GCM, scrypt KDF), policy file the agent has no tool to write, deterministic policy gate on every signing operation, optional local HTTP dashboard. Triggers: agent wallet, give the agent a wallet, agent address, fund the agent, agent autonomy, policy gate, kill switch, agent permissions, bounded autonomy, ERC-4337 alternative, session-key alternative.
热度
- GitHub 星标
- 7.0k
- 排名
- #13620
- 许可证
- —
- 更新时间
- 2026/10/26
评论
- …
同一仓库的更多技能
internet-court
7.0k帮你的智能体安全地向其他 AI 智能体或付费服务付款、雇用或进行交易,并指引它找到合适的专业指南。
genlayer-erc7710-connector
7.0k帮你的智能体把 AI 审核结果与权限系统连接起来,使不合格的审核可以限制或取消智能体的权限。
genlayer-intelligent-contracts
7.0k帮你的智能体定义 AI 裁判的规则、证据和输出,用于检查另一个智能体是否遵循了其授权范围。
x402-erc7710
7.0k帮你的智能体按次为网络服务付款,并设置在权限预算范围内的持续支出。