Skip to content
 
 

Repository files navigation

ManagedCode.SkillOpt

NuGet .NET CI License: MIT

ManagedCode.SkillOpt is a C#/.NET port of Microsoft's original Python SkillOpt project. This repository is a fork that preserves the upstream Git history and license while maintaining an in-process .NET library. The upstream Python source remains the reference for future port work; Python engines, benchmarks, CLI tools, plugins, and WebUI are not shipped here.

The library targets .NET 10 and uses caller-provided Microsoft.Extensions.AI IChatClient instances and Microsoft.Extensions.AI.Evaluation IEvaluator. Hosts built with Microsoft Agent Framework can pass their normal MEAI client. The library does not start Python, launch a subprocess, call a provider SDK, create an HTTP model transport, or require an optimizer service.

Install

<PackageReference Include="ManagedCode.SkillOpt" Version="0.1.4" />

What it implements

The port optimizes one Markdown skill document while keeping the target client fixed. It runs scenarios, evaluates typed per-case evidence, reflects on success and failure, aggregates and selects bounded edits, validates candidates on a held-out selection split, and retains the best skill. It includes supported patch/rewrite modes, edit-budget schedules, rejected-edit memory, epoch meta/slow updates, optional final test reporting, candidate gates, and awaited typed checkpoints. See the port coverage and known deviations; this is a documented C# implementation scope, not a claim of complete Python feature or benchmark parity.

Example

The exact request contract and persistence guidance are in the C# package guide. In outline, the host provides frozen, disjoint cases and role clients:

var result = await SkillOptOptimizer.OptimizeAsync(new SkillOptRequest
{
    InitialSkill = skillMarkdown,
    TrainingCases = trainingCases,
    SelectionCases = validationCases,
    TestCases = testCases,
    TargetChatClient = targetClient,
    OptimizerChatClient = optimizerClient,
    Evaluator = evaluator,
    Options = options,
    Checkpoint = async (state, token) => await SaveCheckpointAsync(state, token)
}, cancellationToken);

var bestSkillMarkdown = result.BestSkill;

The caller owns model/client construction, evaluator policy, case collection, durable checkpoint storage, billing, and saving the returned artifact. The checkpoint callback must persist its state before it returns. The library never modifies a product draft or publishes a skill.

Build and verify

dotnet restore ManagedCode.SkillOpt.sln
dotnet format ManagedCode.SkillOpt.sln --verify-no-changes
dotnet build ManagedCode.SkillOpt.sln --configuration Release
dotnet test ManagedCode.SkillOpt.sln --configuration Release
dotnet pack src/ManagedCode.SkillOpt/ManagedCode.SkillOpt.csproj --configuration Release

The package version is maintained in Directory.Build.props. Published .NET releases use dotnet-v<version> tags so they cannot collide with the preserved upstream v* tags. The dotnet.yml workflow runs package checks and publishes the versioned NuGet package.

Upstream source and license

About

SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages