Action Guard — 防止重复外部操作
v1.0.0防止重复的外部操作(发帖、回复、发送、转账、部署)。行动前检查,行动后记录。适用于:(1)回复社交媒体帖子,(2)发送代币/加密货币,(3)发送邮件或消息,(4)部署到生产环境,(5)任何代理可能在不同会话中重复的不可逆操作。
详细分析 ▾
运行时依赖
版本
首次发布。AI 代理外部操作的通用去重。行动前检查,行动后记录。
安装命令 点击复制
技能文档
Check before you act. Record after. Never do the same thing twice.
Why This Exists
AI agents lose state between sessions. Without a record of what you've already done, you will:
- Reply twice to the same post
- Send duplicate token transfers (unrecoverable on-chain)
- Deploy the same build twice
- Email the same person the same thing
This skill provides a universal dedup layer for any external action.
Quick Start
# Before acting — exits 1 if already done
node scripts/guard.js check # After acting — record it
node scripts/guard.js record [--note "context"] [--parent ]
# Examples
node scripts/guard.js check reply 2033701370289963286
node scripts/guard.js record reply 2033701370289963286 --note "replied to @startupideaspod" --parent 2033500000000000000
node scripts/guard.js check send CPcrV6UeL8CcEvC7rCV6iyUDxbkT5bkJifbz5PUs6zfg
node scripts/guard.js record send CPcrV6UeL8CcEvC7rCV6iyUDxbkT5bkJifbz5PUs6zfg --note "250K WREN airdrop"
Exit Codes
0— safe to proceed (no prior action found)1— STOP — action already taken (details printed to stderr)2— error (config missing, etc.)
How It Works
- Check hashes
and searches the log: - Also checks
--parentmatches — catches "different reply to same post" duplicates - Record appends to
.action-guard/actions.jsonl - Data persists across sessions — survives context resets
Action Types
Use any string. Common types:
| Type | Use For |
|---|---|
reply | Social media replies |
post | Original posts |
send | Token/crypto transfers |
email | Outbound emails |
deploy | Production deployments |
dm | Direct messages |
webhook | Webhook triggers |
CLI Reference
node scripts/guard.js [options]Commands:
check Check if action was already taken
record Record a completed action
history [--type ] Show recent actions
stats Action counts by type
search Search notes
Options:
--note "text" Context note (for record)
--parent Parent/target ID (catches reply-to-same-post dupes)
--days Limit history to N days (default: 30)
--data-dir Data directory (default: .action-guard/)
Integration Pattern
In cron jobs or automation, always wrap actions:
BEFORE each action:
node guard.js check
If exit 1 → SKIP (already done)DO the action
AFTER success:
node guard.js record --note "what you did" --parent
Data Format
Actions stored in .action-guard/actions.jsonl (one JSON object per line):
{"type":"reply","target":"2033701370289963286","parent":"2033500000000000000","note":"replied to @startupideaspod","ts":"2026-03-16T21:30:00.000Z"}
JSONL format means: no parsing the whole file, just append. Fast grep. Easy cleanup.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制