Stages: optional skills block loading pinned library skills per visit

A model stage may declare a skills block (name or name@N per line).
Drafts and publications are validated against the server skill library;
human/ntfy stages reject the block. Each run resolves unpinned names to the
latest version at admission and records name@N per stage (run
stage_skills, step skills); retry reuses the recorded versions. Every visit
gets a private read-only copy of exactly those bundles under the run's
artifact tree, and the harness loads only them: Claude via a session
plugin (--plugin-dir, Skill tool with per-skill allow rules, bundled skills
off, ambient loads fail the visit), Pi via --skill under --no-skills, and
OpenCode via per-session instruction entries (V2 only). The app shows the
block in the stage definition and the resolved versions on each visit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 19:17:16 +00:00
parent 509d4c624f
commit 85a7284fba
34 changed files with 1418 additions and 35 deletions
+11 -2
View File
@@ -3,6 +3,7 @@ package stage
import (
"context"
"fmt"
"slices"
"strconv"
"strings"
"time"
@@ -58,7 +59,7 @@ func (ModelStage) Spec(def Definition) (ModelSpec, error) {
}
for block := range def.Blocks {
switch block {
case "output", "prompt", "edges", "configs", "tools", "permissions", "checks", "verification":
case "output", "prompt", "edges", "configs", "tools", "permissions", "checks", "verification", "skills":
default:
return ModelSpec{}, fmt.Errorf("unexpected block %q for model stage", block)
}
@@ -69,6 +70,10 @@ func (ModelStage) Spec(def Definition) (ModelSpec, error) {
if _, err := StagePermissions(def); err != nil {
return ModelSpec{}, err
}
skillRefs, err := SkillRefs(def)
if err != nil {
return ModelSpec{}, err
}
if _, err := VerificationTargetFor(def); err != nil {
return ModelSpec{}, err
}
@@ -113,10 +118,14 @@ func (ModelStage) Spec(def Definition) (ModelSpec, error) {
return ModelSpec{}, err
}
if backend == "pi" {
tools, _, _ := ToolNames(def)
tools, explicit, _ := ToolNames(def)
if _, err := piTools(tools); err != nil {
return ModelSpec{}, err
}
if len(skillRefs) > 0 && explicit && !slices.Contains(tools, "read") {
// Pi advertises a skill by path and the model reads its SKILL.md.
return ModelSpec{}, fmt.Errorf("the pi harness loads skills with its read tool; add read to the tools block or remove the skills block")
}
}
if backend != ClaudeBackend {
tools, _, _ := ToolNames(def)