Skip to content

Subagent-injected skills are not deployed by sync's closure resolver #895

Description

@williamthorsen

Problem

resolveClosure (packages/agents/src/lib/dependency-resolver.ts) follows only dependencies: and members: edges. A subagent's top-level skills: field — the runtime injection list telling the harness which skills to load into the subagent's context — is invisible to it. A skill named only in skills: is injected at runtime but never pulled into the set of files sync deploys, so a selectively-synced subagent can reference a skill that was never materialized.

Context

The @library collection masks the gap: it resolves to every skill, so sync --global deploys them all. The gap bites a project that selectively deploys a subagent via repo sync without that skill otherwise in its closure. All 10 shipped subagents that declare skills: omit a matching dependencies: edge, so the "declare it in two places" workaround is reliably missed. Surfaced while reviewing #880, where the authoring-guidance rulebook documents that workaround.

Proposed solution

Union a subagent's top-level skills: into its skill edges in resolveClosure — not retrofit a dependencies: edge onto each subagent, which the 10/10 omission rate shows authors won't maintain. The resolver's existing visit bookkeeping carries dedup and cycle-safety, so a skill named in both skills: and dependencies: resolves once. An injected skill absent from the library fails sync closed, the same as any other missing edge.

Acceptance criteria

Must have

  • resolveClosure unions a subagent's top-level skills: field into its skill edges, so injected skills enter the deployment closure without a separate dependencies: declaration.
  • A subagent deployed via selective repo sync materializes its injected skills even when they are not otherwise in the closure.
  • Dedup and cycle detection still hold with the added edges.
  • The new resolver behavior is covered by tests.

Should have

  • The authoring-guidance rulebook no longer presents an injected skills: entry as needing a paired dependencies: edge — both the "Declaring dependencies" section opener and the subagent frontmatter bullet are corrected.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions