Loop Engine — Governed Loops for OpenClaw

# loop-engine-governance

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Loop Engine — Governed Loops for OpenClaw" with this command: npx skills add betterdataco/loop-engine-governance

loop-engine-governance

Add governed decision loops to any OpenClaw workflow — human approval gates, AI confidence guards, and full audit trails without changing your agent logic.

Source and maintainer

Required environment variables

This skill includes four examples. Each requires different credentials:

ExampleRequired env varProvider
example-expense-approval.tsNoneNo external API calls
example-ai-replenishment-claude.tsANTHROPIC_API_KEYAnthropic
example-infrastructure-change-openai.tsOPENAI_API_KEYOpenAI
example-fraud-review-grok.tsXAI_API_KEYxAI

Only set the env var for the example you intend to run. The expense approval example requires no API key and is the recommended starting point.

Install

# Core (required for all examples)
npm install @loop-engine/sdk @loop-engine/adapter-memory @loop-engine/adapter-openclaw

# For the Claude example only
npm install @loop-engine/adapter-anthropic @anthropic-ai/sdk

# For the OpenAI example only
npm install @loop-engine/adapter-openai openai

# For the Grok example only
npm install @loop-engine/adapter-grok openai

Verify package maintainers before installing:

  • @loop-engine/* — published by the betterdata npm org
  • @loop-engine/adapter-openclaw — published by the betterdata npm org
  • @anthropic-ai/sdk — published by Anthropic
  • openai — published by OpenAI

Data sent to external providers

Read this before running the AI examples.

The AI examples send structured context to external LLM provider APIs as part of the loop actor submission. This includes whatever you pass as evidence to createSubmission().

The included examples use synthetic illustrative data only:

  • example-ai-replenishment-claude.ts — fictional inventory figures
  • example-infrastructure-change-openai.ts — fictional infrastructure metadata
  • example-fraud-review-grok.ts — fictional transaction and cardholder data

Before using in production:

  • Do not send real PII, cardholder data, or regulated information to LLM providers without reviewing their data processing agreements
  • Review your LLM provider's data retention and training policies
  • For regulated industries (healthcare, finance, pharma), confirm your provider agreement covers the data classification you intend to send
  • Consider redacting or tokenizing sensitive fields before passing as evidence

Loop Engine captures evidence in its local audit trail. The evidence object is also sent to the LLM provider API as part of the actor prompt. These are two separate destinations — plan accordingly. Loop Engine itself never transmits data externally. Only the AI provider adapter calls send data — and only what you explicitly pass as evidence.

What this skill does

Wires Loop Engine into OpenClaw so that any workflow step can be governed by:

  • Human approval gates — transitions only a named human actor can trigger
  • AI confidence guards — block AI recommendations below a threshold
  • Evidence capture — attach structured context to every decision
  • Audit trail — every transition is attributed, timestamped, and immutable

How it works with OpenClaw

OpenClaw agent proposes action
        ↓
Loop Engine evaluates guards       ← @loop-engine/adapter-openclaw
        ↓
Human approves (if policy requires)
        ↓
OpenClaw executes the approved action

Guards are enforced at the runtime level — not in prompts.

How governance weighting works

Three types of weighting evaluated in sequence — all must pass:

1. Confidence threshold (numeric gate) Every AI actor submission carries a 0–1 confidence score. The guard blocks the transition if the score falls below the configured threshold.

2. Guard priority (hard vs soft) Hard failures block the transition regardless of everything else. A human-only guard is an absolute block — no confidence score overrides it.

3. Evidence completeness (structural gate) The evidence-required guard checks for specific fields before allowing a transition. Missing any required field blocks the transition.

Evaluation order:

1. Actor authorized for this signal?
2. Required evidence fields present?
3. Confidence score above threshold?
4. All hard guards pass?

Quick start (no API key required)

import { createLoopSystem, parseLoopYaml, CommonGuards } from '@loop-engine/sdk'
import { MemoryAdapter } from '@loop-engine/adapter-memory'

const definition = parseLoopYaml(`
  loopId: approval.workflow
  name: Approval Workflow
  version: 1.0.0
  initialState: pending
  states:
    - stateId: pending
      label: Pending Approval
    - stateId: approved
      label: Approved
      terminal: true
  transitions:
    - transitionId: approve
      from: pending
      to: approved
      signal: approve
      allowedActors: [human]
      guards: [human-only]
`)

const system = createLoopSystem({
  storage: new MemoryAdapter(),
  guards: CommonGuards,
})

const loop = await system.startLoop({ definition, context: {} })

await system.transition({
  loopId: loop.loopId,
  signalId: 'approve',
  actor: { id: 'alice', type: 'human' },
  evidence: { reviewNote: 'Approved' },
})

Examples included

FileProviderAPI key
example-expense-approval.tsNoneNot required
example-ai-replenishment-claude.tsAnthropic ClaudeANTHROPIC_API_KEY
example-infrastructure-change-openai.tsOpenAI GPT-4oOPENAI_API_KEY
example-fraud-review-grok.tsxAI Grok 3XAI_API_KEY

All examples use synthetic data. Do not use real PII or regulated data without reviewing your provider's data processing agreements.

License

MIT-0 — free to use, modify, and redistribute. No attribution required.

@loop-engine/* packages: Apache-2.0 Provider SDKs: licensed by their respective maintainers

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

AgentMesh Governance

AI agent governance, trust scoring, and policy enforcement powered by AgentMesh. Activate when: (1) user wants to enforce token limits, tool restrictions, or...

Registry SourceRecently Updated
4990Profile unavailable
Security

Enterprise Risk Management Engine

Enterprise Risk Management Engine helps organizations identify, assess, mitigate, and monitor operational, financial, strategic, compliance, cyber, and reput...

Registry SourceRecently Updated
5270Profile unavailable
Security

Moses Governance

MO§ES™ Governance Harness — constitutional enforcement layer for AI agents. Modes, postures, roles, SHA-256 audit chain, lineage custody, signing gate, commi...

Registry SourceRecently Updated
1970Profile unavailable
Security

Drission Sota Toolkit

Professional Web Intelligence & Automation Toolkit. Features Protocol Phantom (TLS/JA4), Local Socket Relaying, and Hardened physical gating.

Registry SourceRecently Updated
720Profile unavailable