Skip to content

feat(commands): add /learn to draft skills from recent work - #100442

Merged
steipete merged 2 commits into
mainfrom
feat/learn-command-65fd03
Jul 6, 2026
Merged

steipete merged 2 commits into
mainfrom
feat/learn-command-65fd03

Conversation

@steipete

@steipete steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Operators repeatedly walk the agent through the same multi-step workflows, but there is no one-command path from a successful session to a saved skill. Skill authoring today starts from a blank page: you have to remember the workshop exists, describe the workflow from scratch, and know the frontmatter/structure conventions. The knowledge from a good run evaporates when the session ends.

Closes #100408.

Why This Change Was Made

/learn [request] turns "what we just did" (or named sources) into a reviewable skill draft using machinery that already exists:

  • The handler rewrites the current turn into a server-built, standards-guided instruction (same mechanism as /goal, src/auto-reply/reply/commands-goal.ts) and lets the normal agent run execute it — no new model tool, no config surface, no system-prompt change.
  • The instruction (src/skills/workshop/learn-prompt.ts, pure function) embeds the skill-authoring standards from docs/tools/creating-skills.md: lowercase-hyphenated name, one short quoted trigger-phrase description, no invented commands/flags, scripts as proposal support files, ~100–200-line body.
  • The agent files exactly ONE pending proposal via the existing skill_workshop tool. /learn never applies it — the operator approval flow is unchanged.
  • Bare /learn defaults to distilling the reusable workflow from the current conversation.
  • An availability guard composes the existing tool-policy primitives (sandbox status, runtime allowlists, harness/CLI-backend tool exposure, model tool support, final effective tool policy) and replies with a clear message instead of continuing when skill_workshop cannot be available. Supporting extraction: the inline "harness builds OpenClaw tools" predicate in embedded-agent-runner/run.ts moved to shared helpers in src/agents/harness/selection.ts so the guard reuses it instead of duplicating policy. learn is also reserved against plugin command shadowing.

User Impact

  • New /learn [request] chat command (all channels with text commands; also in the native command registry): one message converts recent work or named sources (paths, URLs, pasted notes) into a pending skill proposal, announced with proposal id and skill name.
  • Proposals remain pending and go through the normal Skill Workshop review/apply flow (openclaw skills workshop).
  • Agents where the workshop is unavailable (sandboxed, tools disabled, model without tool support) get an explanatory reply instead of a silent failure.
  • Docs: /learn section in skill-workshop and the slash-command table.

Evidence

  • Focused tests (all passing locally, 6 Vitest shards): src/auto-reply/reply/commands-learn.test.ts (rewrite + default + standards + 4 unavailability paths), src/skills/workshop/learn-prompt.test.ts, src/auto-reply/commands-registry.test.ts, src/plugins/commands.test.ts (reservation), src/agents/harness/selection.test.ts, src/docs/slash-commands-doc.test.ts, ui/src/pages/chat/chat-commands.test.ts, plus src/auto-reply/reply/commands-goal.test.ts as the neighboring-precedent regression check.
  • Typecheck (tsgo core + core-test lanes) and targeted oxlint clean; git diff --check clean.
  • Structured second-model review (Codex, gpt-5.5) of the full bundle: no actionable findings.
  • Release-note context: user-facing feat — new /learn command drafting reviewable skills from recent work via Skill Workshop.

/learn rewrites the turn into a standards-guided Skill Workshop authoring
instruction: the agent gathers named sources (or distills the current
conversation) and files ONE pending skill proposal via skill_workshop.
Approval flow unchanged; sandboxed/tool-restricted agents get a clear
unavailable reply. Extracts the harness OpenClaw-tools predicate into
shared helpers and reserves the command name against plugin shadowing.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Jul 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62c1f88fb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +132 to +136
const modelCompat = resolveConfiguredModelCompat({
cfg: params.cfg,
modelProvider: params.provider,
modelId: params.model,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use resolved model compat for /learn availability

When the selected model comes from a plugin/runtime catalog instead of cfg.models.providers—for example Arcee trinity-large-thinking, whose catalog sets compat.supportsTools: false—resolveConfiguredModelCompat() returns undefined, so /learn is allowed even though the real run later gates tools with supportsModelTools(params.model) in src/agents/embedded-agent-runner/run/attempt.ts and sends no skill_workshop tool. In that setup the model receives an instruction to call a tool it cannot see, so users get no pending proposal instead of the intended “Skill workshop is not available” reply; this check needs to use the resolved runtime model/effective inventory compat, not only configured models.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 9:53 PM ET / 01:53 UTC.

Summary
Adds a built-in /learn [request] chat command that rewrites the turn into a Skill Workshop proposal instruction, reserves learn, factors harness tool-exposure helpers, and updates docs, tests, and UI command metadata.

PR surface: Source +268, Tests +233, Docs +21. Total +522 across 18 files.

Reproducibility: yes. for the PR blocker: source inspection shows /learn still reads only configured model compat while the runner gates actual tools from the resolved runtime model. The feature request itself is not a bug reproduction.

Review metrics: 1 noteworthy metric.

  • Command namespace change: 1 built-in command added, 1 reserved plugin command name added. This changes text/native command routing and can reject plugins that previously registered learn.

Stored data model
Persistent data-model change detected: serialized state: src/skills/workshop/learn-prompt.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100408
Summary: This PR is the implementation candidate for the linked /learn feature issue and should stay paired with it until the PR merges or maintainers reject the direction.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix /learn availability to use resolved runtime/effective model compatibility and add a no-tools plugin catalog model regression case.
  • [P1] Add redacted real behavior proof showing either a pending proposal result or the unavailable reply in a real setup.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body and comments list tests and CI only; add redacted terminal/live output, logs, screenshot, or recording showing /learn creating a pending proposal or returning the unavailable reply, then update the PR body to trigger re-review.

Mantis proof suggestion
A web UI chat proof would materially show the user-visible /learn command path without asking Mantis to mutate the PR. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: verify that /learn drafts one pending Skill Workshop proposal and returns proposal details without applying it.

Risk before merge

  • [P1] No real run, log, screenshot, recording, or linked artifact shows /learn creating a pending Skill Workshop proposal or returning the unavailable reply in a real setup.
  • [P1] The PR reserves learn as a built-in command name, so existing plugins that register learn would be rejected after upgrade.
  • [P1] The availability guard can allow /learn to continue for resolved catalog models whose runtime metadata disables tools, leaving the model unable to call skill_workshop.

Maintainer options:

  1. Repair compatibility before merge (recommended)
    Keep the core command shape but make the availability guard use resolved runtime/effective model compatibility and prove the real /learn path before merge.
  2. Accept the namespace reservation
    Maintainers may intentionally reserve learn if they are comfortable rejecting plugin commands with that name after upgrade.
  3. Pause the core command
    Pause or close this PR if the command should remain a plugin or ClawHub-level affordance instead of core.

Next step before merge

  • [P1] Manual review is appropriate because the PR needs maintainer namespace approval and contributor proof; the remaining code defect is concrete but does not by itself clear the product and proof gates.

Maintainer decision needed

  • Question: Should OpenClaw accept /learn as a built-in core command that reserves learn across text, native, and plugin command surfaces?
  • Rationale: The implementation is a plausible thin wrapper around Skill Workshop, but it adds a new cross-channel core command and compatibility-sensitive plugin namespace reservation.
  • Likely owner: steipete — They own the recent Skill Workshop and command registry history and opened the linked product proposal.
  • Options:
    • Approve after repair (recommended): Accept the core command after the resolved-model compatibility bug, real behavior proof gap, and maintainer namespace sign-off are addressed.
    • Keep direction open: Leave the PR and linked issue open until maintainers decide whether this affordance belongs in core.
    • Route outside core: Ask for a plugin or ClawHub affordance if maintainers do not want another built-in command surface.

Security
Cleared: No new dependencies, workflows, secrets handling, or direct code-execution surfaces were added beyond the existing Skill Workshop proposal tooling and approval gate.

Review findings

  • [P2] Use resolved model compat before continuing /learn — src/auto-reply/reply/commands-learn.ts:132-138
Review details

Best possible solution:

Land only after /learn availability uses the same resolved runtime model/tool compatibility as the runner, redacted real behavior proof shows the proposal or unavailable path, and maintainers explicitly accept reserving /learn in core.

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

Yes for the PR blocker: source inspection shows /learn still reads only configured model compat while the runner gates actual tools from the resolved runtime model. The feature request itself is not a bug reproduction.

Is this the best way to solve the issue?

No as submitted: the thin Skill Workshop wrapper is plausible, but the best merge path must align availability with runtime model/tool compatibility, add real behavior proof, and receive maintainer approval for the core command namespace.

Full review comments:

  • [P2] Use resolved model compat before continuing /learn — src/auto-reply/reply/commands-learn.ts:132-138
    workshopIsAvailable() still reads only cfg.models.providers via resolveConfiguredModelCompat(). Plugin/catalog models such as Arcee trinity-large-thinking carry compat.supportsTools: false on the resolved runtime model, and the runner later gates actual tool exposure with supportsModelTools(params.model), so /learn can continue into a model that cannot see skill_workshop instead of returning the unavailable reply. This prior finding remains on the latest head; use the resolved runtime model/effective inventory compat path and add that regression case.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2db5bd3394f7.

Label changes

Label justifications:

  • P3: This is a low-risk ergonomics feature PR with limited blast radius, not an urgent regression or release blocker.
  • merge-risk: 🚨 compatibility: The PR adds a built-in /learn command and newly reserves learn against plugin command registration, which can affect existing plugin namespaces.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body and comments list tests and CI only; add redacted terminal/live output, logs, screenshot, or recording showing /learn creating a pending proposal or returning the unavailable reply, then update the PR body to trigger re-review.
Evidence reviewed

PR surface:

Source +268, Tests +233, Docs +21. Total +522 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 9 274 6 +268
Tests 6 233 0 +233
Docs 3 21 0 +21
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 528 6 +522

What I checked:

Likely related people:

  • steipete: Current-main blame points to Peter Steinberger on the command registry, Skill Workshop tool/docs, and effective tool inventory surfaces, and he opened the linked /learn proposal and this implementation PR. (role: recent area contributor and product proposer; confidence: high; commits: 655b18c7064c, b22c36f1125c, 62c1f88fb172; files: src/auto-reply/commands-registry.shared.ts, src/agents/tools/skill-workshop-tool.ts, docs/tools/skill-workshop.md)
  • anyech: Authored a recent focused Skill Workshop fix that touched the proposal tool and tests, so they have adjacent behavior context even though the core command decision sits with command/workshop owners. (role: adjacent Skill Workshop contributor; confidence: medium; commits: e14a21235582; files: src/agents/tools/skill-workshop-tool.ts, src/agents/tools/skill-workshop-tool.test.ts)
  • J Cai: Authored a recent focused Skill Workshop raw-proposal validation fix in the same tool and tests. (role: adjacent Skill Workshop contributor; confidence: medium; commits: 1769fdc44f69; files: src/agents/tools/skill-workshop-tool.ts, src/agents/tools/skill-workshop-tool.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-05T19:38:18.440Z sha 62c1f88 :: needs real behavior proof before merge. :: [P2] Use resolved model compat before continuing /learn | [P2] Regenerate the docs map with the new /learn docs

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 5, 2026
@steipete
steipete merged commit 62ecc23 into main Jul 6, 2026
97 checks passed
@steipete
steipete deleted the feat/learn-command-65fd03 branch July 6, 2026 03:54
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
…#100442)

* feat(commands): add /learn to draft skills from recent work (openclaw#100408)

/learn rewrites the turn into a standards-guided Skill Workshop authoring
instruction: the agent gathers named sources (or distills the current
conversation) and files ONE pending skill proposal via skill_workshop.
Approval flow unchanged; sandboxed/tool-restricted agents get a clear
unavailable reply. Extracts the harness OpenClaw-tools predicate into
shared helpers and reserves the command name against plugin shadowing.

* docs: regenerate docs map for /learn section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: /learn command — distill recent work into a reviewable skill draft

1 participant