This guide explains how to make your chatmode agents available across all VS Code projects.
Add this to your ~/.bashrc or ~/.zshrc:
setup-agents() {
local project_dir="${1:-.}"
mkdir -p "$project_dir/.github"
if [ ! -L "$project_dir/.github/agents" ] && [ ! -e "$project_dir/.github/agents" ]; then
ln -s "$HOME/chatmodes" "$project_dir/.github/agents"
echo "✅ Agents linked to $project_dir/.github/agents"
else
echo "⚠️ Agents already exist in $project_dir/.github/agents"
fi
if [ ! -L "$project_dir/.github/chatmodes" ] && [ ! -e "$project_dir/.github/chatmodes" ]; then
ln -s "$HOME/chatmodes" "$project_dir/.github/chatmodes"
echo "✅ Chatmodes linked to $project_dir/.github/chatmodes"
fi
}Usage:
# In any project directory
setup-agents
# Or specify a project path
setup-agents /path/to/projectThis was already configured for you! Every new git repository will automatically include the agents.
What was done:
mkdir -p ~/.git-templates/.github
ln -s ~/chatmodes ~/.git-templates/.github/agents
ln -s ~/chatmodes ~/.git-templates/.github/chatmodes
git config --global init.templateDir '~/.git-templates'Now whenever you run:
git initYour agents will automatically be available!
A standalone script has been created at ~/setup-agents.sh:
# Make it executable (already done)
chmod +x ~/setup-agents.sh
# Use it in any project
cd /path/to/project
~/setup-agents.sh
# Or specify the project path
~/setup-agents.sh /path/to/projectAdd to ~/.bashrc or ~/.zshrc:
alias link-agents='mkdir -p .github && ln -s ~/chatmodes .github/agents && ln -s ~/chatmodes .github/chatmodes && echo "✅ Agents linked!"'Usage:
cd /path/to/project
link-agentsTo verify agents are available in a project:
# Check if symlinks exist
ls -la .github/
# Should show:
# agents -> /home/krishnan/chatmodes
# chatmodes -> /home/krishnan/chatmodes
# List available agents
ls .github/agents/Once linked, your agents will be available in:
- GitHub Copilot Chat (if using GitHub Copilot)
- Other extensions that support chatmodes/agents
- Look for agent selection in your AI assistant interface
- Restart VS Code after creating symlinks
- Check if the symlink exists:
ls -la .github/agents - Ensure VS Code has access to the directory
- Check GitHub Copilot settings if using Copilot
Since they're symlinked, just update files in ~/chatmodes/ and all projects will automatically have the latest versions!
Run any of the methods above in the project directory.
For new projects:
git init
# Agents are automatically included via git template!For existing projects:
cd /path/to/existing/project
setup-agents- The agents are stored centrally in
~/chatmodes/ - Each project gets a symlink, not a copy
- Changes to agents are immediately available in all projects
- No need to manually sync or copy files
- Both
.github/agents/and.github/chatmodes/are created for compatibility