> ## Documentation Index
> Fetch the complete documentation index at: https://docs.niteshift.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-repository environments

> An environment can include multiple repositories, so tasks can change code and run services across your whole stack.

A Niteshift environment can run your full stack, even when it spans several repositories. Tasks in
that environment can change code in any of them and open pull requests against each one.

## Environments and repositories

An environment defines where Niteshift tasks run. A repository is one source of code available
inside that environment. For example, an environment might include these repositories:

* `frontend`
* `backend`
* `infra`

The environment configuration lives in one of those repositories. It could live in `frontend` while
still telling Niteshift to include the other two.

The repository that stores the configuration does not limit what tasks can work on. Once the
repositories are part of the environment, tasks can make changes and open pull requests across any
of them.

## Adding another repository

You do not need to edit the configuration by hand. Start a task in the environment and ask the agent
to add the repository. For example:

> Add the `backend` repository to this environment and set up the backend services so the frontend
> can run against them.

The agent checks the repository out into the current task, records it in `.niteshift/settings.yaml`,
and opens a pull request with the change. After you merge the PR, future tasks in the environment
start with both repositories.

## Changing the agent's working directory

By default the agent starts in the repository that holds the environment configuration. You can ask
the agent to change the agent's working directory. It will edit `settings.yaml` and it will take
effect for future tasks after you merge it.

## Naming an environment

By default an environment is named after the repository that holds its configuration. Give it a more
descriptive name, like "full stack", in **Settings → Environments → \[environment]**.
