Adding Claude Code or Codex alongside GitHub Copilot
Adding Claude Code or Codex alongside GitHub Copilot means keeping Copilot for completions, issue-driven cloud-agent work and review, and giving a second agent the tasks that need its own harness. The two coexist in one repository when they share one AGENTS.md, one skills directory, one GitHub MCP setup, and one set of CI gates.
Your company pays for Copilot Business, yet the repository now holds a .github/copilot-instructions.md, a CLAUDE.md, and an AGENTS.md that disagree about the test command. Pull requests arrive from Copilot, Claude Code, and Codex, and nobody can say which agent is worth its cost. So the question is not how to leave Copilot but how to run a second agent next to it without doubling the confusion.
This page is for the developer who adds the second agent and for the tech lead who has to make the setup repeatable. Copilot is usually the tool the company already pays for, so it stays. It is also a full agent platform now, with a cloud agent, a desktop app, a CLI, hooks, MCP, and Agent Skills; GitHub Copilot as a coding agent covers it in depth.
What you’ll walk away with from running a second agent beside Copilot
Section titled “What you’ll walk away with from running a second agent beside Copilot”- A decision table for when Copilot is enough and when Claude Code or Codex pays for itself
- A repository layout in which Copilot, Claude Code, and Codex read the same instructions, skills, and GitHub MCP server
- Three copy-paste prompts: consolidate instruction files, delegate a cross-file change with evidence, and compare two agents on the same issue
- A two-week pilot with per-agent metrics and an explicit keep, narrow, or drop decision
- The failure modes of a two-agent repository and how to recover from each
When is Copilot enough, and when does a second agent pay off?
Section titled “When is Copilot enough, and when does a second agent pay off?”Start from the work, not the tool. Copilot’s cloud agent turns a well-written GitHub issue into a pull request inside GitHub Actions, and for many teams that covers most delegated work. A second agent earns its place when the work needs something Copilot’s harness does not give that team.
| Situation | What to do |
|---|---|
| Work starts as small, well-scoped GitHub issues | Stay on the Copilot cloud agent. Write the issue as a spec with acceptance criteria an agent can check. |
Engineers want a terminal agent with hooks, subagents, plugins, and headless claude -p runs in scripts and CI | Add Claude Code for those engineers. Keep Copilot for issue-driven work and completions. |
You want GPT-6 Astra, Codex’s default model, in its own harness, or codex exec in CI and Codex cloud tasks | Add Codex. On 2026-09-26, GitHub’s docs listed older OpenAI models for the Codex agent inside Copilot. |
| You want to compare harnesses before buying anything | Enable the Claude or Codex third-party agents inside Copilot (public preview). They draw on your Copilot AI credits and Actions minutes. |
| The code is not on GitHub | The cloud agent does not apply. Compare the other coding agents. |
| Engineers want an IDE-first agent with visual diffs | Evaluate Cursor through the head-to-head comparison, which covers its agent, pricing, and review tools. |
Stay on each tool’s default model at first: Claude Opus 5.5 in Claude Code (from v2.1.280 on the latest release channel; engineers on the stable channel keep the previous default until it reaches v2.1.280) and GPT-6 Astra in Codex. Tune effort before you switch model, and switch only when your own evals say so. Prices and context windows live on the models hub.
Set up one repository for Copilot and a second agent
Section titled “Set up one repository for Copilot and a second agent”The goal is one source of truth per concern: instructions, skills, tool access, and gates. Every duplicate becomes a place where the agents disagree.
-
Make
AGENTS.mdthe canonical instruction file. GitHub’s docs listAGENTS.mdas agent instructions for Copilot, with a rootCLAUDE.mdorGEMINI.mdas alternatives (checked 2026-09-26). Codex readsAGENTS.mdnatively (in a trusted project; since 0.150.0, an untrusted project’sAGENTS.mdis not loaded). Claude Code readsAGENTS.mdonly when a project has noCLAUDE.md. That fallback needs v2.1.277 on thelatestchannel (v2.1.281 on Bedrock, Google Cloud, Foundry or an LLM gateway). Thestablechannel was at v2.1.274 on 2026-09-26. So give Claude Code a one-lineCLAUDE.mdthat imports the shared file. Copilot CLI readsAGENTS.mddirectly and also expands the import, so it may load the file twice; that is harmless but costs context:AGENTS.md # build, test, lint commands; architecture; definition of doneCLAUDE.md # one line: @AGENTS.md (Copilot reads this file too).claude/rules/ # Claude Code rules (Copilot CLI also reads these; the cloud agent does not).github/copilot-instructions.md # Copilot-only notes (review tone, PR template), no build commands.claude/skills/ # shared skills: Copilot and Claude Code both load this path.mcp.json # Claude Code's project MCP servers -
Share skills from one directory. Copilot loads project skills from
.github/skills,.claude/skills, or.agents/skills(GitHub docs, checked 2026-09-26), and Claude Code loads.claude/skills, so a skill written once in.claude/skillsworks in both. In Codex, run/skillsin the TUI to confirm which skills it found before you rely on one. See installing and managing skills. -
Give the new agent the GitHub MCP server. Copilot CLI ships GitHub’s MCP server by default; the second agent needs it added. Read the token from an environment variable, never from the command line, and prefer a fine-grained token with only the repositories it needs.
Commit this
.mcp.jsonat the repository root. Claude Code expands${GITHUB_PAT_TOKEN}from each engineer’s environment, so no secret enters git.{"mcpServers": {"github": {"type": "http","url": "https://api.githubcopilot.com/mcp/","headers": { "Authorization": "Bearer ${GITHUB_PAT_TOKEN}" }}}}Run in a terminal. Codex writes the entry to
~/.codex/config.tomland reads the token from the named variable at run time.Terminal window codex mcp add github --url https://api.githubcopilot.com/mcp/ --bearer-token-env-var GITHUB_PAT_TOKENFor read-only toolsets, lockdown mode, and the local Docker variant, see the GitHub MCP server.
-
Give every agent its own branch. Prefix branches by agent (
claude/…,codex/…) so your metrics can attribute each pull request, and never let two agents push to one branch.claude --worktree NAMEstarts a Claude Code session in its own git worktree. -
Apply one set of required checks to every pull request. Branch protection does not care who wrote the code. Type check, lint, tests, and any security scan are required for Copilot’s pull requests and the second agent’s alike, and every agent pull request carries an evidence bundle.
Run the first prompt in the second agent to do the consolidation in step 1. It reads what Copilot already knows and moves it, instead of asking you to rewrite it by hand.
You verify this change by the table at the end and by running the commands in AGENTS.md yourself once. If the table shows a dropped rule you still need, restore it before you merge.
Delegate a cross-file change to the second agent
Section titled “Delegate a cross-file change to the second agent”Give the second agent a task that is awkward as a Copilot issue: one that spans modules and needs the agent to run the project’s own tools repeatedly. Write the acceptance criteria into the prompt so the result is checkable without reading every line.
Start an isolated session from the repository root, paste the prompt, and approve the plan in plan mode (Shift+Tab) before edits begin.
claude --worktree moment-to-date-fnsRun the same prompt non-interactively with the workspace permission profile (beta), which limits writes to the workspace. Save the prompt to prompt.md, then create the branch yourself first, because Codex cannot:
git switch -c codex/moment-to-date-fnscodex exec -c default_permissions=":workspace" "$(cat prompt.md)"Under :workspace, Codex edits files but cannot commit: the profile keeps .git read-only and leaves the sandbox without network access unless you enable it (checked on codex-cli 0.157.1). So run npm install date-fns && npm uninstall moment yourself before the run (the agent then only edits code), or enable network for the profile. Afterwards review the diff, commit, push, and run gh pr create, pasting the evidence the agent printed.
The Copilot cloud agent can take the same prompt as an issue body, which is what makes the next step possible.
Compare Copilot and the second agent on the same issue
Section titled “Compare Copilot and the second agent on the same issue”Opinions about which agent is “better” settle nothing. Give both agents the same issue, then have a third party, human or agent, score the two pull requests against the issue’s acceptance criteria rather than against taste.
To start both runs, assign issue #412 to Copilot (Assignees → Copilot, or start it from the Agents tab) and run the second agent on the branch claude/issue-412. Run the comparison with the GitHub MCP server connected so the agent can read the issue and both pull requests. The Copilot cloud agent can itself run Claude or GPT models, so choose a reviewer whose model differs from both authors’ models; otherwise one model grades its own habits.
Run a two-week pilot and decide with numbers
Section titled “Run a two-week pilot and decide with numbers”-
Pick three to five engineers and two task classes. For example: dependency upgrades and cross-module refactors. Keep issue-sized work on Copilot during the pilot so you have a baseline.
-
Track four measures per agent. Merge rate of agent pull requests; rework, meaning fix commits to the same files within 14 days; first-push CI pass rate; and cost per merged pull request. Attribute Copilot pull requests by the pull request author (the Copilot bot) or its branch; each Claude Code pilot engineer records the token and plan-usage figures from
/usageat the end of each week, and team-level cost comes from claude.ai Admin settings > Usage (Team and Enterprise seats), the Claude Console (API billing), or the OpenTelemetry export described in cost governance. For Codex on a ChatGPT plan, divide the pilot seats’ monthly plan cost by mergedcodex/pull requests. Attribute the rest by branch prefix. Metrics frameworks explains why merge rate and rework beat activity counts. -
Budget both bills. Copilot bills usage in GitHub AI Credits at $0.01 each since 2026-06-01, and its cloud agent and third-party agents also use Actions minutes. Anthropic’s own estimate for Claude Code in enterprises is “around $13 per developer per active day and $150-250 per developer per month” (Claude Code costs docs, checked 2026-09-26). Codex is included in ChatGPT Plus, Pro, Business, Edu, and Enterprise plans. Plan prices live in the pricing analysis; budget controls in cost governance.
-
Decide at the end of week two. Keep both if the second agent beats the Copilot baseline on merge rate and rework, at a cost per merged pull request you accept. Narrow it to the winning task class if it wins on only one of the two, or only in one class. Drop it if Copilot matches it on both. When the two are close, let first-push CI pass rate break the tie. Write the decision and the numbers down, so the next tool request starts from evidence. Pilot design covers control groups and sample size.
How do you verify two agents’ work without reading every line?
Section titled “How do you verify two agents’ work without reading every line?”Verification does not change with the author. The same gates catch the same failures whether Copilot or the second agent wrote the code.
- Acceptance criteria before code. Each issue or prompt names the criteria and the command that proves them. The prompts above follow this shape.
- Required checks on every pull request. Type check, lint, tests, and security scanning run in CI and block the merge. No agent gets an exception.
- An evidence bundle in the pull request body. Each criterion maps to a test and its output. The reviewer checks the mapping, not every line.
- An automated reviewer from a different vendor. Copilot code review, Claude Code’s
/code-review, or Codex review on GitHub can each review the other agents’ pull requests. See AI review bots compared. - Human sign-off where tests cannot reach. The engineer who delegated the task signs off on the evidence and reads the diff only for auth, data migrations, billing, and public API changes. Reviewing agent pull requests gives the full checklist.
- Small pull requests and a clean revert path. One agent, one branch, one task. If a merged change misbehaves,
git revertremoves it without touching the other agent’s work.
What breaks when Copilot and a second agent share a repository?
Section titled “What breaks when Copilot and a second agent share a repository?”The agents follow different rules. Someone updates the test command in .github/copilot-instructions.md but not in AGENTS.md. Recovery: rerun the consolidation prompt, then add a CI step that fails when CLAUDE.md does not start with @AGENTS.md (head -n 1 CLAUDE.md | grep -qx '@AGENTS.md') and when .github/copilot-instructions.md mentions a build command (! grep -Eq '(npm|pnpm|yarn|bun|make) (run|test|build)' .github/copilot-instructions.md; adjust the tool names to your repository).
Some Claude Code sessions never load AGENTS.md. Engineers on the stable channel, or anyone with a CLAUDE.md that lacks the import, never load it. Recovery: the @AGENTS.md import does not depend on the fallback, so it works on both channels. Check that every CLAUDE.md in the repository starts with it.
Claude-only instructions reach Copilot. GitHub’s docs name a root CLAUDE.md as an alternative instruction file for Copilot. Recovery: keep CLAUDE.md to the import plus tool-neutral lines, and move Claude-specific rules into .claude/rules/. That keeps them out of CLAUDE.md and away from the Copilot cloud agent, but not from Copilot CLI, which reads .claude/rules/**/*.md the same way it reads .github/instructions/ (Copilot CLI command reference, checked 2026-09-26). A rule that must never reach Copilot needs wording that is harmless to any agent, or paths: frontmatter that scopes it to the files it governs.
Two agents push to the same branch. A Copilot follow-up commit lands on the second agent’s branch and CI goes red for reasons neither agent caused. Recovery: close the pull request, restart from the default branch with one agent, and enforce the branch-prefix rule.
The organisation blocks the new agent’s tools. Copilot organisation policies govern MCP and the third-party agents, and enabling the Claude or Codex agent inside Copilot installs a GitHub App. Recovery: ask the admin for the specific policy, and record the change in your cross-vendor managed policy.
Spend doubles quietly. Engineers expense personal plans while the company pays Copilot seats. Recovery: move the pilot users to company seats with a budget cap, and review both bills at the week-two decision.
The review queue floods. Two agents produce pull requests faster than the team reviews them, and reviewers start skimming. Recovery: cap open agent pull requests per engineer, keep them small, and see managing the review queue.
Where to go next with Copilot and a second agent
Section titled “Where to go next with Copilot and a second agent”To install the second agent, start with the Claude Code quick start or the Codex quick start. To make the repository itself agent-ready, see the project conversion playbook.