← 返回
未分类 中文

Action Guard

Prevents duplicate external actions (posts, replies, sends, transfers, deploys). Check before acting, record after. Use when: (1) replying to social media po...
防止
wrentheai wrentheai 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 433
下载
💾 0
安装
1
版本
#agents#dedup#latest#safety

概述

Action Guard

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 <action-type> <target-id>

# After acting — record it
node scripts/guard.js record <action-type> <target-id> [--note "context"] [--parent <parent-id>]

# 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)
  • 1STOP — action already taken (details printed to stderr)
  • 2 — error (config missing, etc.)

How It Works

  1. Check hashes : and searches the log
  2. Also checks --parent matches — catches "different reply to same post" duplicates
  3. Record appends to .action-guard/actions.jsonl
  4. Data persists across sessions — survives context resets

Action Types

Use any string. Common types:

TypeUse For
---------------
replySocial media replies
postOriginal posts
sendToken/crypto transfers
emailOutbound emails
deployProduction deployments
dmDirect messages
webhookWebhook triggers

CLI Reference

node scripts/guard.js <command> [options]

Commands:
  check <type> <target>           Check if action was already taken
  record <type> <target>          Record a completed action
  history [--type <type>]         Show recent actions
  stats                           Action counts by type
  search <query>                  Search notes

Options:
  --note "text"                   Context note (for record)
  --parent <id>                   Parent/target ID (catches reply-to-same-post dupes)
  --days <n>                      Limit history to N days (default: 30)
  --data-dir <path>               Data directory (default: .action-guard/)

Integration Pattern

In cron jobs or automation, always wrap actions:

BEFORE each action:
  node guard.js check <type> <target>
  If exit 1 → SKIP (already done)

DO the action

AFTER success:
  node guard.js record <type> <target> --note "what you did" --parent <parent-if-applicable>

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.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 16:52 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,398 📥 323,041
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,473 📥 535,652
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,109 📥 830,805