Repository navigation
feat(plugins): skill authoring runtime for plugins that own an agent skills folder - #190983
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds 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".
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin 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]
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +438, Tests +889, Docs +50, Config +7, Other +2. Total +1386 across 26 files. Added test files: 3. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 2, 2026, 8:19 AM ET / 13:19 UTC (Revision 4). |
c72b623 to
73a8173
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed as 5937314. Bundled plugins can now read, validate, scan and commit skills in their own manifest |
…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]>
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_changeddispatch, 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
src/skills/lifecycle/skill-authoring.ts, composes the existing guard, scan, frontmatter andskill_changedowners; Workshop now calls it instead of each piece (−112 lines inlibrary.ts). The per-agent skills-root layout has one owner shared with discovery.commitSkillChangetaking{ config, agentId, skillName, … }. The host resolves the root from the calling plugin's own manifestagentSkillsDir; 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.commitSkillChangeapplies the change, refreshes discovery, then dispatchesskill_changedonce; a failed apply dispatches nothing.skill_changed.sourcegains"plugin"and an optional host-filledpluginId; plugin commits refresh with the existing"manual"reason. No schema or protocol change.Evidence
73a81731993e, sanitized):../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.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_changedfires once withsource: "plugin",pluginId;../other-skills/...refused withpath_escapeand the other plugin's folder is never created; plugin withoutagentSkillsDirrefused; plugin disabled during a waiting write → refused, no file, no hook (fails without the guard).prefix-stability.mtssnapshots, 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.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:diffadditive only.