Skip to content

improve: skill auto-capture catches reactive corrections and routes them to existing skills#100576

Merged
steipete merged 1 commit into
mainfrom
improve-skill-autocapture-reactive
Jul 6, 2026
Merged

improve: skill auto-capture catches reactive corrections and routes them to existing skills#100576
steipete merged 1 commit into
mainfrom
improve-skill-autocapture-reactive

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jul 6, 2026

Copy link
Copy Markdown
Member

What Problem This Solves

Skill auto-capture missed reactive corrections, could route tied matches to an arbitrary skill, overwrote existing skill descriptions, replayed historical transcript signals, and could double-capture explicit /learn requests. Current main also has a default suggestion tier, so suggestion and autonomous capture need one coordinated signal and provenance path.

Why This Change Was Made

  • Detect prospective instructions and conservative reactive corrections, grouped by topic.
  • Pass the exact current-turn user messages from CLI, embedded, Codex app-server, and Copilot runners. Existing SDK/native callers retain the previous event-message fallback.
  • Route only unique matches to writable workspace skills, including .agents/skills, while preserving existing skill descriptions.
  • Revise only pending proposals created by auto-capture; manual workshop proposals remain untouched.
  • Suppress same-run /learn duplication in both suggestion and autonomous modes.
  • Keep suggestions success-only. Autonomous mode can retain a user correction from a failed turn.
  • Skip skill discovery on signal-free turns and avoid replaying applied or rejected historical feedback.
  • Preserve callers without runId; use it only when available for same-run provenance and deduplication.
  • Keep the compact Skill Workshop prompt contract unchanged. The default suggestion tier on current main supersedes the always-rendered prompt approach from improve: skill-workshop prompt banks reactive corrections without a save command #100578.

User Impact

Users get pending skill improvements from the correction they just made, targeted only when one writable skill is the clear match. Existing metadata and manual proposals are preserved, explicit /learn remains authoritative, and old transcript corrections do not get captured again.

Evidence

  • Blacksmith Testbox through Crabbox: tbx_01kwv5ewt8fz6mw1r050y6rt7s (blacksmith-testbox), validating local head f811a19cb015d1b5c99075ac58744d97ea4f3346.
  • Focused Testbox coverage: signal extraction/routing, workshop proposal ownership, gateway schema, end-of-run orchestration, CLI current-turn capture, and embedded compaction-safe current-turn capture.
  • Testbox pnpm check:changed -- <18 changed paths>: clean.
  • Fresh autoreview --mode branch --base origin/main: no accepted/actionable findings; overall patch-correct confidence 0.78.
  • Rebase verification: final head 609b97d3d6b1d19de619d17bb974b8ea40dc923c has the same stable patch ID as the Testbox-validated and autoreviewed content after rebasing onto 7b68306949d9a268cb2b3d6ddc635073b5ddcff6.
  • Codex contract checked directly in codex-rs/app-server-protocol/src/protocol/v2/turn.rs and codex-rs/app-server/src/request_processors/turn_processor.rs: turn input is the current Vec<UserInput> validated before turn start.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L maintainer Maintainer-authored PR labels Jul 6, 2026
@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 4:28 AM ET / 08:28 UTC.

Summary
The PR expands skill auto-capture to extract current-turn reactive/prospective corrections, route and revise proposals against writable skills across runners, and document/test the coordinated capture path.

PR surface: Source +497, Tests +712, Docs +8. Total +1217 across 18 files.

Reproducibility: yes. Source inspection of current main shows auto-capture reads full event history and only handles the prior single-signal path; the PR adds focused tests for current-turn capture, /learn suppression, failed-turn corrections, and non-replay.

Review metrics: 1 noteworthy metric.

  • Gateway proposal source enum: 1 added. Full proposal inspection can now report skill-autocapture, so maintainers should notice the additive protocol/stored-record source before merge.

Root-cause cluster
Relationship: canonical
Canonical: #100576
Summary: This PR is the canonical open autonomous auto-capture overhaul; the prompt-only reactive-correction PR was closed in favor of this path, while the default suggestion tier has already merged as adjacent prerequisite work.

Members:

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

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Next step before merge

  • No ClawSweeper repair lane is needed because current head has no concrete review finding; the remaining action is normal maintainer review and landing.

Security
Cleared: No dependency, workflow, secret, package, or executable supply-chain changes were introduced; proposal writes remain pending and scanned through the existing workshop service.

Review details

Best possible solution:

Land this coordinated autonomous auto-capture overhaul after maintainer review of the exact-head CI/Testbox evidence, keeping #100692 as the merged suggestion-tier prerequisite.

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

Yes. Source inspection of current main shows auto-capture reads full event history and only handles the prior single-signal path; the PR adds focused tests for current-turn capture, /learn suppression, failed-turn corrections, and non-replay.

Is this the best way to solve the issue?

Yes. The fix is in the owner path: signal extraction stays in src/skills/research, auto-capture owns proposal source/revision, and runners pass current-turn messages instead of making the workshop service infer transcript cursors.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0c38082c6db9.

Label changes

Label changes:

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

Label justifications:

  • P3: This is a low-urgency maintainer improvement to optional skill capture behavior with focused tests and no emergency user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The contributor proof gate is not applicable to this maintainer/MEMBER PR; the PR body still includes Testbox, CI, and autoreview evidence for reviewer context.
Evidence reviewed

PR surface:

Source +497, Tests +712, Docs +8. Total +1217 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 11 601 104 +497
Tests 6 728 16 +712
Docs 1 9 1 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 1338 121 +1217

What I checked:

  • Repository policy read: Root, docs, extensions, and agents scoped AGENTS.md files were read fully; the review applied their guidance on full-path review, Codex source inspection, plugin boundaries, docs rules, and gateway protocol compatibility. (AGENTS.md:1, 0c38082c6db9)
  • Current-main gap: Current main extracts a single durable proposal from the full agent-end event messages, which makes historical replay and missing current-turn provenance source-reproducible from code inspection. (src/skills/research/autocapture.ts:73, 0c38082c6db9)
  • Current-turn capture fix: The PR extracts only currentTurnMessages, suppresses same-run proposal duplication by runId, and delays writable skill discovery until after a cheap signal check. (src/skills/research/autocapture.ts:182, 609b97d3d6b1)
  • Signal routing implementation: The PR adds conservative reactive patterns plus grouped proposal routing with existing-skill tie handling and a per-turn proposal cap. (src/skills/research/signals.ts:20, 609b97d3d6b1)
  • Workshop provenance contract: The existing tool factory passes agent/session/run/message origin into skill_workshop, and the PR’s same-run suppression can therefore detect curated proposals from the same run. (src/agents/openclaw-tools.ts:488, 0c38082c6db9)
  • Codex source contract checked: Sibling Codex source defines turn/start input as Vec and maps that input into the core Op::UserInput for the accepted turn, matching the PR’s current-turn Codex app-server path. (../codex/codex-rs/app-server-protocol/src/protocol/v2/turn.rs:68, be33f80bc651)

Likely related people:

  • steipete: Peter Steinberger introduced the current-main auto-capture/suggestion-tier behavior and performed the earlier capture-invariant review that shaped this branch. (role: feature owner and recent area contributor; confidence: high; commits: 5d9cec16f356, 1e2e7fb936ad; files: src/skills/research/autocapture.ts, src/skills/research/signals.ts, src/skills/workshop/service.ts)
  • vincentkoc: The PR author is a MEMBER, is assigned to the PR, and posted the current-head update saying they addressed the blocking capture-invariant findings on this same branch. (role: current branch owner and likely follow-up owner; confidence: high; commits: 609b97d3d6b1; files: src/skills/research/autocapture.ts, src/skills/research/signals.ts, src/agents/harness/agent-end-side-effects.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-06T03:31:19.122Z sha 4f6374f :: needs changes before merge. :: [P3] Use toSorted in the new assertion | [P3] Reflow the workshop settings row

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 6, 2026
@vincentkoc vincentkoc self-assigned this Jul 6, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Independent review (read both diffs in full plus the current main capture//learn surfaces). The extractor improvements here are genuinely valuable and should land — reactive patterns, vocabulary-routing to existing skills, per-skill grouping, and dropping the success === false gate are all right. But the capture loop needs a provenance rework before this is safe to merge:

Blocking findings

  1. Replay/merge defect (P1). Extraction rescans the whole transcript every agent-end with no message cursor or signal fingerprint; dedupe is only "pending/quarantined proposal exists for skillKey" (src/skills/research/autocapture.ts, the continue branch). Consequences: a second correction for the same skill while the first proposal is pending is discarded rather than revised into it; and once that proposal is applied/rejected, the next agent-end re-extracts the old corrections from history and files them again. The feature built to stop repetition repeats itself.
  2. /learn collision (P1). A /learn turn is autocapture-eligible (blocked triggers are only cron/heartbeat/memory/overflow + cron/hook/subagent sessions), so with autonomy enabled one /learn turn can produce its curated proposal plus up to DEFAULT_MAX_PROPOSALS correction proposals from the same transcript. Needs same-run suppression.
  3. Discovery before signal (P2). listWritableWorkspaceSkillSummaries (full workspace skill status) runs on every eligible agent-end before any signal check. Cheap regex extraction must come first; skill facts should be passed in, not rediscovered per turn (repo hot-path rule).
  4. CI: check-lint and check-docs failing at head.

Shared capture invariant to build against (this PR + the suggest tier + /learn all consume the same signals.ts owner):

  • attach run/message provenance or a signal fingerprint; process only uncaptured current-turn signals
  • upsert/revise an auto-capture-owned pending proposal per skill; never touch manually created proposals
  • suppress agent-end capture when the same run already created a proposal (especially /learn)
  • extraction before discovery; reuse prepared skill facts

Coordination: a default-on "suggest" tier (detect signal → one-shot context line next turn → user decides; no new config) is about to land, sitting between off and autonomous.enabled. Plan: that lands first, then this PR gets rebased/refactored on top as the autonomy-mode overhaul implementing the invariant above, keeping this PR's extractor work intact. I'll push the refactor to this branch (same-repo head) unless you object — shout if you'd rather take it yourself, @vincentkoc.

Integration acceptance tests for the refactor: /learn + autonomy → exactly one proposal; second correction revises the existing auto proposal; applied/rejected signals never replay; failed turns capture only new signals; signal-free turns perform no discovery.

Related: #100578 is being closed in favor of this coordinated design — its reactive-correction insight survives here in REACTIVE_PATTERNS, and the conditional per-turn variant is superseded by the suggest-tier line, which costs prompt bytes only when a signal actually fired.

@vincentkoc

Copy link
Copy Markdown
Member Author

i’m addressing the blocking capture-invariant findings on this branch now: current-turn provenance/revision without replay, /learn same-run suppression, and extraction before workspace discovery. i’ll push the rebased exact-head patch with Testbox + autoreview evidence when it’s clean; please hold off on a parallel branch rewrite for the moment.

@vincentkoc

Copy link
Copy Markdown
Member Author

Updated this branch on current main with all review findings addressed.

  • existing skill descriptions are preserved on auto-captured updates;
  • ambiguous best-score ties fall back to topic inference instead of selecting the first discovered skill;
  • the compact Skill Workshop prompt remains unchanged; improve: skill-workshop prompt banks reactive corrections without a save command #100578 stays superseded by the default suggestion tier already on main;
  • built-in runners pass exact current-turn messages, preventing historical replay while preserving the existing fallback for external SDK/native callers;
  • same-run /learn, failed-turn corrections, auto-owned proposal revision, manual-proposal isolation, .agents/skills, and callers without runId are covered.

Proof:

  • pushed head: 609b97d3d6b1d19de619d17bb974b8ea40dc923c;
  • Crabbox / Blacksmith Testbox: tbx_01kwv5ewt8fz6mw1r050y6rt7s;
  • focused regressions and pnpm check:changed -- <18 changed paths> passed;
  • final autoreview: no accepted/actionable findings, patch-correct confidence 0.78;
  • Testbox validated f811a19cb015d1b5c99075ac58744d97ea4f3346; the final rebase was content-identical (git range-diff equality and stable patch ID match).

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling extensions: codex extensions: copilot size: XL and removed size: L labels Jul 6, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 6, 2026
steipete added a commit that referenced this pull request Jul 6, 2026
…ons (#100576)

Merges the reactive-correction extractor with the landed suggest tier
under one capture contract: signal-fingerprint ring on the session
entry (replay-proof across applied/rejected proposals), revise-upsert
into autocapture-owned pending proposals, same-run suppression for
/learn-style turns, and extraction-before-discovery. Restores the
suggest-tier behavior a textually-clean rebase had silently dropped.
Fixes check-lint (.sort()) and docs table formatting.
@steipete
steipete force-pushed the improve-skill-autocapture-reactive branch from 609b97d to 517c125 Compare July 6, 2026 08:31
@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling extensions: codex extensions: copilot labels Jul 6, 2026
…ariant (#100576)

Reactive corrections ("that's not what I asked", "stop doing X") now
count as durable signals: expanded extraction patterns, vocabulary
routing to existing workspace skills, per-skill grouping. Both capture
modes share one invariant: a bounded signal-fingerprint ring on the
session entry prevents replaying applied/rejected corrections, pending
autocapture-owned proposals are revised instead of skipped, /learn-style
turns suppress duplicate agent-end capture, and extraction runs before
any skill discovery. Autonomy off keeps the suggest-tier offer; autonomy
on files/revises proposals directly.

Co-authored-by: Vincent Koc <[email protected]>
@steipete
steipete force-pushed the improve-skill-autocapture-reactive branch from 517c125 to ad7af27 Compare July 6, 2026 08:44
@steipete
steipete merged commit 8b2e9dd into main Jul 6, 2026
94 of 96 checks passed
@steipete
steipete deleted the improve-skill-autocapture-reactive branch July 6, 2026 08:50
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Landed as 8b2e9dd with the coordinated refactor on top of your extractor work (squash credits preserved via co-authorship). What changed relative to your last push, per the review contract above:

  • bounded signal-fingerprint ring on the session entry (replay-proof: applied/rejected corrections never re-file from transcript history)
  • pending autocapture-owned proposals are revised (appended) instead of skipped; manual/quarantined proposals untouched
  • same-run suppression: turns that already made skill_workshop create/update/revise calls (e.g. /learn) skip agent-end capture
  • extraction now precedes skill discovery; signal-free turns do zero discovery
  • reconciled with the suggest tier that landed in feat(skills): suggest saving detected reusable workflows by default #100692 (autonomy off = one offer for the most recent group)
  • check-lint (.sort()) and docs table formatting fixed

Your REACTIVE_PATTERNS, vocabulary routing, and grouping shipped intact — thanks Vincent, the reactive-phrasing insight is the heart of the feature. Proof: 680/680 focused Testbox tests across research/session/reply surfaces, clean structured review.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
…ariant (openclaw#100576) (openclaw#100576)

Reactive corrections ("that's not what I asked", "stop doing X") now
count as durable signals: expanded extraction patterns, vocabulary
routing to existing workspace skills, per-skill grouping. Both capture
modes share one invariant: a bounded signal-fingerprint ring on the
session entry prevents replaying applied/rejected corrections, pending
autocapture-owned proposals are revised instead of skipped, /learn-style
turns suppress duplicate agent-end capture, and extraction runs before
any skill discovery. Autonomy off keeps the suggest-tier offer; autonomy
on files/revises proposals directly.

Co-authored-by: Peter Steinberger <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…ariant (openclaw#100576) (openclaw#100576)

Reactive corrections ("that's not what I asked", "stop doing X") now
count as durable signals: expanded extraction patterns, vocabulary
routing to existing workspace skills, per-skill grouping. Both capture
modes share one invariant: a bounded signal-fingerprint ring on the
session entry prevents replaying applied/rejected corrections, pending
autocapture-owned proposals are revised instead of skipped, /learn-style
turns suppress duplicate agent-end capture, and extraction runs before
any skill discovery. Autonomy off keeps the suggest-tier offer; autonomy
on files/revises proposals directly.

Co-authored-by: Peter Steinberger <[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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

2 participants