Skip to content

Add @copilot coding agent as a Squad member type#13

Merged
bradygaster merged 33 commits intobradygaster:mainfrom
spboyer:feature/copilot-coding-agent-member
Feb 11, 2026
Merged

Add @copilot coding agent as a Squad member type#13
bradygaster merged 33 commits intobradygaster:mainfrom
spboyer:feature/copilot-coding-agent-member

Conversation

@spboyer
Copy link
Copy Markdown
Contributor

@spboyer spboyer commented Feb 11, 2026

Closes #12

Summary

Adds the GitHub Copilot coding agent (@copilot) as a first-class member type in Squad, alongside AI agents (✅) and humans (👤). When enabled, the team Lead can triage issues to @copilot and the coding agent picks them up autonomously — creating branches, writing code, and opening draft PRs.

What's new

🤖 Coding Agent member type

  • New 🤖 Coding Agent badge distinguishes from ✅ Active (AI) and 👤 Human
  • @copilot is always named "@copilot" — exempt from universe casting (like Scribe)
  • Three-tier capability profile (🟢 good fit / 🟡 needs review / 🔴 not suitable) in team.md
  • Lead evaluates issues against the profile during triage

Enable paths

  1. Conversation (recommended): "I want to add copilot to the squad", "hire copilot to the squad", "add team member copilot"
  2. Init-time question: Squad asks during init if you want to include the coding agent
  3. CLI fallback: npx squad copilot / copilot --auto-assign / copilot --off

Auto-assign workflow

  • When squad:copilot label is added to an issue, the workflow:
    1. Posts a routing comment (via GITHUB_TOKEN)
    2. Assigns copilot-swe-agent[bot] to the issue (via COPILOT_ASSIGN_TOKEN PAT)
    3. Coding agent picks up the issue and opens a draft PR
  • Dynamically detects the repo's default branch (works with main, master, etc.)

copilot-instructions.md

  • Template providing autonomous coding context: team roster, routing rules, capability self-check, branch naming
  • Auto-created when @copilot is enabled, refreshed on upgrade

Init-time question

  • Squad asks during init if you want to include the coding agent
  • Adds to roster with default capability profile

Setup requirements

COPILOT_ASSIGN_TOKEN (required for auto-assign)

The auto-assign workflow requires a classic Personal Access Token with repo scope:

  1. Create at https://github.com/settings/tokens/new — check repo scope
  2. Add as repo secret: gh secret set COPILOT_ASSIGN_TOKEN

Why? The default GITHUB_TOKEN cannot assign copilot-swe-agent[bot]. Fine-grained PATs also fail (403). Only a classic PAT with repo scope works.

Copilot coding agent must be enabled

  • Repository must have coding agent enabled in Settings → Copilot
  • copilot-setup-steps.yml must exist in .github/

Files changed

New files

File Purpose
templates/copilot-instructions.md Template for .github/copilot-instructions.md
docs/features/copilot-coding-agent.md Feature documentation

Modified files

File Change
index.js copilot subcommand, upgrade early-exit fix, copilot-instructions.md copy, PAT setup guidance
.github/agents/squad.agent.md Init question, casting exemption, Coding Agent Member section, routing signals
templates/roster.md Coding Agent section template
templates/routing.md @copilot routing entries, squad:copilot label, Lead triage guidance
templates/workflows/squad-issue-assign.yml squad:copilot detection, copilot-swe-agent[bot] assignment via PAT, dynamic default branch
templates/workflows/squad-triage.yml Capability profile parsing, @copilot triage routing
templates/workflows/sync-squad-labels.yml Creates squad:copilot label when coding agent on roster
test/index.test.js 11 new tests for copilot subcommand
README.md What's New entry, squad:copilot label
docs/scenarios/upgrading.md copilot-instructions.md upgrade row

Upgrade safety

  • upgrade does NOT touch .ai-team/team.md — your team roster, members, and decisions are preserved
  • Only squad-owned files are refreshed: squad.agent.md, workflows, templates, and copilot-instructions.md (if enabled)
  • Existing workflows for other members (non-copilot) are unaffected

Bugs fixed

  1. Upgrade early-exit bug: isAlreadyCurrent path called process.exit(0) before reaching workflow/agent copy code. Now refreshes all squad-owned files even when version matches.
  2. Dynamic default branch: agent_assignment.base_branch was hardcoded to main. Now fetches the repo's default_branch via API.

Testing

  • 44 tests passing (11 new for copilot subcommand)
  • Tested end-to-end on spboyer/slidemaker:
    • squad:copilot label → workflow fires → comment posted → agent assigned → agent starts working

- New member type: 🤖 Coding Agent with three-tier capability profile
- Init Mode asks if user wants @copilot on the team
- Configurable auto-assign via <!-- copilot-auto-assign --> in team.md
- Lead evaluates issues against capability profile during triage
- copilot-instructions.md template for autonomous coding agent context
- Upgrade updates copilot-instructions.md when @copilot is enabled
- squad:copilot label synced automatically
- Workflows: triage routes to @copilot, issue-assign auto-assigns
- Intercept rule ensures 'Enable @copilot' is not treated as greeting
- Docs: feature guide, README, upgrading docs updated
- Tests: 5 new tests (38 total, all passing)
Move @copilot command detection to a mandatory pre-check table
at the very top of Team Mode, before any routing or interpretation.
Explicit STOP instructions prevent the coordinator from treating
the command as a file reference or session greeting.
Typing '@copilot' in Copilot chat triggers IDE file-tagging,
preventing the coordinator from seeing the command text.
Changed all trigger phrases to use 'coding-agent' which is
unambiguous and won't collide with file/folder names.
'@copilot' triggered IDE file-tagging, 'coding-agent' triggered
Azure MCP tools (azd coding-agent config). New triggers use
squad-prefixed phrases or 'hire copilot' which are unambiguous.
…squad'

- Moved trigger check to top-level (before Init/Team Mode split)
  so it runs before any routing or interpretation
- Primary trigger: 'add copilot to squad' - unambiguous, won't
  trigger IDE file-tagging (@) or Azure tools (coding-agent)
- Previous triggers failed: '@copilot' (IDE intercept),
  'coding-agent' (Azure MCP), 'hire copilot' (confused with
  existing team hiring language)
'add copilot to squad' was interpreted as adding a new cast
member named Copilot. Adding 'agent' disambiguates — it's
clearly about the GitHub Copilot coding agent, not a person.
Also added explicit 'NOT a new cast member' warnings in the
command check and routing table.
- Add 'squad copilot' subcommand (--auto-assign, --off flags)
- Remove unreliable agent instruction triggers
- CLI directly modifies team.md and copies copilot-instructions.md
- Update agent.md to reference CLI instead of chat commands
- Rewrite tests for copilot subcommand (44/44 passing)
- Update feature docs with CLI usage
- Primary flow: coordinator handles in conversation during init or team mode
- Routing signal: 'add team member copilot' maps to Copilot Coding Agent Member section
- CLI subcommand kept as backup option
- Updated docs to show conversation-first, CLI-second approach
- Add @copilot exemption in Name Allocation (like Scribe)
- Add 'add team member copilot' guard in Human Team Members triggers
- Both redirect to Copilot Coding Agent Member section
- Prevents coordinator from casting copilot as a universe character
- Remove unreliable mid-session chat triggers (7 failed attempts)
- Keep init-time question (conversational, works in setup flow)
- Keep CLI subcommand for existing teams
- Keep casting exemption for @copilot (like Scribe)
- Clean up docs to reflect actual working flows
- Place check at the very top of the agent file (line 21-24)
- Before Team Mode, before project context loading
- Exact phrase match avoids collision with project copilot code
- 'squad' prefix makes it command-like, not a name to cast
- Falls through to Team Mode if phrase doesn't match
- Slash-command syntax signals 'this is a command, not a work request'
- 'bot' has zero semantic overlap with project copilot code
- Placed at line 21 with explicit STOP instructions
- Prevents file scanning, name casting, project analysis
- squad:copilot label now always assigns @copilot (no roster lookup needed)
- Assignment happens immediately in the copilot branch, not conditionally
- Simplified comment (removed auto-assign conditional)
- Removed redundant auto-assign block
- 'Already up to date' path was skipping workflow and agent copies
- Now always refreshes squad-owned files even when version matches
- Fixes issue where re-running upgrade didn't pick up workflow changes
- REST API addAssignees doesn't work for @copilot (special entity)
- Use 'gh issue edit --add-assignee @copilot' which is the documented approach
- Script step sets output, follow-up step runs gh CLI conditionally
- Use execSync with gh issue edit --add-assignee inside the script step
- Pass GH_TOKEN via env to the step
- Removes separate step that wasn't executing (output issue)
- Use --add-assignee copilot (no @)
- Use --repo GITHUB_REPOSITORY
- Use secrets.GITHUB_TOKEN per official docs
The gh CLI 'add-assignee copilot' fails with 'copilot not found' in
workflow context. Switch to github.rest.issues.addAssignees() which
properly recognizes the Copilot coding agent bot user.
The REST API addAssignees silently ignores 'copilot' - it returns 201
but doesn't actually assign. The coding agent can only be assigned
through the GitHub UI or an authenticated user's CLI session.

The workflow now posts a comment with the gh CLI command for the team
lead to assign @copilot manually.
…sign

Per GitHub docs, the coding agent assignee is 'copilot-swe-agent[bot]'
(not 'copilot') and requires the agent_assignment payload in the REST
API call. Uses SQUAD_TOKEN (PAT) if available, falls back to
GITHUB_TOKEN.
Match the exact pattern from GitHub docs: separate step using
github-token with a PAT secret (COPILOT_ASSIGN_TOKEN), calling
github.request() with copilot-swe-agent[bot] assignee and
agent_assignment payload.
…gnees

No PAT needed. Use github.rest.issues.addAssignees with
'copilot-swe-agent' (no [bot] suffix) and default GITHUB_TOKEN.
Single step, no separate secrets required.
GITHUB_TOKEN (app token) silently fails to assign copilot-swe-agent.
GitHub docs require a user token (PAT) for coding agent assignment.
Falls back to GITHUB_TOKEN if COPILOT_ASSIGN_TOKEN not configured.
…ment

The PAT can't post comments (Resource not accessible). Use default
GITHUB_TOKEN for routing/comments step, and COPILOT_ASSIGN_TOKEN
PAT only for the copilot-swe-agent assignment step.
Try copilot-swe-agent[bot] with agent_assignment payload first (per
GitHub docs), fall back to copilot-swe-agent without. Wrapped in
try/catch so routing comment still posts even if assignment fails.
May require classic PAT with repo scope.
Slidemaker uses 'master' not 'main'. The agent_assignment base_branch
was hardcoded to 'main' causing a ruleset-like error. Now fetches
the repo's default_branch via API.
When running 'npx squad copilot', the CLI now tells the user to
create a classic PAT and set it as COPILOT_ASSIGN_TOKEN repo secret.
This is required for the auto-assign workflow to work.
- Added Prerequisites section with repo requirements
- Added Quick Start with step-by-step commands
- Added dedicated COPILOT_ASSIGN_TOKEN section explaining why classic
  PAT is required (fine-grained fails, GITHUB_TOKEN silently ignores)
- Removed unreliable /squad-bot conversation trigger
- CLI is the recommended enable path
- Updated README prerequisites with PAT requirement
- CLI now shows PAT setup instructions when enabling copilot
@bradygaster bradygaster merged commit 2deea1a into bradygaster:main Feb 11, 2026
bradygaster added a commit that referenced this pull request Feb 13, 2026
Session: 2026-02-13-v040-boards-and-docs
Requested by: Brady

Changes:
- Created Squad Backlog project board (#13)
- Fenster: Phase 1 foundation — skill, proposal 006a, gate decision
- McManus: Blog post, README/guide.md updates
- Closed spikes: #22, #32, #33, #34, #35
- Merged decisions from inbox
- Logged session
joniba pushed a commit to joniba/squad that referenced this pull request Mar 26, 2026
Orchestration: Gandalf completed coffee-ratings squad-infra audit + reviewer hire planning.

Changes:
- Created 7 GitHub issues (bradygaster#7-bradygaster#13) with dependency chains:
  * Squad-infra audit: Elrond research → Bilbo docs → Gandalf decide → Gimli port → Bilbo template
  * Reviewer hire: Elrond study Bobbie patterns → Gandalf hire new Reviewer
- Merged decision inbox: clean-chat directive + coffee-port-plan
- Updated gandalf history.md with learnings

Labels created: squad:elrond (blue), squad:bilbo (green), squad:gandalf (yellow)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Add @copilot coding agent as a Squad member type

2 participants