Repository navigation
feat(skills): review background learning as drafts with Skill Workshop propose mode - #181747
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesAdds Propose mode with reviewable skill drafts, Control UI Apply and Discard actions, chat review, and recovery of earlier proposal exports. Example: A background review proposes changing deploy from “make deploy” to “make ship”.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR restores a useful, maintainer-approved review workflow that current main lacks; no actionable introduced defect remains in the reviewed diff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSkill Workshop turns conversation experience into agent-local skill instructions; this change stages background suggestions for review before the existing versioned library publishes them. flowchart TD
A[Conversation experience] --> B[Background review]
B --> C[Agent draft inbox]
D[Doctor proposal recovery] --> C
C --> E[Control UI or chat review]
E --> F[Versioned skill library]
F --> G[Skill discovery and Undo]
Technical reviewBest possible solution: Land the approved draft workflow with the existing versioning, Undo, authorization, and Doctor recovery owners. Do we have a high-confidence way to reproduce the issue? Current main accepts only Off and Auto, confirming that background learning cannot currently stage reviewable drafts. Is this the best way to solve the issue? The implementation uses one draft owner and the existing versioned publication path, restoring review without rebuilding the retired proposal database and approval machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c7cfa1f9971d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +871, Tests +395, Docs +52, Generated 0, Other +116. Total +1434 across 56 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 (11 earlier review cycles; latest 8 shown)
Reviewed October 26, 2026, 9:02 PM ET / October 27, 2026, 01:02 UTC (Revision 12). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@obviyus @nikosml answering the questions from #161057 here. Thank you @obviyus, both for the quick turnaround and for asking for our input before taking it further. That's very much appreciated. Doctor leaving propose alone and the old queue coming back as drafts already fixes the part that hurt most. To your questions, and please correct me if I've misread the draft: For me, the nicest part of the old propose was seeing each proposal and applying or rejecting it myself. We already do a fair bit of learning by hand in chat, so if drafts only live in a folder, I'm not sure I'd get much more out of it than from off. If drafts could show in the Control UI with Apply / Reject, even a plain list, that would bring back the bit I miss. I may well be missing something in how /learn drafts is meant to be used, though. |
|
Thank you for picking up on this, much appreciated! Re:
Maybe I m too conservative but I 'd still like to review the proposal for a draft. Don't feel strongly about it and with the undo functionality I could always tell my agent to review the change afterward. Since I initiated the /learn session I m there anyway. On the other hand. I m there to approve it if needed. And if it stays as draft I could leave it there to be considered for the next /learn session. Just some thoughts. I like the ability to streer the /learn command! Another thing I was doing when I was "manually" reviewing drafts was to group them per skill. If I read the proposal well it works on all waiting drafts. Especially for people on not best models this may yield suboptimal results. So at least an optional option like /learn -s some_skill_name steer_text where the harness would programmatically filter suggestions only for some_skill_name and the model would need to reason only for them, would be appreciated. |
…raft-mode # Conflicts: # docs/.generated/config-baseline.sha256
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in b073ac5. Propose mode is back: background reviews save drafts in Proof: real Gateway run (draft saved, Apply/Undo in the Control UI, authority revoked mid-apply refused, Thank you @diskawrs and @nikosml for the feedback that shaped this. Not in this PR: a per-agent mode (the mode is still global), and counting skill use from Claude CLI's native Skill tool. That second one is next on my list. @diskawrs, your offer to try it on your five-agent setup is very welcome once it ships. |
Regenerate the Control UI locale catalogs and metadata with ui:i18n:sync so build-artifacts no longer fails its catalog fallback baseline check. Keep all 21 locales at zero fallback keys and preserve existing translations. The drift follows English copy in #181747 (Workshop drafts and its config hint), #185263 (OAuth expiry), and #185292 (Side chat selections). Locale refresh run 40433199860 generated the updates but deferred publishing because generator inputs changed on main during publication. Validation: ui:i18n:check reproduced the baseline failure before generation and passed afterward; tsgo:ui passed; independent autoreview found no P0-P2 issues. Generated locale artifacts only: 694 additions, 211 removals.
…p propose mode (openclaw#181747) Related: openclaw#161057 (comment) (feedback from @nikosml and @diskawrs in openclaw#181747 (comment) and openclaw#181747 (comment)) ## What Problem This Solves Since openclaw#161057, background learning either changes skills on its own (`auto`) or does nothing (`off`). Users who reviewed proposals before they applied lost that workflow, and Doctor silently switched their `propose` config to `off`. ## User Impact User impact: set `skills.workshop.autonomous.mode` to `"propose"` (or pick **Propose** in the Control UI) and background reviews save drafts instead of changing skills. Review them either way: - **Control UI:** a **Drafts** list on the Skill workshop page. An update to a live skill opens as a diff against it; a new skill opens as its instructions, with its support files. **Apply** saves the draft through the normal versioned write (Undo works); **Discard** deletes it. - **Chat:** `/learn drafts` has the agent judge the waiting drafts together, propose what to keep, and **ask before saving**. Undecided drafts stay for later. `/learn drafts <skill> [focus]` reviews only that skill's drafts; the command picks them, not the model. Upgrades: - Configs that still say `mode: "propose"` keep working; Doctor no longer rewrites them to `"off"`. Legacy `autonomous.enabled: true` now maps to `"propose"`. - Proposals Doctor already exported to `workshop-skills/.archive/.retired-proposals/` move into `workshop-skills/.drafts/` on the next Doctor run; new exports go straight there. - Users already migrated to `"off"` must opt in again; Doctor cannot tell them apart from users who chose `"off"`. ## Why This Change Was Made - **Storage stays one plain folder.** A draft is `.drafts/<id>/SKILL.md` (plus support files and an optional `.reason`), the same shape Doctor already exported. No SQLite table, status, approval record or rollback. Saving or discarding a draft writes no change row. Applying one is a single locked, versioned Workshop mutation: every file is validated (including the security scan) first, then the whole next skill is built in a staging copy and swapped in by rename through `publishSkillBundle`, the same publish path `restore` now uses. A refused file or failed write leaves the live skill untouched; one change row and one snapshot mean one Undo restores the skill as it was before the draft. - **One owner.** `src/skills/workshop/drafts.ts` lists, saves, views, applies and discards drafts. The agent tool, the Gateway methods, `/learn drafts`, the CLI list and Doctor all go through it. - **Background review:** in `propose` mode the `skill_workshop` tool refuses a review's live writes and accepts `action=draft`. Reviews cannot discard drafts. At most 50 drafts wait per agent; past that, reviews save nothing new. - **`/learn drafts`:** the command lists drafts itself and passes the selected ids to the turn, so a weaker model reasons only over the chosen skill. With no matching drafts it answers without a model turn. **Protocol changes (additive, approved by @obviyus):** - `skills.workshop.list` result: `mode` gains `"propose"`; new optional `drafts: [{ id, skillName, summary, createdAtMs }]` (absent from older Gateways, which the UI treats as none). - `skills.workshop.read` params: optional `draftId`. - New methods `skills.workshop.applyDraft` / `skills.workshop.discardDraft` (`operator.admin`, since `2026.10`). They take the `skills.workshop.read` params with `draftId` required, so no new params schema or validator is added. Apply also refuses when `name` is not the draft's skill, so you can only apply the draft you reviewed. Both answer `SkillsWorkshopChangesResult`. The UI offers them only when the Gateway advertises them. - No native app consumes these; Swift/Kotlin protocol checks pass unchanged. **Update behavior:** Doctor's existing Skill Workshop final step also renames earlier exports (written by 2026.10.5–2026.10.7) into `.drafts/`. It never overwrites an existing draft: it keeps that export and records a recoverable warning, which does not block table retirement. It is skipped in update rehearsals, and nothing is deleted. ## Evidence - UI before/after (mock Control UI, synthetic data): openclaw#181747 (comment) (Drafts list, update diff, new-skill draft, applied with Undo) and the mode switch in openclaw#181747 (comment). - `src/skills/workshop/drafts.test.ts` (real filesystem): applying over a live skill is one `write_file` change that `restore` undoes; a multi-file draft is one change and one undo removes its support file and restores the instructions; a draft with a rejected support file changes nothing and stays in the inbox; a new-skill draft is one `create`; a draft identical to the live skill changes nothing and still leaves the inbox. A draft whose second file cannot be written leaves the live skill whole and records no change. A binary support asset (`assets/logo.png`) publishes byte for byte. The multi-file, rejected-file and failed-write cases fail on the previous per-file apply. - `src/agents/tools/skill-workshop-tool.test.ts`: in `propose` mode a review's `patch` is refused, `draft` saves, the live skill and change feed stay unchanged, the review cannot discard; a foreground run aborted after its `draft` or `discard` call has started (authority captured, still preparing) writes no draft and deletes nothing (the discard case fails without the final-effect authority check). - `src/auto-reply/reply/commands-learn.test.ts`: no drafts → reply without a model turn; `/learn drafts deploy …` selects only `deploy` drafts and keeps the focus; other text keeps all drafts; the prompt says not to save before the user answers. - `ui/src/pages/skill-workshop/skill-workshop-page.test.tsx`: an agent with no skills sees only its drafts on the Drafts tab; discarding the last draft outside Propose mode keeps the Drafts list open; the Drafts list opens a draft as a diff against the live skill, Apply calls `skills.workshop.applyDraft` and follows the skill to Active; the mode switch writes `"propose"`. - `src/gateway/server-methods/skills-workshop.test.ts`: `applyDraft` and `discardDraft` refuse a requester whose authority is gone, and the draft stays on disk. Both methods are `operator.admin` in the method descriptors, so `operator.read` callers are refused by the shared scope gate. - `packages/gateway-protocol/src/index.test.ts`: read params accept an optional `draftId` and reject an empty one; `src/skills/workshop/drafts.test.ts` refuses applying a draft under another skill's name. - `src/commands/doctor-skill-workshop-retire-proposals.test.ts`, `legacy-config-migrations.runtime.skills.test.ts`, `experience-review-scheduler.test.ts`, `src/gateway/server-methods/skills-workshop.test.ts`: export/move into `.drafts/`, config mapping, reviews still queue in `propose`, list includes drafts. - Local: the focused suites above pass; `tsgo:core`, `tsgo:ui` and `tsgo:scripts` pass; changed-file oxlint, `protocol-registry:check`, the protocol since guard, native protocol checks and `ui:i18n:verify` pass. Other UI locales get the new strings from the post-merge locale refresh. - **Real Gateway + upgrade proof:** openclaw#181747 (comment). A real background review (Claude Sonnet 5.5, propose mode) saved a draft and changed no skill. Apply and Undo worked through the real Control UI. Rotating the Gateway token during an apply refused it (`Gateway requester authority changed`): no live skill, draft kept, no change row. An `operator.read` client is refused both draft methods. 2026.10.4 → candidate and 2026.10.4 → 2026.10.7 → candidate upgrades keep every pending/quarantined proposal as a draft. - Hosted CI is green on the merged head. <details><summary>Simplify pass</summary> - **Generated churn removed:** a dedicated draft-params schema made the gateway validator generator renumber about 6,000 `check_N` functions in `predicates.js`. The draft methods now reuse the read params, and the generated diff is 6 lines. - **Removed:** the draft params schema, its validator and protocol test; the "+N more files" cap (draft files use the same Files-tab layout as live skills, which has no cap); separate apply/discard access flags (one `canReviewDrafts`). - **Kept on purpose:** the `.drafts/` folder as the only draft storage; the staged-swap publish shared with `restore`; the Doctor move of 2026.10.5–10.7 exports; the 50-draft cap. - **Whole-change delta vs `main`:** production +1055/-186, tests +427/-33, docs +114/-62, mock UI +119/-4, generated +6/-4. </details> Co-authored-by: Ayaan Zaidi <[email protected]>
Regenerate the Control UI locale catalogs and metadata with ui:i18n:sync so build-artifacts no longer fails its catalog fallback baseline check. Keep all 21 locales at zero fallback keys and preserve existing translations. The drift follows English copy in openclaw#181747 (Workshop drafts and its config hint), openclaw#185263 (OAuth expiry), and openclaw#185292 (Side chat selections). Locale refresh run 40433199860 generated the updates but deferred publishing because generator inputs changed on main during publication. Validation: ui:i18n:check reproduced the baseline failure before generation and passed afterward; tsgo:ui passed; independent autoreview found no P0-P2 issues. Generated locale artifacts only: 694 additions, 211 removals.


Related: #161057 (comment) (feedback from @nikosml and @diskawrs in #181747 (comment) and #181747 (comment))
What Problem This Solves
Since #161057, background learning either changes skills on its own (
auto) or does nothing (off). Users who reviewed proposals before they applied lost that workflow, and Doctor silently switched theirproposeconfig tooff.User Impact
User impact: set
skills.workshop.autonomous.modeto"propose"(or pick Propose in the Control UI) and background reviews save drafts instead of changing skills. Review them either way:/learn draftshas the agent judge the waiting drafts together, propose what to keep, and ask before saving. Undecided drafts stay for later./learn drafts <skill> [focus]reviews only that skill's drafts; the command picks them, not the model.Upgrades:
mode: "propose"keep working; Doctor no longer rewrites them to"off". Legacyautonomous.enabled: truenow maps to"propose".workshop-skills/.archive/.retired-proposals/move intoworkshop-skills/.drafts/on the next Doctor run; new exports go straight there."off"must opt in again; Doctor cannot tell them apart from users who chose"off".Why This Change Was Made
.drafts/<id>/SKILL.md(plus support files and an optional.reason), the same shape Doctor already exported. No SQLite table, status, approval record or rollback. Saving or discarding a draft writes no change row. Applying one is a single locked, versioned Workshop mutation: every file is validated (including the security scan) first, then the whole next skill is built in a staging copy and swapped in by rename throughpublishSkillBundle, the same publish pathrestorenow uses. A refused file or failed write leaves the live skill untouched; one change row and one snapshot mean one Undo restores the skill as it was before the draft.src/skills/workshop/drafts.tslists, saves, views, applies and discards drafts. The agent tool, the Gateway methods,/learn drafts, the CLI list and Doctor all go through it.proposemode theskill_workshoptool refuses a review's live writes and acceptsaction=draft. Reviews cannot discard drafts. At most 50 drafts wait per agent; past that, reviews save nothing new./learn drafts: the command lists drafts itself and passes the selected ids to the turn, so a weaker model reasons only over the chosen skill. With no matching drafts it answers without a model turn.Protocol changes (additive, approved by @obviyus):
skills.workshop.listresult:modegains"propose"; new optionaldrafts: [{ id, skillName, summary, createdAtMs }](absent from older Gateways, which the UI treats as none).skills.workshop.readparams: optionaldraftId.skills.workshop.applyDraft/skills.workshop.discardDraft(operator.admin, since2026.10). They take theskills.workshop.readparams withdraftIdrequired, so no new params schema or validator is added. Apply also refuses whennameis not the draft's skill, so you can only apply the draft you reviewed. Both answerSkillsWorkshopChangesResult. The UI offers them only when the Gateway advertises them.Update behavior: Doctor's existing Skill Workshop final step also renames earlier exports (written by 2026.10.5–2026.10.7) into
.drafts/. It never overwrites an existing draft: it keeps that export and records a recoverable warning, which does not block table retirement. It is skipped in update rehearsals, and nothing is deleted.Evidence
src/skills/workshop/drafts.test.ts(real filesystem): applying over a live skill is onewrite_filechange thatrestoreundoes; a multi-file draft is one change and one undo removes its support file and restores the instructions; a draft with a rejected support file changes nothing and stays in the inbox; a new-skill draft is onecreate; a draft identical to the live skill changes nothing and still leaves the inbox. A draft whose second file cannot be written leaves the live skill whole and records no change. A binary support asset (assets/logo.png) publishes byte for byte. The multi-file, rejected-file and failed-write cases fail on the previous per-file apply.src/agents/tools/skill-workshop-tool.test.ts: inproposemode a review'spatchis refused,draftsaves, the live skill and change feed stay unchanged, the review cannot discard; a foreground run aborted after itsdraftordiscardcall has started (authority captured, still preparing) writes no draft and deletes nothing (the discard case fails without the final-effect authority check).src/auto-reply/reply/commands-learn.test.ts: no drafts → reply without a model turn;/learn drafts deploy …selects onlydeploydrafts and keeps the focus; other text keeps all drafts; the prompt says not to save before the user answers.ui/src/pages/skill-workshop/skill-workshop-page.test.tsx: an agent with no skills sees only its drafts on the Drafts tab; discarding the last draft outside Propose mode keeps the Drafts list open; the Drafts list opens a draft as a diff against the live skill, Apply callsskills.workshop.applyDraftand follows the skill to Active; the mode switch writes"propose".src/gateway/server-methods/skills-workshop.test.ts:applyDraftanddiscardDraftrefuse a requester whose authority is gone, and the draft stays on disk. Both methods areoperator.adminin the method descriptors, sooperator.readcallers are refused by the shared scope gate.packages/gateway-protocol/src/index.test.ts: read params accept an optionaldraftIdand reject an empty one;src/skills/workshop/drafts.test.tsrefuses applying a draft under another skill's name.src/commands/doctor-skill-workshop-retire-proposals.test.ts,legacy-config-migrations.runtime.skills.test.ts,experience-review-scheduler.test.ts,src/gateway/server-methods/skills-workshop.test.ts: export/move into.drafts/, config mapping, reviews still queue inpropose, list includes drafts.tsgo:core,tsgo:uiandtsgo:scriptspass; changed-file oxlint,protocol-registry:check, the protocol since guard, native protocol checks andui:i18n:verifypass. Other UI locales get the new strings from the post-merge locale refresh.Gateway requester authority changed): no live skill, draft kept, no change row. Anoperator.readclient is refused both draft methods. 2026.10.4 → candidate and 2026.10.4 → 2026.10.7 → candidate upgrades keep every pending/quarantined proposal as a draft.Simplify pass
check_Nfunctions inpredicates.js. The draft methods now reuse the read params, and the generated diff is 6 lines.canReviewDrafts)..drafts/folder as the only draft storage; the staged-swap publish shared withrestore; the Doctor move of 2026.10.5–10.7 exports; the 50-draft cap.main: production +1055/-186, tests +427/-33, docs +114/-62, mock UI +119/-4, generated +6/-4.