Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AMAP ML SkillClaw ValidationWorker

From Leeroopedia
Knowledge Sources
Domains Distributed_Validation, Quality_Evaluation
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for idle-time client-side validation of candidate skills via session replay, provided by the SkillClaw client package.

Description

The ValidationWorker class runs as a background asyncio task on each SkillClaw client. When the client is idle (no recent LLM requests) and within daily quota, it picks up validation jobs from shared storage. For each job, `_replay_validate_job` replays up to 3 session cases with both the current skill (baseline) and the candidate skill, scoring each response via PRMScorer. The candidate is accepted only if its mean score exceeds both the threshold and the baseline mean. Results are submitted back to shared storage for the server to collect.

Usage

Import and use when you need to:

  • Run background skill validation on client machines
  • Understand the replay validation logic (baseline vs candidate comparison)
  • Configure idle-time validation (quota, idle threshold, concurrency)

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `skillclaw/validation_worker.py:L42-338`

Signature

class ValidationWorker:
    """Idle-time client-side validator."""

    def __init__(
        self,
        config: SkillClawConfig,
        *,
        idle_provider: Optional[IdleStateProvider] = None,
    ) -> None:

    def stop(self) -> None:
        """Signal the worker to stop."""

    async def run_once(self, *, force: bool = False) -> dict:
        """Check for open jobs, validate up to quota, return summary."""

    async def _replay_validate_job(self, job: dict[str, Any]) -> dict[str, Any]:
        """Replay validation: run baseline vs candidate on each case.

        Returns: {
            "validator_mode": "replay",
            "decision": "accept" | "reject",
            "accepted": bool,
            "score": float,
            "threshold": float,
            "reason": str,
            "checks": dict,
            "replay_summary": {
                "case_count": int,
                "baseline_mean_score": float,
                "candidate_mean_score": float,
                "cases": list,
            },
        }
        """

    async def run(self) -> None:
        """Main loop: periodically run_once when idle."""

Import

from skillclaw.validation_worker import ValidationWorker

I/O Contract

Inputs

Name Type Required Description
config SkillClawConfig Yes Config with validation_enabled, idle settings, quota
idle_provider None No Proxy server idle state checker
force bool No (run_once) Bypass idle check (default False)
job dict Yes (_replay_validate_job) Validation job with candidate_skill, current_skill, replay_cases

Outputs

Name Type Description
run_once() returns dict Summary with checked_jobs, validated_jobs, skipped_jobs, reason
_replay_validate_job() returns dict Validation result with decision, score, replay_summary
Side effects Storage Result saved via ValidationStore.save_result

Usage Examples

Background Validation Worker

import asyncio
from skillclaw.validation_worker import ValidationWorker

# Created by SkillClawLauncher when validation_enabled is True
worker = ValidationWorker(
    config=cfg,
    idle_provider=api_server,  # Proxy server provides idle state
)

# Run as background task
asyncio.create_task(worker.run())

# Stop when done
worker.stop()

Manual Validation Run

# Force a validation run (bypasses idle check)
result = asyncio.run(worker.run_once(force=True))
print(f"Checked: {result['checked_jobs']}, Validated: {result['validated_jobs']}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment