feat(skill-distillation): add config and Rust contracts#6
Conversation
|
2d265ba to
7de4052
Compare
|
|
||
| The public contract includes: | ||
|
|
||
| - safe `SkillNamespace`, `TrajectoryId`, and `SkillVersionId` identifiers; |
There was a problem hiding this comment.
Im not sure I understand what TrajectoryId is and if its different from the session awareness we have implemented already
There was a problem hiding this comment.
Renaming to "SkillEvidenceId"
basically this will be the thing fed into an LLM that will distill into a skill.
It can be a piece of a session, or perhaps multiple sessions.
|
@elyasmnvidian Can you share how the rust traits are going to be used within switchyard ? Im trying to follow the API but its not clear to me how everything ties in. |
You’re right—the Switchyard code that calls these traits is not in this PR. This PR defines four expected steps: TrajectorySource loads completed runs, SkillDistiller creates a candidate skill, SkillValidator checks it, and SkillStore saves it and can make it active. |
Summary
This PR establishes the first skill-distillation boundary in Switchyard:
switchyard configure --skill-distillation NAMEsaves the namespace that later launcher and runtime work will use.switchyard configure --disable-skill-distillationremoves that saved namespace.switchyard-skill-distillationRust crate defines the source-neutral records, validation rules, and async extension points shared by future trajectory sources, distillers, validators, and skill stores.Existing provider and launcher configuration remains unchanged. A skill-only config update writes
~/.config/switchyard/config.jsonand does not require provider credentials.UserConfigowns the saved namespace. The Rust crate owns the cross-implementation API contracts. It does not choose a provider, store, model, agent runtime, or activation policy.This PR does not yet save sessions, run a distiller, write or activate skills, import external runs, or mount skills into launched agents.
Public Contract
The Rust crate exports:
SkillNamespace,SkillEvidenceId, andSkillVersionIdidentifiers;Trajectory,DistillationRequest, andSkillCandidaterecords;TrajectorySource,SkillDistiller,SkillValidator, andSkillStoretraits.DistillationRequest::validate_candidate()checks that a candidate uses the request namespace, references only input evidence, and names the request's base skill as its parent. Candidate validation also requires source-evidence provenance and rejects invalid validation metrics.The contract crate has no provider, filesystem, Python binding, benchmark, or model implementation dependency. Provider-specific event data stays inside JSON payload and metadata fields.
Feature Proof
Saved config excerpt:
{ "skill_distillation": { "namespace": "tooluniverse-trialqa" } }The Rust API can be implemented by independent adapters without depending on Switchyard's Python CLI:
Invalid namespaces, path traversal in contract identifiers, non-string namespaces, unsupported manually edited
skill_distillationkeys, missing namespace values, empty CLI namespaces, conflicting configure modes, duplicate skill-evidence IDs, missing candidate provenance, and mismatched candidate/request evidence fail closed.Design Decisions
The namespace is saved user configuration, not a per-request header. Future requests may be recorded inside saved sessions, but one HTTP request must not reconfigure which skill is learned or used.
Skill generation should happen after sessions finish, not during normal model request handling. Later implementations can use the Rust traits while keeping provider, storage, validation policy, and agent-specific mounting behavior outside the contract crate.
Generated output should remain reviewable text such as
SKILL.mdplus support reports. Future updates should retain source-session provenance and previous active versions so people can inspect and roll back changes.