Skip to main content

2 posts tagged with "MCP"

View All Tags

GitHub Copilot: From Basics to AI Agents

Β· 22 min read

Watercolor illustration of a woodworker in blue meeting his first AI helper in green at a furniture workshop

Imagine a furniture workshop. You're the craftsperson in the blue shirt β€” the one with the vision, the taste, the final say. The helpers in green shirts? Those are your AI agents. At first there's just one, handing you the right chisel at the right moment. By the end of this journey, you'll have a whole crew in green building furniture to your specifications while you direct, decide, and review.

A year ago, I was tab-completing function signatures. Today, I manage a team of named AI agents that handle PR reviews, documentation sweeps, and infrastructure audits.

That sounds like a sales pitch. It's not. It's a progression that happened one level at a time, each building on the last. And the best part? You can start the same journey in about 15 minutes.

Here's the path I took β€” four levels, from "ooh that's cool" to "wait, this changes everything."

The TL;DR​

LevelWhat ChangesTime to Value
1. First DayYou get an AI pair programmer (IDE + CLI)15 minutes
2. Making It YoursCopilot learns YOUR codebase (instructions, MCPs, skills)1-2 hours
3. SquadA team of agents working in concert1 day
4. Autonomous OpsFully defined work executes itself2-3 days

Each level builds on the previous one, and each is independently useful. Once you see what's possible at each stage, you'll want to keep climbing.

Badge legend: πŸ–₯️ VS Code Β· ⌨️ CLI Β· πŸ‘€ Interactive Β· πŸ€– Autonomous Β· πŸ’» Local Β· ☁️ Cloud Β· 🌐 GitHub.com


Level 1: Your First Day with Copilot​

πŸ–₯️ VS Code Β· ⌨️ CLI Β· πŸ‘€ Interactive Β· πŸ’» Local

Watercolor illustration of a blue-shirted craftsperson at the workbench while a green-shirted helper steadies the joint

Your first day in the workshop. You're at the bench with your mallet (blue shirt), fitting a dovetail joint. Your one helper in green steadies the piece, hands you the right tool before you ask, and suggests a better angle β€” but you swing the mallet.

This is where everyone starts β€” and honestly, where most of the immediate productivity gains live. Level 1 spans two environments: Copilot in your IDE (VS Code, JetBrains, etc.) and the standalone Copilot CLI in your terminal.

In the IDE: Inline Completions & Inline Chat​

πŸ–₯️ VS Code Β· πŸ‘€ Interactive Β· πŸ’» Local

Inline completions β€” the thing most people think of as "Copilot." You type, it suggests. But it's more than autocomplete. It reads your open files, your comments, your function signatures, and generates contextually aware suggestions. This happens directly in your editor as you type.

Inline chat β€” highlight code, press Ctrl+I, ask a question. "Explain this regex." "Refactor this to use async/await." "Add error handling." It edits in place within the current file.

In the IDE: Copilot Chat Panel​

πŸ–₯️ VS Code Β· πŸ‘€ Interactive Β· πŸ’» Local

The Chat panel (Ctrl+Shift+I or the sidebar) opens a conversation with Copilot that has broader awareness:

  • Open file context β€” ask questions about the file you're looking at: "What does this function do?" "Find the bug in this logic."
  • @workspace β€” ask about the entire repository: "Where is authentication handled?" "Show me all API routes." Copilot searches across your project.
  • @terminal β€” get help with shell commands without leaving the IDE: "How do I find large files?" "What's the git command to squash commits?"
  • Agent mode β€” Copilot Chat also has an "agent" mode where it can make multi-step edits, run terminal commands, and iterate. This is powerful for IDE-based workflows, but note: this is different from the Squad "agents" discussed later. Agent mode is a single AI working iteratively; Squad agents are specialized team members working in concert.

The Standalone Copilot CLI​

⌨️ CLI Β· πŸ‘€ Interactive Β· πŸ’» Local

The copilot command brings the full Copilot agent to your terminal β€” file editing, shell commands, sub-agents, and more:

# Non-interactive prompt mode:
copilot -p "extract a .tar.gz file preserving permissions"

# Ask about git:
copilot -p "undo my last commit but keep the changes"

# Start an interactive session:
copilot

The standalone CLI (copilot) is a full agent runtime β€” it can read/write files, run commands, and orchestrate complex tasks from your terminal. It's distinct from the IDE chat panel but equally powerful.

When to Use Each​

ContextBest For
Inline completionsFlow-state coding, writing new functions
Inline chat (Ctrl+I)Quick edits to selected code
Chat panel (open file)Understanding code you're reading
Chat panel (@workspace)Finding things across a project
Chat panel (@terminal)Shell command help inside IDE
Agent mode (IDE)Multi-step edits within a project
copilot CLITerminal-first workflows, scripting, automation

Try This Now​

  1. Install GitHub Copilot in VS Code
  2. Open any project, start a new file, write a comment:
// Parse a CSV string into an array of objects using the first row as headers

Copilot will generate the implementation. Tab to accept.

  1. Install the standalone Copilot CLI and try:
copilot -p "explain why this Node.js app leaks memory when processing large CSV uploads"

What I Learned at Level 1​

The biggest gain wasn't the code generation β€” it was the velocity shift in unfamiliar territory. Working in a language I don't know well? Copilot bridges the gap between "I know what I want" and "I know the syntax." It turned 30-minute research into 30-second completions.

The limitation: Copilot at this level generates generic best-practice code. It knows nothing about your specific conventions or preferences. That leads to ...


Level 2: Making Copilot Yours​

πŸ–₯️ VS Code Β· ⌨️ CLI Β· πŸ‘€ Interactive Β· πŸ’» Local

Watercolor illustration of a blue-shirted craftsperson alone, setting up custom jigs and labeled drawers

No green shirts in sight β€” this is setup time. You're alone at the bench, labeling drawers, building custom jigs, and pinning reference cards to the pegboard. You're not building furniture yet; you're building the system that makes your workshop uniquely yours. When the green-shirted helpers return, they'll know exactly where everything goes.

Level 1 Copilot is smart but generic. Level 2 is where it starts feeling like a teammate who's read your wiki. This level works in both the IDE and CLI β€” the same instruction files and MCP configs are picked up by Copilot Chat in the IDE and Copilot CLI.

Custom Instruction Files​

Drop instruction files in your repo and Copilot learns your conventions:

.github/copilot-instructions.md β€” global instructions for all Copilot interactions:

# Project Conventions

- Use TypeScript strict mode with explicit return types
- Prefer `Result<T, Error>` pattern over throwing exceptions
- All API responses follow our envelope format: `{ data, error, meta }`
- Tests use vitest with the `describe/it` pattern
- Never use `any` β€” prefer `unknown` with type guards

AGENTS.md β€” agent instructions that can live anywhere in your repo. Unlike copilot-instructions.md (which must be in .github/), you can place multiple AGENTS.md files at different directory levels β€” the nearest one in the directory tree takes precedence. This makes it ideal for monorepos where each package needs its own agent behavior:

my-monorepo/
β”œβ”€β”€ AGENTS.md ← shared team-wide instructions
β”œβ”€β”€ packages/
β”‚ β”œβ”€β”€ frontend/
β”‚ β”‚ └── AGENTS.md ← React-specific agent rules (wins here)
β”‚ └── backend/
β”‚ └── AGENTS.md ← API-specific agent rules (wins here)

Every suggestion Copilot makes now respects these rules. No more "helpful" suggestions that violate your architecture.

MCP Servers: Giving Copilot New Abilities​

Model Context Protocol (MCP) servers let you plug external data sources and tools into Copilot's context. Think of them as APIs that Copilot can call mid-conversation β€” in both the IDE and CLI.

// .copilot/mcp.json
{
"mcpServers": {
"azure": {
"command": "npx",
"args": ["-y", "@azure/mcp@latest", "server", "start"]
}
}
}

Now Copilot can query your Azure resources, check deployment status, or read your database schema β€” all within the conversation.

Some MCP servers I use daily:

Skills: Repeatable, Deterministic Work​

Skills are the underrated powerhouse of Level 2. A skill is a directory with a SKILL.md file that defines a repeatable pattern β€” including deterministic steps from scripts and code.

.<directory>/skills/
β”œβ”€β”€ pr-review/
β”‚ └── SKILL.md # "Run lint, check test coverage, review diff"
β”œβ”€β”€ doc-sync/
β”‚ └── SKILL.md # "Compare API surface to docs, flag drift"
└── sdk-sample-check/
└── SKILL.md # "Validate all samples compile and match SDK version"

Read the Visual Studio documentation for the best directory location for your skill usage.

Skills differ from instructions in that they define executable workflows β€” not just preferences. A skill can include shell commands to run, files to check, and decision trees to follow. They're reusable across sessions and agents.

Why skills matter:

  • Repeatable β€” same process every time, no drift
  • Composable β€” skills can reference other skills
  • Deterministic where needed β€” embed scripts and validation steps that always run the same way
  • Shareable β€” check them into your repo, the whole team benefits

Try This Now​

  1. Create .github/copilot-instructions.md with your project's conventions
  2. Add an MCP server for a tool you use daily (Azure, database, etc.)
  3. Create a .github/skills/quick-review/SKILL.md that describes your code review checklist

Then open Copilot Chat or run copilot and notice the difference β€” it follows YOUR patterns now.

What I Learned at Level 2​

Custom instructions are absurdly high-leverage. A 50-line markdown file eliminates 80% of the "no, not like that" moments. MCP servers bridge "Copilot that knows code" and "Copilot that knows your infrastructure." Skills turn tribal knowledge into executable processes.

The limitation: everything is still per-session. Copilot doesn't automatically carry context between sessions β€” it won't remember decisions from yesterday's refactor. It doesn't have persistent context about your project's evolving state. It doesn't coordinate with other instances of itself.

Enter Squad.


Level 3: Squad β€” A Team Working in Concert​

πŸ–₯️ VS Code Β· ⌨️ CLI Β· πŸ‘€ Interactive Β· πŸ’» Local

Watercolor illustration of craftspeople collaborating at a shared workbench in a woodworking shop

The workshop is getting busy. You're at the bench, studying the blueprint. Around you, a small team of helpers is assembling a cabinet together β€” one holds the frame, another drives the dowels, another checks the level. Each knows their role. Each stays in their lane. The work moves faster because they each know their job and coordinate with each other, not just with you.

This is where the mental model shifts from "AI assistant" to "AI team."

Squad gives you a team of specialized agents working in concert to complete tasks, where each member's expertise and boundaries positively impact the result. It's not just "named agents with memory" β€” it's a coordinated system where the reviewer's standards shape the coder's output, and the docs writer's perspective catches gaps the implementer missed.

Squad runs on the Copilot CLI (copilot --agent squad) and adds the organizational layer that makes agents feel like a real team rather than a single assistant wearing different hats.

What Makes Squad Different​

FeatureRegular CopilotSquad
MemorySession-basedPersistent across sessions
IdentityGeneric assistantNamed agents with charters
CoordinationYou manage contextAgents hand off to each other
SpecializationSame agent for everythingDomain-specific agents with boundaries
Result qualityOne perspectiveDiverse perspectives improve output

Installing Squad​

# Install Squad CLI
npm install -g @bradygaster/squad-cli

# Initialize in your project
npx @bradygaster/squad-cli init

# Start Copilot with Squad (standalone CLI)
copilot --agent squad

This scaffolds a .squad/ directory:

.squad/
β”œβ”€β”€ agents/
β”‚ β”œβ”€β”€ ralph/ # Orchestrator
β”‚ β”‚ └── charter.md
β”‚ β”œβ”€β”€ reviewer/
β”‚ β”‚ └── charter.md
β”‚ └── docs-writer/
β”‚ └── charter.md
β”œβ”€β”€ ceremonies/
β”‚ └── sweep.md
└── memory/
└── decisions.md

Agent Charters: Expertise + Boundaries​

Each agent has a charter β€” a markdown file that defines who they are and what they do and, critically, what they won't do:

# Reviewer Agent Charter

## Identity
You are the code reviewer for this project. You focus on:
- Security vulnerabilities
- Performance anti-patterns
- Consistency with project conventions

## What I Own
- TypeScript files and build system

## Boundaries
- Never approve your own changes
- Escalate architectural concerns to the team lead
- Don't refactor code that isn't in the PR scope

The boundaries matter as much as the expertise. A reviewer that knows when to escalate produces better outcomes than one that tries to handle everything. The interplay between agents β€” where one's output becomes another's input β€” is what makes Squad feel like a team rather than parallel solo workers.

Ceremonies: On-Demand Structured Workflows​

Ceremonies are repeatable workflows you trigger when needed:

# Ceremonies & Rituals

## Design Review

**When:** Before PRD implementation begins
**Who:** <list of named agents>
**Purpose:** Validate requirements, issue templates, and process flow before work starts

## Retrospectives

**When:** After major deliveries (GitHub Projects setup, issue templates, Actions automation)
**Who:** All team members
**Facilitator:** <single agent name>
**Purpose:** Reflect on what worked, what didn't, continuous improvement

## Cross-Repo Sync

**When:** As needed
**Owner:** <single agent name>
**Purpose:** Ensure coordination across all projects (reads repos.json for scope)

Ceremonies encode your team's best practices into executable workflows that any agent can run consistently.

Try This Now​

With the Squad open in a Copilot CLI interactive chat, assign work to the squad.

# Then talk to the team:
"Team, fan out and review this PR for security issues"
"Ralph go"

What I Learned at Level 3​

The agents and charter system is what makes Squad click. With it, you have agents that maintain consistent behavior, remember decisions, and build expertise over time. Without it, you have "Copilot with extra steps."

The real insight: diversity, expertise, coordination, and boundaries create quality.When the reviewer can't approve its own work, when the docs writer must verify against actual code, when the security agent escalates instead of guessing β€” the team produces better results than any single agent could alone.

The honest trade-off: Squad requires investment in codifying your work patterns and practices. A poorly-defined agent is worse than no agent because it gives inconsistent results. Spend the time upfront.


Level 4: Autonomous Operations​

πŸ–₯️ VS Code Β· ⌨️ CLI Β· πŸ€– Autonomous Β· πŸ’» Local Β· ☁️ Cloud

Watercolor illustration of workers building furniture at separate workbenches in a woodworking shop

The helpers are working independently across the shop β€” each at their own bench, each building a different piece from your specifications. One saws, one hammers, one planes. You glance across the room and trust the work because you wrote clear blueprints for your team of experts. They don't need you hovering.

Level 4 is where the work has been fully defined and you just need it completed. You've already figured out what needs to happen β€” now you hand it off and let the system execute.

This is the difference between "AI that helps me work" and "AI that does the work I've specified."

Five Ways to Run Autonomously​

1. VS Code Agent Mode​

πŸ–₯️ VS Code Β· πŸ€– Autonomous Β· πŸ’» Local

In VS Code, Copilot's agent mode executes multi-step tasks β€” reading files, running commands, editing code β€” without manual intervention. You describe the outcome, and agent mode figures out the steps:

# In VS Code Copilot Chat (agent mode):
"Refactor all API handlers to use the new error envelope format"

Agent mode uses your custom instructions and MCPs from Level 2, so it already knows your project's conventions. Best for: well-scoped tasks while you're in the IDE.

2. Copilot CLI Agent Mode​

⌨️ CLI Β· πŸ€– Autonomous Β· πŸ’» Local

The standalone CLI provides the same autonomous execution outside VS Code:

# CLI agent mode β€” executes the full task autonomously
copilot -p "Refactor all API handlers to use the new error envelope format"

Best for: well-scoped tasks from the terminal, scripted workflows, or when you prefer the command line over the IDE.

3. "Ralph, go" β€” Squad Work Queue (In-Session)​

⌨️ CLI Β· πŸ€– Autonomous Β· πŸ’» Local

Ralph, the Squad work monitor, processes your entire work queue autonomously within a Copilot session. First, connect Squad to your repo's issues ("pull issues from owner/repo"). Then Ralph triages those issues, assigns work to the right specialist agents, monitors progress, and keeps going until the board is clear:

# In a Copilot CLI session with Squad:
copilot --agent squad

# Then:
"Ralph, go" # β†’ Starts processing the work queue
"Ralph, status" # β†’ Shows what's open, stalled, or ready to merge

Ralph monitors GitHub issues, triages incoming work, and drives tasks through your agent team without you intervening. It doesn't stop between tasks β€” it keeps cycling until everything is done.

Best for: in-session work queue processing, multi-agent coordination, and batching related tasks.

4. Squad Watch β€” Persistent Local Monitoring​

⌨️ CLI Β· πŸ€– Autonomous Β· πŸ’» Local

When you're away from the keyboard but your machine is on, squad watch provides persistent polling of your GitHub issues:

# Polls every 10 minutes (default)
npx @bradygaster/squad-cli watch

# Custom intervals
npx @bradygaster/squad-cli watch --interval 5 # every 5 minutes
npx @bradygaster/squad-cli watch --interval 30 # every 30 minutes

This runs as a standalone local process (not inside Copilot) that auto-triages issues from your connected repo, assigns work based on team roles and keywords, and routes issues to agents or @copilot for pickup. It runs until you Ctrl+C. (Requires the same repo connection set up via Squad.)

Best for: overnight monitoring, catching issues while you're in meetings, and persistent triage between active sessions.

5. Copilot Cloud Agent (GitHub Issues)​

☁️ Cloud Β· πŸ€– Autonomous Β· 🌐 GitHub.com

Assign a GitHub issue to Copilot and it works independently β€” no terminal open, no local setup. The cloud agent runs in a GitHub Actions-powered ephemeral environment: it researches your repo, creates a plan, makes code changes, and opens a PR.

Trigger it from a GitHub issue comment:

<!-- In a GitHub issue comment: -->
@copilot implement this

Or assign the issue to Copilot directly from the GitHub Issues UI, VS Code, JetBrains, or the GitHub CLI.

The cloud agent works best for well-scoped, clearly described issues: "add a new endpoint that follows the existing pattern," "write tests for this module," "update the config schema to support the new field." Think of this as a single async task you hand off β€” describe the outcome clearly, and come back to a PR.

It uses GitHub Actions minutes and Copilot premium requests, so you're trading compute for time. No local session required; the work happens entirely on GitHub's infrastructure.

When to Use Each​

ApproachBest ForRuns OnRequires Active Session?
VS Code agent modeIDE-scoped tasksYour machineYes
copilot CLITerminal-scoped tasksYour machineYes
"Ralph, go"Work queue + coordinationYour machine (Squad)Yes
squad watchPersistent monitoringYour machine (background)No β€” standalone process
Copilot cloud agentIssue-driven implementationGitHub's cloudNo β€” fully async

The Autonomy Spectrum​

These options form a spectrum from "I'm here watching" to "I'm asleep":

You're present              You're away              You're asleep
─────────────────────────────────────────────────────────────────
VS Code agent mode β†’ squad watch β†’ Copilot cloud agent
Copilot CLI β†’ (machine on) β†’ (GitHub cloud)
Ralph, go

What I Learned at Level 4​

The key insight: autonomous execution requires fully-defined work. The quality of autonomous output is directly proportional to how clearly the task was specified. Vague issues get vague results. A well-written issue with acceptance criteria, examples, and constraints? That's where autonomous execution shines.

The cloud agent on GitHub is the lowest-friction option β€” no local setup, just assign an issue. squad watch bridges the gap between active sessions and cloud β€” your machine monitors and triages even when you're not in a Copilot session. Ralph is best when you're actively working through a backlog and want coordinated multi-agent execution.


Finding Your Path​

Not everyone takes the same route through these levels:

RoleStart HereQuick WinLevel Up
EngineerLevel 1 (completions + CLI)Custom instructions for your stackSkills for repeatable reviews
PM/ContentLevel 1 (chat for drafting)Custom instructions for voice/styleSquad ceremonies for sweeps
Team LeadLevel 2 (instructions + MCPs)Skills for team processesSquad for coordinated reviews
PlatformLevel 2 (MCP + infra context)Squad for monitoringSquad for always-on monitoring

The Ecosystem at a Glance​

The Copilot ecosystem is growing fast. Here are the key resources:

Essential Tools​

  • GitHub Copilot Extension β€” the IDE extension (VS Code, JetBrains, etc.)
  • Copilot CLI β€” standalone copilot command for terminal
  • Squad CLI β€” named agents working in concert (npm i -g @bradygaster/squad-cli)

Learning & Community​

Infrastructure​


What Actually Changed for Me​

I want to be honest about what's different after six months at Level 3+:

What improved:

  • PR turnaround dropped from days to hours (the green shirts handle first-pass review)
  • Documentation stays in sync with code (sweep ceremonies catch drift)
  • I work in unfamiliar codebases with dramatically less ramp-up time
  • Boilerplate tasks that used to take 30 minutes take 2 minutes
  • Skills encode my best practices β€” I define a process once, it runs the same way forever

What didn't change:

  • Architecture decisions still require human judgment
  • Debugging subtle logic errors still requires deep thought
  • Agent output needs review β€” trust but verify
  • Writing good charters and instructions is a skill that takes time to develop, update, and improve

The mental model shift: I stopped thinking "what code do I need to write?" and started thinking "what work needs to happen, and who should do it?" Sometimes the answer is me β€” blue shirt at the bench, swinging the mallet. Often it's a green shirt with clear instructions and a well-scoped task.


Start Today​

You don't need to plan all four levels. Start where you are:

Never used Copilot? β†’ Install the extension, write a comment, press Tab. That's it.

Using Copilot but it's generic? β†’ Write a copilot-instructions.md file and one skill. 10 minutes, massive payoff.

Want more than autocomplete? β†’ Install Squad CLI, write one agent charter, run copilot --agent squad.

Ready for autonomous execution? β†’ Try copilot --autopilot on a well-defined task, or assign an issue to the cloud agent.

The progression is natural. Each level solves a real problem you'll discover at the previous one. And unlike most "AI transformation" pitches, you can validate the value at every step before investing in the next.

The future of development isn't AI replacing developers. It's developers who know how to orchestrate AI systems outperforming those who don't. The tools are here. The ecosystem is open source. The only question is which level you start at.

Want to go further? The next post in this series covers Cloud-Scale Agent Fleets for Level 5 β€” coming soon.


πŸ“£ GitHub Copilot Dev Days β€” Next Week!​

Want to go deeper? GitHub Copilot Dev Days are happening next week with sessions in multiple languages and time zones:

These are free, virtual events covering the latest in Copilot extensibility, agentic development, and the ecosystem tools discussed in this post. See you there!


Have questions or want to share your own journey? Find me on GitHub at @dfberry or check out my other posts on the Copilot ecosystem.

Copilot CLI Context Window: How I Cut Token Usage from 52% to 13%

Β· 11 min read

I'll be honest: I started this whole investigation backwards. I had 117 skills consuming 413K tokens on disk and assumed that was the problem. I spent two hours optimizing them before I thought to actually measure what was in my context window. Turns out, skills are on-demand β€” they never touch the context window at all.

The biggest consumer was something I never would have guessed: a single plugin loading ~27K tokens of tool definitions into every message. This is the story of how I found it, scoped it down, and β€” importantly β€” how you can configure it to match your workflow without losing functionality.

What makes this different? There are already several great articles about MCP context optimization (devbolt.dev, The New Stack, StackOne, blog.pamelafox.org). This one adds: real measured token numbers from a production setup, the /context command as a diagnostic tool, the Azure MCP namespace scoping solution, and the Squad orchestration angle.

Step 1: Measure First β€” Check Your Token Breakdown​

I run GitHub Copilot CLI with a multi-agent orchestration setup β€” half a dozen MCP servers, several plugins, and 117 skills. Mid-session, I got curious about what my context window actually looked like and ran /context:

Before optimization: /context showing 52% usage and compaction to 40%

Context Usage
claude-opus-4.6 Β· 104k/200k tokens (52%)

System/Tools: 62.5k (31%)
Messages: 41.8k (21%)
Free Space: 55.3k (28%)
Buffer: 40.4k (20%)

52% consumed before typing a single message. The System/Tools bucket alone was 62.5K tokens β€” 31% of my 200K window. That's the baseline cost of my setup: agent instructions, MCP tool definitions, system prompt, memories.

With only 28% free space, complex multi-agent tasks would trigger compaction mid-session. I needed to find what was actually consuming those 62.5K tokens β€” and the only way to know for sure was to audit what's always-loaded vs. what lives on disk.

Step 2: Distinguish Always-Loaded from On-Demand​

The first question to ask is not "what's biggest?" but "what's always in context?"

The System/Tools bucket contains everything that loads on every message β€” unconditionally. If I can reduce that, every operation gets cheaper. Optimizing anything else only helps specific operations.

I built a breakdown:

Consumer~TokensWhen LoadedControllable?
MCP/Plugin tool definitions~27K+Every messageβœ… Scope or remove
Agent instructions~20KEvery messageβœ… Slim it down
System prompt + memories~10KEvery messagePartial
Skills~143K on diskOn-demand onlyCan optimize, but won't help context
Conversation historyGrowingAccumulatesFresh sessions help

Key insight: Skills sit on disk until an agent explicitly requests one. They are never in the context window. Optimizing them makes individual agent spawns cheaper and faster β€” valuable for performance β€” but they don't contribute to System/Tools at all. (I learned this after spending two hours optimizing them. Do as I say, not as I did.)

Context consumers breakdown: MCP tools 30-40K, agent instructions 20K, skills on-demand

Step 3: Audit What's Always-Loaded​

The mystery is: what's in that 62.5K System/Tools bucket?

MCP Tool Definitions (~6–10K tokens)​

MCP servers inject their tool schemas into every message. I had:

  • GitHub MCP β€” ~15 tools (issues, PRs, code search, actions)
  • Mail MCP β€” ~20 tools (search, send, reply, forward, attachments)
  • PowerBI MCP β€” ~6 tools (execute query, generate query, get schema)
  • M365 Agents Toolkit β€” ~4 tools (knowledge, snippets, schema, troubleshoot)
  • IDE β€” ~2 tools (diagnostics, selection)

These are real β€” about 47–55 tools across all servers. But they're only ~6–10K tokens total. Where's the other 50K?

The Azure Plugin (~27K tokens) β€” The Biggest Consumer​

I checked ~/.copilot/settings.json and found the Azure plugin enabled:

PluginSourceImpact
azuremicrosoft/azure-skills50+ tools, ~27K tokens

Here's the thing about the Azure MCP Server: it's comprehensive. Version 3.0.0-beta.6 has 259 tools across 56 namespaces β€” covering everything from ACR to Virtual Desktop to Well-Architected Framework. That breadth is genuinely impressive, and the team clearly designed it to be a one-stop shop for Azure developers.

The good news: the team also thought carefully about how developers actually work. They built in namespace scoping and mode selection so you don't have to load the entire surface area. In its default "namespace" mode, it groups tools by service β€” but if you're only using a few services, you can filter down to just those. More on that in a moment.

In my case, the default configuration was loading 50+ tool schemas into every message β€” even when I wasn't doing Azure work in that session. Not a bug, just a configuration I hadn't tuned yet.

Azure plugin details: 4 plugins consuming context, 50+ tools at 30-40K tokens

Agent Instructions (~20K tokens)​

My agent governance file β€” .github/copilot-instructions.md at the repo root β€” is 80KB. It loads on every turn. This is the ongoing cost of a sophisticated agent setup: the orchestration rules are comprehensive, and they load unconditionally whether I need them or not.

Step 4: Scope the Azure Plugin to Match How You Work​

Once I understood the breakdown, the fix was straightforward. The Azure MCP team built exactly the right lever for this β€” namespace scoping lets you declare which services matter for your project and ignore the rest. No functionality lost, just a tighter fit.

Option A: Disable Entirely (Full removal)​

If you genuinely don't use Azure, just turn it off:

// ~/.copilot/settings.json
"azure@azure-skills": false

This is what I did initially β€” it dropped System/Tools from 62.5K β†’ 35.2K, freeing ~27K tokens instantly.

Azure plugin disabled: azure@azure-skills set to false

This is where the Azure MCP Server's design really shines. The team built namespace filtering specifically for this use case β€” you declare the services relevant to your project, and only those tool schemas load into context.

Configure it in your MCP settings with the --namespace flag:

--namespace appservice --namespace cosmos --namespace keyvault --namespace storage

This gives you 4 namespaces (~24 tools) instead of 56 namespaces (~259 tools) β€” a significant reduction in context usage while keeping the Azure tools you actually use.

Azure MCP Modes​

The server supports 4 modes that control how tools are exposed:

ModeBehaviorBest For
namespace (default)One tool per service namespaceCopilot β€” good balance
consolidatedGroups operations by user intentNatural language workflows
singleOne routing tool for everythingMaximum simplicity
allEvery operation as a separate tool (259!)Maximum granularity β€” high context cost

Pick Your Stack​

Here's a quick reference for common developer personas:

If you work with...Namespaces to keep
Web appsappservice, cosmos, keyvault, storage, functions
Data/Analyticscosmos, sql, kusto, eventhubs, storage
DevOps/Infracompute, aks, azureterraform, deploy, monitor
AI/MLfoundryextensions, search, speech, applicationinsights

All 56 Namespaces (Reference)​

For the curious, here's the full list with tool counts. Use this to build your own --namespace filter:

NamespaceToolsNamespaceToolsNamespaceTools
acr2advisor1aks2
appconfig5applens1applicationinsights1
appservice7azurebackup16azuremigrate2
azureterraform10azureterraformbestpractices1bicepschema1
cloudarchitect1communication2compute12
confidentialledger2containerapps1cosmos2
datadog1deploy5deviceregistry1
eventgrid3eventhubs9extension3
fileshares14foundryextensions7functionapp1
functions3grafana1group2
keyvault8kusto7loadtesting6
managedlustre18marketplace2monitor16
mysql6policy1postgres6
pricing1quota2redis2
resourcehealth2role1search6
servicebus3servicefabric2signalr1
speech2sql13storage7
storagesync18subscription1virtualdesktop3
wellarchitectedframework1workbooks5

VS Code Users​

You can also scope Azure MCP visually: click the gear icon next to the chat panel β†’ select/deselect at the server, namespace, or individual tool level. No config files needed.

Other Filtering Options​

  • Individual tools: --tool azmcp_storage_account_get --tool azmcp_cosmos_query for surgical precision
  • Combine namespace + tool filters for maximum control

Step 5: Then Optimize On-Demand Content (Optional)​

Now that the always-loaded problem was solved, it was the right time to optimize skills β€” not because they consume context window (they don't), but because they improve individual agent spawn performance.

I spent two hours optimizing 117 Copilot CLI skills β€” reducing them from 413K to 143K tokens on disk, a 65% reduction. The process used waza_tokens to find bloated skills and patterns like reference extraction and checklist compression.

This didn't move the System/Tools percentage. But it made agent spawns faster and cheaper to run. Both wins are real β€” you just optimize them for different reasons.

Step 6: Measure Results​

Fresh session after Azure disabled: context at 35K/200K (18%)

After scoping the Azure plugin:

System/Tools:  35.2k (18%)
Total usage: ~70k/200k (35%)
Free Space: ~90k (45%)

After upgrading the agent coordinator file:

System/Tools:  25.5k (13%)
Total usage: 26k/200k (13%)
Free Space: 134.1k (67%)

The remaining ~10K drop from 35.2K β†’ 25.5K came from upgrading my agent coordinator file β€” the new version replaced the old 80KB governance prompt with a leaner one. Skill optimization (270K saved on disk) didn't affect this number because skills are on-demand and never in the context window.

Final state: context at 26K/200K (13%), 67% free space

The Scorecard​

ActionTokens FreedEffortContext Impact
Scope Azure plugin~27KConfig changeSignificant β€” always loaded
Upgrade agent coordinator file~10K1 commandSignificant β€” always loaded
Optimize 117 skills~270K on disk2 hours, 106 filesZero on context β€” but faster agent spawns

System/Tools went from 62.5K β†’ 25.5K. Free space went from 28% β†’ 67%. That's 2.4x more room for actual work.

The counterintuitive lesson: The biggest token savings came from the smallest changes β€” because I measured first instead of guessing.

Why Measurement First Matters​

Most people (including me, initially) assume the biggest files on disk must be the problem. It's intuitive. It's wrong.

Skills: 143K on disk β†’ 0K in context. Azure plugin: 50+ tools β†’ ~27K in context every message.

Without checking /context, I would have spent all my time optimizing the wrong thing. I did optimize skills first (and it was worthwhile for other reasons), but the crucial discovery was always-loaded vs. on-demand. I'm reframing my mistake as a teaching moment: measure first, then optimize.

Quick Diagnostic Guide​

This is the methodology. Use it whenever context runs tight:

MCP config file layers: user vs repo level, what you can control

  1. Run /context β€” see your actual breakdown
  2. Check plugins β€” ~/.copilot/settings.json β€” scope or disable unused ones (biggest wins are usually here)
  3. Scope your MCPs β€” use namespace filtering, tool filtering, or mode selection to load only what you need
  4. Check MCP servers β€” ~/.copilot/mcp-config.json and .copilot/mcp-config.json β€” remove servers you don't use daily
  5. Check agent instructions β€” if you use custom agent governance files, they load every turn
  6. Skills are usually fine β€” they're on-demand, not always-loaded
  7. Start fresh sessions β€” conversation history accumulates; don't run marathon sessions

The biggest wins are almost always in steps 2–3. Scoping one plugin can save more context than hours of file optimization.

What About Hooks?​

One thing I haven't tested yet: Copilot hooks (commit hooks, pre-push hooks, custom event hooks). These are lightweight by design β€” they're shell scripts or short instructions, not loaded into the context window the way MCP tool definitions are. They fire on specific events rather than sitting in the always-loaded bucket.

That said, if you have hooks that reference large config files or trigger MCP calls, those downstream effects could impact context during execution. Worth running /context before and after adding hooks to verify. My expectation is minimal impact, but I'll update this post once I've measured it directly.

The Setup​

  • GitHub Copilot CLI v1.0.40
  • Squad v0.9.4-insider.1 for multi-agent orchestration
  • 117 skills in .copilot/skills/ β€” now ~143K tokens (optimized)
  • 5 MCP servers (GitHub, Mail, PowerBI, M365 Agents Toolkit, IDE)
  • Azure plugin: scoped to needed namespaces (the one that mattered)
  • Model: Claude Opus 4.6 with 200K context window

Investigation: May 5, 2026. The key lesson: measurement comes before optimization. Run /context and let the data guide your effort, not your intuition about file sizes. And when you find an MCP consuming more than you need β€” scope it down to match how you actually work.

The skills optimization ran same session β€” 117 skills reduced by 65% (413K β†’ 143K tokens on disk) using waza tools.