---
title: "Working on the code"
summary: "The repository's own instructions for a coding agent changing the mirror itself."
read_when: "you are a coding agent changing the mirror's own source"
url: https://mirrordimensions.com/docs/working-on-the-code/
source: https://github.com/mirrordimensions/mirrordimensions/blob/main/AGENTS.md
---

# Working on the code

The repository's own instructions for a coding agent changing the mirror itself.

This file is for an AI coding agent working in this repository, whichever one it is. [CLAUDE.md](https://github.com/mirrordimensions/mirrordimensions/blob/main/CLAUDE.md) holds the full working rules and applies to every agent and every person; read it first. What follows is the part that is easiest to get wrong.

## What this project is

A test range for AI agents: a synthetic company in a sealed sandbox, with everything an agent does recorded and scored. It is a containment product. A change that weakens isolation, leaves something unrecorded, or lets the agent under test learn it is being tested is a security defect, whatever else it improves.

## Rules that are not negotiable

- **Never reach the engine from a unit test.** The engine on a developer's computer may be holding a world of theirs. Tests stand in for Docker; `tests/conftest.py` refuses any unit test that opens the real one. A test that needs the engine is marked `integration` and is not run by default.
- **Never point code at a real organization's systems.** Everything runs against the local sandbox. Made-up companies only, in code, tests, examples and documents.
- **Never weaken a protection to make something work.** If a system needs the internet at run time, stop and say so.
- **Never commit a secret, a key, a `.mirror/` folder or real data.**
- **Never describe a sandbox escape, an egress bypass or a capture gap in a public issue, commit message or pull request title.** Those go through private vulnerability reporting ([SECURITY.md](https://mirrordimensions.com/docs/reporting-a-vulnerability/)).
- **Never put this repository's code, configuration or data where the agent under test can reach it.**
- **Do not change the user's Docker context, Lima instances or WSL settings.**

## Before you say a change is done

Run what `CONTRIBUTING.md` lists:

```sh
uv run ruff check . && uv run ruff format --check .
uv run pyright
uv run pytest
uv run python scripts/check_imports.py && uv run python scripts/check_spdx.py && uv run python scripts/check_licenses.py
```

and, for the portal's front end, in `src/mirrordimensions/portal/web`: `npm run typecheck`, `npm run lint`, `npm test`, `npm run build`, `npx playwright test`.

Say what you ran and what you did not. A check you skipped is said as skipped.

## How changes are made

- One pull request per change, with the checks passing. Sign off every commit (`git commit -s`).
- A new source file starts with `SPDX-License-Identifier: Apache-2.0`.
- A decision that changes the design gets a record in `docs/decisions/`. Keep `README.md`, `docs/` and `CHANGELOG.md` true in the same pull request.
- A new way for the agent under test to touch something is not done until it is captured, appears in coverage, and has a reconciliation test. A new way into the portal or the operator server updates [docs/security/threat-model.md](https://mirrordimensions.com/docs/threat-model/).
- OS-specific code lives only in `src/mirrordimensions/hostos/` and `src/mirrordimensions/engine/`. A call that behaves differently on Windows belongs there, behind a portable helper.
- User-facing text makes no absolute promise: design goals, not guarantees.

## If you are setting a world up for someone, not changing this code

Use the operator MCP server (`mirror mcp serve --worlds <folder>`), which tells you the order of the work. See [docs/setup-with-an-agent.md](https://mirrordimensions.com/docs/setup-with-an-agent/). The session that sets a world up must not be the agent that is then tested in it.
