Back to Portfolio HomePortfolioContext & Token Cheat-Sheet

Be Digital · Bonus material · GenAI Advisory

Context & Token Cheat-Sheet: GitHub Copilot vs Claude Code

How each tool builds context, what it ignores vs loads, and how that drives token usage.

Directory structure — what each tool cares about

Both tools need to understand your project layout, but they discover it in fundamentally different ways.

Aspect GitHub Copilot Claude Code
Discovery method Semantic index — builds a vector embedding of the workspace at startup; retrieves relevant snippets on each prompt On-demand file reads — Read tool calls triggered by the model during the conversation
What it sees first Open editor tabs + semantically similar chunks from the index CLAUDE.md (project memory) + whatever the model decides to read
Tree awareness Implicit — the index covers all non-ignored files; no explicit tree walk Explicit — model calls ListDir or Glob to navigate the repo tree
Config that controls scope .copilotignore, VS Code files.exclude .claude/settings.json deny rules (block reads/writes by path pattern)

Claude Code tree example — what a typical exploration looks like in the conversation log:

# Claude Code navigates a regulated Java codebase
ListDir → /
├── CLAUDE.md
├── .claude/
│   ├── settings.json
│   └── commands/
├── src/
│   ├── main/java/com/app/   ← denied by settings.json
│   └── test/java/com/app/   ← allowed — write target
├── pom.xml                   ← denied (frozen)
└── target/site/jacoco/       ← read-only, coverage data

Read → target/site/jacoco/jacoco.xml
Read → src/main/java/com/app/PriceService.java
Write → src/test/java/com/app/PriceServiceTest.java
How each tool builds context GitHub Copilot Workspace files Semantic index (vector embeddings) Retrieval → relevant snippets Context window Claude Code CLAUDE.md (always loaded) Model decides what to read On-demand Read / ListDir / Glob Context window

What's IGNORED vs LOADED

GitHub Copilot

Ignored:

  • Files matching .copilotignore patterns (same syntax as .gitignore)
  • Files excluded by VS Code files.exclude / search.exclude
  • Binary files, images, compiled output
  • node_modules/, .git/, build artifacts by default

Loaded:

  • Currently open editor tabs (highest priority)
  • Semantically similar chunks from the workspace index
  • .github/copilot-instructions.md — always injected as system context
  • *.instructions.md files scoped to specific directories/patterns
  • Prompt files (.github/prompts/*.prompt.md) when explicitly invoked
  • Project-level skills from .github/skills/, .claude/skills/, or .agents/skills/ — Copilot reads these when committed to the repo (as of April 2026)
  • CLAUDE.md if present in the repo — Copilot reads it as project context alongside copilot-instructions.md

Key insight: Copilot's context is bounded by the retrieval window. You don't control exactly which snippets it picks — you control what's in the index by using .copilotignore and what's always present via instructions files. As of April 2026, Copilot also reads project-level skills and CLAUDE.md if committed to the repo — making these files effectively cross-tool.

Claude Code

Ignored (via deny rules):

  • Paths matching deny patterns in .claude/settings.json — blocks Read, Edit, Write tool calls
  • The model physically cannot read or write denied paths — it's an enforcement layer, not a hint
  • Typical deny targets: src/main/**, pom.xml, .env, secrets, large binaries

Loaded:

  • CLAUDE.md at project root — always loaded at session start (project memory)
  • Directory-scoped CLAUDE.md files — loaded when the model enters that directory
  • Whatever the model explicitly reads via Read tool calls
  • Slash command output (.claude/commands/*.md) when invoked
  • Conversation history (grows every turn — the main cost driver)

Key insight: Claude Code's context is explicit and observable. Every file that enters the context window was either declared (CLAUDE.md) or requested (Read tool call). You can see the full context with /context or /cost.

Token usage — the levers

Every turn in an agentic conversation re-sends the full history plus any new context. These are the levers that control how fast the meter runs.

Lever GitHub Copilot Claude Code
Always-on context copilot-instructions.md — keep it lean; it's injected every turn CLAUDE.md — same principle; every byte is re-sent on every message
Load-on-demand Prompt files (*.prompt.md) — only loaded when you invoke them Slash commands + explicit Read calls — model loads files as needed
Scope exclusion .copilotignore — removes files from the semantic index entirely Deny rules in .claude/settings.json — blocks tool calls to those paths
Conversation length Less visible — Copilot manages context window internally, auto-truncates Fully visible — use /cost to see token count; use /compact to summarize and reset
Output tokens Controlled by prompt design — shorter prompts, shorter completions Tool output counts — use maxTokens on Read calls; keep responses concise in CLAUDE.md instructions

Rules of thumb:

• Keep always-on context under ~200 lines. Claude Code's documented guidance is CLAUDE.md under 200 lines — that's the budget where the model reliably follows every rule.

• Move reference material into load-on-demand files (prompt files / slash commands).

• Exclude large generated files (coverage reports, lock files, compiled output) from indexing / context.

• In Claude Code, run /compact after major milestones to reset the conversation length without losing progress.

Quick mental model

The two tools use different names for the same concepts. Here's the mapping:

copilot-instructions.md  ↔  CLAUDE.md  (Copilot reads both if present)

*.instructions.md (directory-scoped)  ↔  directory CLAUDE.md

prompt files (.github/prompts/*.prompt.md)  ↔  Skills (.claude/skills/, .github/skills/)  — cross-tool since April 2026

Mental model — config file equivalences copilot-instructions.md CLAUDE.md *.instructions.md (scoped) directory CLAUDE.md prompt files (*.prompt.md) Skills (.claude/skills/ — cross-tool)

Bonus — filling the gaps

Hard token numbers & the /context command

Claude Code exposes its context state directly. Use these commands mid-session to understand where tokens are going:

  • /cost — shows total input/output tokens and estimated cost for the current session
  • /context — shows what's currently loaded in the context window (CLAUDE.md, conversation, read files)
  • /compact — summarizes the conversation so far and starts a fresh context with the summary, dramatically cutting token usage on the next turn
  • /clear — fully resets the session (loses all context)

Rule of thumb: Run /cost every 10–15 turns. If you're above $2 on a single session, consider /compact before continuing. The cost is cumulative — every subsequent turn re-sends everything before it.

GitHub Copilot doesn't expose equivalent commands. Token usage is managed internally by the service — you can't inspect or reset it. The lever you have is controlling what enters the index (.copilotignore) and what's always injected (instructions files).

Ignore-files — a Copilot/VS Code concept, not a Claude Code one

A common point of confusion: .copilotignore and .gitignore-style exclusion patterns are a GitHub Copilot and VS Code concept. Claude Code does not use ignore files.

In Claude Code, scope control is handled by deny rules in .claude/settings.json. These are not "ignore" hints — they are hard enforcement. A denied path cannot be read or written by the model, period. The model receives an error if it tries.

Concept GitHub Copilot Claude Code
Exclude from context .copilotignore (advisory — removes from index) Deny rules in .claude/settings.json (hard block)
Enforcement level Index exclusion — the model simply won't see the file in retrieval results Tool-call rejection — the model sees an error if it attempts access
Bypass risk Low (file not in index) but if file is open in editor, still visible None — deny rules evaluate before allow rules and cannot be overridden at project level

Sources

Brian Uckert · Be Digital Biz Inc. · Start a conversation →

Want this kind of work for your team?

Context engineering and token optimization for your agentic AI workflows — scoped to your tools and compliance framework.

See GenAI & AppSec advisory