# Contexts

> Save a named set of repositories to search together with context and give Corfedo AI as sources, for yourself or for the whole workspace.

Source: https://docs.corfedo.ai/workspace/sources/contexts/

A context is a named list of repositories, such as "Backend services". Search it with `context:"Backend services"` or choose it under **Sources** when you ask Corfedo AI. A context is yours or the workspace's. Every member can use a workspace context and sees only the repositories in it they can read.

The list is fixed. A context does not pick up new repositories that match a name or an organization. It holds at most 1,000 repositories.

## Before you begin

- Any member can create their own contexts.
- Workspace contexts need a workspace administrator.

## Save a search as a context

### Search the repositories

Run a search with repository filters, such as `org:acme retry` or `(repo:payments or repo:billing) retry`. Select **Details**, next to the result count, to open **Search details**.

### Save them

Select **Save as context**, enter a **Name** and select **Save context**. Administrators choose **Your context** or **Workspace context**. The context holds the repositories the search included, and your search stays as it is.

**Check:** `context:"<name>"` returns results from those repositories only.

## Create or change a context

Open **Your contexts** in the menu under your name, or **Settings** › **Contexts** for workspace contexts. Select **Create context**, or open a context. Under **Repositories**, find repositories by name in **Add repositories** and select **Add**. Select **Create context** or **Save changes**.

**Search in this context** opens a search with its `context:` filter. **Delete** makes searches that use the context match nothing.

## Use a context elsewhere

| Where | How |
| --- | --- |
| Search, CLI `search`, MCP `search_code` | `context:"Backend services"` in the query. Your own context comes before a workspace context of the same name. See the [search syntax](https://docs.corfedo.ai/reference/search-syntax/#repository-filters). |
| Ask Corfedo | **Sources** › **Only selected**, then the context, see [Ask Corfedo](https://docs.corfedo.ai/use/ask/) |
| CLI | `corfedo contexts list`, `show`, `create`, `change` and `delete`. `--workspace` selects a workspace context. See [CLI commands](https://docs.corfedo.ai/reference/cli/#saved-contexts). |
| HTTP API | The `/api/v1/contexts` operations, see [listContexts](https://docs.corfedo.ai/reference/api/read/listContexts/). The search `scope` accepts a context ID. |

A client manages contexts only with the matching permissions, **Manage your saved contexts** or **Manage workspace contexts**, see [Permissions and scopes](https://docs.corfedo.ai/reference/permissions-and-scopes/#client-scopes).

## Troubleshooting

| What you see | Why | What to do |
| --- | --- | --- |
| "context:… matches nothing you can access and was ignored" | No context of that name, or none of its repositories is readable to you | Check the name in **Your contexts**. Quote names with spaces. |
| **Save as context** is not offered | The search has no repository filter, or it includes more than 1,000 repositories | Add a repository filter, or narrow it |
| "… repositories you can't access" on a context | Repositories were removed or your access changed | Select **Remove them** |
| **Someone changed this context. Review it and save again.** | Another person saved it while you edited | Review the reloaded list and save again |
