GitLab Duo Agent Platform context

GitLab Duo uses context to make decisions and offer suggestions. Context can be available in these ways:

  • Always
  • Based on your location, so the context changes when you go to another page.
  • When referenced explicitly, for example when you mention the information by URL, ID, or file path.

You can also manage context exclusions to keep project content out of that context.

Context available to GitLab Duo

The following table shows when each type of context is available:

ContextGitLab Duo Agentic ChatSoftware development flow
GitLab documentationAlwaysNot available
General programming knowledge, best practices, and language specificsAlwaysAlways
Files in your project that Git tracksAlwaysAlways
Results from the Search APIAlwaysAlways
Current page title and URL in the GitLab UIBased on locationNot available
Files open in your IDE1Based on locationBased on location
Files, including images2 (PNG, JPEG, WebP)When referencedWhen referenced
Images attached to issues and merge requests2When referencedWhen referenced
Epics, issues, and merge requestsWhen referencedWhen referenced
PipelinesWhen referenced, including job logsWhen referenced, for the merge request pipeline status only
CommitsWhen referencedNot available
Work itemsWhen referencedWhen referenced
Wiki pagesWhen referencedNot available

Unlike GitLab Duo Non-Agentic Chat, Agentic Chat can search for referenced resources without exact IDs or URLs. For example, you can ask “Find the merge request about authentication” and Agentic Chat searches for relevant merge requests.

Agentic Chat also looks up the context it needs from SDLC data, GitLab Orbit, MCP clients, and custom instructions.

Manage context exclusions

  • Tier: Premium, Ultimate

Use context exclusions to reduce the exposure of sensitive information, like password and configuration files.

Context exclusions apply to code suggestions and chat, where GitLab Duo controls which files are read. When an agent runs, context exclusions are best-effort only. For more information, see context exclusion limitations.

Prerequisites:

  • The Maintainer or Owner role for the project.

To specify content that GitLab Duo excludes:

  1. In the top bar, select Search or go to and find your project.
  2. In the left sidebar, select Settings > General.
  3. Under GitLab Duo, in the GitLab Duo context exclusions section, select Manage exclusions.
  4. Specify which project files and directories are excluded from GitLab Duo context, and select Save exclusions.
  5. Optional. To delete an existing exclusion, select Delete ( remove ) for the appropriate exclusion.
  6. Select Save changes.

The exclusions for a project can be up to 64 KiB in total.

Context exclusion limitations

Tool or environmentLimitation
Agent shell commandsExclusions do not apply to shell commands.
grep toolThe tool might return content from excluded files.
Case-insensitive file systems, like the defaults on Windows and macOSA path with different capitalization might not match an exclusion.
get_merge_request tool in the GitLab MCP serverThe tool might return commit diffs that include content from excluded files. The server does not check for exclusions when it fetches diffs.
add_commit tool in the GitLab MCP serverThe move action does not apply the exclusion check to the source path. An agent with push access could move an excluded file to a non-excluded path and then read it.

The GitLab MCP server limitations are tracked in issue 628141. To protect sensitive information, review which tools and permissions you grant to MCP clients that access sensitive projects.


  1. To stop GitLab Duo from using a file as context, close the file in your IDE. ↩︎

  2. Images are available only in your IDE. For attached images, give the upload reference as it appears in the Markdown. For more information, see image requirements. ↩︎ ↩︎