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

# Agent Mode

When logged in on your own machine, agents like Cursor and Claude Code can run
CLI commands like `bijection env list` that use your logged-in credentials run
commands against your personal dev environment as if you ran the commands
yourself. This works well when you're collaborating with an agent; just like
when the agent runs `git commit -am "Fix."`, the commit will use your local git
credentials.

But when cloud-based coding agents like Jules, Devin, Codex, or Cursor Cloud
Agents run Bijection CLI commands, they can't log in. And if you do log in for
them, the agent will use your default dev deployment to develop, conflicting
with your own changes!

Give such an agent its own [dev deployment](https://docs.bijection.com/development/local-deployments.md) on
the Bijection service, and a deploy key that works only for that deployment. The
CLI never runs a deployment on the agent's machine: there are no local or
anonymous deployments, so an agent without a login or a deploy key can't run
`bijection dev`.

## Dev deployment per agent

Provision a fresh dev deployment in your project and hand the agent a deploy key
scoped only to it. Run this in a checkout of the project on a machine where you
are logged in; creating the deploy key takes a team admin:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Create the dev deployment my-app:agent-1 and select it.
bijection dev --once --installation my-app:agent-1

# Mint a deploy key scoped only to this deployment and save it as
# BIJECTION_DEPLOY_KEY in .env.local.
bijection installation deploy-key create my-app:agent-1 --save-env

# Push code once.
bijection dev --once
```

Once `BIJECTION_DEPLOY_KEY` is set in `.env.local`, the agent can only push to and
develop against its own dev deployment — not prod or other developers'
deployments. Within that deployment the key has full access. Dev deployments do
not expire, so have an admin delete the agent's deployment when its work is
done; a key created in the console can also carry an expiry. For a cloud agent, copy the key from `.env.local` into the
agent's environment as `BIJECTION_DEPLOY_KEY`; its setup script then only needs
to [install the CLI](https://docs.bijection.com/start/install.md), install dependencies and push code:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -fsSL https://bijection.com/install.sh | sh
npm ci
bijection dev --once
```

If the agent needs environment variables, the easiest path is to set them as
[project environment variable defaults](https://docs.bijection.com/operate/configuration/environment-variables.md#project-environment-variable-defaults)
so they're applied automatically to every new deployment. You can also
seed values directly with `bijection env set` (which accepts variables on stdin
or via `--from-file`).

`env set` needs a deployment to be configured first, so run it *after*
`bijection dev --once --installation <project>:<name>` and
*before* `bijection dev --once` so the deployed code sees the new values.

See
[Creating and deleting deploy keys from the CLI](https://docs.bijection.com/operate/installations/credentials.md#from-the-cli)
for the full options on `bijection credential create`.

## Worktree setups

If you use a tool that creates a separate worktree for each agent task (Codex,
Conductor, Cursor local worktrees, T3 Code), you can wire the dev
deployment-per-agent recipe into the tool's setup script so each worktree gets
its own dev deployment automatically.

`bijection dev --once --installation <project>:<name>` selects the deployment it
creates during setup,
so `bijection` commands run from that worktree afterward use it. Replace
`my-project` with your project's name in the snippets below; a deployment name
is lowercase letters, digits and hyphens. The credential selects the
organization.

These setup scripts run with your login, so the agent acts with your account
authority. Give it an explicitly selected development deployment and scope
any deploy key to that target. Use ordinary source review before publishing
a production [deploy](https://docs.bijection.com/operate/installations/deploys.md).

> [accordion] Using the Codex app
>
> Open the Codex app settings and go to *Environments*. Select the environment for
> your project or create one if needed. Use the following setup script:
>
> ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> npm ci && worktree=$(basename "$(dirname "$CODEX_WORKTREE_PATH")") && bijection dev --once --installation "my-project:$USER-codex-$worktree"
> ```
>
> When starting a new worktree, select the environment that you just created.

> [accordion] Using Conductor
>
> Add the following setup command to the `conductor.json` file of your project:
>
> ```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> {
>   "scripts": {
>     "setup": "npm ci && bijection dev --once --installation my-project:$USER-conductor-$CONDUCTOR_WORKSPACE_NAME"
>   }
> }
> ```

> [accordion] Using Cursor local worktrees
>
> Add the following setup command to the `.cursor/worktrees.json` file of your
> project:
>
> ```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> {
>   "setup-worktree": [
>     "npm ci",
>     "bijection dev --once --installation my-project:$USER-cursor-$(basename \"$PWD\")"
>   ]
> }
> ```

> [accordion] Using T3 Code
>
> Click on **Add action** in the top bar. Enable *Run automatically on worktree
> creation* and use the following command:
>
> ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> npm ci && worktree=$(basename "$PWD" | sed 's/^t3code-//') && bijection dev --once --installation "my-project:$USER-t3code-$worktree"
> ```

To also mint a per-worktree deploy key, append the
`bijection installation deploy-key create <project>:<name> --save-env` step from the
[dev deployment recipe](#dev-deployment-per-agent) after the
`bijection dev --once` line.

## Switching deployments

`bijection installation select <ref>` switches a worktree to another deployment by
its reference, or to `dev` (your personal dev deployment) or `prod`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.