# One AGENTS.md for Claude Code, Codex and Cursor when every agent has its own machine

> How Claude Code, Codex and Cursor each find AGENTS.md, and what a team's AGENTS.md should say once each agent works on its own cloud machine: setup, ports, branches, checks, secrets and when to stop. With a template, and what the file cannot enforce.

How Claude Code, Codex and Cursor each find AGENTS.md, and what a team's AGENTS.md should say once each agent works on its own cloud machine: setup, ports, branches, checks, secrets and when to stop. With a template, and what the file cannot enforce.

December 1, 2026 · 5 min read · The Sandscale team

A team that uses more than one coding agent ends up with more than one instruction file: a `CLAUDE.md` for Claude Code, a rules folder for Cursor, an `AGENTS.md` for Codex. They drift apart, and the agents follow whichever version they happen to read.

[AGENTS.md](https://agents.md/) is an open format for this: a plain Markdown file in the repository that tells coding agents how to work on the project. Claude Code, Codex and Cursor all read it now. This post covers how each one finds the file, and what to put in it when each agent works on its own machine rather than in someone’s laptop checkout.

## How each agent finds AGENTS.md

The three tools read the same file, but they do not load it the same way. These details are from each tool’s documentation, read on 1 December 2026.

- **Codex** builds an instruction chain when it starts. It reads a global file from its home directory (`~/.codex/AGENTS.md`, or `AGENTS.override.md` if present), then walks from the project root down to the current directory and reads at most one file per directory, checking `AGENTS.override.md` before `AGENTS.md`. Files closer to the current directory come later and so take precedence. It stops adding files at a size limit, 32 KiB by default (`project_doc_max_bytes`). See [Custom instructions with AGENTS.md](https://developers.openai.com/codex/guides/agents-md).
- **Claude Code** reads `AGENTS.md` as project instructions when there is no `CLAUDE.md` or `CLAUDE.local.md` in the working directory or above it. If there is a `CLAUDE.md`, it reads only the `CLAUDE.md` files, unless the `CLAUDE.md` imports `AGENTS.md`. See [How Claude remembers your project](https://code.claude.com/docs/en/memory).
- **Cursor** reads `AGENTS.md` as a plain Markdown alternative to its `.cursor/rules` files, including nested `AGENTS.md` files in subdirectories, where the more specific file takes precedence. See [Cursor’s rules documentation](https://cursor.com/docs/context/rules).

The practical rule for a mixed team: keep the shared instructions in `AGENTS.md`. If someone also keeps a `CLAUDE.md`, have it import `AGENTS.md` so Claude Code does not silently skip the shared file.

## What changes when each agent has its own machine

Most AGENTS.md advice assumes the agent runs in a developer’s checkout, next to the developer’s other work. When every agent gets its own machine, such as a [Sandscale workspace](https://sandscale.dev/workspaces) per agent, a few instructions change, and they are worth writing down because the agent cannot guess them.

- **Setup is the agent’s job.** A fresh machine has the template’s tools and whatever the agent installed last time, and nothing from a laptop. Spell out the install and build commands, in order, so the agent does not improvise.
- **Ports are not shared.** On one laptop, two agents fight over port 3000. On separate machines they do not, so the file can name one fixed port for the dev server. That also makes it easy for a reviewer to forward the same port from any agent’s machine.
- **The branch is the hand-off.** The machine is not where the result should live. Tell the agent to work on its own branch, commit, and push, so the result does not depend on any one machine.
- **Checks run where the code is.** Name the exact test and lint commands the agent must run before it says it is done. On its own machine, a slow test suite does not compete with anyone else’s work.
- **Secrets come from the environment, never the file.** Name the environment variables the code expects. Do not put values in AGENTS.md. It is committed, and every agent reads it into its context.

## A template

```markdown
# AGENTS.md

## Where you run
- You run on your own machine for this task. Nothing from anyone's laptop is here.
- Do not install system-wide tools that are not listed below. Ask first.

## Setup
1. `corepack enable`
2. `pnpm install --frozen-lockfile`
3. `pnpm build`

## Dev server
- `pnpm dev` serves on port 3000. Always use port 3000.

## Branches and commits
- Work on a branch named `agent/<task-id>-<short-name>`. Never commit to `main`.
- Commit in small steps. Push your branch when the checks pass.
- Do not rewrite history that is already pushed.

## Checks before you say you are done
- `pnpm lint`
- `pnpm test`
- If a test fails for a reason unrelated to your change, say so. Do not change the test to make it pass.

## Secrets
- The app reads `DATABASE_URL` and `STRIPE_TEST_KEY` from the environment.
- Never print, log or commit their values. Never write them into files.

## Stop and ask when
- A change touches `infra/`, `.github/workflows/`, or this file.
- You want to add a production dependency.
- You need network access to a host that is not the package registry or the git host.
```

Put service-specific rules in a nested `AGENTS.md` (or, for Codex, `AGENTS.override.md`) next to that service, rather than growing the root file. Codex stops reading at its size limit, and a long file is harder for any agent to follow.

## Giving each agent its machine

With the Sandscale CLI (1.4.1), a workspace per agent and task looks like this:

```sh
sandscale workspace templates-list
sandscale workspace create --name agent-billing-fix --template-id TEMPLATE_ID
sandscale workspace ssh agent-billing-fix
```

Clone the repository inside, start Claude Code, Codex or Cursor’s agent there, and it reads the repository’s `AGENTS.md` like it would anywhere else. A workspace keeps its disk across stop and start, so the setup steps in the file run once per machine, not once per session. If you prefer to give the agent tools rather than a shell, the [Quickstart](https://sandscale.dev/docs/quickstart) shows how to connect Claude Code, Codex or Cursor to Sandscale’s MCP server instead.

Secrets that a run needs come from [Vault](https://sandscale.dev/docs/concepts/vault), which injects them at run time and keeps them out of prompts and logs. That matches the rule in the template: the file names the variable, and the value never passes through the agent’s instructions.

## What AGENTS.md cannot do

AGENTS.md is guidance. Claude Code’s documentation says it plainly about its own instruction files: they are context, not enforced configuration. An agent can misread the file, skip a step, or follow a conflicting instruction from the chat, which every tool lets override the file.

So put the rules that must hold somewhere that enforces them:

- **Which agents may run, on which templates, sizes and run times:** your organization’s [policies](https://sandscale.dev/docs/concepts/approvals).
- **Actions a person must sign off:** approval gates. Nobody approves their own request.
- **A record of what ran:** the [audit log](https://sandscale.dev/docs/concepts/audit), which every agent’s actions land in.
- **Stopping everything:** the organization’s kill switch.
- **What the agent’s own process can touch:** the machine boundary itself. An agent on its own microVM cannot read files from your laptop, whatever its instructions say.

Use AGENTS.md for how to do the work well, and the platform for what must never happen.

## Related

- [A Cursor project rule that sends installs and tests to a Sandscale sandbox](https://sandscale.dev/blog/cursor-rule-run-tests-in-a-sandbox)
- [Writing a policy for coding agents](https://sandscale.dev/blog/writing-a-policy-for-coding-agents)
- [Your coding agents run on your laptop. What that costs the team](https://sandscale.dev/blog/coding-agents-on-your-laptop-what-it-costs-the-team)

**On this page**

1. How each agent finds AGENTS.md
2. What changes when each agent has its own machine
3. A template
4. Giving each agent its machine
5. What AGENTS.md cannot do
6. Related

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [December 1, 2026 · **A team workflow for coding agents: who starts them, who approves, who reviews, who stops them** · When a team runs Claude Code, Codex or Cursor agents every day, someone has to own each step. A simple division of roles, a naming convention, and the Sandscale commands and controls behind each step, with no code to write.](https://sandscale.dev/blog/team-workflow-for-coding-agents)
- [December 1, 2026 · **Running Claude Code, Codex and Cursor agents in parallel: one machine each, from splitting the work to merging it** · A practical way for a team to run several coding agents at once: split the work so the agents do not collide, give each agent its own cloud machine, check on all of them from one terminal, review each one's running app, and merge branch by branch.](https://sandscale.dev/blog/running-coding-agents-in-parallel-one-machine-each)

---
Source: https://sandscale.dev/blog/agents-md-for-coding-agents-on-their-own-machines
