Skip to content

Commit 8e33a63

Browse files
committed
feat(agents): share pi-skills across every coding agent
The pi-skills repo was reachable only through a hand-made symlink into pi's skills directory, pointing at a local checkout, so the other agents saw none of it and nothing was reproducible on another machine. Skills are discovered as any top-level directory holding a SKILL.md, so adding one to the repo reaches every agent after `nix flake update pi-skills` without touching this module. Each skill is linked on its own because Claude Code and Codex only look one level deep; linking the repo root would bury every skill one directory too far for them. Claude Code and Codex are kept out of the zed skill, which only pays for itself in the agents driven from Zed. opencode also scans the Claude Code and Codex directories, which would find every shared skill three times. It keys skills by name and resolves the collision by whichever file parses last, so the reported location flips between sessions and busts the prompt cache (anomalyco/opencode#29950). OPENCODE_DISABLE_EXTERNAL_SKILLS confines it to its own directory.
1 parent 8288b10 commit 8e33a63

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

‎flake.lock‎

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
5757
nix-linux-builder.url = "github:input-output-hk/nix-linux-builder";
5858
llm-agents.url = "github:numtide/llm-agents.nix";
59+
# Skill definitions shared by every coding agent. Consumed as a plain source
60+
# tree, so `nix flake update pi-skills` is what publishes a skill edit.
61+
pi-skills = {
62+
url = "github:zekurio/pi-skills";
63+
flake = false;
64+
};
65+
5966
sops-nix = {
6067
url = "github:Mic92/sops-nix";
6168
inputs.nixpkgs.follows = "nixpkgs-unstable";
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
flake.modules.homeManager.zekurio = {
3+
inputs,
4+
lib,
5+
...
6+
}: let
7+
source = inputs.pi-skills;
8+
9+
# A skill is any top-level directory holding a SKILL.md, so adding one to
10+
# the pi-skills repo reaches every agent here after `nix flake update
11+
# pi-skills` without touching this file.
12+
available =
13+
lib.filter (name: builtins.pathExists "${source}/${name}/SKILL.md")
14+
(builtins.attrNames (builtins.readDir source));
15+
16+
# The zed skill only pays for itself in the agents driven from Zed, so it is
17+
# kept out of Claude Code's and Codex's context.
18+
shared = lib.filter (name: name != "zed") available;
19+
20+
# Claude Code and Codex only look one level deep, at <directory>/<skill>/
21+
# SKILL.md, so each skill is linked on its own. Linking the pi-skills repo
22+
# root instead would bury every skill one directory too deep for them.
23+
linkSkills = directory: skills:
24+
lib.listToAttrs (map (name:
25+
lib.nameValuePair "${directory}/${name}" {
26+
source = "${source}/${name}";
27+
})
28+
skills);
29+
in {
30+
home.file =
31+
linkSkills ".pi/agent/skills" available
32+
// linkSkills ".claude/skills" shared
33+
# Codex's documented user scope.
34+
// linkSkills ".agents/skills" shared
35+
// linkSkills ".config/opencode/skills" available;
36+
37+
# Left alone, opencode also scans ~/.claude/skills and ~/.agents/skills, so
38+
# every shared skill would be discovered three times. It keys skills by name
39+
# and resolves the collision by whichever file parses last, which makes the
40+
# reported skill location flip between sessions and busts the prompt cache
41+
# (anomalyco/opencode#29950). Confining it to its own directory keeps
42+
# discovery deterministic.
43+
home.sessionVariables.OPENCODE_DISABLE_EXTERNAL_SKILLS = "1";
44+
};
45+
}

0 commit comments

Comments
 (0)