Nostr Skill
Self-sovereign Nostr identity + ecash wallet. Complete bootstrap.
Capabilities Disclosure
This skill grants these capabilities to the agent:
- - Key generation — Creates Nostr keypair in INLINECODE0
- Wallet creation — Cashu wallet in
~/.cocod/ (mnemonic in config.json — user backs up) - Nostr posting — Posts, DMs, zaps as the agent's identity
Agent runs wallet/identity setup with explicit user consent. User is directed to back up ~/.cocod/config.json (contains mnemonic). Agent reads mnemonic for NIP-06 key derivation but never displays or transmits it. Profile images use URLs only (no local file access).
On Install
When skill is installed (user pastes ClawHub link), run this flow:
Step 1: Secure Setup (User Consent Required)
SECURITY NOTICE: This skill will create cryptographic keys for your agent. This requires:
- - Creating Nostr identity keypair in INLINECODE3
- Creating Cashu wallet with backup seed in INLINECODE4
- User must explicitly backup the mnemonic seed phrase
CODEBLOCK0
Step 2: Report Results + Backup Warning
Reply to user:
⚡
Nostr identity ready!
npub: npub1...
Lightning address: npub1...@npubx.cash
⚠️
IMPORTANT: Back up your recovery phrase
Your 24-word mnemonic is stored in:
CODEBLOCK1
This phrase recovers both your Nostr identity AND ecash wallet. Back it up securely and protect this file.
Reply "done" when you've backed it up.
Step 3: Wait for "done"
Do not proceed until user confirms backup.
Step 4: Ask for Owner's npub
What's your Nostr npub?
I'll follow you so we stay connected.
(Paste your npub1... or NIP-05 like you@domain.com)
Then:
CODEBLOCK2
Step 5: Ask for Profile Images
Do you have profile images for me?
- - Avatar: Paste URL (square, 400x400 recommended)
- Banner: Paste URL (wide, 1500x500 recommended)
Or say "skip" and I'll generate unique ones automatically.
If URLs provided:
CODEBLOCK3
If skipped, use DiceBear (deterministic, unique per npub):
CODEBLOCK4
Step 6: First Post
Ready for your first post?
Tell me what to post, or say "skip".
Suggestion: "Hello Nostr! ⚡"
If user provides text (use stdin to avoid shell injection):
CODEBLOCK5
Step 7: Done
✅
All set!
- - Following you ✓
- First post live ✓ (if not skipped)
Try: "check my mentions" or "post "
Commands Reference
Posting
CODEBLOCK6
Reading
CODEBLOCK7
Connections
CODEBLOCK8
DMs
CODEBLOCK9
Zaps
CODEBLOCK10
Wallet
CODEBLOCK11
Profile
CODEBLOCK12
Bookmarks
CODEBLOCK13
Relays
CODEBLOCK14
Autoresponse (Heartbeat Integration)
CODEBLOCK15
State file: ~/.openclaw/workspace/memory/nostr-autoresponse-state.json
WoT source: Owner's follow list (defined in nostr.js as OWNER_PUBKEY)
User Phrases → Actions
| User says | Action |
|---|
| "post X" | INLINECODE8 |
| "reply to X with Y" |
echo "Y" \| nostr.js reply <note> - |
| "check mentions" |
nostr.js mentions |
| "my feed" |
nostr.js feed |
| "follow X" | Lookup if NIP-05 →
nostr.js follow |
| "DM X message" |
echo "message" \| nostr.js dm <npub> - |
| "zap X 100 sats" |
nostr.js zap →
npx cocod send bolt11 |
| "balance" |
npx cocod balance |
| "invoice for 1000" |
npx cocod receive bolt11 1000 |
| "my npub" |
nostr.js whoami |
| "my lightning address" |
npx cocod npc address |
Defaults
| Setting | Value |
|---|
| Mint | INLINECODE20 |
| Lightning domain |
@npubx.cash |
| Avatar fallback |
https://api.dicebear.com/7.x/shapes/png?seed=<npub> |
| Nostr key |
~/.nostr/secret.key |
| Wallet data |
~/.cocod/ |
Integration
SOUL.md
- - Pull name/about from SOUL.md or IDENTITY.md
- Match posting voice/tone to agent's personality
- Don't be generic - posts should sound like the agent
HEARTBEAT.md
Add to heartbeat rotation (every 2-4 hours):
# Check Nostr activity
node {SKILL_DIR}/scripts/nostr.js mentions 10
node {SKILL_DIR}/scripts/nostr.js dms 5
If mentions from WoT or zaps received → notify user.
TOOLS.md
After setup, store for quick reference:
CODEBLOCK17
Profile Sources
- - Name: IDENTITY.md or SOUL.md
- About: SOUL.md description
- Picture: User-provided URL, or DiceBear fallback
- Banner: User-provided URL, or DiceBear fallback
- lud16: From INLINECODE25
Nostr 技能
自主主权 Nostr 身份 + 电子现金钱包。完整引导。
能力说明
本技能赋予智能体以下能力:
- - 密钥生成 — 在 ~/.nostr/secret.key 创建 Nostr 密钥对
- 钱包创建 — 在 ~/.cocod/ 创建 Cashu 钱包(助记词在 config.json 中——由用户备份)
- Nostr 发布 — 以智能体身份发布帖子、私信、Zap
智能体在获得用户明确同意后运行钱包/身份设置。用户需备份 ~/.cocod/config.json(包含助记词)。智能体读取助记词用于 NIP-06 密钥派生,但绝不显示或传输。个人资料图片仅使用 URL(无本地文件访问)。
安装时
当技能被安装(用户粘贴 ClawHub 链接)时,执行以下流程:
步骤 1:安全设置(需用户同意)
安全提示: 此技能将为您的智能体创建加密密钥。这需要:
- - 在 ~/.nostr/secret.key 创建 Nostr 身份密钥对
- 在 ~/.cocod/config.json 创建带有备份种子的 Cashu 钱包
- 用户必须明确备份助记词种子短语
bash
安装依赖
bash {SKILL_DIR}/install.sh
在密钥生成前提示用户同意
echo ⚠️ 安全提示:这将为您的智能体创建加密密钥。
echo - Nostr 身份密钥对:~/.nostr/secret.key
echo - Cashu 钱包种子:~/.cocod/config.json
echo - 您必须备份您的种子短语
echo
read -p 是否继续密钥生成?(yes/no): consent
if [ $consent != yes ]; then
echo 设置已取消
exit 1
fi
创建钱包(助记词保存到配置文件)
npx cocod init
从钱包助记词派生 Nostr 身份(NIP-06)
node {SKILL_DIR}/scripts/nostr.js init
获取身份信息
NPUB=$(node {SKILL_DIR}/scripts/nostr.js whoami | grep npub | awk {print $2})
LN_ADDR=$(npx cocod npc address)
设置基本资料
node {SKILL
DIR}/scripts/nostr.js profile-set {name:<名称>,about:<简介>,lud16:$LNADDR}
步骤 2:报告结果 + 备份警告
回复用户:
⚡
Nostr 身份已就绪!
npub: npub1...
闪电地址: npub1...@npubx.cash
⚠️
重要提示:备份您的恢复短语
您的 24 词助记词存储在:
~/.cocod/config.json
此短语可恢复您的 Nostr 身份和电子现金钱包。请安全备份并保护此文件。
备份完成后请回复完成。
步骤 3:等待完成
在用户确认备份之前不要继续。
步骤 4:询问所有者的 npub
您的 Nostr npub 是什么?
我会关注您以保持联系。
(粘贴您的 npub1... 或 NIP-05 如 you@domain.com)
然后:
bash
如果是 NIP-05,先解析
node {SKILL_DIR}/scripts/nostr.js lookup
关注所有者
node {SKILLDIR}/scripts/nostr.js follow npub>
步骤 5:询问个人资料图片
您有给我的个人资料图片吗?
- - 头像: 粘贴 URL(建议 400x400 方形)
- 横幅: 粘贴 URL(建议 1500x500 宽幅)
或说跳过,我将自动生成独特的图片。
如果提供了 URL:
bash
node {SKILLDIR}/scripts/nostr.js profile-set {picture:url>,banner:}
如果跳过,使用 DiceBear(确定性,每个 npub 唯一):
bash
AVATAR=https://api.dicebear.com/7.x/shapes/png?seed=${NPUB}&size=400
BANNER=https://api.dicebear.com/7.x/shapes/png?seed=${NPUB}-banner&size=1500x500
node {SKILL_DIR}/scripts/nostr.js profile-set {picture:$AVATAR,banner:$BANNER}
步骤 6:首次发帖
准备好发布您的第一条帖子了吗?
告诉我您想发布什么,或说跳过。
建议:你好 Nostr!⚡
如果用户提供了文本(使用标准输入以避免 shell 注入):
bash
echo <用户的消息> | node {SKILL_DIR}/scripts/nostr.js post -
步骤 7:完成
✅ 全部就绪!
试试:检查我的提及或发布 <消息>
命令参考
发布
bash
使用标准输入作为内容(防止 shell 注入)
echo 消息 | node {SKILL_DIR}/scripts/nostr.js post -
echo 回复文本 | node {SKILL_DIR}/scripts/nostr.js reply -
node {SKILL_DIR}/scripts/nostr.js react 🔥
node {SKILL_DIR}/scripts/nostr.js repost
node {SKILL_DIR}/scripts/nostr.js delete
阅读
bash
node {SKILL_DIR}/scripts/nostr.js mentions 20
node {SKILL_DIR}/scripts/nostr.js feed 20
连接
bash
node {SKILL_DIR}/scripts/nostr.js follow
node {SKILL_DIR}/scripts/nostr.js unfollow
node {SKILL_DIR}/scripts/nostr.js mute
node {SKILL_DIR}/scripts/nostr.js unmute
node {SKILL_DIR}/scripts/nostr.js lookup
私信
bash
echo 消息 | node {SKILL_DIR}/scripts/nostr.js dm -
node {SKILL_DIR}/scripts/nostr.js dms 10
Zap
bash
获取发票
node {SKILL_DIR}/scripts/nostr.js zap 100 评论
支付
npx cocod send bolt11
钱包
bash
npx cocod balance
npx cocod receive bolt11 1000 # 创建发票
npx cocod send bolt11 # 支付发票
npx cocod npc address # 闪电地址
资料
bash
node {SKILL_DIR}/scripts/nostr.js whoami
node {SKILL_DIR}/scripts/nostr.js profile
node {SKILL_DIR}/scripts/nostr.js profile 名称 简介
node {SKILL_DIR}/scripts/nostr.js profile-set {name:X,picture:URL,lud16:addr}
书签
bash
node {SKILL_DIR}/scripts/nostr.js bookmark
node {SKILL_DIR}/scripts/nostr.js unbookmark
node {SKILL_DIR}/scripts/nostr.js bookmarks
中继
bash
node {SKILL_DIR}/scripts/nostr.js relays
node {SKILL_DIR}/scripts/nostr.js relays add
node {SKILL_DIR}/scripts/nostr.js relays remove
自动回复(心跳集成)
bash
获取未处理的 WoT 提及(JSON 输出)
node {SKILL_DIR}/scripts/nostr.js pending-mentions [stateFile] [limit]
标记提及为已回复(回复后)
node {SKILL_DIR}/scripts/nostr.js mark-responded [responseNoteId]
标记提及为已忽略(无需回复)
node {SKILL_DIR}/scripts/nostr.js mark-ignored [reason]
检查每小时速率限制(最多 10/小时)
node {SKILL_DIR}/scripts/nostr.js rate-limit
显示自动回复状态摘要
node {SKILL_DIR}/scripts/nostr.js autoresponse-status
状态文件: ~/.openclaw/workspace/memory/nostr-autoresponse-state.json
WoT 来源: 所有者的关注列表(在 nostr.js 中定义为 OWNER_PUBKEY)
用户短语 →