Install
openclaw skills install openclaw-upgraderUpgrade OpenClaw to a specific version or latest using a cross-platform, Codex-supervised flow. Use when the user asks to upgrade or update OpenClaw. OpenCla...
openclaw skills install openclaw-upgraderUse this skill for cross-platform, same-host OpenClaw upgrades. Keep the skill focused on one job:
Do not treat this as a shell script wrapper skill. Treat it as a same-host ACP/CLI delegation skill.
This skill is for upgrading the OpenClaw installation on the same host where the delegated coding agent runs. It is cross-platform across host OS/service models, but it is not a generic remote-host orchestration skill.
Concurrency contract:
OpenClaw should do only lightweight preparation before delegation:
Use scripts/collect-upgrade-context.sh to gather a machine-readable context snapshot before delegation. That script must reject re-entry before agent preflights and may claim the host-level active-run lock on behalf of the outer upgrader flow. Use scripts/run-upgrade-delegation.sh as the outer runner scaffold so the lock is released only when the upgrader flow reaches a terminal path. Read references/review-checklist.md when composing or reviewing the Codex handoff.
After that, hand off the full upgrade workflow to a local coding agent: prefer Codex; use Claude Code if Codex is unavailable or unsuitable.
An upgrade is successful only if all of these are true:
If package installation succeeded but the runtime did not recover, report failure, not success.
Do not hardcode macOS-specific assumptions into the skill contract.
Examples:
LaunchAgent in the generic rules127.0.0.1:18789 as the only valid endpointInstead, require Codex to verify the appropriate host-specific service model and the actual configured/local endpoint.
Examples of host-specific service models Codex may need to handle:
Do these directly before spawning the delegated agent:
The run lock must cover the entire active upgrader lifecycle, not just context collection. scripts/collect-upgrade-context.sh may claim the host-level run lock and emit lock metadata, but the caller/outer runner must retain that lock until the delegated upgrade run reaches a terminal state and then release it deliberately. scripts/run-upgrade-delegation.sh is the default outer-runner scaffold for this purpose and must remain responsible for terminal lock release.
If delegation cannot begin, OpenClaw itself must write a structured pre-delegation failure result. Do not leave blocked delegation as an implicit or unstructured failure. If another upgrader run is already active on this host, reject re-entry or explicitly queue it; do not allow concurrent execution.
Useful facts to pass:
npm, pnpm, yarn, package manager, custom)OPENCLAW_STATE_DIR, OPENCLAW_PROFILE)When multiple OpenClaw instances may exist, pass enough identity information that Codex can upgrade, repair, and verify the same instance.
The delegated local coding agent (Codex or Claude Code) owns the full upgrade flow after handoff. That includes:
Before delegation, check whether a supported local coding agent is actually usable.
Preferred order:
Check all of the following before selecting an agent:
Important: this preflight is a necessary but not sufficient condition. It is only meant to reject obviously unusable agents before delegation. It does not prove that the agent will definitely succeed at package upgrade, service recovery, verification, or file writes during the real run.
Handle these cases explicitly:
If neither Codex nor Claude Code is installed, stop and report that the skill cannot proceed yet. Do not silently fall back to a shell-only upgrade flow. Write a structured result with status delegation_blocked.
If a CLI is installed but not authenticated, stop and report that the selected agent is unavailable until login/auth is completed. If no other supported agent is usable, write a structured result with status delegation_blocked.
If a CLI is authenticated but fails the lightweight delegation-viability preflight, treat it as unavailable for this task and try the other supported CLI if present. If neither agent passes preflight, stop and report that delegation cannot safely continue, and write a structured result with status delegation_blocked.
Do not overclaim what the preflight proves. A passing preflight only means the agent looks viable enough to start delegation; it does not prove that the full upgrade workflow will succeed.
Prefer Codex by default. Use Claude Code when Codex is unavailable, unauthenticated, or lacks the needed capabilities.
OpenClaw should record the selected agent explicitly before delegation.
The most important part of this skill is the prompt quality. The prompt to the delegated agent should strongly emphasize these points:
Tell the delegated agent explicitly:
Tell the delegated agent to infer and verify the real service management model on the host instead of assuming macOS or any single supervisor.
Examples:
Tell the delegated agent to validate the real configured/local Gateway endpoint.
Do not let Codex stop after a restart command. Require it to verify actual reachability.
Require authentication-aware verification:
Tell the delegated agent to separately evaluate:
If the first passes and the latter fail, overall status must still be failure.
Tell the delegated agent to inspect the failure mode and repair the actual cause.
Examples of causes:
Tell the delegated agent to identify the exact OpenClaw instance being upgraded and use the same identity for upgrade, repair, restart, and validation.
Useful identity anchors include:
OPENCLAW_STATE_DIROPENCLAW_PROFILEDo not allow "upgraded one instance, repaired another" outcomes.
Require the delegated agent to write a structured result file with:
Use a prompt roughly like this, adapted to the environment and selected agent:
Upgrade OpenClaw to <TARGET_VERSION> on this host.
You are the delegated local coding agent for this host. You own the full upgrade workflow end to end: package upgrade, service-definition refresh if needed, service recovery, endpoint verification, and post-upgrade validation.
Facts:
- Current version: <CURRENT_VERSION>
- Target version: <TARGET_VERSION>
- OS/platform: <PLATFORM>
- Config path: <CONFIG_PATH>
- Install method clues: <INSTALL_METHOD_HINTS>
- State dir: <STATE_DIR_OR_UNKNOWN>
- Profile: <PROFILE_OR_UNKNOWN>
- Service label/unit/task: <SERVICE_IDENTITY_OR_UNKNOWN>
- Known Gateway endpoint: <KNOWN_ENDPOINT_OR_UNKNOWN>
- Endpoint auth mode: <AUTH_MODE_OR_UNKNOWN>
- Auth source/expectation: <AUTH_SOURCE_OR_UNKNOWN>
- Known recent failure mode: <KNOWN_FAILURE_MODE>
- Config backup already created at: <BACKUP_PATH>
Requirements:
1. Determine the correct host-specific upgrade path
2. Perform the upgrade
3. Refresh or reinstall the host-native service definition if the updated install requires it
4. Recover/restart the correct Gateway instance using the host's actual service model
5. Verify the real configured/local Gateway endpoint is reachable again
6. Use auth-aware probing so "reachable but requires auth" is not misclassified as downtime
7. Verify OpenClaw is operational for the intended local clients again
8. If package install succeeds but runtime recovery fails, treat the overall result as failure and repair it
9. Write a structured result file to ~/.openclaw/.upgrade-result.json
Do not stop at “package upgraded” or “restart issued”. The task is only complete when the intended OpenClaw instance is operational again.
Treat the preflight fields you were given as an initial viability signal, not a proof of full upgrade authority. Re-check permissions/capabilities when the real upgrade actions begin.
Write structured output to:
~/.openclaw/.upgrade-result.json
Expected shape:
{
"status": "success | failed | already_latest | in_progress | delegation_blocked | rejected_reentry",
"start_time": "2026-03-13T20:00:00",
"end_time": "2026-03-13T20:02:30",
"previous_version": "2026.3.12",
"new_version": "2026.3.13",
"selected_agent": "codex | claude-code | none",
"delegation_status": "started | blocked | rejected_reentry | queued | not_needed | unknown",
"delegation_block_reason": "not_installed | not_authenticated | insufficient_capability | active_run_exists | unknown | null",
"agent_checks": {
"codex": {
"installed": true,
"authenticated": true,
"preflight_ok": true
},
"claude_code": {
"installed": false,
"authenticated": false,
"preflight_ok": false
}
},
"service_definition_status": "refreshed | unchanged | failed | unknown | not_started",
"service_status": "healthy | unhealthy | unknown | not_started",
"endpoint_status": "reachable | unreachable | unknown | not_started",
"auth_probe_status": "ok | auth_required | failed | unknown | not_started",
"service_model": "launchctl | systemd | manual | container | unknown | not_started",
"instance_identity": {
"config_path": "...",
"state_dir": "...",
"profile": "...",
"service_name": "...",
"endpoint": "..."
},
"repair_actions": ["..."],
"error": "Error message if failed",
"log_file": "/tmp/openclaw-upgrade-20260313-200000.log"
}
delegation_blocked or rejected_reentry result itself