feat: set up OpenClaw MCP and hooks from the agent install command
DNO-1419
Summary
The agent install command connects OpenClaw to the agent gateway, installs the observability plugin for agents with a live project, enables conversation hooks, and prints a hooks check result plus a restart reminder. This original draft now includes the same reviewed tree as its successor #8108. Prefer #8108 for review; do not merge both.
Run the command in a trusted shell. The separate OpenClaw follow-up prompt contains no redeemable code. Gateway and hooks URLs must use HTTPS. OpenClaw configuration uses an owner-only temporary batch file to avoid putting the key in process arguments; rejected updates preserve the previous gateway. Claude Code and Codex read the key from their launch environment.
Plugin ZIPs mark key files owner-only. Installation handles named profiles, supported CLI flags, missing unzip, projectless agents, failed client configuration, and clipboard failures. The docs distinguish the hooks self-check from runtime attribution and cover the Claude CLI routing limitation.
OpenClaw 2026.10.6 rejects structured MCP header SecretRefs; upstream support proposal #69417 was closed without merging. Its supported batch-file path writes valid config with mode 0600. The key remains in OpenClaw's config and the plugin's key file. This PR is stacked on #8109 and the agent plugin now sets HooksKeyIsAgent: true. Its smoke check clears API-key and org-key environment overrides (including aliases) and isolates cached sign-ins. Agent hooks still depend on #8015 / DNO-1412. Deployment also requires publishing the #8109 hooks binary and updating the server pin: the current 0.3.37 binary predates agent-key precedence. No release is performed by this PR.
Motivation
One installation should explain which parts succeeded and preserve working client configuration when an update fails. Short-lived install codes remain credentials until redeemed, so copying them into a model transcript is avoided.
Platform MCP is unchanged: minting an install code requires the plaintext key. Command K adds no page or named resource here. Demo seed changes are excluded because these are one-time credentials.
Gutternote review steps
- Identities → an agent → Credentials → Issue a key, then Generate install command.
- The command instructions say to run it in a trusted shell and keep it out of chat. The project requirement and Claude CLI coverage caveat appear alongside it.
- After installation, ask OpenClaw to check offers a separate message. Copy it and confirm it contains neither the command nor the key.
- Deny clipboard permission or use a browser without the Clipboard API. Each Copy action shows Copy failed and a manual-copy alert.
Fixes DNO-1419
Narrated dashboard recording
This 49-second recording was captured from #8108 head db38b23597d3c1bc61ef5350eace1b6c4c40f695, whose complete file tree is identical to this PR's current head f18e50fdee8ff67eae7a116bad6d006cf67ab5bb (tree 172521930ca707f75c52c40d76a16715a576330b). It therefore demonstrates the same implementation. Prefer #8108 for review; do not merge both PRs.
Using synthetic local data, it shows trusted-shell installation guidance, the separate credential-free OpenClaw follow-up prompt, and Copy failed feedback when clipboard access is denied. The generated install code and key remain outside the recording crop.
This is a dashboard walkthrough, not a demonstration of completed OpenClaw installation or runtime hooks attribution. The identical #8108 tree passed all 30 focused installer tests.
https://github.com/user-attachments/assets/d49fb32f-72dd-4364-918b-cf52c71024c9