diff --git a/claude-md/opencode-header.md b/claude-md/opencode-header.md new file mode 100644 index 0000000..b2675c5 --- /dev/null +++ b/claude-md/opencode-header.md @@ -0,0 +1 @@ +Screenshots: stored in ~/downloads/screenshots, with date time in the filename diff --git a/nix/home.nix b/nix/home.nix index 4d5e58f..1372659 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,5 +1,6 @@ -# Home-manager module: link centralized agent skills into Claude Code + Codex. -# Usage: add this flake as an input, then import this module in your home config. +# Home-manager module: link centralized agent skills into Claude Code, Codex, +# Pi and opencode. Usage: add this flake as an input, then import this module +# in your home config. # # inputs.agent-skills.url = "git+https://git.naps.pt/yolo/agent-skills.git"; # # in home.nix imports: inputs.agent-skills.homeModules.default @@ -9,9 +10,20 @@ # recursive=true links each FILE individually, so machine-local skills can still # live alongside the managed ones in the same dir (a whole-dir symlink would not). { agent-skills }: -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.agentSkills; + + # Pi and opencode have no `@file` imports in context files, so the shared + # fragments are concatenated into one AGENTS.md per tool. + concatMd = + name: files: + pkgs.writeText name (lib.concatMapStringsSep "\n" builtins.readFile files); in { options.programs.agentSkills.machine = lib.mkOption { @@ -65,6 +77,31 @@ in # Entry files: machine-local sections + @imports of the fragments above. ".claude/CLAUDE.md".source = "${agent-skills}/entry/CLAUDE.md"; ".codex/AGENTS.md".source = "${agent-skills}/entry/codex-AGENTS.md"; + + # Pi: skills need no wiring — pi reads ~/.agents/skills, linked above. + # Settings stay unmanaged: pi writes ~/.pi/agent/settings.json itself. + ".pi/agent/AGENTS.md".source = concatMd "pi-AGENTS.md" [ + "${agent-skills}/claude-md/machines/${cfg.machine}.md" + "${agent-skills}/claude-md/operating.md" + "${agent-skills}/claude-md/writing.md" + "${agent-skills}/claude-md/code-comments.md" + "${agent-skills}/claude-md/RTK.md" + ]; + + # opencode auto-loads skills from ~/.claude/skills and ~/.agents/skills, + # so only the rules file and commands need linking here. + ".config/opencode/AGENTS.md".source = concatMd "opencode-AGENTS.md" [ + "${agent-skills}/claude-md/opencode-header.md" + "${agent-skills}/claude-md/machines/${cfg.machine}.md" + "${agent-skills}/claude-md/operating.md" + "${agent-skills}/claude-md/writing.md" + "${agent-skills}/claude-md/code-comments.md" + "${agent-skills}/claude-md/RTK.md" + ]; + ".config/opencode/commands" = { + source = "${agent-skills}/commands"; + recursive = true; + }; }; } # Hook wiring lives in ~/.claude/settings.json, which this module does not own.