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
+24 -1
View File
@@ -31,6 +31,9 @@ type PiClient struct {
// PIPELINES_ARTIFACTS_DIR so its tools can write stage artifacts.
ArtifactsDir string
ArtifactAccess ArtifactAccess
// Skills are loaded with --skill while --no-skills keeps every discovered
// and configured skill out; nil loads none.
Skills *SkillSet
Policy ToolPolicy
OnSession func(string, bool) error
OnOwnership func(string, string, bool) error
@@ -71,6 +74,11 @@ func piPolicyMap(c *PiClient, tools []string) map[string]any {
if paths == nil {
paths = []string{}
}
read := c.ArtifactAccess.Read
if !c.Skills.Empty() {
// The model reads each skill's SKILL.md and bundled files by path.
read = append(append([]string(nil), read...), c.Skills.Root)
}
return map[string]any{
"directory": c.Directory,
"tools": tools,
@@ -79,7 +87,7 @@ func piPolicyMap(c *PiClient, tools []string) map[string]any {
"shell": c.Policy.Shell,
"artifact_write": c.ArtifactAccess.Write,
"artifact_write_shared": c.ArtifactAccess.WriteShared,
"artifact_read": c.ArtifactAccess.Read,
"artifact_read": read,
}
}
@@ -159,6 +167,7 @@ func (c *PiClient) Generate(ctx context.Context, config ModelConfig, prompt stri
if thinking != "" {
args = append(args, "--thinking", thinking)
}
args = append(args, piSkillArgs(c.Skills)...)
if len(tools) == 0 {
args = append(args, "--no-tools")
} else {
@@ -652,3 +661,17 @@ func PiEvidence(reference string) (string, error) {
data, err = io.ReadAll(io.LimitReader(file, 8<<20))
return RedactEvidence(string(data)), err
}
// piSkillArgs loads exactly the visit's configured skills. Pi documents that
// explicit --skill paths still load under --no-skills, which keeps disabling
// every discovered (user, project) and settings-configured skill.
func piSkillArgs(set *SkillSet) []string {
if set.Empty() {
return nil
}
args := make([]string, 0, 2*len(set.Bundles))
for _, bundle := range set.Bundles {
args = append(args, "--skill", bundle.Dir)
}
return args
}