Repository navigation
✨ feat(copilot): stow whole config dir with runtime-state gitignore - #159
Merged
Merged
Conversation
Copilot was previously stowed per-file: the two config files were individual home.file entries. Switch to the standard whole-dir stow by adding "copilot" to configLinks, so ~/.config/copilot is a single symlink into the repo. Global instructions now work via a git symlink inside the copilot dir pointing at agents/.config/agents/nix-native-deps.md, keeping one source of truth. Research findings recorded for the commit: - COPILOT_CUSTOM_INSTRUCTIONS_DIRS cannot reproduce global behaviour: *.instructions.md files are path-specific (only applied when applyTo matches the file being worked on) and AGENTS.md files in custom dirs are not auto-loaded (github/copilot-cli#713, #1433). Not viable for machine-wide workflow guidance. - The global instructions filename ($COPILOT_HOME/copilot-instructions.md) is fixed; COPILOT_HOME relocates config+state together but cannot split them (github/copilot-cli#1954), so runtime state cannot be redirected to XDG_STATE_HOME. Only the cache dir is XDG-compliant via COPILOT_CACHE_HOME. - Hence runtime state (session-store.db, session-state/, logs/, permissions-config.json, mcp-oauth-config/, etc.) lands inside the repo's copilot dir through the whole-dir symlink; the gitignore whitelist keeps the two stowed config files tracked and ignores the rest. Verified: all three hosts evaluate via nix eval. Co-authored-by: Copilot <[email protected]>
Point skillDirectories at the two skills roots instead of enumerating individual skill directories, so new skills under either tree load automatically. Verified: parent dirs recursively discover all 54 skills across both trees (5 name collisions deduped first-win), confirmed with `copilot skill list` against a scratch COPILOT_HOME before applying. settings.json is now a stowed config file, so whitelist it in the copilot gitignore alongside mcp-config.json and copilot-instructions.md. Co-authored-by: Copilot <[email protected]>
dandyrow
added a commit
that referenced
this pull request
Sep 1, 2026
…159) * ✨ feat(copilot): stow whole config dir with runtime-state gitignore Copilot was previously stowed per-file: the two config files were individual home.file entries. Switch to the standard whole-dir stow by adding "copilot" to configLinks, so ~/.config/copilot is a single symlink into the repo. Global instructions now work via a git symlink inside the copilot dir pointing at agents/.config/agents/nix-native-deps.md, keeping one source of truth. Research findings recorded for the commit: - COPILOT_CUSTOM_INSTRUCTIONS_DIRS cannot reproduce global behaviour: *.instructions.md files are path-specific (only applied when applyTo matches the file being worked on) and AGENTS.md files in custom dirs are not auto-loaded (github/copilot-cli#713, #1433). Not viable for machine-wide workflow guidance. - The global instructions filename ($COPILOT_HOME/copilot-instructions.md) is fixed; COPILOT_HOME relocates config+state together but cannot split them (github/copilot-cli#1954), so runtime state cannot be redirected to XDG_STATE_HOME. Only the cache dir is XDG-compliant via COPILOT_CACHE_HOME. - Hence runtime state (session-store.db, session-state/, logs/, permissions-config.json, mcp-oauth-config/, etc.) lands inside the repo's copilot dir through the whole-dir symlink; the gitignore whitelist keeps the two stowed config files tracked and ignores the rest. Verified: all three hosts evaluate via nix eval. Co-authored-by: Copilot <[email protected]> * 🗂️ feat(copilot): discover skills from parent dirs in settings.json Point skillDirectories at the two skills roots instead of enumerating individual skill directories, so new skills under either tree load automatically. Verified: parent dirs recursively discover all 54 skills across both trees (5 name collisions deduped first-win), confirmed with `copilot skill list` against a scratch COPILOT_HOME before applying. settings.json is now a stowed config file, so whitelist it in the copilot gitignore alongside mcp-config.json and copilot-instructions.md. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
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.
What
Copilot CLI config switches from per-file stowing to the standard whole-dir stow:
dotfiles-linking.nix: added"copilot"toconfigLinks, removed the two per-filehome.fileentries.~/.config/copilotis now a single symlink into the repo'scopilot/.config/copilot/.copilot/.config/copilot/copilot-instructions.md → ../../../agents/.config/agents/nix-native-deps.md— keeps one source of truth for the machine-wide Nix-native dependency guidance..gitignore: whitelist ignores all copilot runtime state inside the repo's copilot dir, keeping only the stowed config files tracked (mcp-config.json,settings.json,copilot-instructions.md).settings.json: now tracked in the repo.skillDirectoriespoints at the two skills roots (wd-product-ai/skillsand~/.local/share/agents/skills) instead of enumerating individual skills, so new skills under either tree auto-load. Verified: parent dirs recursively discover all 54 skills across both trees (5 name collisions deduped first-win) viacopilot skill listagainst a scratchCOPILOT_HOME.Why per-file → whole-dir
The previous per-file handling existed because the two copilot config files came from different sources (mcp-config.json from the copilot dir, copilot-instructions.md from the agents dir). With a git symlink inside the repo's copilot dir, the whole dir can be stowed normally while the instructions content still resolves to the canonical
agents/nix-native-deps.md.Research: can global instructions / runtime state live outside
$COPILOT_HOME?No — investigated before implementing:
COPILOT_CUSTOM_INSTRUCTIONS_DIRScannot reproduce global behaviour.*.instructions.mdfiles are path-specific — only applied whenapplyTomatches the file being worked on — andAGENTS.mdfiles in the custom dirs are unreliable/not auto-loaded (copilot-cli#713, copilot-cli#1433). Not viable for machine-wide workflow guidance.$COPILOT_HOME/copilot-instructions.md; there is no config to point that file at an arbitrary path.COPILOT_HOMErelocates config+state as one bundle with no way to split them (copilot-cli#1954). Only the cache dir is XDG-compliant (COPILOT_CACHE_HOME→~/.cache/copilot).Because the whole-dir symlink means runtime state (session-store.db, session-state/, logs/, permissions-config.json, mcp-oauth-config/, etc.) will be written into the repo's copilot dir, the
.gitignorewhitelist keeps that churn out of git status while keeping the stowed config files tracked.Verification
DansSpectre,New-H0Ryzen,WSL --impure) evaluate vianix eval.git check-ignoreconfirms runtime names are ignored; tracked config files are not.agents/.config/agents/nix-native-deps.mdviareadlink -f.copilot skill list(scratchCOPILOT_HOME,COPILOT_SKILLS_DIRSunset) confirms the parent-dirskillDirectoriesdiscover all 54 skills from both trees.Post-merge switch notes
nixos-rebuild switchwill replace the current real~/.config/copilotdir (203 MB of runtime state) with the symlink into the repo. Existing sessions/logs/permissions in the old dir are left behind; copilot will recreate its runtime files fresh in the repo dir on next launch (auth inconfig.jsonmay need re-login if not stored in the system keyring). Worth a one-time migration ofmcp-oauth-config/andpermissions-config.jsonif you want to keep them. The pre-existing~/.config/copilot/settings.jsonshould be replaced by the repo version after switch (delete or move aside so the symlink's file takes effect).