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

# Sync and workspaces

> What is uploaded to your cloud workspace, and what comes back.

## Workspaces

A **workspace** is the cloud counterpart of one project directory on one
machine. It holds:

* a copy of your source files;
* your project's build outputs (`.lake/build`) and any dependencies that are
  not part of a prebuilt environment.

It persists between commands, which is what keeps builds incremental.

By default a workspace is identified by the machine and the project's path, so
two checkouts of the same repository, or the same repository on two computers,
never interfere. `pp workspace list` shows yours.

To share one workspace across machines, for example so CI jobs reuse each
other's build cache, name it:

```console theme={null}
$ pp --workspace main-ci lake build
```

A named workspace has a single set of sources, so everyone using the same name
should be building the same code.

## What is uploaded

Inside a Lake project, ProofPod uploads the project's **source files**:

* If the project is in a git repository: every tracked file, plus untracked
  files that are not ignored. This is `git ls-files --cached --others --exclude-standard`.
* If it is not a git repository: the same `.gitignore` rules still apply.
* If git is not installed: everything except common build directories and
  compiled artifacts.

Never uploaded, regardless of ignore rules: `.lake/`, `.git/`, `.proofpod/`.

Local path dependencies outside the project root (`require foo from
"../foo"`) are detected from the manifest and synced alongside the project.

To exclude more, list patterns in `proofpod.toml`:

```toml proofpod.toml theme={null}
[sync]
exclude = ["data/", "*.pdf", "notebooks/"]
```

Outside a project, only the files named on the command line are uploaded:
`pp lean A.lean` uploads `A.lean` and nothing else from the directory.

## How little travels

Each sync is a comparison of content hashes:

1. The CLI lists your files and hashes the ones whose size or modification time
   changed since last time.
2. It compares that against what the workspace is known to hold.
3. Changed and new files go up in a single compressed archive; deletions are
   sent as a list.

After the first upload a typical edit-build loop sends one or two small files.
If nothing changed, nothing is uploaded.

In the workspace, only changed files are rewritten. Unchanged files keep their
timestamps, so Lake does not rebuild more than it has to.

## What comes back

After a cloud command finishes, ProofPod looks for source files that the
**command** changed: created, modified or deleted. Those changes are applied to
your working tree.

```console theme={null}
$ pp lake update
proofpod: updated 2 local file(s) changed by the command: lake-manifest.json, lean-toolchain
```

Commands where this matters:

| Command | Typically changes |
| - | - |
| `pp lake update` | `lake-manifest.json`, `lean-toolchain` |
| `pp lake exe mk_all` | the top-level import file |
| `pp lake shake --fix` | `import` lines |
| `pp lean -o Foo.olean Foo.lean` | creates `Foo.olean` |
| `pp lake new foo` (when lake is not installed locally) | creates `foo/` |

The same ignore rules apply in this direction: a new file that your
`.gitignore` ignores is not sent back, and nothing under `.lake/` ever is.

### Your edits are never overwritten

A local file is replaced or deleted only if it still has exactly the content
that was uploaded for this command. If you edited it while the command was
running, your version is kept and you are told:

```console theme={null}
proofpod: warning: Proofs/Basic.lean changed both here and in the cloud; kept your local version
```

### Limits

Files larger than 64 MiB, or more than 256 MiB in total, are not sent back; you
get a warning naming them.

### Turning it off

```console theme={null}
$ pp --no-sync-back lake exe my_generator
```

or `sync_back = false` in `proofpod.toml`. The cloud workspace keeps the
command's changes; your local tree is untouched. The next command you run
re-syncs the workspace to match your local files again.

## Things that are deliberately not synced

* **Build outputs.** `.lake/` stays in the cloud. If you need compiled
  artifacts on your machine, build locally with `pp --local lake build`.
* **`.git`.** A command that inspects git history will not find a repository.
* **Your environment.** Pass variables explicitly with `--env`.

## Limits

A project's source files may total up to 2 GiB. If you hit this, large data
files are probably being picked up: add them to `.gitignore` or
`[sync] exclude`.

## If the two sides disagree

The workspace records the digest of the sources it holds. If that does not
match what the CLI expects, for example because the workspace was reset from
another machine, the command is automatically retried with a full comparison.
Unchanged files are still not rewritten. You will only notice with `--verbose`.


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