How Context Works
When you send a message, the agent assembles context from multiple sources to understand your task. The more relevant context it has, the better the output.Workspace analysis
The agent reads your project’s file structure, dependencies, and language configuration to understand the environment.
Active file context
The file currently open in your editor is automatically included. The agent sees the full contents and cursor position.
Skill matching
The agent checks available Skills and loads any whose description matches the current task.
Explicit context
Anything you attach via
@ mentions, file selections, or pasted content is added to the context window.Providing Context with @ Mentions
Use@ in the chat input to attach specific context:
| Mention | What it does |
|---|---|
@file | Attaches a specific file from your workspace |
@folder | Attaches all files in a folder |
@Jira | Pulls issue details from a connected Jira ticket |
@url | Fetches content from a URL (docs, API references) |
Multi-Repository Context
With Multi-Repository Search, agents can search across indexed repositories beyond the current workspace. This is useful for:- Understanding cross-service dependencies
- Finding shared utility implementations
- Checking how other services handle similar patterns
Multi-Repository Search requires Pro Plus or higher. See Multi-Repository Search for setup instructions.
Skills as Context
Skills inject domain knowledge and team conventions into the agent’s context automatically. Unlike@ mentions, skills are loaded based on task matching — you don’t need to attach them manually.
Examples of context that skills provide:
- Coding standards and naming conventions
- Error handling patterns your team uses
- Testing requirements and framework preferences
- API design guidelines
SKILL.md files in .agents/skills/ and are version-controlled with your repo.
Image Context
Attach images directly in chat to provide visual context:- Screenshots of UI bugs or desired designs
- Figma exports for design-to-code workflows
- Error screenshots from browsers or terminals
- Architecture diagrams for reference
Context from External Tools
MCP Tools
Connected MCP servers let agents query external systems during execution — databases, APIs, Slack, GitHub, and more. The agent decides when to call these tools based on the task.Tips for Better Context
Start with the right file open
Start with the right file open
The active editor file is always included. Open the most relevant file before sending your prompt.
Use @ mentions for targeted context
Use @ mentions for targeted context
Instead of describing a file’s contents, attach it with
@file. The agent gets the exact source instead of your paraphrase.Keep chats focused on one task
Keep chats focused on one task
Long, multi-topic chats accumulate stale context. Start a new chat for each distinct task so the agent’s context stays clean.
Let the agent search when needed
Let the agent search when needed
You don’t need to attach every relevant file upfront. The agent has codebase search and file read tools — it will find what it needs during execution.
Use Skills for recurring context
Use Skills for recurring context
If you find yourself repeating the same instructions across chats, create a Skill so the agent loads that context automatically.
Related
Coding Agent
The primary agent that uses all context sources
Skills
Reusable instruction packages loaded by context matching
Multi-Repository Search
Cross-repository context for multi-service architectures
Integrations & MCP
Connect external tools for richer context