Skip to content

gab-microsoft/multi-copilot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Copilot

Infrastructure for running multiple parallel GitHub Copilot CLI sessions using git worktrees and devcontainers.

Inspired by Jesse Vincent's workflow.

Overview

This repository provides reusable infrastructure (Windows host + PowerShell) that enables:

  • Parallel development: Work on multiple branches simultaneously, each in its own container
  • Isolated environments: Each worktree gets its own devcontainer with isolated state
  • Easy setup: PowerShell scripts automate worktree creation and container management
  • Project-agnostic: Copy these files to any project to enable multi-copilot workflows

Quick Start

1. Copy to Your Project

Copy the following to your project:

  • .devcontainer/ - Devcontainer configuration
  • scripts/ - Worktree management scripts
  • .gitattributes - Ensures shell scripts have correct line endings

2. Customize the Devcontainer

Edit .devcontainer/Dockerfile to add your project's dependencies (languages, tools, etc.).

Edit .devcontainer/devcontainer.json to:

  • Change the name to your project name
  • Update VS Code extensions for your tech stack

3. Set Environment Variables

Set these on your Windows host:

# Required: GitHub authentication
$env:GH_TOKEN = (gh auth token)

# Optional: Git identity
$env:GIT_USER_NAME = "Your Name"
$env:GIT_USER_EMAIL = "your.email@example.com"

# Optional: SSH commit signing
$env:GIT_SIGNING_KEY = "id_ed25519"  # or your key name

4. Start a Worktree Session

Option A: PowerShell scripts (for parallel Copilot CLI sessions)

.\scripts\worktree-up.ps1 feature-branch

Option B: VS Code (for single-session development)

Open the folder in VS Code with the Dev Containers extension installed. VS Code will prompt to reopen in container.

This will:

  1. Create a git worktree at .worktrees/feature-branch/
  2. Start a devcontainer for that worktree
  3. Configure Copilot CLI
  4. Launch Copilot in the container

5. Verify Setup

Inside the container, run:

bash scripts/smoke-test.sh

6. Check Status

.\scripts\worktree-status.ps1

7. Clean Up

# Remove a specific worktree and its container
.\scripts\worktree-down.ps1 feature-branch

# Clean up orphaned containers and project volumes (prompts first)
.\scripts\worktree-cleanup.ps1

How It Works

Git Worktrees

Git worktrees allow multiple working directories linked to the same repository. Each worktree can be on a different branch, enabling parallel development without stashing or committing.

Worktrees are created in .worktrees/ inside your repo (gitignored).

Devcontainers

Each worktree gets its own Docker container with:

  • Isolated filesystem
  • Pre-configured Copilot CLI (yolo mode by default)
  • Git authentication via GH_TOKEN

Path Translation

The tricky part is that git worktrees on Windows use host paths, but inside containers we need container paths. The scripts handle this by:

  1. Mounting the main .git directory at a known location
  2. Rewriting worktree .git files to use container paths
  3. Restoring host paths when exiting

File Structure

.devcontainer/
├── devcontainer.json      # Container configuration
├── Dockerfile             # Build dependencies (customize this)
├── copilot-config.json    # Copilot CLI settings (yolo mode)
├── mcp-config.json        # MCP server configuration
└── setup-git-auth.sh      # Configure git authentication

.github/
├── agents/                # Specialized Copilot agent definitions
│   ├── agent-workflow-engineer.agent.md
│   ├── python-code-expert.agent.md
│   ├── python-workflow-test-expert.agent.md
│   └── secure-code-reviewer.agent.md
├── skills/                # Copilot skill workflows
│   ├── done/              # /done — commit, push, merge
│   ├── parallel/          # /parallel — multi-agent orchestration
│   ├── worktree/          # /worktree — git worktree management
│   ├── coaching/          # /coaching — user writes, Copilot reviews
│   ├── issue/             # /issue — brainstorm and log issues
│   ├── ado-issue-tracker/ # ADO work item management
│   ├── ado-get-current-pr/# Get PR for current branch (with script)
│   └── skill-creator/     # Meta-skill: how to create new skills
├── instructions/          # Scoped instruction files (loaded per applyTo pattern)
│   └── 00-start.instructions.md
├── prompts/               # Reusable prompt templates
│   ├── ado-create-task.prompt.md
│   └── get-pr-changes.prompt.md
├── workflows/             # CI/CD pipelines
│   ├── ci.yml             # Lint, format, test
│   └── codeql.yml         # Security scanning
├── ISSUE_TEMPLATE/        # Bug report and feature request templates
├── pull_request_template.md
└── copilot-instructions.md

scripts/
├── worktree-up.ps1        # Create worktree + start container
├── worktree-down.ps1      # Remove worktree + stop container
├── worktree-status.ps1    # Show all worktrees and container status
├── worktree-cleanup.ps1   # Clean up orphaned containers
├── smoke-test.sh          # Verify devcontainer setup
└── README.md              # Script documentation

AGENTS.md                  # AI agent guidelines for this project

Copilot Skills & Agents

This template includes a batteries-included set of Copilot skills and agents. After copying to your project, update the <PLACEHOLDER> values in each file.

Skills (.github/skills/)

Skill Trigger Description
/done "I'm done", "commit" Stages, tests, commits with conventional message, pushes
/parallel Complex features Decomposes into file-independent tasks, spawns parallel workers
/worktree Parallel branches Creates/manages git worktrees for simultaneous development
/coaching "Coach me" Role-reversal: user codes, Copilot reviews and mentors
/issue "Log this", "I have an idea" Brainstorms rough ideas into structured ADO + GitHub issues
ado-issue-tracker "Track this", "show issues" Full ADO work item lifecycle with session SQL caching
ado-get-current-pr PR workflows Finds the PR for the current branch via ADO API script
skill-creator "Create a skill" Meta-skill: guides you through creating new Copilot skills

Prompts (.github/prompts/)

Reusable prompt templates that can be invoked directly:

Prompt Description
ado-create-task Create an ADO work item for a task
get-pr-changes Retrieve code changes for an ADO pull request

Instructions (.github/instructions/)

Scoped instruction files loaded automatically by Copilot based on applyTo patterns:

File Scope Description
00-start.instructions.md ** (all files) Project info, build commands, repo structure

Agents (.github/agents/)

Agent Invoke With Expertise
Agent Workflow Engineer @agent-workflow-engineer Agent systems, orchestration, state management
Python Code Expert @python-code-expert Python implementation, debugging, optimization
Python Test Expert @python-workflow-test-expert pytest, mocking, async testing, coverage
Secure Code Reviewer @secure-code-reviewer Threat modeling, vulnerability assessment

Customizing for Your Project

Files containing <PLACEHOLDER> values that need updating:

File Placeholders
.github/skills/issue/SKILL.md <ADO_ORG>, <ADO_PROJECT>, <GITHUB_OWNER>, <GITHUB_REPO>
.github/skills/ado-issue-tracker/SKILL.md Same as above
.github/workflows/ci.yml Source directory, install/test commands
.github/workflows/codeql.yml Language
AGENTS.md Owner, repo, build commands, project structure

Customization

Adding MCP Servers

Edit .devcontainer/mcp-config.json:

{
  "mcpServers": {
    "your-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "your-mcp-server"],
      "env": {
        "API_TOKEN": "${YOUR_API_TOKEN}"
      }
    }
  }
}

Then add the env var to remoteEnv in devcontainer.json.

Adding Environment Variables

Add to remoteEnv in devcontainer.json:

"remoteEnv": {
  "MY_TOKEN": "${localEnv:MY_TOKEN}"
}

Requirements

  • Windows with PowerShell 5.1+ (scripts are PowerShell/Windows-focused)
  • Git with worktree support
  • Docker Desktop
  • Node.js (for devcontainer CLI)
  • GitHub CLI (gh) for authentication

License

Copyright 2026 James Casey
SPDX-License-Identifier: Apache-2.0

About

Run multiple parallel GitHub Copilot CLI sessions using git worktrees and devcontainers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • PowerShell 90.2%
  • Shell 6.0%
  • Dockerfile 3.8%