Skip to content

Federate Copilot and Claude instructions from a single source#17

Merged
borland502 merged 1 commit intomainfrom
add-claude-federated-agent-instructions
Apr 30, 2026
Merged

Federate Copilot and Claude instructions from a single source#17
borland502 merged 1 commit intomainfrom
add-claude-federated-agent-instructions

Conversation

@borland502
Copy link
Copy Markdown
Owner

Summary

  • Add home-manager/config/instructions/agent-defaults.md as 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.
  • Introduce home-manager/lib/agent-instructions.nix to render two derivations at evaluation time: copilot (placeholder → copilot, Copilot YAML frontmatter prepended) and claude (placeholder → claude, plain CLAUDE.md with no frontmatter).
  • Wire common.nix and home-darwin.nix to 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.
  • Update scripts/check-copilot-instructions-sync.sh to substitute the placeholder before normalization so the .github/copilot-instructions.md mirror check continues to pass.
  • Update home-manager/config/copilot/README.md to document the new source path and the manual-setup substitution step.
  • Delete the now-redundant static copilot-defaults.instructions.md and CLAUDE.md files.
  • Adding support for a third agent in the future is a single render { ... } call in agent-instructions.nix.

Test plan

  • Pre-commit hooks pass (statix, deadnix, check:copilot-instructions sync check)
  • task upgrade completes successfully and deploys both ~/Library/Application Support/Code/User/prompts/copilot-defaults.instructions.md and ~/.claude/CLAUDE.md with correct content (no literal @@AGENT@@ present, correct cache dir in each)
  • VS Code Insiders prompts file also updated correctly
  • scripts/check-copilot-instructions-sync.sh exits 0

🤖 Generated with Claude Code

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>
@borland502 borland502 merged commit 2474e9f into main Apr 30, 2026
6 checks passed
@borland502 borland502 deleted the add-claude-federated-agent-instructions branch April 30, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant