Alibabacloud Hitl Claw Plugin

Alicloud@alicloud

OpenClaw plugin for intercepting tool calls with user confirmation

Readme

Alibaba Cloud Agent HITL (Preview)

中文文档

An OpenClaw plugin that performs risk detection when executing Alibaba Cloud CLI commands, triggering Human-in-the-Loop (HITL) mechanism when necessary to reduce operational risks.

Note:

Large language models have strong autonomy, and there is still some uncertainty during Agent execution. Please strictly control Agent permissions;

This plugin is in preview and may not cover all risky operations. Please thoroughly test to ensure it meets your needs.

Table of Contents

Prerequisites

  • OpenClaw >= 2026.3.24
  • Node.js >= 22.0.0
  • Alibaba Cloud CLI (aliyun) installed and configured
  • When using external channels, run: openclaw config set session.dmScope per-channel-peer
  • Custom API configurations are not supported

Quick Start

bash
openclaw plugins install @alicloud/alibabacloud-hitl-claw-plugin

Features

  • CLI Command Recognition: Recognizes aliyun CLI commands executed by the Agent
  • Risk Assessment: Integrates with Alibaba Cloud IMS CheckHitlRule API for risk detection
  • Human Approval: High and medium-risk commands require human approval via a secure link
  • Multi-Channel Support: Works with DingTalk, Feishu, and OpenClaw console interfaces

Command Recognition

Trigger Conditions

ConditionDescription
Tool TypeOnly checks exec tool calls for Alibaba Cloud CLI: aliyun
Command PatternMatches aliyun <ProductCode> <APIName> [Parameters...]
Supported StylesBoth RPC and ROA styles

Parsing Method

Uses shell-quote library for professional shell command parsing, supporting:

  • Pipe operator |
  • Logical operators &&, ||
  • Command separator ;
  • Background execution &
  • Quotes and escape characters

Examples

Original CommandServer CheckCommand Sent to ServerNotes
aliyun ecs DescribeInstances✅ Yesaliyun ecs DescribeInstancesStandard RPC style
aliyun ram CreateUser --UserName test✅ Yesaliyun ram CreateUser --UserName testWrite operation with params
aliyun cs GET /clusters✅ Yesaliyun cs GET /clustersROA style
ls && aliyun ecs DeleteInstance --InstanceId i-xxx✅ Yesaliyun ecs DeleteInstance --InstanceId i-xxxExtracts Alibaba Cloud part from composite command
aliyun configure❌ No-Missing API name, no check triggered
aws ec2 describe-instances❌ No-Not an Alibaba Cloud command

Risk Decisions

Risk API (aliyun ims CheckHitlRule) returns three decisions:

DecisionMeaningPlugin Behavior
ALLOWLow risk, allow executionPass through
ESCALATEHigh risk, requires approvalSuspend and wait for approval

How It Works

HITL Workflow

Configuration

The plugin reads configuration from config.json:

json
{
  "enabled": true,
  "confirmationTimeoutSeconds": 600
}
OptionTypeDefaultDescription
enabledbooleantrueWhether to enable the plugin
confirmationTimeoutSecondsnumber600Approval timeout in seconds

Security

1. Shell Command Execution

This plugin invokes the Alibaba Cloud CLI for:

ScenarioDescription
Sensitive Operation DetectionCalls aliyun ims CheckHitlRule to detect if the current command is a sensitive operation
Resume User CLI RequestAfter user approval, resumes execution of the original command

This plugin runs in Node.js and uses the child_process module to invoke the aliyun CLI.

Data sent to server: aliyun CLI command content, CLI version, plugin version, Agent type, Session ID

2. Network Requests

This plugin uses fetch to poll approval status and sends approval result notifications to external channels (DingTalk, Feishu) via OpenClaw's dispatchReplyFromConfig API.

  • No sensitive credentials are sent to the server
  • Network requests are only for approval status polling and message notifications

All above behaviors are essential for core plugin functionality. Sensitive information is processed locally and will not be sent to the server.

License

MIT