Federate Copilot and Claude instructions from a single source#17
Merged
borland502 merged 1 commit intomainfrom Apr 30, 2026
Merged
Federate Copilot and Claude instructions from a single source#17borland502 merged 1 commit intomainfrom
borland502 merged 1 commit intomainfrom
Conversation
Add home-manager/config/instructions/agent-defaults.md as the source of truth for shared AI agent defaults, using @@agent@@ as a placeholder. Introduce home-manager/lib/agent-instructions.nix to render per-agent derivations (Copilot with YAML frontmatter, Claude as plain CLAUDE.md) via builtins.replaceStrings at evaluation time. Wire both common.nix and home-darwin.nix to the derived outputs and drop the old static files. Update the copilot sync check script to substitute the placeholder before normalization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
home-manager/config/instructions/agent-defaults.mdas the single source of truth for shared AI agent defaults, using@@AGENT@@as a placeholder wherever the agent name (e.g. cache directory) should differ per tool.home-manager/lib/agent-instructions.nixto render two derivations at evaluation time:copilot(placeholder →copilot, Copilot YAML frontmatter prepended) andclaude(placeholder →claude, plain CLAUDE.md with no frontmatter).common.nixandhome-darwin.nixto consume the rendered derivations instead of static files; all existing deployment targets (~/.claude/CLAUDE.md, VS Code stable/Insiders prompts,~/.config/github-copilot/, IntelliJ) are unchanged.scripts/check-copilot-instructions-sync.shto substitute the placeholder before normalization so the.github/copilot-instructions.mdmirror check continues to pass.home-manager/config/copilot/README.mdto document the new source path and the manual-setup substitution step.copilot-defaults.instructions.mdandCLAUDE.mdfiles.render { ... }call inagent-instructions.nix.Test plan
statix,deadnix,check:copilot-instructionssync check)task upgradecompletes successfully and deploys both~/Library/Application Support/Code/User/prompts/copilot-defaults.instructions.mdand~/.claude/CLAUDE.mdwith correct content (no literal@@AGENT@@present, correct cache dir in each)scripts/check-copilot-instructions-sync.shexits 0🤖 Generated with Claude Code