@cernion/openclaw-energy-tools-sidecar 0.1.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.
@@ -0,0 +1,40 @@
1
+ CERNION_BASE_URL=https://cernion.example
2
+
3
+ # Simplest setup: one Cernion token used for evidence lookup and process-intake demos.
4
+ # For production-like testing, prefer separate CERNION_READONLY_TOKEN and CERNION_PROCESS_TOKEN.
5
+ CERNION_TOKEN=ck_your_cernion_token_here
6
+
7
+ # Optional: separate tokens.
8
+ # CERNION_READONLY_TOKEN=ck_readonly_token_here
9
+ # CERNION_PROCESS_TOKEN=ck_full_or_process_token_here
10
+
11
+ # Recommended: choose the OpenClaw model used by the demo agent.
12
+ # If omitted, the container auto-selects a default for GOOGLE_API_KEY,
13
+ # GEMINI_API_KEY, ANTHROPIC_API_KEY, or OPENAI_API_KEY.
14
+ OPENCLAW_MODEL=google/gemini-3.1-pro-preview
15
+
16
+ # Recommended for the Meckesheim example. Lower thinking levels and smaller
17
+ # flash models are useful for smoke tests but may produce shallow answers.
18
+ OPENCLAW_THINKING=adaptive
19
+
20
+ # Optional: the Docker demo defaults to the Cernion workspace profile in
21
+ # docker/profiles/cernion-demo. Set another workspace or disable copying if you
22
+ # want to mount your own OpenClaw instructions.
23
+ OPENCLAW_PROFILE=cernion-demo
24
+ OPENCLAW_WORKSPACE=/home/node/cernion-demo-workspace
25
+ OPENCLAW_COPY_PROFILE_FILES=true
26
+
27
+ # Optional: pass model provider credentials through to OpenClaw.
28
+ # The compose file forwards this .env file into the container, so provider env
29
+ # vars supported by your OpenClaw setup can be placed here.
30
+ # OPENAI_API_KEY=sk-your-openai-key
31
+ # ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
32
+ # GOOGLE_API_KEY=your-google-ai-key
33
+ # GEMINI_API_KEY=your-gemini-key
34
+
35
+ # Optional: host port for the browser Control UI.
36
+ OPENCLAW_CONTROLUI_PORT=19101
37
+
38
+ # Optional: local Gateway token used by the browser Control UI.
39
+ # Change this if you expose the demo beyond your own machine.
40
+ OPENCLAW_GATEWAY_TOKEN=cernion-local-demo
@@ -0,0 +1,36 @@
1
+ FROM node:24-bookworm-slim
2
+
3
+ ARG OPENCLAW_VERSION=2026.6.10
4
+
5
+ ENV NODE_ENV=production \
6
+ OPENCLAW_PROFILE=cernion-demo \
7
+ OPENCLAW_GATEWAY_PORT=19101 \
8
+ CERNION_BASE_URL=http://10.0.0.8:3900 \
9
+ CERNION_SIDECAR_TIMEOUT_MS=15000
10
+
11
+ RUN apt-get update \
12
+ && apt-get install -y --no-install-recommends ca-certificates git jq tini \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ RUN npm install -g "openclaw@${OPENCLAW_VERSION}"
16
+
17
+ WORKDIR /opt/cernion-openclaw-sidecar
18
+
19
+ COPY --chown=node:node package*.json ./
20
+ RUN npm ci --include=dev
21
+
22
+ COPY --chown=node:node . .
23
+ RUN npm run build \
24
+ && npm test \
25
+ && npm run plugin:validate
26
+
27
+ COPY docker/entrypoint.sh /usr/local/bin/cernion-openclaw-sidecar
28
+ RUN chmod +x /usr/local/bin/cernion-openclaw-sidecar
29
+
30
+ USER node
31
+ ENV HOME=/home/node
32
+
33
+ EXPOSE 19101
34
+
35
+ ENTRYPOINT ["tini", "--", "/usr/local/bin/cernion-openclaw-sidecar"]
36
+ CMD ["gateway"]
@@ -0,0 +1,302 @@
1
+ # OpenClaw + Cernion Sidecar Docker Demo
2
+
3
+ This directory contains a self-contained OpenClaw container with the Cernion
4
+ Energy Tools Sidecar plugin preinstalled. It is meant for interested users who
5
+ have access to a Cernion Energy Tools instance and want to try the
6
+ OpenClaw/Cernion interaction from a browser.
7
+
8
+ The container starts an OpenClaw Gateway and Control UI. Cernion connection
9
+ settings are supplied through environment variables.
10
+
11
+ ## What Runs
12
+
13
+ - OpenClaw Gateway and browser Control UI
14
+ - this repository's `cernion-energy-tools-sidecar` plugin
15
+ - an isolated OpenClaw profile, default `cernion-demo`
16
+ - a Cernion demo workspace profile copied from
17
+ `docker/profiles/cernion-demo`
18
+ - an isolated container home mounted in the Docker volume
19
+ `openclaw-cernion-home`
20
+
21
+ The container does not mount your personal OpenClaw workspace, memory,
22
+ transcripts, or host secrets.
23
+
24
+ ## Requirements
25
+
26
+ - Docker with Docker Compose
27
+ - a reachable Cernion Energy Tools base URL, for example
28
+ `https://cernion.example`
29
+ - a Cernion bearer token
30
+ - model credentials for any OpenClaw-supported provider, or model
31
+ configuration added later in the Control UI
32
+
33
+ For a quick demo, set one token:
34
+
35
+ - `CERNION_TOKEN`: used for read-only evidence lookup and process-intake demos
36
+
37
+ For a stricter setup, set two tokens:
38
+
39
+ - `CERNION_READONLY_TOKEN`: read-only/evidence token
40
+ - `CERNION_PROCESS_TOKEN`: process-intake token
41
+
42
+ If your Cernion instance currently requires full-access for
43
+ `POST /api/evidence-router/route`, use a full token as `CERNION_TOKEN` for the
44
+ demo. Cernion still owns the server-side policy checks.
45
+
46
+ ## Configure
47
+
48
+ From the repository root:
49
+
50
+ ```bash
51
+ cp docker/.env.example docker/.env
52
+ ```
53
+
54
+ Edit `docker/.env`:
55
+
56
+ ```dotenv
57
+ CERNION_BASE_URL=https://cernion.example
58
+ CERNION_TOKEN=ck_your_cernion_token_here
59
+ OPENCLAW_MODEL=google/gemini-3.1-pro-preview
60
+ OPENCLAW_THINKING=adaptive
61
+ OPENCLAW_PROFILE=cernion-demo
62
+ OPENCLAW_WORKSPACE=/home/node/cernion-demo-workspace
63
+ OPENCLAW_CONTROLUI_PORT=19101
64
+ OPENCLAW_GATEWAY_TOKEN=cernion-local-demo
65
+ ```
66
+
67
+ Add model provider credentials for your OpenClaw setup as needed. The Compose
68
+ file forwards `docker/.env` into the container, so provider variables such as
69
+ `GOOGLE_API_KEY`, `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or
70
+ other OpenClaw-supported provider settings can live in the same file.
71
+
72
+ `OPENCLAW_MODEL` selects the model for the demo agent. If it is omitted, the
73
+ container auto-selects a matching default for common provider keys:
74
+
75
+ - `GOOGLE_API_KEY` or `GEMINI_API_KEY` -> `google/gemini-3.1-pro-preview`
76
+ - `ANTHROPIC_API_KEY` -> `anthropic/claude-sonnet-4-6`
77
+ - `OPENAI_API_KEY` -> `openai/gpt-5.5`
78
+
79
+ `OPENCLAW_THINKING` controls the demo agent's thinking level. For the
80
+ Meckesheim example, keep `adaptive` or use a stronger level if your selected
81
+ model supports it. Smaller flash models and low/adaptive reasoning can be fine
82
+ for connection smoke tests, but they may answer from generic web-like priors
83
+ instead of doing enough tool-backed aggregation.
84
+
85
+ The Sidecar itself does not depend on a specific model provider.
86
+
87
+ ## Demo Workspace Profile
88
+
89
+ The Docker demo ships a Cernion-specific workspace profile under
90
+ `docker/profiles/cernion-demo`:
91
+
92
+ - `AGENTS.md`: general demo role, evidence discipline, and answer structure
93
+ - `SOUL.md`: Cernion-focused assistant identity
94
+ - `TOOLS.md`: recommended Cernion tool order for domain knowledge, evidence,
95
+ operational status, and process-intake use cases
96
+
97
+ At container start, these files are copied into `OPENCLAW_WORKSPACE`, which
98
+ defaults to `/home/node/cernion-demo-workspace`, and the OpenClaw profile is
99
+ configured with `agents.defaults.workspace` pointing there. This makes the demo
100
+ agent Cernion-aware without baking that persona into the Sidecar plugin.
101
+
102
+ To use your own workspace instructions, set `OPENCLAW_WORKSPACE` to another
103
+ container path and either mount your files there or set
104
+ `OPENCLAW_COPY_PROFILE_FILES=false`.
105
+
106
+ ## Start
107
+
108
+ ```bash
109
+ docker compose --env-file docker/.env -f docker/compose.yml up --build
110
+ ```
111
+
112
+ Open the Control UI in your browser:
113
+
114
+ ```text
115
+ http://localhost:19101
116
+ ```
117
+
118
+ If you changed `OPENCLAW_CONTROLUI_PORT`, use that port instead.
119
+ When prompted for Gateway authentication, use the value of
120
+ `OPENCLAW_GATEWAY_TOKEN` from `docker/.env`.
121
+
122
+ The Compose file binds the Control UI to `127.0.0.1` on the host. Keep it that
123
+ way for local demos. If you intentionally expose it beyond your own machine,
124
+ set a strong `OPENCLAW_GATEWAY_TOKEN` first.
125
+
126
+ ## First Question
127
+
128
+ Use this question as the first demo prompt in the Control UI:
129
+
130
+ ```text
131
+ Mich würde interessieren, ob die Gemeinde Meckesheim bereits so viel Erzeugungskapazitäten hat, dass sie unter idealen Bedingungen sich selbst versorgen könnte. Wenn nicht, wie viel Erzeugung Solar müsste zugebaut werden?
132
+ ```
133
+
134
+ Expected behaviour:
135
+
136
+ 1. OpenClaw asks Cernion for relevant evidence endpoints and/or calls Cernion
137
+ evidence APIs through the sidecar plugin.
138
+ 2. Cernion returns structured evidence such as MaStR installation counts,
139
+ installed capacity by technology, and residual-load forecast values.
140
+ 3. OpenClaw performs the user-facing reasoning: it separates storage from
141
+ generation, checks the load model, explains assumptions, and synthesizes the
142
+ final answer.
143
+
144
+ The important architecture boundary is:
145
+
146
+ ```text
147
+ Cernion supplies evidence and policy.
148
+ OpenClaw turns that evidence into the final user answer.
149
+ ```
150
+
151
+ Model choice matters for this example. With a fast flash model, the agent may
152
+ produce a plausible but shallow answer from partial public facts, for example by
153
+ using old annual consumption estimates and a few named PV examples instead of
154
+ aggregating the full local installation register. A stronger model with
155
+ `OPENCLAW_THINKING=adaptive`, such as `google/gemini-3.1-pro-preview`, is a
156
+ better first-run setting because it is more likely to:
157
+
158
+ - ask the Cernion Sidecar for complete local evidence,
159
+ - distinguish installed generation from storage,
160
+ - compare momentary, daily, and annual self-supply separately,
161
+ - explain remaining uncertainty instead of treating partial evidence as final.
162
+
163
+ ## Regulatory Fachwissen Example
164
+
165
+ For regulatory or procedural questions, the Sidecar exposes a dedicated
166
+ Knowledge RAG tool. Use a prompt like:
167
+
168
+ ```text
169
+ Welche Pflichten ergeben sich aus §14a EnWG für einen Verteilnetzbetreiber, und was müsste ich in Cernion als nächstes prüfen?
170
+ ```
171
+
172
+ Expected behaviour:
173
+
174
+ 1. OpenClaw first uses `cernion_query_domain_knowledge` to retrieve Cernion
175
+ Fachwissen such as regulatory text, BNetzA guidance, procedures, roles, and
176
+ obligations.
177
+ 2. The returned `evidenceAssessment` controls answer discipline for
178
+ primary-source support. It is not a judgment on the value of Cernion
179
+ Fachwissen. If `evidenceAdequacy=low`, OpenClaw should say that Cernion
180
+ returned useful domain/strategy knowledge, but not enough primary-source
181
+ support for hard legal/procedural obligations. A strategy or synonym card is
182
+ orientation, not a source for hard obligations.
183
+ 3. Only after that should it use operational Cernion evidence when the concrete
184
+ job context requires it, for example grid-operator readiness, metering,
185
+ master-data quality, or missing BDEW/grid-operator identifiers.
186
+ 4. The final answer should separate general obligations from the current
187
+ operational Cernion status and name the next useful job step.
188
+
189
+ This avoids two weak demo behaviours: generic web-search answers despite
190
+ Cernion-owned knowledge, and immediate process/backend hydration when the user
191
+ first needs regulatory or procedural consulting.
192
+
193
+ ## ZNP And OSM Grid Context Example
194
+
195
+ For Zielnetzplanung, Netzanschluss, PV/BESS/HPC siting, fNAV, or
196
+ voltage-level questions, the demo profile should combine Cernion Fachwissen
197
+ with OSM-visible grid infrastructure context. Use a prompt like:
198
+
199
+ ```text
200
+ Ich möchte für die Stadt Sinsheim (PLZ 74889) eine erste Zielnetzplanungs-Einschätzung bis 2030. Angenommen werden 20 MWp PV, 10 MW / 20 MWh Speicher, ein Ladepark mit 30 HPC-Ladepunkten, 800 Wärmepumpen und 1.500 Wallboxen. Welche Spannungsebenen und Netzbereiche könnten kritisch werden, und welche Cernion-Evidenz fehlt?
201
+ ```
202
+
203
+ Expected behaviour:
204
+
205
+ 1. OpenClaw uses `cernion_query_domain_knowledge` for ZNP, §14d, fNAV, NOVA,
206
+ and process/strategy evidence.
207
+ 2. OpenClaw uses `cernion_query_grid_context` for Cernion OSM Geo evidence.
208
+ For a county-wide search it should start with substations and voltage-level
209
+ hints only; topology should be enabled only for candidate-place drill-down.
210
+ 3. OpenClaw then uses `cernion_route_evidence` and
211
+ `cernion_execute_evidence_endpoint` for MaStR, residual load, forecasts,
212
+ market partners, or operational status when relevant.
213
+ 4. The final answer treats OSM as concrete hypothesis evidence. It may make
214
+ statements about likely HS/MS/MS/NS concerns more specific, but must not
215
+ claim available capacity, switching state, protection settings, complete
216
+ ownership, or a final Netzverträglichkeitsprüfung without separate evidence.
217
+
218
+ For data-center or other large-load siting questions, the answer should use a
219
+ stricter evidence hierarchy. Explicit grid-connection availability maps,
220
+ published connection capacity, or operator-confirmed Anschlusskapazität outrank
221
+ generic grid-expansion projects and OSM proximity. A substation upgrade is a
222
+ reason to investigate a location, not proof that large-load connection capacity
223
+ is available.
224
+
225
+ ## Smoke Test
226
+
227
+ To verify the container and sidecar connection without using the browser:
228
+
229
+ ```bash
230
+ docker compose --env-file docker/.env -f docker/compose.yml run --rm openclaw-cernion test
231
+ ```
232
+
233
+ The smoke test checks:
234
+
235
+ - OpenClaw plugin installation and runtime loading
236
+ - Cernion Sidecar descriptor retrieval
237
+ - Cernion tool-list retrieval
238
+ - a read-only capability-list call
239
+ - capability and operation resolution through `/api/_agent`
240
+ - an asset-list read-only REST plan with explicit `limit`, including Sidecar
241
+ pagination/export metadata when the returned rows exhaust the limit
242
+ - that token-shaped values are not echoed in returned payloads
243
+
244
+ ## Useful Commands
245
+
246
+ Start in the background:
247
+
248
+ ```bash
249
+ docker compose --env-file docker/.env -f docker/compose.yml up -d --build
250
+ ```
251
+
252
+ Show logs:
253
+
254
+ ```bash
255
+ docker compose --env-file docker/.env -f docker/compose.yml logs -f openclaw-cernion
256
+ ```
257
+
258
+ Stop:
259
+
260
+ ```bash
261
+ docker compose --env-file docker/.env -f docker/compose.yml down
262
+ ```
263
+
264
+ Reset the demo state:
265
+
266
+ ```bash
267
+ docker compose --env-file docker/.env -f docker/compose.yml down -v
268
+ ```
269
+
270
+ Open a shell inside the configured container:
271
+
272
+ ```bash
273
+ docker compose --env-file docker/.env -f docker/compose.yml run --rm openclaw-cernion shell
274
+ ```
275
+
276
+ ## Environment Reference
277
+
278
+ | Variable | Required | Purpose |
279
+ | --- | --- | --- |
280
+ | `CERNION_BASE_URL` | yes | Base URL of the Cernion Energy Tools instance. |
281
+ | `CERNION_TOKEN` | quick demo | Single token used as read-only and process token. |
282
+ | `CERNION_READONLY_TOKEN` | strict setup | Token used for read-only evidence calls. |
283
+ | `CERNION_PROCESS_TOKEN` | optional | Token used only for `cernion_prepare_process_intent`. |
284
+ | `CERNION_SIDECAR_TIMEOUT_MS` | no | HTTP timeout for Cernion calls, default `15000`. |
285
+ | `CERNION_SMOKE_ASSET_PATH` | no | Asset endpoint used by the smoke test, default `/api/assets/solar`. |
286
+ | `CERNION_SMOKE_ASSET_LOCATION` | no | Asset location used by the smoke test, default `74909`. |
287
+ | `CERNION_SMOKE_ASSET_LIMIT` | no | Asset limit used by the smoke test, default `3`. |
288
+ | `OPENCLAW_MODEL` | recommended | Demo-agent model id, for example `google/gemini-3.1-pro-preview`. |
289
+ | `OPENCLAW_THINKING` | recommended | Demo-agent thinking level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `adaptive`, or `max`; recommended `adaptive`. |
290
+ | `OPENCLAW_CONTROLUI_PORT` | no | Host port for Control UI, default `19101`. |
291
+ | `OPENCLAW_GATEWAY_TOKEN` | no | Local Gateway token for Control UI login, default `cernion-local-demo`. |
292
+ | provider env vars | recommended | Any model-provider environment variables supported by OpenClaw, for example `GOOGLE_API_KEY`, `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`, or `OPENAI_API_KEY`. |
293
+
294
+ ## Notes
295
+
296
+ - The demo intentionally accepts environment variables so users do not need to
297
+ create token files.
298
+ - The plugin still keeps evidence and process boundaries separate internally.
299
+ - Process Intake creates `pending_confirmation` receipts only; it does not
300
+ execute processes or resolve HITL approvals.
301
+ - The Control UI is protected with the local Gateway token and bound to
302
+ `127.0.0.1` on the host.
@@ -0,0 +1,49 @@
1
+ services:
2
+ openclaw-cernion:
3
+ build:
4
+ context: ..
5
+ dockerfile: docker/Dockerfile
6
+ image: cernion-openclaw-sidecar-openclaw:local
7
+ env_file:
8
+ - path: .env
9
+ required: false
10
+ environment:
11
+ OPENCLAW_PROFILE: ${OPENCLAW_PROFILE:-cernion-demo}
12
+ OPENCLAW_GATEWAY_PORT: "19101"
13
+ OPENCLAW_CONTROLUI_PORT: ${OPENCLAW_CONTROLUI_PORT:-19101}
14
+ OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN:-cernion-local-demo}
15
+ CERNION_BASE_URL: ${CERNION_BASE_URL:?Set CERNION_BASE_URL to your Cernion Energy Tools base URL}
16
+ CERNION_TOKEN: ${CERNION_TOKEN:-}
17
+ CERNION_READONLY_TOKEN: ${CERNION_READONLY_TOKEN:-}
18
+ CERNION_PROCESS_TOKEN: ${CERNION_PROCESS_TOKEN:-}
19
+ CERNION_SIDECAR_TIMEOUT_MS: ${CERNION_SIDECAR_TIMEOUT_MS:-15000}
20
+ ports:
21
+ - "127.0.0.1:${OPENCLAW_CONTROLUI_PORT:-19101}:19101"
22
+ volumes:
23
+ - openclaw-cernion-home:/home/node
24
+ command: ["gateway"]
25
+
26
+ sidecar-it:
27
+ build:
28
+ context: ..
29
+ dockerfile: docker/Dockerfile
30
+ image: cernion-openclaw-sidecar-openclaw:local
31
+ env_file:
32
+ - path: .env
33
+ required: false
34
+ environment:
35
+ OPENCLAW_PROFILE: ${OPENCLAW_PROFILE:-cernion-demo}
36
+ OPENCLAW_GATEWAY_PORT: "19101"
37
+ OPENCLAW_CONTROLUI_PORT: ${OPENCLAW_CONTROLUI_PORT:-19101}
38
+ OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN:-cernion-local-demo}
39
+ CERNION_BASE_URL: ${CERNION_BASE_URL:?Set CERNION_BASE_URL to your Cernion Energy Tools base URL}
40
+ CERNION_TOKEN: ${CERNION_TOKEN:-}
41
+ CERNION_READONLY_TOKEN: ${CERNION_READONLY_TOKEN:-}
42
+ CERNION_PROCESS_TOKEN: ${CERNION_PROCESS_TOKEN:-}
43
+ CERNION_SIDECAR_TIMEOUT_MS: ${CERNION_SIDECAR_TIMEOUT_MS:-15000}
44
+ volumes:
45
+ - openclaw-cernion-home:/home/node
46
+ command: ["test"]
47
+
48
+ volumes:
49
+ openclaw-cernion-home:
@@ -0,0 +1,29 @@
1
+ services:
2
+ openclaw-cernion:
3
+ build:
4
+ context: ..
5
+ dockerfile: docker/Dockerfile
6
+ image: cernion-openclaw-sidecar-openclaw:local
7
+ env_file:
8
+ - path: .env
9
+ required: false
10
+ environment:
11
+ OPENCLAW_PROFILE: ${OPENCLAW_PROFILE:-cernion-demo}
12
+ OPENCLAW_WORKSPACE: ${OPENCLAW_WORKSPACE:-/home/node/cernion-demo-workspace}
13
+ OPENCLAW_COPY_PROFILE_FILES: ${OPENCLAW_COPY_PROFILE_FILES:-true}
14
+ OPENCLAW_GATEWAY_PORT: "19101"
15
+ OPENCLAW_CONTROLUI_PORT: ${OPENCLAW_CONTROLUI_PORT:-19101}
16
+ OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN:-cernion-local-demo}
17
+ CERNION_BASE_URL: ${CERNION_BASE_URL:?Set CERNION_BASE_URL to your Cernion Energy Tools base URL}
18
+ CERNION_TOKEN: ${CERNION_TOKEN:-}
19
+ CERNION_READONLY_TOKEN: ${CERNION_READONLY_TOKEN:-}
20
+ CERNION_PROCESS_TOKEN: ${CERNION_PROCESS_TOKEN:-}
21
+ CERNION_SIDECAR_TIMEOUT_MS: ${CERNION_SIDECAR_TIMEOUT_MS:-15000}
22
+ ports:
23
+ - "127.0.0.1:${OPENCLAW_CONTROLUI_PORT:-19101}:19101"
24
+ volumes:
25
+ - openclaw-cernion-home:/home/node
26
+ command: ["gateway"]
27
+
28
+ volumes:
29
+ openclaw-cernion-home: