Skip to content

feat(plugins): skill authoring runtime for plugins that own an agent skills folder - #190983

Merged
obviyus merged 3 commits into
mainfrom
seam/skill-authoring-runtime
Nov 2, 2026
Merged

obviyus merged 3 commits into
mainfrom
seam/skill-authoring-runtime

Conversation

@obviyus

@obviyus obviyus commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Plugins that declare agentSkillsDir (Skill Workshop's learned skills, and any memory or team-skills plugin) have no supported way to read, validate, security-scan and commit skills in their own folder. Skill Workshop does it through core internals (workspace skill write guards, frontmatter, bundle scan, skill_changed dispatch, discovery refresh), which blocks moving it into its bundled plugin.

User Impact

No user-visible change: Workshop skill writes, scans, errors and refresh timing are unchanged. Bundled plugins gain the private SDK subpath openclaw/plugin-sdk/skill-authoring-runtime.

Why This Change Was Made

  • One core owner, src/skills/lifecycle/skill-authoring.ts, composes the existing guard, scan, frontmatter and skill_changed owners; Workshop now calls it instead of each piece (−112 lines in library.ts). The per-agent skills-root layout has one owner shared with discovery.
  • The SDK subpath (private-local-only) exposes read/list/validate/write/remove/commitSkillChange taking { config, agentId, skillName, … }. The host resolves the root from the calling plugin's own manifest agentSkillsDir; a plugin cannot pass a root or folder name, and a plugin without one is refused (no_skills_root). Confinement and the security scan are enforced by core.
  • commitSkillChange applies the change, refreshes discovery, then dispatches skill_changed once; a failed apply dispatches nothing.
  • Live plugin authority: captured host-side from the invocation scope, checked after each awaited step and immediately before each write, delete and the dispatch.
  • Additive public changes: skill_changed.source gains "plugin" and an optional host-filled pluginId; plugin commits refresh with the existing "manual" reason. No schema or protocol change.

Evidence

  • Authority final-effect trace (executed on 73a81731993e, sanitized):
    # allowed (Gateway e2e, real loader)
    ✓ gateway-skill-authoring-plugin.e2e > lets a loaded plugin author a skill that the next turn discovers, refusing an escape and a revoked write
      plugin write → SKILL.md created → next turn lists skill → skill_changed x1 {source:"plugin", pluginId:"<fixture>"}
    # revoked during filesystem preparation (real PluginInstance owner)
    ✓ skill-authoring.test > commits nothing when the owning plugin is revoked during filesystem preparation
      trace: authority:captured → prepare:skill-dir → owner:revoked → refused (PluginInstanceUnavailableError)
      SKILL.md exists: false · skill_changed events: 0
    
    With the final-effect guard disabled, the revoked case commits the write and the test fails.
  • Validator now applies the write path contract (../escape.md, notes.md → invalid_path); Workshop records its change after discovery refresh again (base order), with a regression where a failed change-log write still refreshes and fires no hook.
  • New Gateway e2e src/gateway/gateway-skill-authoring-plugin.e2e.test.ts (four plugins via the real loader): plugin writes a skill and the next turn lists it; skill_changed fires once with source: "plugin", pluginId; ../other-skills/... refused with path_escape and the other plugin's folder is never created; plugin without agentSkillsDir refused; plugin disabled during a waiting write → refused, no file, no hook (fails without the guard).
  • Prompt cache (prefix-stability.mts snapshots, plugin commit vs core Workshop commit): within the write turn the prefix only appends; next turn keeps tools, cache key and history identical, and the system prompt differs only by the new skill's <skill> entry — the same shape and timing for both writers.
  • Workshop behavior pin, assertions unchanged: 6 unit contract suites 65/65; 3 e2e contract suites 17/17 (+ seam and skill-refresh e2e: 19/19).
  • Siblings 999 passed, 1 skipped (69 files).
  • tsgo:core, tsgo:core:test, tsgo:extensions, plugin-sdk:check-exports, plugin-sdk:surface:check, all baseline ratchets, line-cap, source contracts pass; plugin-sdk:api:diff additive only.

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts extensions: xai size: XL labels Nov 2, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds a manifest-bound skill-authoring SDK runtime and moves Workshop’s shared authoring operations into one core owner.

Example: A plugin declaring agentSkillsDir: "proof-skills" creates the skill "proof-learned".

  • Before: The plugin needs core internals to validate, write, refresh discovery, and notify observers.
  • After: The SDK writes proof-skills/proof-learned/SKILL.md, exposes it on the next turn, and emits skill_changed with the calling plugin’s identity.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful and coherent, with no open finding; authority proof is sufficient, while validation remains production-path harness evidence rather than an independent deployed run.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (logs): The supplied exact-head traces exercise the real Gateway loader and authoring owners on an isolated filesystem, covering allowed creation, next-turn discovery, foreign-root refusal, missing-root refusal, and revocation before the final write; the inspected negative-control scenario fails when that guard is disabled.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Plugins owning learned-skill folders cannot use supported host operations to author skills with the same safety and refresh behavior as Workshop.
Reason: The collaborator-authored direction supplies the missing generic seam anticipated by the earlier Workshop extraction, with naming and versioning remaining caller-owned.

Merge readiness

✅ Ready for maintainer review

This PR provides a useful, owner-directed plugin capability that current main lacks; both earlier findings are fixed, and no new actionable defect was found.

Priority: P2
Reviewed head: 73a81731993ee8976718efebed4de91956edcc06

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin invocations supply an agent, skill name, and content; the host binds the manifest-owned folder and live plugin authority, then uses existing filesystem, scanning, discovery, and hook owners.

flowchart TD
  A[Plugin invocation] --> B[Manifest and live authority]
  B --> C[Shared skill authoring]
  C --> D[Validation and security scan]
  D --> E[Confined filesystem operation]
  E --> F[Discovery refresh]
  F --> G[Skill changed observers]
Loading

Technical review

Best possible solution:

Keep one shared authoring owner behind the manifest-bound private SDK while preserving Workshop’s existing policy and storage layout.

Do we have a high-confidence way to reproduce the issue?

This is a capability addition; current main exposes discovery for manifest-owned skill folders but lacks the proposed supported authoring runtime.

Is this the best way to solve the issue?

The extraction follows existing owners for filesystem admission, scanning, discovery, and hooks, and migrates Workshop callers without adding a competing persistence or policy owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 75be4d0f9332.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +438, Tests +889, Docs +50, Config +7, Other +2. Total +1386 across 26 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 16 694 256 +438
Tests 3 889 0 +889
Docs 3 50 0 +50
Config 2 8 1 +7
Generated 0 0 0 0
Other 2 2 0 +2
Total 26 1643 257 +1386

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: A useful plugin capability and Workshop ownership improvement without an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: Adds a private SDK subpath and expands skill_changed.source; the collaborator-authored direction accepts this additive contract expansion without removing existing values.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-02T08:54:07.332Z sha c72b623 :: needs real behavior proof before merge. :: [P2] Validate support-path syntax in the exported validator | [P2] Preserve discovery refresh when change-log recording fails
  • reviewed 2026-11-02T10:50:18.816Z sha 73a8173 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-02T13:11:58.272Z sha 73a8173 :: needs maintainer review before merge. :: none

Reviewed November 2, 2026, 8:19 AM ET / 13:19 UTC (Revision 4).

@obviyus
obviyus force-pushed the seam/skill-authoring-runtime branch from c72b623 to 73a8173 Compare November 2, 2026 10:44
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 2, 2026
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 2, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 2, 2026
@obviyus
obviyus merged commit 5937314 into main Nov 2, 2026
276 checks passed
@obviyus
obviyus deleted the seam/skill-authoring-runtime branch November 2, 2026 14:25
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 5937314. Bundled plugins can now read, validate, scan and commit skills in their own manifest agentSkillsDir through openclaw/plugin-sdk/skill-authoring-runtime. Core Workshop uses the same owner. Proof: Gateway e2e with four real-loader plugins (allowed write, next-turn discovery, path escape, missing root, revoked write), the executed authority trace, prompt-cache refresh parity with core Workshop, and the Workshop contract suites with unchanged assertions.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
…skills folder (openclaw#190983)

## What Problem This Solves

Plugins that declare `agentSkillsDir` (Skill Workshop's learned skills, and any memory or team-skills plugin) have no supported way to read, validate, security-scan and commit skills in their own folder. Skill Workshop does it through core internals (workspace skill write guards, frontmatter, bundle scan, `skill_changed` dispatch, discovery refresh), which blocks moving it into its bundled plugin.

## User Impact

No user-visible change: Workshop skill writes, scans, errors and refresh timing are unchanged. Bundled plugins gain the private SDK subpath `openclaw/plugin-sdk/skill-authoring-runtime`.

## Why This Change Was Made

- One core owner, `src/skills/lifecycle/skill-authoring.ts`, composes the existing guard, scan, frontmatter and `skill_changed` owners; Workshop now calls it instead of each piece (−112 lines in `library.ts`). The per-agent skills-root layout has one owner shared with discovery.
- The SDK subpath (private-local-only) exposes read/list/validate/write/remove/`commitSkillChange` taking `{ config, agentId, skillName, … }`. The host resolves the root from the calling plugin's own manifest `agentSkillsDir`; a plugin cannot pass a root or folder name, and a plugin without one is refused (`no_skills_root`). Confinement and the security scan are enforced by core.
- `commitSkillChange` applies the change, refreshes discovery, then dispatches `skill_changed` once; a failed apply dispatches nothing.
- Live plugin authority: captured host-side from the invocation scope, checked after each awaited step and immediately before each write, delete and the dispatch.
- Additive public changes: `skill_changed.source` gains `"plugin"` and an optional host-filled `pluginId`; plugin commits refresh with the existing `"manual"` reason. No schema or protocol change.

## Evidence

- Authority final-effect trace (executed on `73a81731993e`, sanitized):
  ```
  # allowed (Gateway e2e, real loader)
  ✓ gateway-skill-authoring-plugin.e2e > lets a loaded plugin author a skill that the next turn discovers, refusing an escape and a revoked write
    plugin write → SKILL.md created → next turn lists skill → skill_changed x1 {source:"plugin", pluginId:"<fixture>"}
  # revoked during filesystem preparation (real PluginInstance owner)
  ✓ skill-authoring.test > commits nothing when the owning plugin is revoked during filesystem preparation
    trace: authority:captured → prepare:skill-dir → owner:revoked → refused (PluginInstanceUnavailableError)
    SKILL.md exists: false · skill_changed events: 0
  ```
  With the final-effect guard disabled, the revoked case commits the write and the test fails.
- Validator now applies the write path contract (`../escape.md`, `notes.md` → `invalid_path`); Workshop records its change after discovery refresh again (base order), with a regression where a failed change-log write still refreshes and fires no hook.
- New Gateway e2e `src/gateway/gateway-skill-authoring-plugin.e2e.test.ts` (four plugins via the real loader): plugin writes a skill and the next turn lists it; `skill_changed` fires once with `source: "plugin"`, `pluginId`; `../other-skills/...` refused with `path_escape` and the other plugin's folder is never created; plugin without `agentSkillsDir` refused; plugin disabled during a waiting write → refused, no file, no hook (fails without the guard).
- Prompt cache (`prefix-stability.mts` snapshots, plugin commit vs core Workshop commit): within the write turn the prefix only appends; next turn keeps tools, cache key and history identical, and the system prompt differs only by the new skill's `<skill>` entry — the same shape and timing for both writers.
- Workshop behavior pin, assertions unchanged: 6 unit contract suites 65/65; 3 e2e contract suites 17/17 (+ seam and skill-refresh e2e: 19/19).
- Siblings 999 passed, 1 skipped (69 files).
- `tsgo:core`, `tsgo:core:test`, `tsgo:extensions`, `plugin-sdk:check-exports`, `plugin-sdk:surface:check`, all baseline ratchets, line-cap, source contracts pass; `plugin-sdk:api:diff` additive only.

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

Labels

docs Improvements or additions to documentation extensions: xai gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant