GitHub Copilot is remarkable when you are polishing a standalone function. It feels psychic. Then you move into a real-world enterprise codebase—four hundred modules, deeply nested interfaces, a shared utility buried six directories away—and the psychic turns into a stranger who hallucinates function signatures.
The frustration is immediate. You already defined that data model in types/user.ts. Why is GitHub Copilot inventing a brand new, incompatible object in services/authService.ts?
At 365Finds, we see developers treat this as a mysterious bug or conclude that the tool is overrated. It is neither. It is an intentional architectural trade-off. Copilot splits its intelligence into two fundamentally different engines operating under different physical constraints. Once you understand the mechanics, feeding it repository-wide context becomes a predictable workflow rather than guesswork.
The Latency Paradox: Why Ghost Text Ignores Your Unopened Files
Inline code suggestions—the grey "ghost text" that appears while you type—operate under a brutal latency budget: 200 to 500 milliseconds.
If Copilot took two seconds to inspect your workspace, your IDE would stutter, and typing would feel like wading through wet cement. In those few hundred milliseconds, Copilot cannot parse your entire project abstract syntax tree (AST), run cross-package dependency graphs, or trigger high-dimensional vector search across twenty thousand files.
Instead, inline completions rely primarily on two mechanisms:
- Immediate cursor context: The code directly above and below your cursor (using Fill-in-the-Middle or FIM prompting).
- The "Neighboring Tabs" algorithm: Copilot takes the files you currently have open in active editor tabs, breaks them into small sliding chunks (roughly 60 lines each), and measures their lexical overlap with your cursor position using Jaccard similarity.
Here is the crux: if a file is not open in an active tab, inline ghost text almost certainly does not know it exists.
Even worse is tab clutter. If you leave 45 random files open across multiple debugging sessions, Copilot’s Jaccard scoring gets diluted. Unrelated chunks compete for the prompt's strict token budget. The model ends up ingesting irrelevant snippets from a CSS file or an old migration script instead of the database interface you actually need.
Two Engines, Two Latency Budgets
To get accurate cross-file completions, you must stop treating GitHub Copilot as a single monolith. It is two distinct tools sharing one brand name.
| Feature Layer | Latency Budget | Context Reach | Context Retrieval Mechanism |
|---|---|---|---|
| Inline Completions (Ghost Text) | 200–500 ms | Current file + open tabs | Jaccard similarity over open buffers; shallow import detection |
Copilot Chat & @workspace | 2–6 seconds | Entire workspace repository | Codebase semantic indexing, symbol graphs, BM25 text search |
| Copilot Edits (Working Set) | Multi-second streaming | Multi-file explicit working set | User-defined file list, simultaneous cross-file diff generation |
At 365Finds, our direct recommendation is simple: never expect inline ghost text to perform cross-module architectural refactoring. Use ghost text for rapid flow inside a file, and switch deliberately to Copilot Chat or Copilot Edits the moment code spans multiple files.
5 Practical Methods to Supply Broader Context
1. Curate Neighboring Tabs (The 3-to-5 Rule)
Because the inline completion engine queries open buffers via Jaccard similarity, treat your editor tabs as Copilot's active RAM.
- Close irrelevant tabs: Run "Close Others" or close all tabs before starting a feature.
- Pin 3 to 5 critical context files: Open the exact interface definition (e.g.,
schema.prismaortypes.ts), the consumer component, and a representative implementation that already does what you want to achieve. - When Copilot sees lexical overlap between your active cursor and those pinned tabs, the relevance score spikes, and cross-file autocompletions succeed immediately.
2. Anchor Imports and Signatures First (Prompt Priming)
Copilot uses the tokens near your cursor to match neighboring tab snippets. If you start writing raw implementation logic in an empty file without imports, the similarity score between your cursor and other files is near zero.
- Before prompting or typing inline, declare the imports explicitly at the top of the file:
import { UserProfile, UserRole } from '@/types/user'; import { DatabaseClient } from '@/lib/db'; - Alternatively, write the function signature with full type annotations before typing the body:
export async function syncUserProfile(userId: string, role: UserRole): Promise<UserProfile> { - This forces the prompt builder to pull matching chunks from the files defining
UserProfileandDatabaseClient.
3. Establish Project Ground Rules in .github/copilot-instructions.md
Copilot often invents patterns because it lacks repository conventions. You can inject system-level instructions into Copilot by adding a Markdown configuration file at .github/copilot-instructions.md in the repository root.
# Repository Architecture Guidelines
## Stack & Conventions
- Framework: Next.js 14 App Router, TypeScript (Strict mode enabled).
- Data fetching: Use server actions located in `src/actions/`, never call raw Prisma directly from client components.
- Shared models: Always import schemas from `@/types/schema`, do not define ad-hoc interfaces.
- Error handling: Wrap service responses in `Result<T, AppError>` defined in `src/lib/result.ts`.
For large monorepos, use scoped path instructions (e.g., .github/instructions/backend.instructions.md with an applyTo: "src/backend/**/*.ts" frontmatter header) so backend rules do not pollute frontend prompts.
4. Direct Chat Context with @workspace and #file
When you need to reason across files that are not open, bypass ghost text and use Copilot Chat.
- Use
@workspace: Typing@workspace Where are user roles validated across the API routes?instructs Copilot to query VS Code's local repository index and symbol tables rather than relying on open tabs. - Use
#filecontext variables: Don't let the agent guess which files matter. Type:Refactor the session logic in #file:auth.ts using the validation helper in #file:validators.ts - Adding explicit
#filetags manually injects those exact buffers into the prompt payload with top priority.
5. Multi-File Refactoring via Copilot Edits Working Sets
If you need to change a function signature and update every call site across four components, inline chat and ghost text are the wrong tools.
- Open Copilot Edits in VS Code.
- Build your Working Set: Drag and drop the target files into the panel, or type
#to addapi/user.ts,components/UserCard.tsx, andtests/user.test.ts. - Issue the modification prompt: "Rename
fetchProfiletogetUserProfile, adjust the return type to includeavatarUrl, and update all callers." - Copilot generates synchronized inline diffs across all files in the Working Set simultaneously, letting you accept or discard changes per file or hunk.
365Finds Verdict: Control the Window, Don't Blame the Model
GitHub Copilot does not have a global brain scanning your hard drive on every keystroke. It has a high-speed sliding window tuned to avoid breaking your typing cadence.
At 365Finds, our stance is firm: developers who get burned by Copilot are usually trying to use a sub-second completion engine for full-system orchestration. Prune your open tabs down to 4 relevant buffers, write your import anchors first, define your repository boundaries in .github/copilot-instructions.md, and delegate multi-file surgery to Copilot Edits. Context is not something GitHub Copilot automatically discovers; it is a parameter you actively configure.