Skip to content

Latest commit

 

History

History
142 lines (105 loc) · 3.46 KB

File metadata and controls

142 lines (105 loc) · 3.46 KB

Making Agents Available Globally in VS Code

This guide explains how to make your chatmode agents available across all VS Code projects.

Method 1: Shell Function (Recommended for Existing 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/project

Method 2: Git Template (Automatic for New Repos)

This 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 init

Your agents will automatically be available!

Method 3: Manual Setup Script

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/project

Method 4: Quick Alias

Add 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-agents

Verification

To 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/

VS Code Usage

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

Troubleshooting

Agents not showing up in VS Code

  1. Restart VS Code after creating symlinks
  2. Check if the symlink exists: ls -la .github/agents
  3. Ensure VS Code has access to the directory
  4. Check GitHub Copilot settings if using Copilot

Updating agents

Since they're symlinked, just update files in ~/chatmodes/ and all projects will automatically have the latest versions!

Adding agents to existing projects

Run any of the methods above in the project directory.

Recommended Workflow

For new projects:

git init
# Agents are automatically included via git template!

For existing projects:

cd /path/to/existing/project
setup-agents

Notes

  • 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