@axonflow/openclaw 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +272 -134
  3. package/dist/audit.d.ts +2 -2
  4. package/dist/audit.d.ts.map +1 -1
  5. package/dist/audit.js +2 -2
  6. package/dist/audit.js.map +1 -1
  7. package/dist/axonflow-client.d.ts +22 -0
  8. package/dist/axonflow-client.d.ts.map +1 -1
  9. package/dist/axonflow-client.js +56 -0
  10. package/dist/axonflow-client.js.map +1 -1
  11. package/dist/cache-dir.d.ts +34 -0
  12. package/dist/cache-dir.d.ts.map +1 -0
  13. package/dist/cache-dir.js +106 -0
  14. package/dist/cache-dir.js.map +1 -0
  15. package/dist/client-ref.d.ts +19 -0
  16. package/dist/client-ref.d.ts.map +1 -0
  17. package/dist/client-ref.js +16 -0
  18. package/dist/client-ref.js.map +1 -0
  19. package/dist/community-saas-bootstrap.d.ts +58 -0
  20. package/dist/community-saas-bootstrap.d.ts.map +1 -0
  21. package/dist/community-saas-bootstrap.js +281 -0
  22. package/dist/community-saas-bootstrap.js.map +1 -0
  23. package/dist/config.d.ts +26 -1
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +60 -30
  26. package/dist/config.js.map +1 -1
  27. package/dist/governance.d.ts +3 -2
  28. package/dist/governance.d.ts.map +1 -1
  29. package/dist/governance.js +2 -2
  30. package/dist/governance.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +123 -12
  34. package/dist/index.js.map +1 -1
  35. package/dist/llm-audit.d.ts +3 -3
  36. package/dist/llm-audit.d.ts.map +1 -1
  37. package/dist/llm-audit.js +3 -3
  38. package/dist/llm-audit.js.map +1 -1
  39. package/dist/message-guard.d.ts +2 -2
  40. package/dist/message-guard.d.ts.map +1 -1
  41. package/dist/message-guard.js +2 -2
  42. package/dist/message-guard.js.map +1 -1
  43. package/dist/plugin-version-check.d.ts +50 -0
  44. package/dist/plugin-version-check.d.ts.map +1 -0
  45. package/dist/plugin-version-check.js +89 -0
  46. package/dist/plugin-version-check.js.map +1 -0
  47. package/dist/telemetry-config.d.ts +7 -1
  48. package/dist/telemetry-config.d.ts.map +1 -1
  49. package/dist/telemetry-config.js +1 -2
  50. package/dist/telemetry-config.js.map +1 -1
  51. package/dist/telemetry.d.ts +37 -14
  52. package/dist/telemetry.d.ts.map +1 -1
  53. package/dist/telemetry.js +146 -46
  54. package/dist/telemetry.js.map +1 -1
  55. package/openclaw.plugin.json +3 -6
  56. package/package.json +9 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0] - 2026-04-29 — Production, quality, and security hardening — upgrade encouraged
4
+
5
+ **Upgrade strongly recommended.** Over the past month we've shipped substantial production, quality, and security hardening across the AxonFlow plugin and platform — upgrade to the latest version for a more secure, reliable, and bug-free experience.
6
+
7
+ **Security highlights from this release cycle:**
8
+ - **Plugin cache and credential-file permission hardening** (this release). Cache and config directories are tightened to mode `0700` on every invocation; `try-registration.json` is written with mode `0600`. Pre-existing world-readable credential files are detected and refused on first load. Documented in [`GHSA-cqmh-pcgr-q42f`](https://github.com/getaxonflow/axonflow-openclaw-plugin/security/advisories/GHSA-cqmh-pcgr-q42f).
9
+ - **Hook-closure dead-code fix** (this release). Hooks registered against the AxonFlow client previously captured the pre-bootstrap client by value, so the post-bootstrap re-construction was invisible to every registered hook. Refactored to a `ClientRef` holder so all 5 factory paths see the live client. Closes a P0 governance bypass on the hook-driven enforcement path.
10
+ - **Telemetry opt-out reliability** (this release). `DO_NOT_TRACK` was unreliable because host CLIs commonly inject `DO_NOT_TRACK=1` regardless of user intent; the canonical opt-out is now `AXONFLOW_TELEMETRY=off`, an AxonFlow-scoped signal hosts can't unilaterally set.
11
+
12
+ The full set of platform-side security fixes shipped alongside this release — including multi-tenant isolation in MAP execution, cross-tenant audit-log isolation, and SQLi enforcement on the Community SaaS endpoint — is documented in the consolidated platform advisory [`GHSA-9h64-2846-7x7f`](https://github.com/getaxonflow/axonflow/security/advisories/GHSA-9h64-2846-7x7f). Bundled OpenClaw upstream advisories closed by the dependency bump in this release are tracked in this repo's Dependabot alerts.
13
+
14
+ **Reliability and bug-fix highlights:**
15
+ - **7-day delivered-heartbeat with stamp-on-success** (this release). Telemetry stamp advances only after the POST returns 2xx, so a transient network failure no longer silences telemetry until the next 7-day window. Concurrent invocations are de-duplicated by an in-flight gate.
16
+ - **Mode-clarity canary log line** on every plugin init (this release). Logs `[AxonFlow] Connected to AxonFlow at <URL> (mode=...)` and a PR-blocking CI gate asserts the canary matches the actual outbound destination, guarding against silent endpoint drift.
17
+ - **PR-blocking install-to-use smoke against the live community stack** (this release). Catches plugin-side regressions against `try.getaxonflow.com` before they reach a user's host process.
18
+
19
+ ### BREAKING
20
+
21
+ - **`DO_NOT_TRACK` is no longer honored as an AxonFlow telemetry opt-out.** Use `AXONFLOW_TELEMETRY=off` instead. Host tools and CLIs commonly inject `DO_NOT_TRACK=1` regardless of user intent, which makes it unreliable as a signal.
22
+ - **`default` values for `endpoint` / `clientId` / `clientSecret` removed from `openclaw.plugin.json`.** The plugin loader now sees `pluginConfig.endpoint` as `undefined` when the user hasn't configured it — required by the Community-SaaS-default resolver to distinguish "no choice" from "explicit localhost".
23
+
24
+ ### Added
25
+
26
+ - **First-run Community-SaaS bootstrap** — plugin connects to AxonFlow Community SaaS at `https://try.getaxonflow.com` when no `endpoint` / `clientId` / `clientSecret` is supplied in `pluginConfig`. Registers via `/api/v1/register` on first run and persists the credential to `~/.config/axonflow/try-registration.json` (mode 0600). Set any of those keys to opt into self-hosted.
27
+ - **Mode-clarity canary** on every plugin init: `[AxonFlow] Connected to AxonFlow at <url> (mode=community-saas|self-hosted)`.
28
+ - **One-time setup disclosure** on first Community-SaaS connection. Stamped at `<cache-dir>/openclaw-plugin-disclosure-shown` so it fires exactly once per install.
29
+ - **Plugin/platform version compatibility check** on startup. Reads `plugin_compatibility.min_plugin_version["openclaw"]` from the agent's `/health` endpoint and `console.warn`s if the runtime version is below the floor.
30
+ - **`deployment_mode=community-saas`** telemetry value, distinguishing first-class Community-SaaS users from self-hosted production / development (previously bucketed inside `production`).
31
+ - **`AXONFLOW_CACHE_DIR` / `AXONFLOW_CONFIG_DIR`** environment overrides for the cache/config directory resolver. Useful for sandboxed containers and any deployment that needs to redirect AxonFlow state.
32
+
33
+ ### Changed
34
+
35
+ - **Telemetry switched to a 7-day delivered-heartbeat.** At most one anonymous ping per environment every 7 days, with the stamp advanced only after the POST returns 2xx — a transient network failure doesn't silence telemetry until the next window. Concurrent invocations are de-duplicated by an in-flight gate.
36
+ - `pluginConfig` is now optional (was required). `registerAxonFlowGovernance` with no `pluginConfig`, `undefined`, or `{}` resolves to Community SaaS mode rather than throwing `requires configuration`.
37
+
38
+ ### Fixed
39
+
40
+ - The `DO_NOT_TRACK=1 is deprecated...` `console.warn` is no longer emitted on every plugin init when `DO_NOT_TRACK=1` is set.
41
+ - Hooks now correctly see Community-SaaS credentials produced by the asynchronous bootstrap. Previously the hook handlers captured the AxonFlowClient by value at registration time, so the post-bootstrap reassignment was invisible — every governed tool call kept shipping `Authorization: Basic :` against try.getaxonflow.com. Hooks now read through a mutable client holder.
42
+
43
+ ### Security
44
+
45
+ - Cache and config directories tightened to `0700` on every plugin init (was: only set on directory creation via `mkdirSync({ mode: 0o700 })`, which left existing 0755 dirs unchanged).
46
+
47
+
48
+ ## [1.3.2] - 2026-04-22
49
+
50
+ ### Deprecated
51
+
52
+ - `DO_NOT_TRACK=1` as an AxonFlow telemetry opt-out — scheduled for removal after 2026-05-05 in the next major release. Use `AXONFLOW_TELEMETRY=off` instead. The plugin emits a one-time `console.warn` when `DO_NOT_TRACK=1` is the active control and `AXONFLOW_TELEMETRY=off` is not also set.
53
+
3
54
  ## [1.3.1] - 2026-04-19
4
55
 
5
56
  Patch release. Fixes a v1.3.0 gap surfaced by install-and-use E2E
package/README.md CHANGED
@@ -1,81 +1,159 @@
1
1
  # @axonflow/openclaw
2
2
 
3
- **Policy enforcement, approval gates, and audit trails for [OpenClaw](https://github.com/openclaw/openclaw).**
3
+ **Governance for OpenClaw agents: block dangerous tool calls, require human approval on high-risk actions, redact PII from outbound messages, and keep a compliance-grade audit trail without changing a single line of your agent code.**
4
4
 
5
- ## Why
5
+ [![npm](https://img.shields.io/npm/v/%40axonflow%2Fopenclaw?color=%2300A36C)](https://www.npmjs.com/package/@axonflow/openclaw)
6
+ [![ClawHub](https://img.shields.io/badge/ClawHub-listed-00A36C)](https://clawhub.ai/plugins/%40axonflow%2Fopenclaw)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
6
8
 
7
- OpenClaw is widely deployed with [13+ CVEs disclosed in 2026](https://github.com/jgamblin/OpenClawCVEs/) (multiple CVSS 9.8+), [135,000+ publicly exposed instances](https://www.bitsight.com/blog/openclaw-ai-security-risks-exposed-instances), and [1,184 malicious skills](https://cyberpress.org/clawhavoc-poisons-openclaws-clawhub-with-1184-malicious-skills/) poisoned in ClawHub via the ClawHavoc supply chain attack. OpenClaw provides agent runtime and tool execution but no centralized policy enforcement, no PII scanning, and no compliance-grade audit trails.
9
+ > **→ Full integration walkthrough:** **[docs.getaxonflow.com/docs/integration/openclaw](https://docs.getaxonflow.com/docs/integration/openclaw/)** architecture, hook coverage, policy examples, and troubleshooting.
8
10
 
9
- This plugin adds the governance layer. AxonFlow governs, OpenClaw orchestrates. No LLM provider keys needed OpenClaw handles all LLM calls, AxonFlow only enforces policies and records audit trails. Your data stays on your infrastructure.
11
+ > **Upgrade strongly recommended.** AxonFlow ships substantial monthly security and quality hardening; staying on the latest major is the security-supported release line. [Latest release](https://github.com/getaxonflow/axonflow-openclaw-plugin/releases/latest) · [Security advisories](https://github.com/getaxonflow/axonflow-openclaw-plugin/security/advisories)
10
12
 
11
- This plugin is useful when you want to:
12
- - block dangerous tool calls (reverse shells, SSRF, destructive commands) before they run
13
- - detect and redact PII and secrets in outbound messages before delivery
14
- - require human approval for high-risk tools (exec, web_fetch, message)
15
- - keep a compliance-grade audit trail of every tool call and LLM interaction
16
- - gain visibility into token usage and LLM activity across agents via audit trails
13
+ ---
17
14
 
18
- ## What It Does
15
+ ## Why this plugin exists
19
16
 
20
- | Hook | Purpose |
21
- |------|---------|
22
- | `before_tool_call` | Evaluate tool inputs against AxonFlow policies before execution |
23
- | `after_tool_call` | Record tool execution in AxonFlow audit trail |
24
- | `message_sending` | Scan outbound messages for PII/secrets before delivery |
25
- | `llm_input` | Record prompt, model, and provider for audit |
26
- | `llm_output` | Record response summary, token usage, and latency for audit |
17
+ OpenClaw is a strong agent runtime. It is also a serious production security problem the moment you take it past a prototype:
27
18
 
28
- The plugin also:
29
- - **Verifies AxonFlow connectivity** on startup and logs a warning if unreachable
30
- - **Tracks governance metrics** in-process (tool calls blocked/allowed, messages redacted, etc.) accessible via `getMetrics()`
19
+ - **[135,000+ publicly exposed instances](https://www.bitsight.com/blog/openclaw-ai-security-risks-exposed-instances)** deployed without central policy enforcement
20
+ - **[13+ CVEs disclosed in 2026](https://github.com/jgamblin/OpenClawCVEs/)**, several at CVSS 9.8+
21
+ - **[1,184 malicious skills](https://cyberpress.org/clawhavoc-poisons-openclaws-clawhub-with-1184-malicious-skills/)** poisoned in ClawHub via the ClawHavoc supply-chain attack
22
+ - **No native PII/secrets scanning**, no SQL-injection defense, no compliance-grade audit trail, no org-wide tool policy, no approval workflow
31
23
 
32
- ## Current Limitation
24
+ OpenClaw handles agent runtime, MCP connectivity, channels, and tool execution. It was never intended to be the place you enforce governance. This plugin adds the governance layer on top, so OpenClaw keeps doing what it does well and AxonFlow takes over the "is this allowed, should this redact, who approved, where is the audit record" questions.
33
25
 
34
- Tool results written into the OpenClaw session transcript are not yet scanned by this plugin. OpenClaw's `tool_result_persist` hook is synchronous today, so it cannot call AxonFlow's HTTP policy APIs.
26
+ **AxonFlow governs. OpenClaw orchestrates. Your data stays on your infrastructure.** No LLM provider keys leave your machine OpenClaw still makes every LLM call; AxonFlow only evaluates policies and records audit trails.
35
27
 
36
- What is protected today:
37
- - tool inputs before execution
38
- - outbound messages before delivery
39
- - tool and LLM audit trails
28
+ ---
40
29
 
41
- What is not protected yet:
42
- - tool results entering the LLM context through the session transcript
30
+ ## What you get
43
31
 
44
- If OpenClaw adds async support for `tool_result_persist`, AxonFlow can add transcript/result scanning immediately. Upstream issue: [openclaw/openclaw#58558](https://github.com/openclaw/openclaw/issues/58558).
32
+ | Capability | What it means in practice |
33
+ |---|---|
34
+ | **Pre-execution policy check** | Every tool call is scored against 80+ built-in policies (reverse shells, SSRF, credential access, SQLi, prompt injection, path traversal, PII in arguments) before it runs |
35
+ | **Approval gates** | Any tool in `highRiskTools` pauses execution and posts a native OpenClaw approval request with policy severity surfaced as approval priority |
36
+ | **Outbound message scanning** | Every message to Telegram/Discord/Slack/webhook is scanned for PII and secrets before delivery — redacted, blocked, or passed through per policy |
37
+ | **Compliance-grade audit trail** | Every tool call and LLM interaction records the input, output summary, matched policies, decision, and duration |
38
+ | **Decision explainability** | Blocked calls return a `decision_id` the agent can pass to `explainDecision()` to see exactly which policy family triggered and why |
39
+ | **Session overrides** | Operators can request a time-bounded, audit-logged exception when policy allows it — without leaving the agent |
40
+ | **Per-user identity** | `config.userEmail` threads the actual human operator through to every explain/override call, so shared chat agents still produce attributable audits |
45
41
 
46
- ## Prerequisites
42
+ ---
47
43
 
48
- This plugin connects to [AxonFlow](https://github.com/getaxonflow/axonflow), a self-hosted governance platform, for policy evaluation and audit logging. AxonFlow must be running before you use the plugin. Your data stays on your infrastructure.
44
+ ## How it plugs in
49
45
 
50
- ```bash
51
- # Start AxonFlow (Docker — runs entirely on your machine)
52
- git clone https://github.com/getaxonflow/axonflow.git
53
- cd axonflow
54
- docker compose up -d
46
+ ```
47
+ ┌──────────────────────────────────────────────────────────────┐
48
+ │ OpenClaw Agent │
49
+ │ │
50
+ │ User Message LLM Call → Tool Execution → Response → User │
51
+ │ │ │ │ │ │
52
+ │ ▼ ▼ ▼ ▼ │
53
+ │ ┌────────────────────────────────────────────────────────┐ │
54
+ │ │ @axonflow/openclaw │ │
55
+ │ │ │ │
56
+ │ │ GOVERNANCE (can block / modify): │ │
57
+ │ │ before_tool_call (priority 10) → check_input │ │
58
+ │ │ message_sending (priority 10) → check_output │ │
59
+ │ │ │ │
60
+ │ │ AUDIT (observe-only, non-blocking): │ │
61
+ │ │ after_tool_call (priority 90) → audit_tool_call │ │
62
+ │ │ llm_input (priority 90) → record prompt │ │
63
+ │ │ llm_output (priority 90) → record response │ │
64
+ │ └────────────────────────┬───────────────────────────────┘ │
65
+ └───────────────────────────┼──────────────────────────────────┘
66
+
67
+
68
+ ┌───────────────────┐
69
+ │ AxonFlow │
70
+ │ ┌─────┐ ┌─────┐ │
71
+ │ │Policy│ │Audit│ │
72
+ │ │Engine│ │Trail│ │
73
+ │ └─────┘ └─────┘ │
74
+ │ ┌─────┐ │
75
+ │ │ PII │ │
76
+ │ │Scan │ │
77
+ │ └─────┘ │
78
+ └───────────────────┘
55
79
  ```
56
80
 
57
- See [Getting Started](https://docs.getaxonflow.com/docs/getting-started/) for full setup options.
81
+ **What stays the same:** your OpenClaw agent config, ClawHub skills, MCP connectors, and channel integrations are unchanged. The plugin only adds lifecycle hooks.
58
82
 
59
- ## Install
83
+ ---
60
84
 
61
- Available on [ClawHub](https://clawhub.ai/plugins/%40axonflow%2Fopenclaw) and [npm](https://www.npmjs.com/package/@axonflow/openclaw).
85
+ ## The production problems this solves
62
86
 
63
- **Recommended:**
87
+ These are the three questions that reliably surface the moment an OpenClaw agent hits real users or regulators.
64
88
 
65
- ```bash
66
- openclaw plugins install @axonflow/openclaw
67
- ```
89
+ ### 1. "The tool that phones home"
90
+
91
+ A `web_fetch` skill is installed from ClawHub. An agent uses it to look up product docs. Then a user asks, *"Summarize my customer list"* — the agent calls `web_fetch` with customer emails in the URL. The data leaves your infrastructure. OpenClaw executed the tool correctly; nobody checked what it was sending.
92
+
93
+ **What the plugin does:** `check_input` fires before `web_fetch` runs, scans the URL arguments against PII and exfiltration policies, and blocks the call with a decision ID.
94
+
95
+ ### 2. "The MCP response full of PII"
96
+
97
+ An MCP connector queries your CRM for "recent support tickets." The MCP server returns 50 rows with names, emails, phone numbers. All of it flows into the LLM context. OpenClaw managed the connection; SecretRef protected the credentials; the *data itself* was never inspected.
98
+
99
+ **What the plugin does:** `check_output` fires on `message_sending` before anything reaches the user channel, and scans every outbound message for SSN, credit card, API key, and other 80+ policy matches — redacting or blocking per policy.
100
+
101
+ ### 3. "The compliance question nobody can answer"
102
+
103
+ Six months later, a regulator asks: *"For this interaction on March 14, which tools were called, what data did they access, which policies were in effect, and why was the response allowed?"* OpenClaw's execution logs show a tool was called and succeeded. The *decision context* does not exist.
104
+
105
+ **What the plugin does:** every governed call emits a structured audit record with tool, input, output summary, matched policies, decision, and duration. Search via `searchAuditEvents()` or the Customer Portal.
106
+
107
+ ---
108
+
109
+ ## Try AxonFlow on a real plugin rollout
110
+
111
+ We're opening limited **Plugin Design Partner** slots.
112
+
113
+ 30-minute hook lifecycle review, policy pack scoping, override workflow design, and IDE/CLI rollout pattern walkthrough — for solo developers and small teams putting governance on OpenClaw.
114
+
115
+ [Apply here](https://getaxonflow.com/plugins/design-partner?utm_source=readme_plugin_openclaw) or email [design-partners@getaxonflow.com](mailto:design-partners@getaxonflow.com). Personal email is fine — solo developers welcome.
116
+
117
+ ### See AxonFlow in Action
118
+
119
+ Three short videos covering different angles of the platform:
120
+
121
+ - **[Community Quickstart Demo (Code + Terminal, 2.5 min)](https://youtu.be/BSqU1z0xxCo)** — governed calls, PII block, Gateway Mode with LangChain/CrewAI, and MAP from YAML
122
+ - **[Runtime Control Demo (Portal + Workflow, 3 min)](https://youtu.be/6UatGpn7KwE)** — approvals, retry safety, execution state, and the audit viewer
123
+ - **[Architecture Deep Dive (12 min)](https://youtu.be/Q2CZ1qnquhg)** — how the control plane works, policy enforcement flow, and multi-agent planning
68
124
 
69
- The `clawhub:@axonflow/openclaw` form also works if you prefer to be explicit about the source:
125
+ ### Plugin Evaluation Tier (Free 90-day License)
126
+
127
+ Outgrown Community on a real plugin install? Evaluation unlocks the capacity and features that matter for plugin users — without moving to Enterprise yet:
128
+
129
+ | Capability | Community | Evaluation (Free) | Enterprise |
130
+ |---|---|---|---|
131
+ | Tenant policies | 20 | 50 | Unlimited |
132
+ | Org-wide policies | 0 | 5 | Unlimited |
133
+ | Audit retention | 3 days | 14 days | Up to 10 years |
134
+ | HITL approval gates | — | 25 pending, 24h expiry | Unlimited, 24h |
135
+ | Evidence export (CSV/JSON) | — | 5,000 records · 14d window · 3/day | Unlimited |
136
+ | Policy simulation | — | 300/day | Unlimited |
137
+ | Session overrides (self-service unblock) | — | — | Enterprise-only |
138
+
139
+ Org-wide policies and session overrides are **Enterprise-only** — those are the actual upgrade triggers for plugin users.
140
+
141
+ [Get a free Plugin Evaluation license](https://getaxonflow.com/plugins/evaluation-license?utm_source=readme_plugin_openclaw_eval)
142
+
143
+ ---
144
+
145
+ ## Install
146
+
147
+ Requires OpenClaw **2026.4.14 or later**. Upgrade with `npm install -g openclaw@latest` if needed.
70
148
 
71
149
  ```bash
72
- openclaw plugins install clawhub:@axonflow/openclaw
150
+ openclaw plugins install @axonflow/openclaw
73
151
  ```
74
152
 
75
- Requires OpenClaw **2026.4.14 or later**. If you are not on the latest, upgrade with `npm install -g openclaw@latest`.
153
+ Available on [ClawHub](https://clawhub.ai/plugins/%40axonflow%2Fopenclaw) and [npm](https://www.npmjs.com/package/@axonflow/openclaw). The `clawhub:@axonflow/openclaw` form works if you prefer to be explicit about the source.
76
154
 
77
155
  <details>
78
- <summary>On an older OpenClaw CLI? The old workaround is still needed.</summary>
156
+ <summary>On an older OpenClaw CLI? The ENOENT workaround still applies.</summary>
79
157
 
80
158
  OpenClaw versions before 2026.4.14 had a bug ([openclaw/openclaw#66618](https://github.com/openclaw/openclaw/issues/66618)) that made scoped packages fail with `ENOENT .../openclaw-clawhub-package-XXXXXX/@axonflow/openclaw.zip` — both forms of the install command hit it. The fix shipped in 2026.4.14. If you cannot upgrade, install from npm directly:
81
159
 
@@ -86,111 +164,169 @@ openclaw plugins install "./$TGZ"
86
164
  ```
87
165
  </details>
88
166
 
89
- For the full integration walkthrough (architecture, hook coverage, policy examples, troubleshooting), see the [OpenClaw Integration Guide](https://docs.getaxonflow.com/docs/integration/openclaw/).
167
+ ### Start AxonFlow
168
+
169
+ The plugin connects to AxonFlow, a self-hosted governance platform. AxonFlow must be running before the plugin loads. Everything stays on your infrastructure.
170
+
171
+ ```bash
172
+ git clone https://github.com/getaxonflow/axonflow.git
173
+ cd axonflow && docker compose up -d
174
+ ```
175
+
176
+ See [Getting Started](https://docs.getaxonflow.com/docs/getting-started/) for production deployment options.
177
+
178
+ ---
90
179
 
91
180
  ## Configure
92
181
 
93
- In your OpenClaw config:
182
+ The plugin works without any configuration. Install it and run a tool — on first run it registers against AxonFlow Community SaaS at `https://try.getaxonflow.com` and persists the resulting credentials to `~/.config/axonflow/try-registration.json` (mode 0600). Every plugin init logs:
183
+
184
+ ```
185
+ [AxonFlow] Connected to AxonFlow at https://try.getaxonflow.com (mode=community-saas)
186
+ ```
187
+
188
+ Community SaaS is intended for basic testing and evaluation. For real workflows, real systems, or sensitive data, point the plugin at a self-hosted AxonFlow:
94
189
 
95
190
  ```yaml
191
+ # openclaw.config.yaml
96
192
  plugins:
97
193
  @axonflow/openclaw:
98
194
  endpoint: http://localhost:8080
99
- # In community mode, clientId defaults to "community"
100
- # and clientSecret can be left unset.
101
- # Set both only for evaluation/enterprise credentials.
102
- # clientId: your-client-id
103
- # clientSecret: your-client-secret
104
- # requestTimeoutMs: 8000
105
195
  highRiskTools:
106
196
  - web_fetch
107
197
  - message
108
198
  ```
109
199
 
110
- ### Configuration Options
200
+ Setting any of `endpoint` / `clientId` / `clientSecret` opts you into self-hosted mode. The Community-SaaS bootstrap is skipped, and the plugin uses your values verbatim. The same canary log line confirms the destination on every init:
201
+
202
+ ```
203
+ [AxonFlow] Connected to AxonFlow at http://localhost:8080 (mode=self-hosted)
204
+ ```
205
+
206
+ ### Full configuration reference
111
207
 
112
208
  | Option | Required | Default | Description |
113
209
  |--------|----------|---------|-------------|
114
- | `endpoint` | Yes | | AxonFlow agent gateway URL |
115
- | `clientId` | No | `"community"` | Tenant identity for data isolation. Override for evaluation/enterprise. |
116
- | `clientSecret` | No | `""` | License key for evaluation/enterprise features. Requires `clientId` to be set. |
210
+ | `endpoint` | No | `https://try.getaxonflow.com` (Community SaaS) when unset; `http://localhost:8080` when self-hosted with no endpoint specified | AxonFlow agent gateway URL |
211
+ | `clientId` | No | `"community"` (self-hosted) or auto-bootstrapped `cs_<uuid>` (Community SaaS) | Tenant identity for data isolation. Override for evaluation/enterprise. |
212
+ | `clientSecret` | No | `""` (self-hosted) or auto-bootstrapped (Community SaaS) | Basic-auth secret paired with `clientId`. Required for evaluation/enterprise tenants; leave unset in community mode. |
213
+ | `userEmail` | No | — | Per-user identity forwarded on explain/override calls. Shared agents should set this from session context. |
117
214
  | `highRiskTools` | No | `[]` | Tools that require human approval even when policy allows |
118
215
  | `governedTools` | No | `[]` (all) | Tools to govern. Empty = all tools. |
119
- | `excludedTools` | No | `[]` | Tools to exclude from governance |
120
- | `defaultOperation` | No | `"execute"` | Operation type for mcp_check_input (`"execute"` or `"query"`) |
121
- | `onError` | No | `"block"` | Behavior when AxonFlow is unreachable: `"block"` (fail-closed) or `"allow"` (fail-open) |
122
- | `requestTimeoutMs` | No | `8000` | Timeout for policy checks, output scans, audit writes, and health checks. Increase for remote AxonFlow deployments. |
216
+ | `excludedTools` | No | `[]` | Tools to exclude from governance. Takes precedence over `governedTools`. |
217
+ | `defaultOperation` | No | `"execute"` | Operation type for `check_input` (`"execute"` or `"query"`) |
218
+ | `onError` | No | `"block"` | Governs behavior on **auth/config errors only** (401/403). `"block"` denies the tool call with a message telling the operator to fix configuration; `"allow"` lets the call through ungoverned. Does not apply to network/transient errors — see Fail behavior below. |
219
+ | `requestTimeoutMs` | No | `8000` | Timeout for policy checks, output scans, audit writes, and health checks |
220
+
221
+ ### Fail behavior
222
+
223
+ The plugin classifies errors from the AxonFlow client into two buckets and applies different rules per hook.
224
+
225
+ | Hook | Transient network error (timeout, DNS, connection refused, 5xx) | Auth/config error (401 / 403) |
226
+ |---|---|---|
227
+ | `before_tool_call` | **Always fail-open** — tool call proceeds regardless of `onError`. Transient infrastructure issues should not block legitimate dev workflows. | Respects `onError`. With the default `"block"`, the tool call is denied with a message pointing at the misconfiguration. With `"allow"`, the call proceeds ungoverned. |
228
+ | `message_sending` | Respects `onError`. With `"block"` (default), the outbound message is cancelled. With `"allow"`, it is delivered ungoverned. | Same as network error — respects `onError`. |
229
+ | `after_tool_call`, `llm_input`, `llm_output` (audit) | Always silently caught. Governance was already enforced on the pre-execution hook. | Always silently caught. |
230
+
231
+ If you need tool-execution itself to fail-closed during an AxonFlow outage (for example on a production infrastructure agent), pair the plugin with an OpenClaw-side health check or a front-door liveness gate — the plugin alone will not achieve that for `before_tool_call`.
232
+
233
+ ---
123
234
 
124
- **Valid configurations:**
125
- - Both omitted → community mode (`clientId` defaults to `"community"`)
126
- - `clientId` only → community mode with custom tenant identity
127
- - Both set → licensed mode (evaluation/enterprise)
128
- - `clientSecret` only → **error** (licensed mode requires explicit tenant identity to prevent data going to the wrong tenant)
235
+ ## Use-case recipes
129
236
 
130
- ## How It Works
237
+ ### DevOps / coding agent — heavy exec usage
131
238
 
239
+ ```yaml
240
+ plugins:
241
+ @axonflow/openclaw:
242
+ endpoint: http://localhost:8080
243
+ highRiskTools: [exec, process]
244
+ excludedTools: [get_current_time, list_models]
245
+ onError: block
132
246
  ```
133
- User sends message → OpenClaw receives
134
-
135
-
136
- ┌─────────────────────────────────────────────┐
137
- │ llm_input (audit) │
138
- │ → Record prompt, model, provider │
139
- └─────────────────────────────────────────────┘
140
-
141
-
142
- LLM generates response (may include tool calls)
143
-
144
-
145
- ┌─────────────────────────────────────────────┐
146
- │ llm_output (audit) │
147
- │ → Record response, tokens, latency │
148
- └─────────────────────────────────────────────┘
149
-
150
- ▼ (if tool calls in response)
151
- ┌─────────────────────────────────────────────┐
152
- │ before_tool_call (governance) │
153
- │ → mcp_check_input(openclaw.{tool}, args) │
154
- │ → BLOCK / REQUIRE APPROVAL / ALLOW │
155
- └─────────────────────────────────────────────┘
156
-
157
-
158
- Tool executes (web_fetch, message, MCP, etc.)
159
-
160
-
161
- Tool result persisted to session transcript
162
- (not scanned — pending async hook support)
163
-
164
-
165
- ┌─────────────────────────────────────────────┐
166
- │ after_tool_call (audit) │
167
- │ → audit_tool_call(tool, params, result) │
168
- └─────────────────────────────────────────────┘
169
-
170
-
171
- ┌─────────────────────────────────────────────┐
172
- │ message_sending (governance) │
173
- │ → mcp_check_output(openclaw.message_sending) │
174
- │ → CANCEL / REDACT / ALLOW │
175
- └─────────────────────────────────────────────┘
176
-
177
-
178
- Message delivered to user channel
247
+
248
+ ### Customer support agent — Slack/Discord/Telegram
249
+
250
+ ```yaml
251
+ plugins:
252
+ @axonflow/openclaw:
253
+ endpoint: http://localhost:8080
254
+ highRiskTools: [message, execute_sql, send_email]
255
+ onError: block
179
256
  ```
180
257
 
181
- ## Telemetry
258
+ ### Self-healing infrastructure agent — highest risk
259
+
260
+ ```yaml
261
+ plugins:
262
+ @axonflow/openclaw:
263
+ endpoint: http://localhost:8080
264
+ highRiskTools: [exec, process, web_fetch]
265
+ onError: block # auth-error path and message_sending fail-closed; see Fail behavior above
266
+ ```
182
267
 
183
- This plugin sends an anonymous telemetry ping on initialization to help us understand usage patterns, including local and self-hosted evaluations. The ping includes: plugin version, platform info (OS, architecture, Node.js version), AxonFlow platform version, and hook configuration (count, onError mode). No PII, no tool arguments, no policy data.
268
+ More examples content/social agents, data analysts, RAG pipelines in the [integration guide](https://docs.getaxonflow.com/docs/integration/openclaw/#use-case-configuration-examples).
184
269
 
185
- Opt out:
186
- - `DO_NOT_TRACK=1` (standard)
187
- - `AXONFLOW_TELEMETRY=off`
270
+ ---
188
271
 
189
- The startup ping is enabled by default for local, self-hosted, and remote deployments. Opt-out controls always win.
272
+ ## MCP tools available to your agent
190
273
 
191
- ## Starter Policies
274
+ Beyond the lifecycle hooks, OpenClaw agents can call **10 MCP tools** via the agent's MCP server at `/api/v1/mcp-server`. These are served by the platform (not the plugin), so new tools become available to every plugin without a code change.
192
275
 
193
- See [policies/README.md](./policies/README.md) for recommended policy setup for OpenClaw deployments, including protections against reverse shells, credential exfiltration, SSRF, path traversal, and agent config file poisoning.
276
+ **Governance (6):** `check_policy`, `check_output`, `audit_tool_call`, `list_policies`, `get_policy_stats`, `search_audit_events`
277
+
278
+ **Explainability & overrides (4):** `explain_decision`, `create_override`, `delete_override`, `list_overrides`
279
+
280
+ When a tool call is blocked, the agent can surface the `decision_id` to the operator, call `explain_decision` to reveal the triggering policy family, and — if the decision is overridable — call `create_override` with mandatory justification for a short-lived, audit-logged exception. Operators never leave the OpenClaw session.
281
+
282
+ See [Decision Explainability](https://docs.getaxonflow.com/docs/governance/explainability/) and [Session Overrides](https://docs.getaxonflow.com/docs/governance/overrides/).
283
+
284
+ ---
285
+
286
+ ## What's covered today, and what's not
287
+
288
+ **Protected today:**
289
+ - Tool inputs before execution
290
+ - Outbound messages before delivery
291
+ - Tool and LLM audit trails (including search & explainability)
292
+ - Decision-level overrides with per-user attribution
293
+
294
+ **Not protected yet:**
295
+ - Tool results written into the session transcript (OpenClaw's `tool_result_persist` hook is synchronous and cannot call AxonFlow's HTTP APIs)
296
+
297
+ PII in tool results is still caught by `message_sending` before it reaches the end user, but it is visible to the LLM. When OpenClaw adds async support for `tool_result_persist`, this plugin will add transcript scanning immediately. Upstream issue: [openclaw/openclaw#58558](https://github.com/openclaw/openclaw/issues/58558).
298
+
299
+ ---
300
+
301
+ ## Latency
302
+
303
+ | Operation | Typical overhead |
304
+ |-----------|-----------------|
305
+ | Policy pre-check | 2–5 ms |
306
+ | PII / secrets detection | 1–3 ms |
307
+ | SQL-injection scan | 1–2 ms |
308
+ | Audit write (async) | 0 ms (non-blocking) |
309
+ | **Total per-tool overhead** | **3–10 ms** |
310
+
311
+ Imperceptible for interactive agents.
312
+
313
+ ---
314
+
315
+ ## Starter policies
316
+
317
+ The [policies directory](./policies) ships research-backed starter policies addressing the top 10 OpenClaw security risks — reverse shells, SSRF, credential exfiltration, path traversal, agent config poisoning, prompt injection, and more. Ready-to-use SQL INSERT statements and setup instructions included.
318
+
319
+ ---
320
+
321
+ ## Telemetry
322
+
323
+ The plugin sends a one-time anonymous ping on initialization so AxonFlow can understand adoption and environment shape. Includes plugin version, OS/arch, Node.js version, AxonFlow platform version, hook configuration summary. **Never** includes message contents, tool arguments, or policy data.
324
+
325
+ Opt out: set `AXONFLOW_TELEMETRY=off` in the environment OpenClaw runs in.
326
+
327
+ `DO_NOT_TRACK` is **not** honored as an opt-out for AxonFlow telemetry. It is commonly inherited from host tools and developer environments, which makes it an unreliable expression of user intent.
328
+
329
+ ---
194
330
 
195
331
  ## Testing
196
332
 
@@ -204,25 +340,27 @@ Smoke E2E (requires a live AxonFlow stack at `localhost:8080`):
204
340
 
205
341
  ```bash
206
342
  npm ci && npm run build
207
- # Start a stack via axonflow-enterprise (see its setup-e2e-testing.sh)
343
+ # Start a local AxonFlow stack first `docker compose up -d` in
344
+ # the axonflow repo, or point AXONFLOW_ENDPOINT at an existing one.
208
345
  node tests/e2e/smoke-block-context.mjs
209
346
  ```
210
347
 
211
- The smoke scenario uses `AxonFlowClient.mcpCheckInput` to fire a
212
- SQLi-bearing statement against a running platform and asserts the
213
- response carries Plugin Batch 1 richer-context fields (`decision_id`,
214
- `risk_level`, `policy_matches`). Exits 0 with a `SKIP:` message if no
215
- stack is reachable. In CI, run manually via `workflow_dispatch` with a
216
- reachable endpoint (GitHub-hosted runners have no local stack).
348
+ The smoke scenario uses `AxonFlowClient.mcpCheckInput` to fire a SQLi-bearing statement against a running platform and asserts the response carries richer-context fields (`decision_id`, `risk_level`, `policy_matches`). Exits 0 with a `SKIP:` message if no stack is reachable.
349
+
350
+ For the broader validation story — explain-decision, override lifecycle, audit-filter parity, cache invalidation — see the [OpenClaw integration guide](https://docs.getaxonflow.com/docs/integration/openclaw/).
217
351
 
218
- Full install-and-use matrix (explain, override lifecycle, audit filter
219
- parity, cache invalidation) lives in `axonflow-enterprise/tests/e2e/plugin-batch-1/openclaw-install/`.
352
+ ---
220
353
 
221
354
  ## Links
222
355
 
356
+ - **[OpenClaw Integration Guide](https://docs.getaxonflow.com/docs/integration/openclaw/)** — the full walkthrough (recommended starting point)
223
357
  - [AxonFlow Documentation](https://docs.getaxonflow.com)
224
- - [OpenClaw Integration Guide](https://docs.getaxonflow.com/docs/integration/openclaw/)
225
358
  - [Policy Enforcement](https://docs.getaxonflow.com/docs/mcp/policy-enforcement/)
359
+ - [Decision Explainability](https://docs.getaxonflow.com/docs/governance/explainability/)
360
+ - [Session Overrides](https://docs.getaxonflow.com/docs/governance/overrides/)
361
+ - [PII Detection](https://docs.getaxonflow.com/docs/security/pii-detection/)
362
+ - [Audit Logging](https://docs.getaxonflow.com/docs/governance/audit-logging/)
363
+ - Sister plugins: [Claude Code](https://github.com/getaxonflow/axonflow-claude-plugin) · [Cursor](https://github.com/getaxonflow/axonflow-cursor-plugin) · [Codex](https://github.com/getaxonflow/axonflow-codex-plugin)
226
364
 
227
365
  ## License
228
366
 
package/dist/audit.d.ts CHANGED
@@ -4,14 +4,14 @@
4
4
  * Records every tool execution to AxonFlow's audit trail.
5
5
  * Fire-and-forget: audit failures do not block tool execution.
6
6
  */
7
- import type { AxonFlowClient } from "./axonflow-client.js";
7
+ import type { ClientRef } from "./client-ref.js";
8
8
  import type { AxonFlowPluginConfig } from "./config.js";
9
9
  /**
10
10
  * Create the after_tool_call hook handler.
11
11
  *
12
12
  * Logs tool execution details to AxonFlow for compliance audit.
13
13
  */
14
- export declare function createAfterToolCallHandler(client: AxonFlowClient, config: AxonFlowPluginConfig): (event: {
14
+ export declare function createAfterToolCallHandler(clientRef: ClientRef, config: AxonFlowPluginConfig): (event: {
15
15
  toolName: string;
16
16
  params: Record<string, unknown>;
17
17
  runId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,oBAAoB,IAEd,OAAO;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,OAAO,CAAC,IAAI,CAAC,CAkBlB"}
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,oBAAoB,IAEd,OAAO;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,OAAO,CAAC,IAAI,CAAC,CAkBlB"}
package/dist/audit.js CHANGED
@@ -11,13 +11,13 @@ import { recordAuditEventSent } from "./metrics.js";
11
11
  *
12
12
  * Logs tool execution details to AxonFlow for compliance audit.
13
13
  */
14
- export function createAfterToolCallHandler(client, config) {
14
+ export function createAfterToolCallHandler(clientRef, config) {
15
15
  return async (event) => {
16
16
  if (!shouldGovernTool(event.toolName, config)) {
17
17
  return;
18
18
  }
19
19
  try {
20
- await client.auditToolCall(event.toolName, event.params, event.result, event.error, event.durationMs);
20
+ await clientRef.current.auditToolCall(event.toolName, event.params, event.result, event.error, event.durationMs);
21
21
  recordAuditEventSent();
22
22
  }
23
23
  catch {
package/dist/audit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAsB,EACtB,MAA4B;IAE5B,OAAO,KAAK,EAAE,KAQb,EAAiB,EAAE;QAClB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,aAAa,CACxB,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,UAAU,CACjB,CAAC;YACF,oBAAoB,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,wEAAwE;QAC1E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAoB,EACpB,MAA4B;IAE5B,OAAO,KAAK,EAAE,KAQb,EAAiB,EAAE;QAClB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,OAAO,CAAC,aAAa,CACnC,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,UAAU,CACjB,CAAC;YACF,oBAAoB,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,wEAAwE;QAC1E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}