Skip to content

feat(config): support top-level shared skills and commands#2971

Merged
dgageot merged 2 commits into
mainfrom
feat/top-level-skills-commands
Jun 2, 2026
Merged

feat(config): support top-level shared skills and commands#2971
dgageot merged 2 commits into
mainfrom
feat/top-level-skills-commands

Conversation

@Sayt-0
Copy link
Copy Markdown
Member

@Sayt-0 Sayt-0 commented Jun 2, 2026

What

Implements top-level, shareable skills and commands, so the same command set or skill configuration can be reused across multiple agents in a single YAML instead of being duplicated.

How

  • New top-level commands and skills maps of named, reusable groups.
  • Agents opt in by name via new use_commands / use_skills fields.
  • Groups are merged into each agent during config resolution, so teamloader and the runtime are unchanged. Agent inline entries take precedence on name conflicts; skill sources/includes are unioned and inline skills deduped by name.
  • Config schema bumped to v11 (previous schema frozen as pkg/config/v10).
  • Updated agent-schema.json, the HCL block rules, added examples/shared-commands-skills.yaml, and documented the sections in docs/configuration/overview.

Testing

  • New tests in pkg/config cover merge semantics, inline override, missing-group errors, and top-level group validation.
  • Verified end-to-end with cagent debug config examples/shared-commands-skills.yaml.

Closes #2967

Add top-level `commands` and `skills` sections holding reusable, named
groups that agents opt into by name via `use_commands` / `use_skills`.
Groups are merged into each agent during config resolution; an agent's
inline entries win on name conflicts. Bumps the config schema to v11
and updates the JSON schema, HCL converter, example, and docs.

Closes #2967
@Sayt-0 Sayt-0 requested a review from a team as a code owner June 2, 2026 15:45
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/skills Skills system and custom slash commands kind/feat PR adds a new feature (maps to feat: commit prefix) labels Jun 2, 2026
Comment thread pkg/config/v10/auth.go Outdated
@@ -0,0 +1,253 @@
package v10
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All those changes should go in the latest package, no need to create a new version

@docker-agent
Copy link
Copy Markdown

PR Review Failed — The review agent encountered an error and could not complete the review. View logs.

Drop the v11 schema bump and the frozen v10 package. The top-level
commands/skills support now lives entirely in the latest package and the
schema stays at version 10.
@dgageot dgageot merged commit e72c2bd into main Jun 2, 2026
9 checks passed
@Sayt-0 Sayt-0 deleted the feat/top-level-skills-commands branch June 2, 2026 16:40
aheritier added a commit that referenced this pull request Jun 4, 2026
Adds `use_commands` and `use_skills` to the agent properties reference
and full schema YAML example in docs/configuration/agents/index.md.
These agent-level fields were introduced by #2971 but were missing from
the agent reference doc.

Also fixes a broken example link in docs/configuration/overview/index.md
that pointed to the wrong repo (cagent instead of docker-agent).

Source PR: #2971
@Sayt-0
Copy link
Copy Markdown
Member Author

Sayt-0 commented Jun 4, 2026

/review

Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The implementation is well-structured. Merge precedence (inline wins over shared), nil-map guards, skill deduplication, and validation ordering are all correct. No high or medium severity bugs were found.

Two minor observations are left as inline comments.

Comment thread pkg/config/skills.go
// SkillsConfig. Every top-level group is validated up front (parity with
// resolveMCPDefinitions), then each referenced group is merged into the agent.
func resolveSkillDefinitions(cfg *latest.Config) error {
for name := range cfg.Skills {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW] Non-deterministic error message when multiple skill groups are invalid

for name := range cfg.Skills iterates the map in random order. If two or more top-level skill groups are simultaneously invalid, the error returned on each run may name a different group, producing unstable output that can make error messages hard to reproduce and could cause flaky tests if any future test ever checks which group's error surfaces.

Suggested fix: collect all group names into a sorted slice before iterating, so validation always reports errors in a deterministic order (consistent with how other validation loops in the codebase use slices.Sorted / sort.Strings).

Comment thread pkg/config/commands.go
// Commands map. Commands defined inline on the agent take precedence over a
// group's command of the same name, mirroring the override semantics used for
// MCP definitions (see applyMCPDefaults).
func resolveCommandDefinitions(cfg *latest.Config) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW] Top-level commands groups are not validated proactively

resolveSkillDefinitions validates every top-level skill group (even unreferenced ones) before merging. resolveCommandDefinitions has no equivalent loop — top-level command groups are only inspected when an agent explicitly references them via use_commands. A misconfigured but unreferenced command group will never be caught.

While current CommandConfig fields are validated at YAML parse time, the asymmetry will become a silent correctness gap if richer semantic validation is added to commands in the future.

Suggested fix: add an up-front validation loop over cfg.Commands (mirroring the cfg.Skills loop) or add a comment explaining the intentional difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/skills Skills system and custom slash commands kind/feat PR adds a new feature (maps to feat: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support top level skills and commands

4 participants