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 evolve skill from sessions

From Leeroopedia
Knowledge Sources
Domains Skill_Evolution, LLM_Prompting
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for LLM-driven skill evolution decisions (improve, optimize description, or skip) and new skill creation from session evidence, provided by the SkillClaw evolve server package.

Description

The evolve_skill_from_sessions async function sends session evidence (trajectories + summaries) for one skill group to an LLM, which decides the best action: `improve_skill`, `optimize_description`, or `skip`. It returns a parsed skill dict with name, description, category, and content. The create_skill_from_sessions function handles the no-skill group, proposing entirely new skills. The execute_merge function merges two versions of the same skill into one superior version when conflicts arise.

Usage

Import and use when you need to:

  • Evolve an existing skill based on session evidence
  • Create a new skill from sessions that referenced no skill
  • Merge two versions of a skill into one

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `evolve_server/pipeline/execution.py:L366-415` (evolve/create), `L265-289` (merge)

Signature

async def evolve_skill_from_sessions(
    llm: AsyncLLMClient,
    skill_name: str,
    sessions: list[dict],
    current_skill: Optional[dict],
    existing_skill_names: list[str],
) -> Optional[dict]:
    """Combined decision + execution for one existing-skill session group.

    LLM decides: improve_skill, optimize_description, or skip.
    Returns parsed skill dict or None if skipped.
    """

async def create_skill_from_sessions(
    llm: AsyncLLMClient,
    sessions: list[dict],
    existing_skill_names: list[str],
) -> Optional[dict]:
    """Combined decision + execution for the no-skill session bucket.

    LLM decides whether to create a new skill from unreferenced sessions.
    Returns parsed skill dict or None.
    """

async def execute_merge(
    llm: AsyncLLMClient,
    existing_skill: dict,
    incoming_skill: dict,
) -> Optional[dict]:
    """Merge two versions of the same skill into one superior version."""

Import

from evolve_server.pipeline.execution import (
    evolve_skill_from_sessions,
    create_skill_from_sessions,
    execute_merge,
)

I/O Contract

Inputs

Name Type Required Description
llm AsyncLLMClient Yes Async LLM client
skill_name str Yes (evolve) Name of skill to evolve
sessions list[dict] Yes Session evidence with trajectories and summaries
current_skill None No Existing skill content (None for new skills)
existing_skill_names list[str] Yes All skill names in library (avoids duplicates)

Outputs

Name Type Description
Returns None Skill dict with name, description, category, content; None if skipped

Usage Examples

Evolve Existing Skill

import asyncio
from evolve_server.core.llm_client import AsyncLLMClient
from evolve_server.pipeline.execution import evolve_skill_from_sessions

llm = AsyncLLMClient(api_key="sk-...", model="gpt-4o")

result = asyncio.run(evolve_skill_from_sessions(
    llm=llm,
    skill_name="python_deployment",
    sessions=skill_sessions,  # sessions that referenced this skill
    current_skill={"name": "python_deployment", "content": "..."},
    existing_skill_names=["python_deployment", "git_workflow", "docker_setup"],
))

if result:
    print(f"Action decided, new content: {result.get('content', '')[:200]}")
else:
    print("LLM decided to skip evolution for this skill")

Create New Skill

from evolve_server.pipeline.execution import create_skill_from_sessions

new_skill = asyncio.run(create_skill_from_sessions(
    llm=llm,
    sessions=no_skill_sessions,  # sessions that referenced no skill
    existing_skill_names=["python_deployment", "git_workflow"],
))

Related Pages

Implements Principle

Page Connections

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