Claw Image Build
Use this skill for OpenClaw container image work from source checkout to published GHCR proof.
Contract
- Work from the current OpenClaw checkout unless the user explicitly asks for another worktree.
- Respect the repo
AGENTS.md: do not switch worktrees for git mutations, do not print secrets, do not print Docker auth configuration, and verify live sources when requested.
- Pull or checkout exactly what the user asked for before building. If the worktree is dirty, stop before
git pull and report the dirty state. If the user asks for a new worktree, create it from the latest upstream default branch and preserve unrelated local changes.
- Read
docs/install/docker.md and the relevant package manifests before choosing build args or plugin install strategy. Unless the user explicitly narrows or changes the plugin set, require @openclaw/codex, @openclaw/slack, and @openclaw/diagnostics-otel.
- Resolve "latest" from the repository's actual upstream default branch. If a prompt says
origin/master but the default branch is different, fetch the default branch, record the exact commit, and state the branch name used.
- Build multi-arch images when requested; include
linux/amd64 explicitly for x86_64/amd64 proof unless the user says otherwise.
- Prefer
ghcr.io/kevinslin/openclaw for Kevin's registry unless the user explicitly provides a different owner. Verify namespace and visibility with gh api.
- Do not claim success from a local image only. Pull the published tag back from GHCR and verify the requested platforms.
- Always run an image secret-hygiene pass before closeout when publishing or when the user asks about secrets.
- Never deploy, restart, or modify any live gateway, devbox, or service while building or verifying images. Do not modify the OpenAI monorepo or its Applied spec as part of OpenClaw image work.
- For Codex images or source/base-image updates affecting Codex, treat the built image itself as the artifact under test. Run the Codex image contract gate in
./references/workflow.md before publishing or reporting success.
Build Strategy
Use the repo Dockerfile and repository-native build pipeline when it can build the requested image directly. Do not rebase onto an unrelated runtime image and do not modify built plugin contents after the final packaging stage.
For self-contained source-bundled images, build OpenClaw and bundled plugins from the same source revision whenever the repository supports it. Do not combine a newer OpenClaw source build with older published plugin packages. The default required plugin set is @openclaw/codex, @openclaw/slack, and @openclaw/diagnostics-otel; use the repository's standard bundled-extension packaging location and build args, for example OPENCLAW_EXTENSIONS=diagnostics-otel,codex,slack, unless the user explicitly mentions a different plugin set. Preserve manifests, runtime dependencies, source maps, assets, and generated output required for plugin discovery and runtime loading.
diagnostics-otel is a first-class packaged plugin for these images. It must not require openclaw plugins install, npm installation, network access, or filesystem mutation at container startup. Do not add runtime installation scripts for it; remove or replace manual diagnostics installation logic with packaged plugin coverage.
If native Docker source compile fails under cross-arch emulation but the local source build passes, use the proven runtime-image assembly pattern from ./references/workflow.md: build dist locally, then assemble per-platform runtime images with BuildKit --build-context built_dist=./dist. Use that fallback only when the repo Dockerfile cannot complete the requested source build.
For @openclaw/codex image work, build from an immutable OpenClaw commit with an OCI revision label, verify packaging and base-image digests inside the artifact, and run the #96872 thread/start behavioral contract from a validation stage or external harness. Do not rely on source Vitest running inside the production image.
For source-bundled plugins, "available" means:
- source package manifest exists under
extensions/<id>/package.json;
- packaged manifest and entrypoint exist under
/app/dist/extensions/<id>/;
- runtime dependencies needed by the plugin are present in the final image;
node openclaw.mjs plugins inspect <id> --runtime --json succeeds from the pulled published image;
- startup logs contain no plugin install, npm install, module-resolution, or missing-dependency errors.
For external npm plugin images, "available" means:
- installed in the OpenClaw plugin store under
/home/node/.openclaw/npm/projects/.../node_modules/<package>/package.json;
- enabled in config;
node openclaw.mjs plugins inspect <id> --json reports status: "loaded" from the pulled published image.
Do not rely on require.resolve("@openclaw/<plugin>/package.json") from /app unless the image intentionally bundles that package as a root/runtime dependency. External official plugins may be plugin-store installs rather than root app dependencies.
Workflow
- Establish source and tags:
git status -sb
- if clean and user asked for latest: fetch/pull the upstream default branch with the repo-required workflow
- record
git rev-parse HEAD, git rev-parse --short=10 HEAD, and node -p "require('./package.json').version"
- determine and reuse the repository's existing snapshot/release tag convention; do not invent one.
- Inspect docs and plugin packages:
docs/install/docker.md
Dockerfile
extensions/<plugin>/package.json
- for source-bundled plugin images, verify OpenClaw and each default/requested plugin package report the same intended version from the same checkout.
- use
npm view @openclaw/<plugin> version dist.tarball --json only for images that intentionally install external npm plugin packages.
- Build and push arch-specific tags first:
<baseTag>-amd64
<baseTag>-arm64
- Create multi-arch tags with
docker buildx imagetools create.
- Verify GHCR:
- manifest digest and platforms;
- package visibility;
- expected tag set.
- Pull-run verify each requested platform:
- OpenClaw version;
- default/requested plugin discovery and runtime inspect output;
- package manifests in plugin store when external npm plugins are requested;
- packaged manifests, entrypoints, and runtime dependencies when source-bundled plugins are requested;
/healthz returns HTTP 200;
- offline
--network none startup succeeds after the image has been pulled.
- Secret-scan:
- container environment names only, never values;
docker history --no-trunc keyword count.
- Run focused package, Docker, typecheck, and integration tests that cover changed packaging behavior, including packaged inventory, manifests, entrypoints, runtime dependencies, version metadata, no manual diagnostics install, and offline plugin discovery. Do not hide unrelated failures; distinguish pre-existing failures from regressions.
- Report source branch and exact commit, chosen version, plugin versions, changed files, bundling mechanism, Docker build command, registry destination, pushed tag and immutable digest, local/remote digest comparison, exact verification and test commands with results, offline-start proof, caveats, secret-scan result, and worktree status.
References
Read ./references/workflow.md before building or republishing an image. It contains command templates for the runtime assembly fallback, manifest creation, plugin verification, and secret checks.
1---2name: claw-image-build3description: Build, publish, and verify OpenClaw Docker/GHCR images. Use when the user asks to build an OpenClaw image, publish or republish GHCR tags, bundle official plugins such as @openclaw/codex, @openclaw/slack, or @openclaw/diagnostics-otel, make or verify multi-arch linux/amd64 and linux/arm64 images, check GHCR visibility, secret-scan an image, enforce Codex image contract gates, or prove a published OpenClaw Docker image works.4---56# Claw Image Build78Use this skill for OpenClaw container image work from source checkout to published GHCR proof.910## Contract11121. Work from the current OpenClaw checkout unless the user explicitly asks for another worktree.132. Respect the repo `AGENTS.md`: do not switch worktrees for git mutations, do not print secrets, do not print Docker auth configuration, and verify live sources when requested.143. Pull or checkout exactly what the user asked for before building. If the worktree is dirty, stop before `git pull` and report the dirty state. If the user asks for a new worktree, create it from the latest upstream default branch and preserve unrelated local changes.154. Read `docs/install/docker.md` and the relevant package manifests before choosing build args or plugin install strategy. Unless the user explicitly narrows or changes the plugin set, require `@openclaw/codex`, `@openclaw/slack`, and `@openclaw/diagnostics-otel`.165. Resolve "latest" from the repository's actual upstream default branch. If a prompt says `origin/master` but the default branch is different, fetch the default branch, record the exact commit, and state the branch name used.176. Build multi-arch images when requested; include `linux/amd64` explicitly for x86_64/amd64 proof unless the user says otherwise.187. Prefer `ghcr.io/kevinslin/openclaw` for Kevin's registry unless the user explicitly provides a different owner. Verify namespace and visibility with `gh api`.198. Do not claim success from a local image only. Pull the published tag back from GHCR and verify the requested platforms.209. Always run an image secret-hygiene pass before closeout when publishing or when the user asks about secrets.2110. Never deploy, restart, or modify any live gateway, devbox, or service while building or verifying images. Do not modify the OpenAI monorepo or its Applied spec as part of OpenClaw image work.2211. For Codex images or source/base-image updates affecting Codex, treat the built image itself as the artifact under test. Run the Codex image contract gate in `./references/workflow.md` before publishing or reporting success.2324## Build Strategy2526Use the repo Dockerfile and repository-native build pipeline when it can build the requested image directly. Do not rebase onto an unrelated runtime image and do not modify built plugin contents after the final packaging stage.2728For self-contained source-bundled images, build OpenClaw and bundled plugins from the same source revision whenever the repository supports it. Do not combine a newer OpenClaw source build with older published plugin packages. The default required plugin set is `@openclaw/codex`, `@openclaw/slack`, and `@openclaw/diagnostics-otel`; use the repository's standard bundled-extension packaging location and build args, for example `OPENCLAW_EXTENSIONS=diagnostics-otel,codex,slack`, unless the user explicitly mentions a different plugin set. Preserve manifests, runtime dependencies, source maps, assets, and generated output required for plugin discovery and runtime loading.2930`diagnostics-otel` is a first-class packaged plugin for these images. It must not require `openclaw plugins install`, npm installation, network access, or filesystem mutation at container startup. Do not add runtime installation scripts for it; remove or replace manual diagnostics installation logic with packaged plugin coverage.3132If native Docker source compile fails under cross-arch emulation but the local source build passes, use the proven runtime-image assembly pattern from `./references/workflow.md`: build `dist` locally, then assemble per-platform runtime images with BuildKit `--build-context built_dist=./dist`. Use that fallback only when the repo Dockerfile cannot complete the requested source build.3334For `@openclaw/codex` image work, build from an immutable OpenClaw commit with an OCI revision label, verify packaging and base-image digests inside the artifact, and run the #96872 thread/start behavioral contract from a validation stage or external harness. Do not rely on source Vitest running inside the production image.3536For source-bundled plugins, "available" means:3738- source package manifest exists under `extensions/<id>/package.json`;39- packaged manifest and entrypoint exist under `/app/dist/extensions/<id>/`;40- runtime dependencies needed by the plugin are present in the final image;41- `node openclaw.mjs plugins inspect <id> --runtime --json` succeeds from the pulled published image;42- startup logs contain no plugin install, npm install, module-resolution, or missing-dependency errors.4344For external npm plugin images, "available" means:4546- installed in the OpenClaw plugin store under `/home/node/.openclaw/npm/projects/.../node_modules/<package>/package.json`;47- enabled in config;48- `node openclaw.mjs plugins inspect <id> --json` reports `status: "loaded"` from the pulled published image.4950Do not rely on `require.resolve("@openclaw/<plugin>/package.json")` from `/app` unless the image intentionally bundles that package as a root/runtime dependency. External official plugins may be plugin-store installs rather than root app dependencies.5152## Workflow53541. Establish source and tags:55 - `git status -sb`56 - if clean and user asked for latest: fetch/pull the upstream default branch with the repo-required workflow57 - record `git rev-parse HEAD`, `git rev-parse --short=10 HEAD`, and `node -p "require('./package.json').version"`58 - determine and reuse the repository's existing snapshot/release tag convention; do not invent one.592. Inspect docs and plugin packages:60 - `docs/install/docker.md`61 - `Dockerfile`62 - `extensions/<plugin>/package.json`63 - for source-bundled plugin images, verify OpenClaw and each default/requested plugin package report the same intended version from the same checkout.64 - use `npm view @openclaw/<plugin> version dist.tarball --json` only for images that intentionally install external npm plugin packages.653. Build and push arch-specific tags first:66 - `<baseTag>-amd64`67 - `<baseTag>-arm64`684. Create multi-arch tags with `docker buildx imagetools create`.695. Verify GHCR:70 - manifest digest and platforms;71 - package visibility;72 - expected tag set.736. Pull-run verify each requested platform:74 - OpenClaw version;75 - default/requested plugin discovery and runtime inspect output;76 - package manifests in plugin store when external npm plugins are requested;77 - packaged manifests, entrypoints, and runtime dependencies when source-bundled plugins are requested;78 - `/healthz` returns HTTP 200;79 - offline `--network none` startup succeeds after the image has been pulled.807. Secret-scan:81 - container environment names only, never values;82 - `docker history --no-trunc` keyword count.838. Run focused package, Docker, typecheck, and integration tests that cover changed packaging behavior, including packaged inventory, manifests, entrypoints, runtime dependencies, version metadata, no manual diagnostics install, and offline plugin discovery. Do not hide unrelated failures; distinguish pre-existing failures from regressions.849. Report source branch and exact commit, chosen version, plugin versions, changed files, bundling mechanism, Docker build command, registry destination, pushed tag and immutable digest, local/remote digest comparison, exact verification and test commands with results, offline-start proof, caveats, secret-scan result, and worktree status.8586## References8788Read `./references/workflow.md` before building or republishing an image. It contains command templates for the runtime assembly fallback, manifest creation, plugin verification, and secret checks.