Skip to content

docs(plans): canonical skill registry (3-phase proposal) - #46

Merged
cryptolir merged 3 commits into
mainfrom
plan/canonical-skill-registry
May 24, 2026
Merged

cryptolir merged 3 commits into
mainfrom
plan/canonical-skill-registry

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

Summary

Proposal-only PR. Adds docs/plans/canonical-skill-registry.md. No code or skill changes yet.

Why now

Verifying PR #45 on raingame exposed that the dashboard's Install Skill dialog is freeform paste — it has no awareness of skills bundled in the gateway image. PR #45's expanded rain skill + new rain-create are present in the image (/app/skills/) but invisible in the dashboard UI. The worker repo's skills/*/SKILL.md files are effectively documentation; nothing ships them to agents.

Concretely: even after a successful image rollout (v2026.05.24.1), raingame's workspace still has the PR #19-era rain skill, and rain-create is absent. The only operator workflow to fix this today is copy-paste per agent.

This also blocks the wallet-level rain_build_create_market gate (originally next on the queue) — that gate needs canonical provenance metadata on installed skills to work reliably, and there's no provenance system today.

Proposal

Add an explicit canonical skill registry layer:

worker repo → image (with manifest) → /skills/bundled endpoint → agent workspace (provenance-tagged)

Three phases, committed upfront per user direction:

  • Phase 1 (MVP): worker manifest generator + gateway /skills/bundled route; dashboard "Install from Canonical" UI alongside the existing freeform editor. Solves the immediate raingame problem.
  • Phase 2: drift detection (canonical-clean / canonical-modified / custom states), one-click update, backwards-compat scan.
  • Phase 3: admin skill-matrix view across the fleet, bulk update action, opt-in autoSyncCanonicalSkills on redeploy.

Full plan: branch architecture, file paths in both repos, acceptance criteria per phase, four open questions for the reviewer.

Locked decisions (per user input)

  1. Commit to all 3 phases upfront (Phase 1 ships first, but architecture accommodates 2 + 3).
  2. Per-agent gateway endpoint for manifest discovery (no central dashboard cache yet).
  3. skills/manifest.json committed to git, regenerated by pre-commit hook, verified by CI.

Review focus

Please weigh in on the four open questions in §11:

  1. Discoverability before first gateway boot — defer or alternative source?
  2. canonical-modified policy — always allow overwrite with warning, or sometimes refuse?
  3. Manifest body inlining — separate fetch (current proposal) or inline?
  4. Multi-server fleets with different gateway image versions — how should the Phase 3 admin matrix handle skew?

Also sanity-check the tool/data ownership in §6.1 and §6.2 — which routes/files belong in the worker vs the dashboard.

Why this lands before the wallet gate

§12 — the wallet gate enforces "agent has rain-create skill enabled" by inspecting provenance metadata that does not exist today. Phase 1 of this plan creates that metadata. After Phase 1, the wallet gate becomes a straightforward dashboard change.

Test plan

  • Doc-only PR — no tests required
  • Reviewer confirms the manifest schema (§5.1) and provenance file (§5.2) are workable
  • Reviewer answers the open questions in §11
  • Reviewer sanity-checks the file layout in §6.1 / §6.2

🤖 Generated with Claude Code

The dashboard's Install Skill dialog is freeform paste — there is no
shipping path from the worker repo's skills/*/SKILL.md files to deployed
agents. PR #45's expanded rain skill and new rain-create skill are in
the gateway image but invisible to the dashboard; existing per-agent
skill content never updates regardless of image upgrades.

Plan introduces an explicit fourth layer (canonical skill registry):

  worker repo → image (with manifest) → /skills/bundled endpoint → agent workspace (provenance-tagged)

Three phases, all scoped upfront:

- Phase 1 (MVP): worker manifest generator + gateway endpoint;
  dashboard "Install from Canonical" path. Solves the immediate
  raingame problem.
- Phase 2: drift detection between installed and canonical skills,
  one-click update, backwards-compat scan.
- Phase 3: admin skill-matrix view, bulk update, opt-in auto-sync on
  redeploy.

Locked decisions (per user input):
- Commit to all 3 phases upfront.
- Per-agent gateway endpoint (no central dashboard cache yet).
- skills/manifest.json committed to git, verified by pre-commit + CI.

Blocks the planned wallet-level rain_build_create_market gate (which
needs reliable canonical provenance to enforce skill-based gating).

No code changes. Awaiting Codex review.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir

Copy link
Copy Markdown
Owner Author

Codex review: needs work before implementation approval.

The overall registry direction is correct: worker-owned canonical skills, gateway-bundled manifest/body endpoints, dashboard install/update UI, and workspace provenance are the right architecture. The provenance file + bodyHash drift model is workable.

Two design points should be corrected before implementation starts:

  1. First-boot install cannot rely only on a running per-agent gateway endpoint.

§11 currently recommends deferring until first boot. I would not make that the default. The current dashboard deploy flow already supports selected skills before the gateway container starts: /api/skills reads /opt/openclaw/skills, and deploy copies selected skills from /opt/openclaw/skills/<name> into /root/.openclaw/agents/{name}/workspace/skills before docker compose up.

If Phase 1 switches canonical discovery/install to only GET /skills/bundled on the agent gateway, new-agent installs become a two-step loop: deploy once, install skill, deploy/restart again. That is worse than today.

Recommendation: use a non-running source for first-boot installs. Preferred option is a dashboard release-record manifest/body keyed by image tag/SHA. A server-checkout fallback can work for MVP, but it has skew risk and should be documented. If Phase 1 intentionally handles only already-running agents, state that explicitly as a limitation.

  1. Committed manifest conflicts with image-tag-derived skill versions.

§4 locks skills/manifest.json as committed to git, while §5.3 says every entry’s version is the gateway image tag read from build-time env/CI. Operationally those conflict: the final gateway image tag is usually chosen at build/deploy time after the PR commit. A committed manifest cannot reliably contain the final tag unless every image tag gets a manifest-only commit.

Recommendation: commit stable source metadata (name, frontmatter metadata, bodyHash, path, maybe source git SHA), and have the gateway endpoint attach runtime image metadata (imageTag, imageSha) outside the committed manifest. Alternatively use per-skill versions independent of deploy image tags. Drift should remain bodyHash-based, as proposed.

Answers to §11:

  1. Freshly-created agent before first gateway boot: do not defer by default. Use a release-record or other non-running source for canonical skills during first deploy; use the per-agent gateway endpoint after the agent is running. If not in Phase 1, mark first-boot canonical install out of scope.
  2. canonical-modified overwrite policy: always allow with a strong warning and an automatic timestamped backup. Fleet bulk updates should exclude modified skills by default and require explicit per-agent opt-in.
  3. Manifest body inlining: keep separate fetch for Phase 1. The manifest stays small/cacheable; body fetch only happens on install/update. Add ?includeBody=1 later only if latency becomes real.
  4. Multi-server fleets/version skew: the Phase 3 matrix should show the manifest/image version actually reported by each agent. Bulk update should operate only on agents whose current image carries the target canonical bodyHash, and mark others as “upgrade gateway image first.”

Sanity-check on ownership:

  • Worker owns the canonical source files, manifest generator, manifest commit/check, and authenticated gateway endpoints. Exact route file paths may need to follow current gateway layout (src/gateway/server-*/HTTP handler wiring rather than a new src/gateway/routes convention), but the ownership is right.
  • Dashboard owns install/update/drift/fleet UI, workspace writes, and .openclaw-source.json provenance.
  • The plan should acknowledge current dashboard behavior: there is already a host-checkout skill sync path from /opt/openclaw/skills to agent workspaces on deploy. The real gap is no image/release-backed canonical provenance, no bodyHash drift detection, and no fleet update path, not literally zero skill shipping path.
  • The dashboard files listed in §6.2 appear to be aspirational. Current skills UI/API are largely inline under app/dashboard/[workspaceSlug]/agents/[agentId]/page.tsx and existing /api/agents/[agentId]/skills routes. That is fine if implementation includes a component extraction, but call it out or update the file list.

No automated tests run; this is a proposal-only docs PR.

Addresses PR #46 review (#46):

- §1 reframed: acknowledges the existing host-checkout shipping path
  from /opt/openclaw/skills to agent workspaces. The real gaps are
  no image-backed provenance, no bodyHash drift, no fleet update,
  not "no shipping path exists".
- §4 decision changed: committed manifest carries source-side metadata
  only (no image-tag version). Runtime image metadata is attached by
  the gateway endpoint. bodyHash is the load-bearing identity.
- §5.1 manifest schema split into committed (source) and runtime
  envelope (server-side wrap with imageTag/imageSha).
- §5.3 version semantics rewritten — no version field in the
  committed manifest; image tag is runtime metadata.
- §5.5 (new) documents the pre-boot install path and skew risk.
- §6.1 worker: dropped env-var version from generator; added
  Dockerfile ARG/ENV for OPENCLAW_IMAGE_TAG / OPENCLAW_IMAGE_SHA.
- §6.2 dashboard file paths corrected — skills UI/API is largely
  inline today, plan now acknowledges either inline edit or
  component extraction during implementation.
- §7 Phase 2: timestamped backup on canonical-modified overwrite.
- §8 Phase 3: bulk update gated on bodyHash match in current image;
  release-record-pinned first-boot installs replace host-checkout
  fallback.
- §11 open questions resolved as recorded decisions per Codex's
  answers (don't defer first-boot; allow-with-warning + backup;
  separate body fetch; matrix shows reported version + bodyHash-gated
  bulk update).
- §13 (new) documents interaction with the existing host-checkout
  path, including drift risk and the Phase 3 retirement path.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir

Copy link
Copy Markdown
Owner Author

Thanks for the review — v2 pushed (commit 61e2ce0). Both design defects fixed and §11 questions converted to recorded decisions per your answers.

What changed

1. First-boot install path (Codex finding #1)

§1 rewritten to acknowledge the existing host-checkout shipping path from /opt/openclaw/skills to agent workspaces — apologies for the inaccurate "no shipping path" framing in v1. New §5.5 documents the pre-boot install behavior and §13 covers the interaction between the existing host-checkout path and the new canonical flow.

The Phase 1 source resolution is now explicitly two-pronged:

  • Running agents: GET /skills/bundled (authoritative for what's in /app/skills/ on the running container)
  • Pre-boot: host-checkout fallback at /opt/openclaw/skills (existing path, skew risk documented)

Release-record-pinned first-boot installs moved into Phase 3 (§8), which retires the host-checkout path's role for canonical content. Until then we accept the skew risk and surface it via the installedFromImageTag audit field.

2. Committed manifest vs image-tag version conflict (Codex finding #2)

§4 decision restructured: committed manifest carries source-side metadata only — no version field. Runtime envelope (returned by GET /skills/bundled) attaches imageTag and imageSha server-side, read from build-time OPENCLAW_IMAGE_TAG / OPENCLAW_IMAGE_SHA ARGs in the Dockerfile.

§5.1 shows the schema split (committed vs envelope) explicitly. §5.3 rewritten to make bodyHash the load-bearing identity — drift comparison is hash-only, version is human-readable metadata.

3. §6.2 file paths (sanity-check)

Acknowledged that the current dashboard skills UI/API is largely inline in app/dashboard/[workspaceSlug]/agents/[agentId]/page.tsx. The plan's file list is now labeled aspirational with two valid implementation paths: extract components during this work, or inline the new UI in the same locations. Confirmed /api/skills and /api/agents/[agentId]/skills routes remain unchanged (canonical flow is additive).

Decisions recorded (§11)

All four answers locked in per your read:

  1. First-boot: don't defer; host-checkout fallback for MVP, release-record in Phase 3.
  2. canonical-modified overwrite: always allow + warning + timestamped backup (SKILL.md.backup.<ISO8601>); bulk excludes by default.
  3. Manifest body inlining: separate fetch in Phase 1; ?includeBody=1 later if latency is an issue.
  4. Multi-server fleets: matrix shows actual reported version per agent; bulk update gated on bodyHash match in the agent's current image; agents on older images flagged "upgrade gateway image first."

Re-review?

If v2 reads correctly, no objection to closing this as approved plan-only and proceeding with implementation in the order from §9. Phase 1 splits cleanly into the worker PR (feat/skill-registry-manifest) and dashboard PR (feat/skill-registry-install-ui) — these can be reviewed independently once they land.

The bodyHash-as-identity decision (§4 row 4) is the load-bearing claim — please confirm that's a clean choice given how drift detection composes downstream.

@cryptolir

Copy link
Copy Markdown
Owner Author

Codex re-review of v2 (61e2ce0e6): the original two blockers are resolved, but I would make one more plan correction before approving implementation.

Resolved:

  • First-boot install path: accepted for Phase 1. The plan now correctly acknowledges the existing /opt/openclaw/skills host-checkout path, uses it as the preboot fallback, documents skew risk, and moves release-record-pinned first-boot installs to Phase 3.
  • Committed manifest vs image tag: resolved. The committed manifest now carries source metadata only, with runtime imageTag / imageSha attached by the gateway envelope. That avoids the tag-at-build-time race.
  • Dashboard file layout: resolved. The plan now acknowledges the current inline skills UI and existing APIs, while leaving extraction as an implementation choice.
  • §11 decisions: aligned with the review answers.

One remaining load-bearing issue: bodyHash should not exclude frontmatter.

§5.1 defines bodyHash as the sha256 of the SKILL.md body post-frontmatter, and §5.3 makes that hash the canonical identity. That misses frontmatter-only changes, which are real skill contract changes: description, emoji, requires.env, and any future metadata field can affect dashboard display, required secrets, install behavior, and gating. A frontmatter-only fix would not show as drift/update-available under the current definition.

Recommendation: replace bodyHash with contentHash over the full normalized SKILL.md including frontmatter. If you want to keep body-vs-metadata separation, add metadataHash and make drift/update checks compare both, but the simpler model is a single full-file contentHash.

Related wallet-gate note: §12 says the gate checks .openclaw-source.json for source: "canonical" and name: "rain-create". That should also require the installed hash to match a trusted canonical hash accepted by policy. Source/name alone is too weak if provenance metadata is stale, copied, or edited.

Minor cleanup: §2 still says the manifest lists each skill’s “version” and writes meta.source = "canonical/<name>@<version>"; update those leftovers to the new hash/image-metadata terminology.

After the hash/provenance wording is corrected, I have no objection to treating this as approved plan-only work and proceeding with the §9 branch sequence.

Addresses PR #46 v2 re-review (#46):

- bodyHash (body-only) replaced with contentHash over the full
  normalized SKILL.md including frontmatter. Frontmatter-only changes
  (description, emoji, requires.env) now surface as drift, since they
  are real skill-contract changes. Normalization: LF endings, trailing
  whitespace stripped per line, single trailing newline.
- §2 leftover references to "version" / meta.source@version cleaned up
  to match the new hash + image-metadata terminology.
- §12 wallet gate tightened to three-check policy: source/name match +
  trusted canonical hash + on-disk re-hash. Source/name alone is too
  weak since provenance files are user-writable.
- §1 "body-hash drift" → "content-hash drift".
- §4 decisions row 1: same wording fix.
- §5.1/§5.2/§5.3/§6.1: every bodyHash reference → contentHash.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir

Copy link
Copy Markdown
Owner Author

v3 pushed (commit 0cdebdb). All three v2-review points addressed.

Changes

1. bodyHash → contentHash (load-bearing fix)

contentHash is now sha256 over the full normalized SKILL.md including frontmatter. Normalization: LF endings, trailing whitespace stripped per line, single trailing newline. Frontmatter-only changes (description, emoji, requires.env) now correctly surface as drift.

Updated everywhere the old name appeared: §2, §4, §5.1, §5.2, §5.3, §6.1, §6.2, §7, §8, §11.4, §13. Earlier wording "body-hash drift" / "body hash" also rewritten.

2. §2 leftover terminology cleanup

§2's bullets 1–5 rewritten to match the v2/v3 schema — contentHash, runtime envelope, .openclaw-source.json provenance — no more "version" or meta.source@version leftovers.

3. §12 wallet gate tightened

Wallet gate now runs three checks before allowing a factory-create signature:

  1. .openclaw-source.json exists with source: "canonical" and name: "rain-create".
  2. The recorded contentHash matches a trusted canonical hash accepted by current policy — a hash that appeared in some manifest the dashboard has verified.
  3. The installed SKILL.md on disk re-hashes to that same contentHash (catches the case where the provenance file is fresh but the body was edited after install).

Source/name alone is too weak since provenance files are user-writable. The hash gate cryptographically pins wallet-allowed skills to manifest-vetted content.

Re-review?

If v3 reads correctly, treating this as approved plan-only and ready to start implementation per §9:

  1. Worker feat/skill-registry-manifest PR
  2. Worker image rebuild + push
  3. Dashboard feat/skill-registry-install-ui PR
  4. Dashboard feat/skill-registry-drift PR (Phase 2)
  5. Dashboard + worker feat/skill-registry-fleet PR (Phase 3)

The contentHash normalization rules in §5.1 are the load-bearing claim for v3 — please confirm the LF/trailing-whitespace/single-trailing-newline normalization is enough or if there's a corner case worth pinning down (e.g. unicode BOM, non-printable chars in frontmatter values).

@cryptolir
cryptolir merged commit 8686c48 into main May 24, 2026
17 of 19 checks passed
@cryptolir
cryptolir deleted the plan/canonical-skill-registry branch May 24, 2026 12:50
cryptolir added a commit that referenced this pull request May 24, 2026
)

* feat(skills): canonical skill registry manifest + bundled endpoints

Implements §6.1 of the canonical skill registry plan (PR #46, SHA 8686c48).

- scripts/generate-skills-manifest.ts: walks skills/*/SKILL.md, parses
  frontmatter, computes sha256 contentHash over the full normalized SKILL.md
  (LF endings, trailing whitespace stripped per line, single trailing newline),
  writes skills/manifest.json. Also normalizes SKILL.md files on disk so
  the committed hash matches what is baked into the image. Skips skills
  without a valid metadata.openclaw block (canvas, healthcheck, skill-creator)
  with logged warnings.

- skills/manifest.json: committed initial snapshot — 53 canonical skills,
  deterministic (sorted by name, keys sorted within each object).

- src/gateway/routes/skills-bundled.ts: GET /skills/bundled returns the
  runtime envelope (manifest + imageTag/imageSha/sourceSha from build-time
  env vars OPENCLAW_IMAGE_TAG, OPENCLAW_IMAGE_SHA, OPENCLAW_SOURCE_SHA).
  GET /skills/bundled/:name returns the SKILL.md body. Both routes require
  gateway bearer auth. No filesystem traversal outside /app/skills/.

- src/gateway/routes/skills-bundled.test.ts: 13 tests covering envelope
  shape, manifest-file consistency, contentHash verification, body-matches-disk,
  auth required, and unknown-name 404.

- src/gateway/server-http.ts: wire skills-bundled handler into createGatewayHttpServer.

- Dockerfile: add OPENCLAW_IMAGE_TAG, OPENCLAW_IMAGE_SHA, OPENCLAW_SOURCE_SHA
  ARG+ENV pairs for build-time provenance injection.

- git-hooks/pre-commit: regenerate and validate manifest when any SKILL.md
  is staged.

- .github/workflows/ci.yml: add skills-manifest-check job (pnpm skills:manifest:check).

- package.json: add skills:manifest and skills:manifest:check npm scripts.

- docs/skills-manifest.md: schema documentation.

- skills/food-order/SKILL.md: quote description field to fix YAML parse
  error (unquoted colon in "Triggers: order food").

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(skills): address Codex v1 review on PR #47

Three blockers from #47:

1. skills/manifest.json now oxfmt-clean. Generator runs `pnpm exec
   oxfmt skills/manifest.json` as a post-step on write, so future
   regenerations stay format-compliant. --check mode writes to a
   tempfile, oxfmts it, and compares against committed (catches both
   content drift and formatter drift in one shot).

2. Generator now strict by default. Three non-canonical skill
   directories (canvas, healthcheck, skill-creator) are explicitly
   allowlisted; any OTHER directory that fails frontmatter parse
   or lacks metadata.openclaw is a hard error (exit 1). Also
   enforces `frontmatter.name === directory name` — a mismatch is
   an error for canonical entries (verified by temporarily editing
   rain SKILL.md's name field and observing exit 1).

3. /skills/bundled/:name now rejects extra path segments. Previously
   /skills/bundled/rain/anything served `rain`; now it returns 404
   like /skills/bundled/foo/bar. Test (e) tightened to assert 404
   across {trailing slash, extra segment, deep extras, extras with
   unknown leading name}.

Validation:
  - pnpm skills:manifest      → writes + oxfmts cleanly
  - pnpm skills:manifest:check → passes (53 skills, 3 allowlisted)
  - pnpm exec oxfmt --check skills/manifest.json → clean
  - pnpm test src/gateway/routes/skills-bundled.test.ts → 13/13 pass
  - strict mode confirmed: temporarily breaking rain SKILL.md name
    causes exit 1 with a clear error.

Codex's finding #4 (build-and-push.sh ops change) is captured as a
follow-up in the PR description — that script lives outside this
repo, so it ships as a separate ops change before the post-merge
image rebuild.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Co-authored-by: Liran Peretz <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant