Skip to content

[FEATURE] Support wildcard/directory-level gitRefs to load all skills from a path #1422

@Daniel-Vaz

Description

@Daniel-Vaz

📋 Prerequisites

📝 Feature Summary

Allow a gitRef entry to point to a directory path (e.g., skills/) and have kagent automatically discover and mount all skill subdirectories found under that path. Eliminating the need to enumerate each skill individually and avoiding redundant clones of the same repository by the init container.

Related with this Discord Thread.

❓ Problem Statement / Motivation

Since git-based skill fetching was introduced in #1365, the recommended way to load skills from a Git repository is to declare each skill explicitly as a separate gitRefs entry in the Agent custom resource. While this works, it introduces two significant pain points when skills are organized under a common parent directory (e.g., a monorepo layout like skills/skill-a/, skills/skill-b/, skills/skill-c/):

1. Excessive verbosity in the Agent CR

Every skill must be explicitly referenced, even when they all share the same repository, branch, and auth credentials:

spec:
  skills:
    gitAuthSecretRef:
      name: git-creds
    gitRefs:
      - url: <url>
        ref: master
        path: skills/skill-example-1
        name: skill-example-1
      - url: <url>
        ref: master
        path: skills/skill-example-2
        name: skill-example-2
      - url: <url>
        ref: master
        path: skills/skill-example-3
        name: skill-example-3

This is unnecessarily verbose and scales poorly as the number of skills grows. Any change to the branch name, auth secret, or repository URL requires updating every single entry.

2. Redundant repository clones in the skills-init init container

Because each gitRef entry is treated independently, the skills-init init container clones the same repository once per entry. For a repo with 10 skills, that means 10 separate git clone operations against the same URL.

💡 Proposed Solution

Introduce support for a directory-level (or "glob") gitRef that allows users to point to a parent path and have kagent automatically expand it into individual skills at reconciliation time or init container execution time.

Example desired API:

spec:
  skills:
    gitAuthSecretRef:
      name: git-creds
    gitRefs:
      - url: <url>
        ref: master
        path: skills/

Expected behavior:

  • The repository is cloned once.
  • All immediate subdirectories under skills/ that are valid skill directories are discovered automatically.
  • Each discovered subdirectory is mounted under /skills/<dirname> in the agent, equivalent to what an explicit per-skill entry would produce.
  • The name field would default to the subdirectory name, consistent with the current behavior for explicit entries.

🔄 Alternatives Considered

  • Keeping the current explicit model: Works today but does not scale, produces verbose CRs, and causes unnecessary multi-clone behavior. Not acceptable for teams managing many skills in a monorepo.

🎯 Affected Service(s)

Controller Service

📚 Additional Context

No response

🙋 Are you willing to contribute?

  • I am willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions