feat: pin agent definitions next to skills

A source can install agents (agents/<name>.md files with a frontmatter
name) alongside or instead of skills.

- manifest: optional "agents" selection; lock: "agents" map
- add --agent / --all-agents, remove --agent, list shows the kind
- check/update diff agents like skills (files, not directories)
- dashboard lists and removes agents
- home-manager module: agentTargets (default .claude/agents) links <name>.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
johannesandClaude Sonnet 5.5 committed 2026-11-28 13:42:45 +01:00
1 parent 0aedef8c8c
commit df8d11d8cb
15 files changed
+648 -131

No files matched your search

+22 -1
View File
@@ -9,6 +9,8 @@ let
cfg = config.programs.skill-manager;
inherit (lib) mkOption types;
sources = (lib.importJSON cfg.lockFile).sources;
# installed name -> store path of the skill directory
skills = lib.concatMapAttrs (
_: src:
@@ -16,7 +18,16 @@ let
tree = builtins.fetchTree src.locked;
in
lib.mapAttrs (_: path: if path == "." then "${tree}" else "${tree}/${path}") src.skills
) (lib.importJSON cfg.lockFile).sources;
) sources;
# installed name -> store path of the agent definition (a .md file)
agents = lib.concatMapAttrs (
_: src:
let
tree = builtins.fetchTree src.locked;
in
lib.mapAttrs (_: path: "${tree}/${path}") (src.agents or { })
) sources;
in
{
options.programs.skill-manager = {
@@ -52,6 +63,12 @@ in
description = "Directories, relative to home, that get one symlink per skill.";
};
agentTargets = mkOption {
type = types.listOf types.str;
default = [ ".claude/agents" ];
description = "Directories, relative to home, that get one <name>.md symlink per agent definition.";
};
switchCommand = mkOption {
type = types.str;
default = "";
@@ -71,6 +88,10 @@ in
lib.concatMap (
target: lib.mapAttrsToList (name: source: lib.nameValuePair "${target}/${name}" { inherit source; }) skills
) cfg.targets
++ lib.concatMap (
target:
lib.mapAttrsToList (name: source: lib.nameValuePair "${target}/${name}.md" { inherit source; }) agents
) cfg.agentTargets
);
};
}