# OpenClaw Integration
SolonGate integrates with OpenClaw as a native plugin. Unlike Claude Code and Gemini CLI which use hooks, OpenClaw has its own plugin system that SolonGate plugs into directly.
How it works
The @solongate/openclaw-plugin registers into OpenClaw's plugin lifecycle. It intercepts every tool call at the before_tool_call hook and evaluates it against your security policy, input validation rules, and rate limits. If a tool call is blocked, OpenClaw receives a structured deny response. All decisions are logged to the SolonGate Dashboard.
Policy Enforcement
Cloud policies from the dashboard or local presets. Deny dangerous tools like exec, bash, shell.
Input Validation
Detects path traversal, SSRF, SQL injection, shell injection, and prompt injection attempts.
Rate Limiting
Per-tool and global rate limits with sliding window. Prevents abuse from compromised prompts.
Audit Logging
Every tool call logged to the SolonGate Dashboard with full arguments, decision, and timing.
Step 1: Install the Plugin
Install the SolonGate plugin using OpenClaw's plugin manager:
1openclaw plugins install @solongate/openclaw-plugin
Then enable it:
1openclaw plugins enable solongate
Verify it's installed:
1openclaw plugins list
You should see solongate in the list with status "enabled".
Step 2: Set Your API Key
The plugin needs your SolonGate API key to fetch policies and send audit logs. Get one at dashboard.solongate.com.
Option A: Set before starting (per session)
1# PowerShell2$env:SOLONGATE_API_KEY="sg_live_your_key_here"34# Bash / macOS / Linux5export SOLONGATE_API_KEY=sg_live_your_key_here
Option B: System environment variable (permanent)
On Windows: Settings → search "Environment variables" → User variables → New → Name: SOLONGATE_API_KEY, Value: sg_live_xxx
On macOS/Linux: add export SOLONGATE_API_KEY=sg_live_xxx to your ~/.bashrc or ~/.zshrc.
Step 3: Start OpenClaw
Start the OpenClaw gateway. The SolonGate plugin activates automatically:
1openclaw gateway
You should see this in the logs:
SolonGate activated — protecting all OpenClaw tools.
Policy: Cloud Policy (12 rules)
Input guard: enabled (SSRF, SQL injection, path traversal, shell injection)
Audit logging: enabled (→ dashboard.solongate.com)
Dashboard: https://dashboard.solongate.com
Not seeing the banner? Make sure you ran openclaw plugins enable solongate and that SOLONGATE_API_KEY is set in the same terminal session.
Step 4: Test It
Send a message to your OpenClaw bot (WhatsApp, Telegram, Discord, etc.) and try these:
Normal file read
"test.txt dosyasini oku"
Dangerous command (restricted policy)
"rm -rf / komutu calistir"
Path traversal attack
"../../etc/passwd dosyasini oku"
Check results at dashboard.solongate.com → Audit Logs. You'll see "OpenClaw" as the agent in the Trust Map.
Environment Variables
Configuration is read from environment variables first, then falls back to ~/.solongate/config.json. The first time you set an env var, the plugin automatically saves it to the config file so you don't have to set it again.
Config File (~/.solongate/config.json)
1{2 "apiKey": "sg_live_your_key_here",3 "policyId": "policy-1774836041626",4 "verbose": false5}
Created automatically when you first set SOLONGATE_API_KEY. You can also create it manually. Env vars always override config file values.
| Variable | Required | Description |
|---|---|---|
| SOLONGATE_API_KEY | Yes | Your SolonGate API key (sg_live_xxx or sg_test_xxx) |
| SOLONGATE_POLICY_ID | No | Specific policy ID to fetch from the dashboard. Without this, fetches the latest (default) policy. |
| SOLONGATE_POLICY | No | restricted (default) or permissive. Only used if cloud policy is unavailable. |
| SOLONGATE_RATE_LIMIT | No | Per-tool rate limit (calls/min). Default: off. |
| SOLONGATE_GLOBAL_RATE_LIMIT | No | Global rate limit across all tools (calls/min). Default: off. |
| SOLONGATE_VERBOSE | No | Set to true to see [ALLOW]/[DENY] for every tool call. |
| SOLONGATE_API_URL | No | Custom API URL. Default: https://api.solongate.com |
Default Policies
When a cloud policy is not available (no API key or offline), the plugin uses a local preset:
Restricted (default)
Blocks dangerous tools, allows everything else:
Permissive
Allows all tools. Input validation and audit logging still active. Set with SOLONGATE_POLICY=permissive.
For custom rules, create a policy in the SolonGate Dashboard. The plugin fetches it automatically on startup.
How Policies Work (No Local File)
Unlike Claude Code and Gemini CLI which use a local policy.json file, OpenClaw has no local policy file. The plugin fetches your policy from the cloud at startup.
Policy Resolution Flow
1. Gateway starts → plugin reads SOLONGATE_API_KEY
2. sg_live_ key → validates license against API
3. Fetches cloud policy from GET /api/v1/policies/default
4. ✓ Policy found → uses cloud rules (e.g. 12 rules from dashboard)
5. ✗ Policy unavailable → falls back to local preset (restricted/permissive)
Cloud Policy (Recommended)
Create and manage rules in the Dashboard → Policies. Changes take effect next time the gateway restarts — no code changes needed.
Specific Policy
If you have multiple policies in a project, specify which one to use:
1# Bash / macOS / Linux2export SOLONGATE_POLICY_ID=my-strict-policy34# PowerShell (Windows)5$env:SOLONGATE_POLICY_ID="my-strict-policy"
Without this, the plugin fetches the default (latest) policy in your project.
Local Fallback (Last Resort)
If the API is unreachable or no cloud policy exists, the plugin falls back to a hardcoded preset built into the plugin code. This is NOT a file on disk — it's compiled into the plugin binary.
• restricted (default) — blocks: *exec*, *bash*, *shell*, *process*, *browser*, *web_fetch*, *eval*, *nodes*
• permissive — allows everything (set with SOLONGATE_POLICY=permissive)
Input validation (SSRF, SQL injection, path traversal) and audit logging still run even with fallback presets.
Why no local file? OpenClaw runs as a gateway service (WhatsApp, Telegram, Discord bots), not inside a project directory. There's no "project root" to put a policy.json in. Cloud-based policies are the natural fit — manage once in the dashboard, applies everywhere.
Policy Hot-Reload
The plugin automatically re-fetches your policy from the dashboard every 10 minutes. If you change a policy in the dashboard, it takes effect within 10 minutes — no restart needed.
Need it immediately? Trigger a manual reload by calling:
1# From your bot chat, call the solongate_reload tool2# Or via API:3curl -X POST http://localhost:PORT/tools/call \4 -d '{"name": "solongate_reload", "params": {}}'
The plugin will fetch the latest policy and respond with the result (changed or unchanged).
Is the API Key Secure?
Yes. Here's exactly what happens with your API key:
Key stays local
The key is read from process.env.SOLONGATE_API_KEY at startup. It's only sent to api.solongate.com in the Authorization header — never logged, never included in audit data.
Format validation
Must start with sg_live_ or sg_test_. Any other format → plugin refuses to activate.
Online license check
sg_live_ keys are validated against the API on startup. Invalid/expired key → plugin logs an error and stops. No tool calls go through.
Audit logs are key-free
When sending audit data, only tool name, arguments, and decision are included. The key is used for auth but is not part of the logged payload.
Best practice: Never hardcode the key in source files. Use environment variables or a secrets manager. If you use a .env file, make sure it's in .gitignore.
Architecture: Plugin vs. Hooks
SolonGate supports two integration models depending on the AI tool:
| Claude Code / Gemini CLI | OpenClaw | |
|---|---|---|
| Integration | Hooks (shell scripts) | Native plugin (in-process) |
| Setup | npx @solongate/proxy init --all | openclaw plugins install |
| Runs in | Separate process (Node.js) | Same process as OpenClaw gateway |
| Config location | Project directory (.claude/, .gemini/) | Global (~/.openclaw/) |
| MCP Proxy | Yes (wraps MCP servers) | No (hooks into OpenClaw directly) |
Managing the Plugin
Use OpenClaw's built-in plugin commands to manage the SolonGate plugin:
Update to latest version
1openclaw plugins update @solongate/openclaw-plugin
Or reinstall to force a specific version:
1openclaw plugins install @solongate/openclaw-plugin@latest
Temporarily disable
1openclaw plugins disable openclaw-plugin
Re-enable with: openclaw plugins enable openclaw-plugin
Uninstall completely
1openclaw plugins uninstall openclaw-plugin
Check plugin status
1# List all plugins2openclaw plugins list34# Show plugin details5openclaw plugins info openclaw-plugin67# Diagnose issues8openclaw plugins doctor
Important: After any plugin change (install, update, enable, disable, uninstall), restart the gateway with openclaw gateway for changes to take effect.
Troubleshooting
Plugin not showing in logs
Run openclaw plugins list and check that solongate is enabled. If not, run openclaw plugins enable solongate.
"SOLONGATE_API_KEY not set" warning
The env var must be set in the same terminal session where you run openclaw gateway. On Windows PowerShell: $env:SOLONGATE_API_KEY="sg_live_xxx"
Logs not appearing in dashboard
Make sure you're using a sg_live_ key, not sg_test_. Test keys skip online validation and don't send audit logs.
All tools getting blocked
Default policy is "restricted" which blocks exec/bash/shell tools. Set SOLONGATE_POLICY=permissive or create a custom policy in the dashboard.