Skip to content

johnalbertini14-glitch/openclaw-skills / skills/0xbeekeeper/security

agentguard

Flagged

GoPlus AgentGuard — AI agent security guard. Automatically blocks dangerous commands, prevents data leaks, and protects secrets. Use when reviewing third-party code, auditing skills, checking for vulnerabilities, evaluating action safety, or viewing security logs.

FileKindSize
SKILL.mdskill md15.8 KB
_meta.jsonconfig453 B
action-policies.mdmarkdown8.3 KB
evals.mdmarkdown2.6 KB
scan-rules.mdmarkdown12.4 KB
scripts/action-cli.tsscript6.6 KB
scripts/auto-scan.jsscript4.8 KB
scripts/data/registry.jsonconfig56 B
scripts/guard-hook.jsscript3.2 KB
scripts/package-lock.jsonmanifest784 B
scripts/package.jsonmanifest109 B
scripts/trust-cli.tsscript4.2 KB
web3-patterns.mdmarkdown5.5 KB

scripts/guard-hook.js

View on GitHub
#!/usr/bin/env node

/**
 * GoPlus AgentGuard PreToolUse / PostToolUse Hook (Claude Code)
 *
 * Uses the common adapter + engine architecture.
 * Reads Claude Code hook input from stdin, delegates to evaluateHook(),
 * and outputs allow / deny / ask via Claude Code protocol.
 *
 * PreToolUse exit codes:
 *   0  = allow (or JSON with permissionDecision)
 *   2  = deny  (stderr = reason shown to Claude)
 *
 * PostToolUse: appends audit log entry (async, always exits 0)
 */

import { join } from 'node:path';

// ---------------------------------------------------------------------------
// Load AgentGuard engine + adapters
// ---------------------------------------------------------------------------

const agentguardPath = join(import.meta.url.replace('file://', ''), '..', '..', '..', '..', 'dist', 'index.js');

let createAgentGuard, ClaudeCodeAdapter, evaluateHook, loadConfig;
try {
  const gs = await import(agentguardPath);
  createAgentGuard = gs.createAgentGuard || gs.default;
  ClaudeCodeAdapter = gs.ClaudeCodeAdapter;
  evaluateHook = gs.evaluateHook;
  loadConfig = gs.loadConfig;
} catch {
  try {
    const gs = await import('@goplus/agentguard');
    createAgentGuard = gs.createAgentGuard || gs.default;
    ClaudeCodeAdapter = gs.ClaudeCodeAdapter;
    evaluateHook = gs.evaluateHook;
    loadConfig = gs.loadConfig;
  } catch {
    process.stderr.write('GoPlus AgentGuard: unable to load engine, allowing action\n');
    process.exit(0);
  }
}

// ---------------------------------------------------------------------------
// Read stdin
// ---------------------------------------------------------------------------

function readStdin() {
  return new Promise((resolve) => {
    let data = '';
    process.stdin.setEncoding('utf-8');
    process.stdin.on('data', (chunk) => (data += chunk));
    process.stdin.on('end', () => {
      try {
        resolve(JSON.parse(data));
      } catch {
        resolve(null);
      }
    });
    setTimeout(() => resolve(null), 5000);
  });
}

// ---------------------------------------------------------------------------
// Claude Code output helpers
// ---------------------------------------------------------------------------

function outputDeny(reason) {
  process.stderr.write(reason + '\n');
  process.exit(2);
}

function outputAsk(reason) {
  console.log(JSON.stringify({
    hookSpecificOutput: {
      hookEventName: 'PreToolUse',
      permissionDecision: 'ask',
      permissionDecisionReason: reason,
    },
  }));
  process.exit(0);
}

function outputAllow() {
  process.exit(0);
}

// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------

async function main() {
  const input = await readStdin();
  if (!input) {
    process.exit(0);
  }

  const adapter = new ClaudeCodeAdapter();
  const config = loadConfig();
  const agentguard = createAgentGuard();

  const result = await evaluateHook(adapter, input, { config, agentguard });

  if (result.decision === 'deny') outputDeny(result.reason || 'Action blocked');
  else if (result.decision === 'ask') outputAsk(result.reason || 'Action requires confirmation');
  else outputAllow();
}

main();
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall