Cloud Agents
Multi-Repo Cloud Agent Environments in Cursor: Setup
One Cursor Cloud Agent environment can span several repositories: select them all when you create it. A single Build prepares every repository together and records a commit for each. Agents and automations then reuse that environment to make coordinated changes, run tests across repos, and open a pull request in each repository they change.

On this page
Can one cloud agent work across multiple repositories?
Yes. You select several repositories when you create the environment, and Cursor clones each one into the agent's machine. Cursor then reuses that environment for future agent runs and automations that use the same repo group. The docs' own examples are the common splits: frontend, backend, infrastructure and shared libraries in separate repos.
Cursor documents four things the agent can do with the full workspace cloned: inspect everything, make coordinated changes, run tests across repos and open pull requests in the repos it changes. A contract change that touches an API server and its client SDK can then land as reviewable PRs in both repos from one prompt.
- Feature
- Workspace
- Single-repo environment
- One cloned repo
- Multi-repo environment
- Every selected repo, cloned side by side
- Feature
- Config resolution
- Single-repo environment
- By repository
- Multi-repo environment
- By repo group
- Feature
- Reuse
- Single-repo environment
- Runs against that repo
- Multi-repo environment
- Runs and automations using the same repo group
- Feature
- Pull requests
- Single-repo environment
- One repo
- Multi-repo environment
- Opened in each repo the agent changed
- Feature
- Secrets fit
- Single-repo environment
- User or team secrets usually suffice
- Multi-repo environment
- Environment-scoped secrets, which apply to every repo in the environment by default
| Feature | Single-repo environment | Multi-repo environment |
|---|---|---|
| Workspace | One cloned repo | Every selected repo, cloned side by side |
| Config resolution | By repository | By repo group |
| Reuse | Runs against that repo | Runs and automations using the same repo group |
| Pull requests | One repo | Opened in each repo the agent changed |
| Secrets fit | User or team secrets usually suffice | Environment-scoped secrets, which apply to every repo in the environment by default |
What changes when an environment spans repos, per Cursor's Cloud Agent setup docs.
Plan the review before you run a cross-repo task. One prompt can produce three pull requests in three repos, which means three reviews and a merge order that nothing sequences for you. Cursor's docs cover opening the PRs, not the order they merge in. A backend change can land an hour before the client change that depends on it, and for that hour main holds a contract only one side implements.
This exact topic is a hands-on Lesson: Split install, start and terminal commands — about 7 minutes, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
How do I set up a multi-repo environment?
The flow is the standard environment setup with one decision made early: pick all the repos at creation time. The first four steps follow Cursor's guided setup, and the fifth is Cursor's advice for multi-repo secrets.
- 1Open the Cloud AgentsAgents that run in a Cursor-managed virtual machine, check out the repo, do the work and open a pull request, then shut down, with no load on your laptop. Press Enter for the full definition. dashboard and create a new environment from the Environments view.
- 2Connect your provider (GitHub, GitLab, Azure DevOps or Bitbucket) and select every repository the agent needs. This selection defines the repo group.
- 3Provide the environment variables and secrets needed to install dependencies and run the code across all of the repos.
- 4Let setup finish, then open the Builds tab. Confirm the first Build cloned every repo, completed
installand became active before you rely on it. - 5Add secrets that belong to this repo group as environment-scoped secrets, so staging credentials for this stack aren't available to other environments.
Slow down on step two, because that selection is the group. Editing the group later has limits, listed at the end of this page, and starting over costs more: environment-scoped secrets belong to one environment, so a new environment starts with none of them, while user and team secrets carry over. That is a reason to keep only stack-specific credentials environment-scoped.
The secrets in step three span two phases. Builds can access team and environment secrets while preparing dependencies, but user secrets arrive only when an agent starts. Changing environment secrets triggers another Build, so confirm it succeeds before you treat the new value as active.
One Build prepares all repositories in the environment and records the commit used for each. Automations on the same repo group start from that active Build instead of cloning and installing every repository from scratch.
How does environment.json work across repos?
Cursor resolves configuration by repository or repo group and uses the first match: a personal saved environment, then a team saved environment, then .cursor/environment.json. The file step applies to single-repo runs only, so a multi-repo run always uses a saved environment. That environment can still read its configuration from a committed file if you pick the file's repository when you create it. If you later change the group's repositories through the API, that repository has to stay in the group.
Cursor does not document a multi-root environment.json format that declares several repos from one file, so don't look for a repos array; it isn't in the schema. What the schema does offer is repositoryDependencies, which solves a narrower problem: access. Its entries, written as github.com/org/repo, name repositories that the environment's generated GitHub access token must include. If a build pulls a private dependency from another repository during install, this field puts that repository inside the token's reach.
{
"snapshot": "snapshot-20260212-00000000-0000-0000-0000-000000000000",
"install": "pnpm install",
"repositoryDependencies": [
"github.com/acme/shared-protos",
"github.com/acme/design-tokens"
]
}Keep the two mechanisms apart. Selecting repos at environment creation clones them into the workspace for the agent to edit. repositoryDependencies widens the access token so builds can fetch a dependency, and the schema says nothing about cloning or editing those repos.
Where the config lives decides how changes get reviewed. If the environment reads a committed file, a config change arrives as a diff someone reviews. Otherwise it changes in the dashboard or through the API, and the review trail is the environment's history. Decide who can edit the environment before the group grows.
What cross-repo tasks work well?
The docs name the primitives: full-workspace inspection, coordinated changes, cross-repo tests, and PRs in each changed repo. The patterns below are task shapes those primitives support. Each is hard to run with single-repo agents, because neither half of the change can see the other.
Change an endpoint in the backend repo and update the client SDK or frontend calls in the same run. The agent reads both sides of the contract, so the types line up, and each repo gets its own PR.
Update the library repo, then fix the fallout in every consumer repo in the same workspace. Cross-repo tests catch breakage before the PRs open.
A new environment variable, queue or bucket usually means an infrastructure repo edit and an application repo edit. One agent holding both avoids the half-shipped state where config exists and code doesn't.
Recurring work like dependency upgrades or lint policy rollouts runs as an automation against the repo group, reusing the environment instead of setting up N machines for N repos.
If you are picking one to try first, we would start with the shared library bump. Consumer repos often have tests already, so the agent has something to check itself against, while an API contract change spreads the review across two teams. A wide workspace is the point of a multi-repo environment, so keep the prompt narrow instead: one change per task.
What are the limits and gotchas?
Each item below says whether it comes from Cursor's docs or from a forum thread.
- Repository changes are limited (docs). Through the Environments API, a multi-repo environment can add, remove and swap repositories but must keep at least two. An environment with one repository or none can't change its list. Design the group before you build it.
- Cursor recommends environment-scoped secrets for multi-repo environments (docs). By default they apply to every repo in the environment and to no other environment, and they never reach Self-Hosted Machines.
- Automation-launched agents in multi-repo environments got none of the environment's secrets in June 2026, while manual and API launches got them (forum). Staff said a fix was live in July. In August, they traced two later reports to a "Skip Install" option stored on older automations, which you clear by re-selecting the environment and saving. On October 6, a user reported the failure on new automations too, with no reply from Cursor. If you see it, work through the secrets fix ladder.
- One VM profile carries the whole workspace (docs). Cloud agents run on a default VM profile with limited memory and CPU, and every repo in the group shares it. Enterprise teams can contact support to raise limits, and Cursor lists self-serve resource configuration as coming soon.
- One Build prepares every repository and records one commit per repo (docs). If that Build fails, agents continue on the last successful Build while you inspect the failure.
- The repository limit has two published figures (changelog and docs). Cursor's October 16, 2026 changelog says environments support up to 300 repositories, while the API reference allows up to 500 when you create one.
By default, an environment-scoped secret reaches every repo in the group. A production token you add for the deploy repo then also reaches a repo where the agent only reads a shared schema. The API reference shows that a secret can be limited to specific repositories, which is the narrower tool for that case. Across team boundaries, a second environment costs more setup and keeps the credential where it belongs.
Whatever the published maximum, every repo you add shares the default VM profile with the rest of the cloned workspace. We would size the group around the repos a task has to read and leave the rest for another environment.
The environment's configuration page on the dashboard shows which environment is active and all past active versions. When a multi-repo run behaves oddly, confirm which version served it before you debug the config you think is live. Version history and restore live in the settings view.
Frequently asked questions
Can a cloud agent open pull requests in more than one repo from a single task?
Yes. In a multi-repo environment the agent makes coordinated changes across the cloned repos and opens pull requests in the repos it changes, so one task can produce a PR per affected repository.
Do my secrets apply to every repo in a multi-repo environment?
Environment-scoped secrets apply to every repo in that environment by default, and other environments can't use them. The API reference shows a secret can also be limited to specific repositories. Cursor recommends environment-scoped secrets for multi-repo setups, staging credentials and repo groups with different access needs.
Do automations use the same multi-repo environment?
Yes. Cursor reuses the environment for future agent runs and automations that use the same repo group, so scheduled work against the stack inherits the cloned workspace and setup.
Is there a limit on how many repositories one environment can include?
Cursor's October 16, 2026 changelog says environments support up to 300 repositories, and the API reference allows up to 500 when you create one. The other constraint is the default VM profile's memory and CPU, which Enterprise teams can ask support to raise.
Sources & last verified
- Cursor Docs - Cloud Agent Setup: multi-repo environments
- Cursor - environment.json schema
- Cursor Docs - Cloud Agent Automations
- Cursor Docs - Cloud Agent Builds
- Cursor Forum - Automation-launched agents get no secrets (multi-repo)
- Cursor Docs - Cloud Agents API: environments and secrets
- Cursor changelog: Cloud Agent Canvases and Environment Improvements
Cursor ships frequently. Last updated October 28, 2026.