AI / GitHub Copilot CLI Fundamentals Interview Questions
How does Copilot CLI read and understand repository context?
Copilot CLI builds its understanding of your codebase from several sources - the directory you run it in, the files it reads during a session, project configuration files, and the copilot-instructions.md file.
| Source | What Copilot learns |
|---|---|
| copilot-instructions.md | Build commands, test procedures, architecture overview, conventions |
| AGENTS.md | Agent behavioural rules, tool permissions for autonomous sessions |
| Directory structure | Project layout, frameworks, languages in use |
| Files read during session | Full content of files explicitly opened or referenced in the task |
| Git history and diffs | Recent changes, branch context, commit messages |
| GitHub.com data | Issues, PRs, CI results - accessed via native GitHub integration or MCP |
# Copilot CLI reads context progressively during a session # It does NOT index the entire codebase upfront # To give Copilot specific context: "Look at src/auth/login.ts and explain the authentication flow" # → Copilot reads that file and builds context from it # For large codebases, guide Copilot to the relevant files: "The bug is in the payment processing module in src/payments/" # → Copilot narrows its file reading to that directory # copilot-instructions.md reduces the need for repeated context: # Instead of explaining your stack every session, put it in the file
Context limits: like all LLM-based tools, Copilot CLI has a context window limit. For very large files or repositories, it reads selectively. Providing clear, targeted prompts and maintaining a well-written copilot-instructions.md reduces the risk of Copilot operating with incomplete context.
More Related questions...