# How a build runs

> What happens when a contractor or an agent runs the build, the tests or the dev server on code they cannot read, from the command to the output.

Source: https://occlude.dev/docs/builds/ · Reviewed 28 November 2026

The person types the command they always type. The build runs on the other side of the workspace, against the whole repository, and only what the person is allowed to see comes back.


## The short version

- The person's side holds the task's files. The build's side holds the whole repository, minus *Absent* paths.
- The person starts a build by name, never as a shell on the build's side.
- The build reads everything it needs, including files the person cannot open, and writes only where the profile says build output goes.
- Its output is cleaned before it reaches the person. The full output goes to the record.
- The preview, the tests and the language server all work as they would for a full-access engineer, except that the code they cannot read stays out of view.

![The person's side and the build's side. The person types npm test; it runs by name on the build's side, which holds the whole repository. The output comes back through a filter, showing the failure at a protected module and the person's own file. Both sides write to the record](https://occlude.dev/figures/build-flow.webp)

*A build starts by name on the other side, reads everything, and its output is cleaned on the way back. The record keeps the full output.*

## A worked example

The fixture repository is a payments monorepo. A frontend contractor works under the profile on the [Profiles](https://occlude.dev/docs/profiles/) page: the web app is *Visible*, the billing engine is *Occluded*, environment files are *Absent*. Their task imports `calculateInvoice` from the billing module.

```text
$ cat src/lib/billing/calculateInvoice.ts
cat: src/lib/billing/calculateInvoice.ts: No such file or directory

$ npm run dev
  VITE ready
  Local: http://localhost:5173/

$ npm test
 FAIL  <protected module>
RangeError: <protected module>
 ❯ <protected module>
 ❯ summarizeInvoice src/web/invoices/summarizeInvoice.ts:11:18
 ❯ <protected module>

 Test Files  1 failed | 25 passed (26)
      Tests  1 failed | 399 passed (400)

$ occlude submit
submitted 1 file(s) as <commit> on <branch>
```

What happened at each line:

1. **`cat`** ran on the person's side. The billing source is *Occluded*, so it does not exist there; only its declaration does. The attempt is on the record ([see it](https://occlude.dev/demo/#contractor-4)).
2. **`npm run dev`** started the `dev` script on the build's side. Vite read the billing engine, because the app imports it, and served the app. The preview opened in the contractor's browser or editor.
3. **`npm test`** ran the whole suite on the build's side, all 400 tests, including tests of code the contractor cannot open. One failed inside billing. Every frame and file name inside billing came back as `<protected module>`; the frame in the contractor's own file stayed, so they can see which of their lines led there ([see it](https://occlude.dev/demo/#contractor-5), next to [a full-access engineer's run](https://occlude.dev/demo/#engineer-5)).
4. **`occlude submit`** opened a pull request on the real repository with the contractor's changes. Git runs on the build's side ([see it](https://occlude.dev/demo/#contractor-6)).

To step through the same commands as the contractor, an AI agent and a full-access engineer side by side, see [See Occlude work](https://occlude.dev/demo/#engineer-1).

## Starting a build

A build starts by name. The person runs `npm run dev`, `npm test` or `npm run build` in their terminal, their editor's task runner or their agent, and Occlude starts that script on the build's side.

- Only the scripts the profile lists can start. Anything else is refused and recorded.
- The script is the one in the repository's package manifest. Manifests are *Read-only* for contractor profiles, so the person cannot change what a script runs.
- Nobody gets a shell on the build's side, and nobody attaches a debugger to it. The person's processes cannot see the build's processes.

## What a build can read

Everything in the repository except *Absent* paths. The compiler reads *Occluded* source, so the build is the build you ship, not a build against stand-ins. Credentials and data seeds are *Absent* everywhere: never mounted, never in memory.

## What a build can write

Only the paths the profile declares as build output, such as `dist/` or `coverage/`. Everything else in the repository is read-only to the build, so a script cannot rewrite an *Occluded* file into a place the person can read. A build that tries is refused, and the refusal is on the record.

Build output itself is *Occluded* on the person's side, because bundles and coverage carry compiled *Occluded* code. The preview is served from the build's side instead.

## What comes back

Every byte from the build's side passes through output sanitisation before it reaches the person:

| What | What the person sees |
|---|---|
| A stack frame inside an *Occluded* module | `<protected module>`. Their own frames stay |
| Output that reproduces *Occluded* source, verbatim or reformatted | Redacted |
| Long encoded runs | Redacted |
| A secret's value | The secret's name |
| A coverage report or a download | Files under *Occluded* paths removed; no source maps for *Occluded* modules |

The unsanitised output goes to the record, readable by authorised staff. See [Output sanitisation](https://occlude.dev/docs/output/).

## The preview

The dev server runs on the build's side. The person reaches it the way they would on their own machine: in the browser workspace's preview, or on `localhost` through their editor's port forwarding. The dev server answers for the app, and it never serves the source of an *Occluded* file, even when asked for one by path.

Compiled client code is readable by whoever runs it in a browser. The profile counts the *Occluded* files the client bundle reaches, and an admin acknowledges them or makes them *Absent*.

## Credentials the build needs

A build that calls a payment provider or a database gets a placeholder in its environment. The real value is attached to the request on its way out of the workspace, so the build job never holds it and its output can never print it. A missing secret fails the job with a named error; nothing falls back to a file.

## Dependencies

Dependencies install on the build's side from your package registry mirror, the only registry the workspace can reach. They are *Read-only* on the person's side: the language server reads their types, and nobody edits them.

## The language server

The person's editor, hover, autocomplete and go-to-definition run on the person's side. Where their code imports an *Occluded* module, a declaration stands in at its path, so the signature resolves and the body is not there. See [Stubs](https://occlude.dev/docs/stubs/).

## Git

`.git` is *Absent* from the person's side, because history holds every version of every *Occluded* file. Git runs on the build's side, as three verbs:

| Verb | Does |
|---|---|
| `occlude status` | The files the person changed |
| `occlude diff` | Their changes, on *Visible* paths only |
| `occlude submit` | A branch and a pull request on the real repository |

## What it cannot catch

A test is code, and it runs on the build's side, so it can read what the build reads. Code that reads *Occluded* paths is flagged before it runs, its output is sanitised, and the run is recorded in full. No output filter is complete, and we say so in writing with every customer. See [Security model](https://occlude.dev/docs/security-model/).
