When Workspace Is Too Big: Scoping with Files
Limit context for speed and precision — selecting specific files, /add, focused scope.
What You Will Learn
- Scope queries with specific files.
- Use /add for incremental context.
- Balance breadth vs precision.
- Reduce latency on large repos.
- Maintain context across turns.
Why This Matters
@workspace on a large repo is slow and may dilute signal. Scoping with specific files gives precision and speed. Knowing when to scope vs use @workspace is an intermediate skill.
Concept Explained
Scoping means attaching specific files instead of using @workspace. Use @workspace for breadth ('what files are involved?'), then scope to specific files for depth ('refactor this function and its callers').
How It Works
Use @workspace to identify relevant files. Then attach those specific files instead of using @workspace for subsequent questions. Use /add to incrementally add files to context.
Step-by-Step Tutorial
1. Use @workspace for discovery
'What files are involved in X?' Get the list.2. Switch to specific files
Attach the files @workspace identified. Drop @workspace.3. Use /add incrementally
As the conversation evolves, /add more files without restarting.4. Scope tighter for precision
If output is generic, attach fewer files.5. Re-scope if needed
If you need breadth again, switch back to @workspace.Real-World Example
A developer on a 5000-file repo asked @workspace 'how does auth work?'. Got a slow, generic answer. Re-asked with the auth module's 5 files attached: 'Given these 5 files, how does auth work?'. Got a detailed, accurate answer in seconds. Lesson: @workspace for discovery, specific files for depth.
Example Prompts / Commands / Code
Turn 1: @workspace What files implement the user authentication flow?
→ Copilot lists: auth/middleware.ts, auth/service.ts, auth/types.ts, routes/login.ts
Turn 2: (Attach those 4 files, drop @workspace)
Given these files, how does a login request flow through them?
Turn 3: (Keep same files)
What would break if I changed the signature of auth/service.ts:validateToken?
Turn 4: (Add tests file via /add)
/add tests/auth.test.ts
Now: are there tests covering the validateToken signature change?
Common Mistakes
- Always using @workspace — slow and generic on large repos.
- Attaching too many files — dilutes signal.
- Not using /add — restarting threads loses context.
- Forgetting to drop @workspace when scoping.
Best Practices
- Use @workspace for discovery.
- Switch to specific files for depth.
- Use /add to incrementally add files.
- Drop @workspace when scoping (faster, more precise).
- Re-scope tighter if output is generic.
Troubleshooting
| Problem | How to Fix |
|---|---|
| Output is generic | Attach fewer files. Be more specific in the question. |
| Latency still high | Close other editor tabs. Restart VS Code to clear cached state. |
Practical Exercise
Your Turn
On a real repo, use @workspace to find files involved in a feature. Then attach those files specifically. Compare latency and output quality between @workspace and scoped approaches.
Professional Challenge
Build a 'scope ladder' for your team: @workspace for discovery → 5 files for depth → 2 files for precision. Document when to use each level.
Key Takeaways
- @workspace for discovery; specific files for depth.
- Use /add to incrementally add files.
- Drop @workspace when scoping (faster).
- Re-scope tighter if output is generic.
- Balance breadth vs precision per task.
Frequently Asked Questions
How many files should I attach?
What's the difference between attach and /add?
Further Reading
Official References
SEO Metadata
SEO title: When Workspace Is Too Big: Scoping with Files
Meta description: Limit context for speed and precision — selecting specific files, /add, focused scope.
Primary keyword: when workspace is too big
Secondary keywords: when workspace is too big: scoping with files
Search intent: Informational
URL slug: /scoping-copilot-with-files-when-workspace-too-big
Categories: AI Tools, GitHub Copilot
Tags: GitHub Copilot, Intermediate, Scoping, @workspace, Context, IMCSEIAN, Tutorial, IMCSEIAN
Featured image concept: IMCSEIAN lesson card for When Workspace Is Too Big: Scoping with Files
Comments
Comments
Post a Comment