Repository navigation
feat: connect OpenClaw to GBrain with one plugin install - #200625
Conversation
- New external plugin `gbrain`: a Gateway service runs GBrain's own commands once (install with Bun, `gbrain init`, `gbrain mcp expose`), mints a bearer through GBrain's owner API, and writes one static streamable-HTTP `mcp.servers.gbrain` entry. - Only reports when GBrain's supervised service is down; never restarts it. - Docker overlay `deploy/gbrain/compose.yaml` runs GBrain next to the Gateway container. - Docs page and a host e2e driver. - Config budget +21: the generic per-plugin `plugins.entries.gbrain.*` keys every plugin gets; the plugin declares no options of its own.
…lobal bin - Docker: GBrain runs as the `gbrain` Compose service on the project network (a shared network namespace broke on every Gateway container restart); the plugin looks for it at 127.0.0.1, then `gbrain`. The sidecar image adds git so `gbrain upgrade` works. - GBrain commands keep the user's session env (XDG_RUNTIME_DIR, DBUS_SESSION_BUS_ADDRESS) so `gbrain mcp expose` installs its systemd user unit; Gateway identity and credential vars stay out. - Find the installed `gbrain` through `bun pm bin -g` (Bun honors XDG_CACHE_HOME and BUN_INSTALL_BIN). - Bun message names unzip on Linux. - Live Docker lane `test:docker:gbrain` and host e2e driver; ClawHub prepublish fixture serves the package detail page.
- `mcp probe` is offline-only and refuses a copied state from another PID namespace; stop the Gateway container, probe from a one-off CLI container on the project network, start it again.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Raw e2e step logsEvery step of the three clean-host runs (live model). One JSON line per step: macOS 15 VM: 36 steps{"step":"node","exit":0,"seconds":2,"last":""}
{"step":"install-openclaw","exit":0,"seconds":43,"last":"npm warn install-scripts Run `npm install -g --allow-scripts=@google/genai,esbuild,protobufjs,openclaw` to allow these scripts once, or `npm config set allow-scripts=@google/genai,esbuild,protobufjs,openclaw --location=user` to allow them for all global installs."}
{"step":"onboard","exit":0,"seconds":4,"last":"Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web"}
{"step":"model-secret","exit":0,"seconds":2,"last":"Updated secrets.providers.oaikey. No gateway restart needed."}
{"step":"model-provider","exit":0,"seconds":2,"last":"Updated models.providers.openai. Change will apply without restarting the gateway."}
{"step":"model-default","exit":0,"seconds":4,"last":"Updated agents.defaults.model. Change will apply without restarting the gateway."}
{"step":"gateway-start","exit":0,"seconds":7,"last":""}
{"step":"plugin-install","exit":0,"seconds":5,"last":"attempt=1"}
{"step":"bun-missing-message","exit":0,"seconds":0,"last":"2026-11-17T13:38:31.299+00:00 [plugins] GBrain needs Bun 1.4.4 or newer. Install it with: curl -fsSL https://bun.sh/install | bash (on Linux, Bun's installer also needs unzip). OpenClaw finishes the GBrain setup within a minute."}
{"step":"bun-install","exit":0,"seconds":3,"last":"Run 'bun --help' to get started"}
{"step":"connect","exit":0,"seconds":60,"last":""}
{"step":"inspect-runtime","exit":0,"seconds":2,"last":"{\"status\":\"loaded\",\"imported\":true,\"activated\":true}"}
{"step":"seed","exit":0,"seconds":1,"last":"}"}
{"step":"gateway-stop","exit":0,"seconds":1,"last":""}
{"step":"mcp-probe","exit":0,"seconds":2,"last":"- gbrain: 8 tools, resources, Codex approval auto"}
{"step":"gateway-restart","exit":0,"seconds":6,"last":""}
{"step":"recall","exit":0,"seconds":55,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"concurrent-holders","exit":0,"seconds":0,"last":"max_holders=1 parA=0 parB=0"}
{"step":"gbrain-doctor","exit":0,"seconds":1,"last":"Overall health score: 90/100. All checks OK (some warnings)."}
{"step":"fault-stop-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-reported","exit":0,"seconds":0,"last":"2026-11-17T13:42:56.820+00:00 [plugins] GBrain's service is not answering on http://127.0.0.1:3131. Check it with: gbrain mcp expose --status"}
{"step":"fault-start-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-recovered","exit":0,"seconds":42,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-kill-serve","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-supervisor-restart","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-recovered","exit":0,"seconds":43,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"fault-rotate-token","exit":0,"seconds":0,"last":"{\"id\":\"62ef933f-3ff1-48e3-88a7-0ee36cbc94fd\",\"revoked\":true}"}
{"step":"fault-rotate-reminted","exit":0,"seconds":0,"last":""}
{"step":"fault-rotate-recovered","exit":0,"seconds":88,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"upgrade-downgrade","exit":0,"seconds":10,"last":"gbrain 0.60.732.0"}
{"step":"upgrade-run","exit":0,"seconds":23,"last":"gbrain 0.60.734.0"}
{"step":"upgrade-recall","exit":0,"seconds":14,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"gbrain__recall\"]}"}
{"step":"uninstall","exit":0,"seconds":3,"last":"Uninstalled plugin \"gbrain\". Removed: plugin settings, install record, directory."}
{"step":"uninstall-no-record","exit":0,"seconds":0,"last":"{\"present\":false}"}
{"step":"uninstall-service-kept","exit":0,"seconds":0,"last":""}
{"step":"uninstall-brain-kept","exit":0,"seconds":0,"last":""}Ubuntu VM, systemd user service: 37 steps{"step":"node","exit":0,"seconds":2,"last":""}
{"step":"install-openclaw","exit":0,"seconds":43,"last":"npm warn install-scripts Run `npm install -g --allow-scripts=@google/genai,esbuild,protobufjs,openclaw` to allow these scripts once, or `npm config set allow-scripts=@google/genai,esbuild,protobufjs,openclaw --location=user` to allow them for all global installs."}
{"step":"onboard","exit":0,"seconds":3,"last":"Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web"}
{"step":"model-secret","exit":0,"seconds":3,"last":"Updated secrets.providers.oaikey. No gateway restart needed."}
{"step":"model-provider","exit":0,"seconds":2,"last":"Updated models.providers.openai. Change will apply without restarting the gateway."}
{"step":"model-default","exit":0,"seconds":3,"last":"Updated agents.defaults.model. Change will apply without restarting the gateway."}
{"step":"gateway-start","exit":0,"seconds":7,"last":""}
{"step":"plugin-install","exit":0,"seconds":4,"last":"attempt=1"}
{"step":"bun-missing-message","exit":0,"seconds":0,"last":"2026-11-17T13:48:59.226+00:00 [plugins] GBrain needs Bun 1.4.4 or newer. Install it with: curl -fsSL https://bun.sh/install | bash (on Linux, Bun's installer also needs unzip). OpenClaw finishes the GBrain setup within a minute."}
{"step":"unzip-install","exit":0,"seconds":7,"last":"No VM guests are running outdated hypervisor (qemu) binaries on this host."}
{"step":"bun-install","exit":0,"seconds":4,"last":"Run 'bun --help' to get started"}
{"step":"connect","exit":0,"seconds":54,"last":""}
{"step":"inspect-runtime","exit":0,"seconds":3,"last":"{\"status\":\"loaded\",\"imported\":true,\"activated\":true}"}
{"step":"seed","exit":0,"seconds":0,"last":"}"}
{"step":"gateway-stop","exit":0,"seconds":1,"last":""}
{"step":"mcp-probe","exit":0,"seconds":3,"last":"- gbrain: 8 tools, resources, Codex approval auto"}
{"step":"gateway-restart","exit":0,"seconds":6,"last":""}
{"step":"recall","exit":0,"seconds":64,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"concurrent-holders","exit":0,"seconds":1,"last":"max_holders=1 parA=0 parB=0"}
{"step":"gbrain-doctor","exit":0,"seconds":0,"last":"Overall health score: 90/100. All checks OK (some warnings)."}
{"step":"fault-stop-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-reported","exit":0,"seconds":0,"last":"2026-11-17T13:53:26.616+00:00 [plugins] GBrain's service is not answering on http://127.0.0.1:3131. Check it with: gbrain mcp expose --status"}
{"step":"fault-start-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-recovered","exit":0,"seconds":53,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-kill-serve","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-supervisor-restart","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-recovered","exit":0,"seconds":38,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"fault-rotate-token","exit":0,"seconds":0,"last":"{\"id\":\"79606808-d7d2-4e6a-ad91-3f2f115ed36a\",\"revoked\":true}"}
{"step":"fault-rotate-reminted","exit":0,"seconds":0,"last":""}
{"step":"fault-rotate-recovered","exit":0,"seconds":27,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"upgrade-downgrade","exit":0,"seconds":4,"last":"gbrain 0.60.732.0"}
{"step":"upgrade-run","exit":0,"seconds":11,"last":"gbrain 0.60.734.0"}
{"step":"upgrade-recall","exit":0,"seconds":44,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"uninstall","exit":0,"seconds":3,"last":"Uninstalled plugin \"gbrain\". Removed: plugin settings, install record, directory."}
{"step":"uninstall-no-record","exit":0,"seconds":0,"last":"{\"present\":false}"}
{"step":"uninstall-service-kept","exit":0,"seconds":0,"last":""}
{"step":"uninstall-brain-kept","exit":0,"seconds":0,"last":""}Docker, released `ghcr.io/openclaw/openclaw:latest` + `deploy/gbrain/compose.yaml`: 35 steps{"step":"pull","exit":0,"seconds":2,"last":"ghcr.io/openclaw/openclaw:latest"}
{"step":"onboard","exit":0,"seconds":4,"last":"Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web"}
{"step":"model","exit":0,"seconds":6,"last":"Updated agents.defaults.model. Change will apply without restarting the gateway."}
{"step":"compose-up","exit":0,"seconds":1,"last":" Container gbrain-e2e-89039-openclaw-gateway-1 Started "}
{"step":"gateway-ready","exit":0,"seconds":28,"last":""}
{"step":"gbrain-healthy","exit":0,"seconds":0,"last":""}
{"step":"plugin-install","exit":0,"seconds":3,"last":"attempt=1"}
{"step":"connect","exit":0,"seconds":0,"last":""}
{"step":"inspect-runtime","exit":0,"seconds":2,"last":"{\"status\":\"loaded\",\"imported\":true,\"activated\":true}"}
{"step":"mcp-probe","exit":0,"seconds":28,"last":"- gbrain: 8 tools, resources, Codex approval auto"}
{"step":"seed","exit":0,"seconds":1,"last":"}"}
{"step":"gateway-restart","exit":0,"seconds":0,"last":" Container gbrain-e2e-89039-openclaw-gateway-1 Started "}
{"step":"gateway-ready-2","exit":0,"seconds":25,"last":""}
{"step":"gbrain-after-gateway-restart","exit":0,"seconds":0,"last":""}
{"step":"recall","exit":0,"seconds":58,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"concurrent-holders","exit":1,"seconds":0,"last":"max_holders=1 parA=1 parB=0"}
{"step":"gbrain-doctor","exit":0,"seconds":1,"last":"Overall health score: 90/100. All checks OK (some warnings)."}
{"step":"fault-stop-gbrain","exit":0,"seconds":0,"last":" Container gbrain-e2e-89039-gbrain-1 Stopped "}
{"step":"fault-stop-reported","exit":0,"seconds":0,"last":"openclaw-gateway-1 | \u001b[90m2026-11-17T13:51:05.490+00:00\u001b[39m \u001b[35m[plugins]\u001b[39m \u001b[33mGBrain's service is not answering on http://127.0.0.1:3131. Check it with: gbrain mcp expose --status\u001b[39m"}
{"step":"fault-start-gbrain","exit":0,"seconds":0,"last":" Container gbrain-e2e-89039-gbrain-1 Started "}
{"step":"fault-stop-recovered","exit":0,"seconds":56,"last":"{\"codeword\":true,\"tools\":[\"skills_read\",\"exec\",\"gbrain__recall\"]}"}
{"step":"fault-kill-serve","exit":0,"seconds":0,"last":"killed 6 "}
{"step":"fault-kill-compose-restart","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-recovered","exit":0,"seconds":78,"last":"{\"codeword\":true,\"tools\":[\"skills_read\",\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-rotate-token","exit":0,"seconds":0,"last":"revoked 7c84f083-e694-4296-9d5c-5c9e8b742497 200"}
{"step":"fault-rotate-reminted","exit":0,"seconds":0,"last":""}
{"step":"fault-rotate-recovered","exit":0,"seconds":80,"last":"{\"codeword\":true,\"tools\":[\"skills_read\",\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"upgrade-downgrade","exit":0,"seconds":6,"last":"gbrain 0.60.732.0"}
{"step":"upgrade-run","exit":0,"seconds":13,"last":"gbrain 0.60.734.0"}
{"step":"upgrade-restart","exit":0,"seconds":1,"last":" Container gbrain-e2e-89039-gbrain-1 Started "}
{"step":"upgrade-recall","exit":0,"seconds":51,"last":"{\"codeword\":true,\"tools\":[\"skills_read\",\"exec\",\"gbrain__recall\"]}"}
{"step":"uninstall","exit":0,"seconds":3,"last":"Uninstalled plugin \"gbrain\". Removed: plugin settings, install record, directory."}
{"step":"uninstall-no-record","exit":0,"seconds":1,"last":"{\"present\":false}"}
{"step":"uninstall-gbrain-kept","exit":0,"seconds":0,"last":""}
{"step":"uninstall-brain-kept","exit":0,"seconds":0,"last":""} |
|
- A key refresh updated the whole `mcp.servers.gbrain` entry and dropped `enabled`, `toolFilter` and other headers; it now updates only the URL, transport and `Authorization`. - An entry on a GBrain host with another port is still the plugin's, so `gbrain mcp expose --port` moves are followed instead of reported as external.
- The runtime config expands `${GBRAIN_MCP_TOKEN}`, so a template-backed entry looked like a literal GBrain key and could be overwritten on refresh. Ownership and the bearer now come from the config file as written; an entry from an `$include` is the user's.
… heredoc deadlock - Both drivers use here-strings; add the shared re-exec guard and register them in `portableScripts`.
|
Codex review: blocked before merge. What this changesThis PR adds a GBrain plugin that sets up its service, creates an MCP connection, and supports Docker deployment. Example: Ask “What is our Sandpiper vault code?” after installing the plugin.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 6 items remain Keep this PR open: the integration has clear value and live evidence, but configuration-preservation defects and incomplete package integration block merging. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherA Gateway plugin service invokes GBrain’s setup commands, reads its service receipt, obtains a bearer key through its owner API, and persists a static MCP connection for agent runs. flowchart LR
A[Plugin installation] --> B[Gateway plugin service]
B --> C[GBrain setup commands]
C --> D[GBrain supervised service]
B --> E[OpenClaw MCP configuration]
E --> F[Agent MCP tools]
F --> D
Technical reviewBest possible solution: Keep the plugin-local connector, preserve authored MCP ownership through the existing config owner, and complete its package assets and generated documentation. Do we have a high-confidence way to reproduce the issue? The configuration defects follow directly from the authored-config traversal and case-sensitive header lookup; no target code was executed during this read-only review. Is this the best way to solve the issue? A plugin using GBrain’s own service and the existing static MCP configuration is an appropriate boundary, but its ownership checks must cover supported authored configurations. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1f75f9cec0ee. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +607, Tests +255, Docs +90, Config +34, Generated 0, Other +694. Total +1680 across 20 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 17, 2026, 9:44 AM ET / 14:44 UTC. |
… user - Ownership tracks every `$include` on the `mcp.servers.gbrain` path and compares the root entry with the include-resolved one, so an entry an include supplies or changes is never rewritten. - Any Authorization header spelled other than `Authorization` marks the entry as the user's, so the plugin never adds a second auth header.
… match
- One rule replaces the include walk: an `$include` at any depth (headers included) or an `${ENV}` value makes the written entry differ from the resolved one, so the entry stays the user's.
… fails - `gbrain upgrade; gbrain --version` hid upgrade failures and neither step called `fail`; the upgrade step now needs a zero exit and a version other than the downgraded one.
- `assets/icon.png` is gbrain.io's 512x512 app icon (`/icons/icon-512.png`), unchanged.
- OpenClaw does not install Bun; on a host without Bun the plugin shows the installer command, and Linux also needs unzip.
- CI `no-raw-channel-fetch`: every GBrain request now goes through `fetchWithSsrFGuard`, allowing only GBrain's exact origin, with no redirects and no capture (requests carry owner and API keys).
…rnal plugin - Same shape as Discord and Codex: publishToClawHub/publishToNpm, install specs with npm as the default, minimum host 2026.11.4, and `!dist/extensions/gbrain/**` so the core openclaw package does not carry it. - Fixes CI `No packaged surface for extension boundary: gbrain`; adds the package README the npm release requires and regenerates the plugin inventory.
- Replace unchecked JSON type assertions with one `asRecord` reader (two remaining assertions carry SAFETY comments); update the entry in place instead of a single-use generic. - Add the required monochrome `assets/activity.svg`: the G from GBrain's MIT wordmark. - Drop the ClawHub fixture detail route: only the UI recording used it, and it broke the fixture's 404 contract.
- CI `coercion-helpers` bans local record coercion helpers in bundled plugins; use `asOptionalRecord` from `openclaw/plugin-sdk/string-coerce-runtime`.
- The previous commit left out the formatter-moved import line.
|
Maintainer override: landing
|
|
Landed in 2718a07.
|
…0625) ## What Problem This Solves Connecting OpenClaw to [GBrain](https://github.com/garrytan/gbrain) today takes a separate install, a hand-written `mcp.servers` entry, a bearer key minted by hand and a service you keep alive yourself. The `gbrain-context-engine` plugin GBrain ships never selects a brain on multi-agent hosts, and on ClawHub `gbrain` returns only unofficial skills. ## User Impact User impact: on a machine with Bun 1.4.4 or newer, install the GBrain plugin (one click in the Control UI, or `openclaw plugins install`) and the agent can recall from your brain about a minute later. You do not edit config, mint a key or set up a service yourself. Without Bun, the plugin shows the one command that installs it (Linux also needs `unzip`); OpenClaw does not install Bun. Docker users add one Compose overlay, whose GBrain image includes Bun. ## Why This Change Was Made GBrain stays the owner of its own install, brain, service and upgrades. The new external plugin `extensions/gbrain` only connects OpenClaw to it: - A Gateway service runs GBrain's own commands once: `bun install -g`, `gbrain init --pglite`, `gbrain mcp expose`. These install the launchd or systemd user service. - It mints a bearer key through GBrain's owner API and writes one static streamable-HTTP `mcp.servers.gbrain` entry. Static means cron, heartbeat and subagent runs see it too. - Every 60 s it checks the connection. A rotated or revoked key is replaced automatically. When the service is down, the plugin reports it with the next command to run. It never restarts the service: that stays with launchd, systemd or Compose. - It leaves alone any existing `mcp.servers.gbrain` that points elsewhere or uses env templates. - Docker: `deploy/gbrain/compose.yaml` runs GBrain as its own service on the project network. The brain volume is mounted read-only into the Gateway. - No core or Plugin SDK changes. The plugin declares no config options. GBrain's per-turn context hook (`gbrain setup openclaw`) stays opt-in. MCP alone recalled without prompting in every run below. **Config budget +21 (`plugin`):** these are the generic `plugins.entries.gbrain.*` keys (`enabled`, `config`, `hooks.*`, `llm.*`, `subagent.*`) that the baseline counter writes once for every bundled plugin id (187 × 21). GBrain adds no options of its own. Counting the shared template once is a separate change to the counter. ## Evidence **Control UI (host with Bun): one click, no consent dialog, recall 58.7 s after the click.** Packed candidate Gateway, plugin served from a local ClawHub fixture (not published yet), real model. | Before | Installing | Installed | Recall | |---|---|---|---| |  |  |  |  | Screencast (1 click → installed → connected 4.3 s → recall from a new session): https://github.com/user-attachments/assets/0d5dc907-4fb1-4265-b84c-0b497d0f4e53 Timeline: clicked install 0 s → `mcp.servers.gbrain` connected 4.3 s → question sent 4.9 s → recalled 58.7 s. Clicks: 1. **Clean hosts, live model, every step exit 0:** | | macOS 15 VM | Ubuntu VM (systemd user) | Docker (`ghcr.io/openclaw/openclaw:latest` + overlay) | |---|---|---|---| | User actions | install + Bun command | install + `apt install unzip` + Bun command | `-f deploy/gbrain/compose.yaml` + install | | Connected | 60 s after Bun | 54 s after Bun | 0 s | | Recall after Gateway restart, codeword never shown to the session | ✅ 55 s | ✅ 64 s | ✅ 58 s | | `brain.pglite` holders with 2 concurrent sessions | 1 | 1 | 1 | | `mcp probe gbrain` | 8 tools | 8 tools | 8 tools | | Stop service / kill serve / rotate key / `gbrain upgrade` → recall | ✅ ✅ ✅ ✅ | ✅ ✅ ✅ ✅ | ✅ ✅ ✅ ✅ | | Uninstall keeps service and brain, removes install record | ✅ | ✅ | ✅ | - Docker run: in the concurrent step, turn A answered the codeword correctly after 6 code-mode bridge calls, but its receipt listed no tool names, so the harness flagged it. The receipt gap is a separate issue. - New live lane: `pnpm test:docker:gbrain`. The host driver is `scripts/e2e/lib/gbrain/host-e2e.sh`. - `pnpm test extensions/gbrain` (unit), Docker plan test, `ocx build --dts` and the packed-tarball check pass at `a4c2d20`. The latest commit changes only the Docker lane script, which the final Docker run used. <details><summary>Bugs found by the e2e runs and fixed here</summary> 1. Shared network namespace with the Gateway: `getaddrinfo ENOTFOUND gbrain` after a Gateway restart. GBrain now has its own namespace. 2. Linux: `Unit gbrain-serve.service could not be found.` GBrain now gets the user session bus env (minus Gateway identity and credentials). 3. Linux: Bun links under `XDG_CACHE_HOME`; the plugin asks `bun pm bin -g`. 4. Docker: `stable_unreadable … (offline, or no git)`. The sidecar image includes git. 5. Clean Linux: Bun's installer needs `unzip`; the message says so. </details> **Local review (ClawSweeper, local range `origin/main...d26de1b`):** complete, "patch is correct", 0 findings. Earlier rounds' findings were all fixed, with regression tests in `extensions/gbrain/src/connect.test.ts` where they apply: - Key refresh kept only URL, transport and bearer; it now keeps the user's other entry settings (`enabled`, `toolFilter`, other headers). - An `expose --port` move is followed instead of being reported as an external entry. - Ownership comes from the config file as authored, not the env-expanded runtime config, so `Bearer ${GBRAIN_MCP_TOKEN}` entries stay the user's; entries supplied or changed by an `$include`, and any non-canonical `authorization` header, also stay the user's. - Both e2e drivers carry the macOS Bash 5.3 heredoc guard and are registered in `portableScripts`. - Both e2e drivers fail when the GBrain downgrade or upgrade fails or leaves the version unchanged. The plugin icon is GBrain's own 512×512 app icon from gbrain.io (`assets/icon.png`); the screenshots above predate it and show the generic letter placeholder. **Maintainer decision on the remaining finding:** the review flags the one-time `bun install -g github:garrytan/gbrain#stable` in the plugin's Gateway service against `extensions/AGENTS.md` ("Runtime never installs deps"). Kept on purpose: that rule covers the plugin's own package dependencies. GBrain is a separate tool with its own installer, its install runs only after the user explicitly installs this plugin, it happens once, and after a failure it retries at most every 10 minutes. Moving it to Doctor would add a step to the one-click setup this PR exists for. **Known gaps (not in this PR):** - GBrain upstream: no CLI to mint a key against a running server (the plugin uses the dashboard API), `mcp expose` has no `--bind`, no official container image. Headless Linux needs `loginctl enable-linger` to keep the user service after logout (not tested). - OpenClaw: MCP startup backoff does not reset when GBrain recovers. `mcp.servers.gbrain` stays after uninstall (`openclaw mcp unset gbrain`). - Bun is a prerequisite on macOS and Linux. Follow-up: install GBrain from its standalone release binaries (`gbrain-darwin-arm64`, `gbrain-linux-x64`) so neither Bun nor `unzip` is needed; first check that `gbrain upgrade` and `mcp expose` work without Bun and that releases publish checksums. - Distribution: `@openclaw/gbrain` is an external plugin like Discord and Codex (`publishToClawHub`/`publishToNpm`, npm default install, excluded from the core `openclaw` package). It publishes with the next release; until then the Control UI proof used a local ClawHub fixture. The unscoped ClawHub name `gbrain` belongs to an unofficial upload; this package is scoped. Co-authored-by: Ayaan Zaidi <[email protected]>
…ux (#200987) ## What Problem This Solves The GBrain plugin (#200625) needs Bun to install GBrain. On a clean Mac or Linux machine that meant a terminal step after the one-click install: run Bun's installer, and on Linux install `unzip` first. ## User Impact User impact: on Apple Silicon macOS and x86-64 Linux without Bun, installing the GBrain plugin is now the only step. The plugin installs GBrain's own release binary and connects; on a clean macOS VM it was connected 14 seconds after the install request. Existing Bun users keep the same Bun install. Intel macOS and ARM Linux, where GBrain publishes no binary, still show the Bun command. ## Why This Change Was Made When `gbrain` is missing and Bun is not installed, the plugin: 1. Reads GBrain's stable version from its documented `stable/VERSION` file. 2. Downloads that release's asset (`gbrain-darwin-arm64` or `gbrain-linux-x64`) to `~/.gbrain/bin/gbrain`. 3. Accepts it only when GitHub's build-provenance attestation for its SHA-256 names that asset and GBrain's release workflow on `master`. This is the same check GBrain's own binary self-update uses (`src/core/binary-self-update.ts`). Nothing is made executable or moved into place before the check passes. GBrain then owns the binary as it does any install: `gbrain mcp expose` supervises the service, and `gbrain upgrade` self-updates the binary in place. When Bun is present the plugin keeps using Bun, so existing installs and the GitHub API limit (see below) cannot block a host that can already install. The release download uses GitHub's fixed download URL; only the attestation lookup uses GitHub's API (one unauthenticated request per install). The plugin logs where it installed GBrain and that `~/.gbrain/bin` must be on `PATH` to run `gbrain` in a terminal. It does not edit shell files. ## Evidence **Clean hosts, packed candidate, live model:** | | macOS 15 VM, Apple Silicon (binary path) | Ubuntu VM, ARM (Bun fallback) | |---|---|---| | Bun on host before install | none | none | | User steps | install only | install + `apt install unzip` + Bun command | | Connected after install | 14 s | 64 s after Bun | | `~/.gbrain/bin/gbrain --version` | 0.60.734.0 | (Bun install) | | Recall after Gateway restart | ✅ | ✅ | | One `brain.pglite` holder, 2 concurrent sessions | ✅ | ✅ | | Stop / kill / key rotation → recall | ✅ ✅ ✅ | ✅ ✅ ✅ | | `gbrain upgrade` (from 0.60.733.0) → recall | ✅ | ✅ | | Uninstall keeps service and brain | ✅ | ✅ | - Earlier runs of the same flow each failed one step: macOS run 2 and ARM Linux run 1. The failing steps were the service-restart recall, where the Gateway's MCP client tried GBrain moments before its restarted service answered, and one of two concurrent recall turns. Both were green on the next run. This is the known MCP retry gap from #200625. - One macOS run hit GitHub's unauthenticated API limit (HTTP 403, 60 requests an hour per network). That led to dropping the releases API call and to a clear "limit used up, resets within an hour" status. The plugin retries within 10 minutes. - x86-64 Linux (privileged Ubuntu container under Rosetta): the binary runs, `gbrain init` and `gbrain serve` work with health `ok`, with no Bun, git or unzip on the host. - Unit tests cover the binary install, a failed download, Bun-first ordering, and the attestation check rejecting a fork, another workflow, another branch, the wrong asset or the wrong digest. - Local ClawSweeper review (local range `origin/main...90ad0c3`): complete, "patch is correct", 0 findings. Earlier rounds found that an existing Bun install could be skipped, that a GitHub API limit could block a Bun host, and that the Bun-free e2e assertion could pass with Bun present; all fixed. **Known gaps:** - No full x86-64 Linux e2e. GBrain installs no service inside containers, and no x86 Linux VM was available. - GBrain upstream: after an upgrade, `gbrain upgrade` checks the new version through `PATH`, not the binary it replaced. Without `~/.gbrain/bin` on `PATH` it swaps the binary, fails, and skips the service restart. - GBrain upstream: `gbrain upgrade` reads the stable channel with `git ls-remote`, so a binary install on Linux needs `git` to upgrade (Bun installs had the same need). - GBrain upstream: no binary for Intel macOS or ARM Linux. Co-authored-by: Ayaan Zaidi <[email protected]>
…ux (openclaw#200987) ## What Problem This Solves The GBrain plugin (openclaw#200625) needs Bun to install GBrain. On a clean Mac or Linux machine that meant a terminal step after the one-click install: run Bun's installer, and on Linux install `unzip` first. ## User Impact User impact: on Apple Silicon macOS and x86-64 Linux without Bun, installing the GBrain plugin is now the only step. The plugin installs GBrain's own release binary and connects; on a clean macOS VM it was connected 14 seconds after the install request. Existing Bun users keep the same Bun install. Intel macOS and ARM Linux, where GBrain publishes no binary, still show the Bun command. ## Why This Change Was Made When `gbrain` is missing and Bun is not installed, the plugin: 1. Reads GBrain's stable version from its documented `stable/VERSION` file. 2. Downloads that release's asset (`gbrain-darwin-arm64` or `gbrain-linux-x64`) to `~/.gbrain/bin/gbrain`. 3. Accepts it only when GitHub's build-provenance attestation for its SHA-256 names that asset and GBrain's release workflow on `master`. This is the same check GBrain's own binary self-update uses (`src/core/binary-self-update.ts`). Nothing is made executable or moved into place before the check passes. GBrain then owns the binary as it does any install: `gbrain mcp expose` supervises the service, and `gbrain upgrade` self-updates the binary in place. When Bun is present the plugin keeps using Bun, so existing installs and the GitHub API limit (see below) cannot block a host that can already install. The release download uses GitHub's fixed download URL; only the attestation lookup uses GitHub's API (one unauthenticated request per install). The plugin logs where it installed GBrain and that `~/.gbrain/bin` must be on `PATH` to run `gbrain` in a terminal. It does not edit shell files. ## Evidence **Clean hosts, packed candidate, live model:** | | macOS 15 VM, Apple Silicon (binary path) | Ubuntu VM, ARM (Bun fallback) | |---|---|---| | Bun on host before install | none | none | | User steps | install only | install + `apt install unzip` + Bun command | | Connected after install | 14 s | 64 s after Bun | | `~/.gbrain/bin/gbrain --version` | 0.60.734.0 | (Bun install) | | Recall after Gateway restart | ✅ | ✅ | | One `brain.pglite` holder, 2 concurrent sessions | ✅ | ✅ | | Stop / kill / key rotation → recall | ✅ ✅ ✅ | ✅ ✅ ✅ | | `gbrain upgrade` (from 0.60.733.0) → recall | ✅ | ✅ | | Uninstall keeps service and brain | ✅ | ✅ | - Earlier runs of the same flow each failed one step: macOS run 2 and ARM Linux run 1. The failing steps were the service-restart recall, where the Gateway's MCP client tried GBrain moments before its restarted service answered, and one of two concurrent recall turns. Both were green on the next run. This is the known MCP retry gap from openclaw#200625. - One macOS run hit GitHub's unauthenticated API limit (HTTP 403, 60 requests an hour per network). That led to dropping the releases API call and to a clear "limit used up, resets within an hour" status. The plugin retries within 10 minutes. - x86-64 Linux (privileged Ubuntu container under Rosetta): the binary runs, `gbrain init` and `gbrain serve` work with health `ok`, with no Bun, git or unzip on the host. - Unit tests cover the binary install, a failed download, Bun-first ordering, and the attestation check rejecting a fork, another workflow, another branch, the wrong asset or the wrong digest. - Local ClawSweeper review (local range `origin/main...90ad0c3`): complete, "patch is correct", 0 findings. Earlier rounds found that an existing Bun install could be skipped, that a GitHub API limit could block a Bun host, and that the Bun-free e2e assertion could pass with Bun present; all fixed. **Known gaps:** - No full x86-64 Linux e2e. GBrain installs no service inside containers, and no x86 Linux VM was available. - GBrain upstream: after an upgrade, `gbrain upgrade` checks the new version through `PATH`, not the binary it replaced. Without `~/.gbrain/bin` on `PATH` it swaps the binary, fails, and skips the service restart. - GBrain upstream: `gbrain upgrade` reads the stable channel with `git ls-remote`, so a binary install on Linux needs `git` to upgrade (Bun installs had the same need). - GBrain upstream: no binary for Intel macOS or ARM Linux. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Connecting OpenClaw to GBrain today takes a separate install, a hand-written
mcp.serversentry, a bearer key minted by hand and a service you keep alive yourself. Thegbrain-context-engineplugin GBrain ships never selects a brain on multi-agent hosts, and on ClawHubgbrainreturns only unofficial skills.User Impact
User impact: on a machine with Bun 1.4.4 or newer, install the GBrain plugin (one click in the Control UI, or
openclaw plugins install) and the agent can recall from your brain about a minute later. You do not edit config, mint a key or set up a service yourself. Without Bun, the plugin shows the one command that installs it (Linux also needsunzip); OpenClaw does not install Bun. Docker users add one Compose overlay, whose GBrain image includes Bun.Why This Change Was Made
GBrain stays the owner of its own install, brain, service and upgrades. The new external plugin
extensions/gbrainonly connects OpenClaw to it:bun install -g,gbrain init --pglite,gbrain mcp expose. These install the launchd or systemd user service.mcp.servers.gbrainentry. Static means cron, heartbeat and subagent runs see it too.mcp.servers.gbrainthat points elsewhere or uses env templates.deploy/gbrain/compose.yamlruns GBrain as its own service on the project network. The brain volume is mounted read-only into the Gateway.GBrain's per-turn context hook (
gbrain setup openclaw) stays opt-in. MCP alone recalled without prompting in every run below.Config budget +21 (
plugin): these are the genericplugins.entries.gbrain.*keys (enabled,config,hooks.*,llm.*,subagent.*) that the baseline counter writes once for every bundled plugin id (187 × 21). GBrain adds no options of its own. Counting the shared template once is a separate change to the counter.Evidence
Control UI (host with Bun): one click, no consent dialog, recall 58.7 s after the click. Packed candidate Gateway, plugin served from a local ClawHub fixture (not published yet), real model.
Screencast (1 click → installed → connected 4.3 s → recall from a new session):
gbrain-one-click-install.mp4
Timeline: clicked install 0 s →
mcp.servers.gbrainconnected 4.3 s → question sent 4.9 s → recalled 58.7 s. Clicks: 1.Clean hosts, live model, every step exit 0:
ghcr.io/openclaw/openclaw:latest+ overlay)apt install unzip+ Bun command-f deploy/gbrain/compose.yaml+ installbrain.pgliteholders with 2 concurrent sessionsmcp probe gbraingbrain upgrade→ recallpnpm test:docker:gbrain. The host driver isscripts/e2e/lib/gbrain/host-e2e.sh.pnpm test extensions/gbrain(unit), Docker plan test,ocx build --dtsand the packed-tarball check pass ata4c2d20. The latest commit changes only the Docker lane script, which the final Docker run used.Bugs found by the e2e runs and fixed here
getaddrinfo ENOTFOUND gbrainafter a Gateway restart. GBrain now has its own namespace.Unit gbrain-serve.service could not be found.GBrain now gets the user session bus env (minus Gateway identity and credentials).XDG_CACHE_HOME; the plugin asksbun pm bin -g.stable_unreadable … (offline, or no git). The sidecar image includes git.unzip; the message says so.Local review (ClawSweeper, local range
origin/main...d26de1b79f): complete, "patch is correct", 0 findings. Earlier rounds' findings were all fixed, with regression tests inextensions/gbrain/src/connect.test.tswhere they apply:enabled,toolFilter, other headers).expose --portmove is followed instead of being reported as an external entry.Bearer ${GBRAIN_MCP_TOKEN}entries stay the user's; entries supplied or changed by an$include, and any non-canonicalauthorizationheader, also stay the user's.portableScripts.The plugin icon is GBrain's own 512×512 app icon from gbrain.io (
assets/icon.png); the screenshots above predate it and show the generic letter placeholder.Maintainer decision on the remaining finding: the review flags the one-time
bun install -g github:garrytan/gbrain#stablein the plugin's Gateway service againstextensions/AGENTS.md("Runtime never installs deps"). Kept on purpose: that rule covers the plugin's own package dependencies. GBrain is a separate tool with its own installer, its install runs only after the user explicitly installs this plugin, it happens once, and after a failure it retries at most every 10 minutes. Moving it to Doctor would add a step to the one-click setup this PR exists for.Known gaps (not in this PR):
mcp exposehas no--bind, no official container image. Headless Linux needsloginctl enable-lingerto keep the user service after logout (not tested).mcp.servers.gbrainstays after uninstall (openclaw mcp unset gbrain).gbrain-darwin-arm64,gbrain-linux-x64) so neither Bun norunzipis needed; first check thatgbrain upgradeandmcp exposework without Bun and that releases publish checksums.@openclaw/gbrainis an external plugin like Discord and Codex (publishToClawHub/publishToNpm, npm default install, excluded from the coreopenclawpackage). It publishes with the next release; until then the Control UI proof used a local ClawHub fixture. The unscoped ClawHub namegbrainbelongs to an unofficial upload; this package is scoped.