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

# Pi coding agent

> Run the Pi terminal coding agent against a project on your host

Pi is a terminal coding agent distributed as a Node.js package. This guide pins the tested package version and gives it writable access to a project mounted from your host.

## Run Pi

**1. Start Pi**

Local-only (Writable host-directory mounts are local-only. On microsandbox cloud, use the isolated-copy alternative and omit replace-on-create.)

```sh macOS & Linux theme={null}
msb run -t --name pi-demo --replace \
  --cpus 2 --memory 2G --root-disk 4G \
  --mount-dir ./my-project:/workspace:rw \
  --workdir /workspace \
  node:24-bookworm-slim -- sh -lc '
    apt-get update &&
    apt-get install -y --no-install-recommends ca-certificates git &&
    npm install -g @mariozechner/pi-coding-agent@0.73.1 &&
    exec pi
  '
```

```powershell Windows theme={null}
msb run -t --name pi-demo --replace `
  --cpus 2 --memory 2G --root-disk 4G `
  --mount-dir ./my-project:/workspace:rw `
  --workdir /workspace `
  node:24-bookworm-slim -- sh -lc '
    apt-get update &&
    apt-get install -y --no-install-recommends ca-certificates git &&
    npm install -g @mariozechner/pi-coding-agent@0.73.1 &&
    exec pi
  '
```

The tested install downloads 188 packages and takes about a minute on a warm Node image cache. Configure a provider from the TUI when prompted.

> [!TIP]
>
> For an isolated workspace, or when using microsandbox cloud, replace `--mount-dir ./my-project:/workspace:rw` with `--copy-dir ./my-project:/workspace`.

**2. Start another session**

After leaving Pi, return to the same sandbox and workspace with:

```sh Shell theme={null}
msb exec -t pi-demo -- pi
```

**3. Verify the installation**

Exit Pi and run:

```sh Shell theme={null}
msb exec pi-demo -- pi --version
```

The pinned example prints `0.73.1`.

**4. Review or export changes**

With the default writable mount, changes are already in the host checkout. Review them inside the sandbox:

```sh Shell theme={null}
msb exec pi-demo -- sh -lc 'cd /workspace && git status --short && git diff --stat && git diff'
```

If you chose the isolated `--copy-dir` alternative, create a patch inside the sandbox:

```sh Shell theme={null}
msb exec pi-demo -- sh -lc 'cd /workspace && git add -N . && git diff --binary > /tmp/pi.patch'
```

Copy the patch to the host:

```sh Shell theme={null}
msb cp pi-demo:/tmp/pi.patch ./pi.patch
```

Check that it applies cleanly before applying it:

```sh Shell theme={null}
git apply --check ./pi.patch
```

**5. Clean up**

```sh Shell theme={null}
msb rm -f pi-demo
```

Changes made through the default workspace mount remain in the host checkout.

## Reference

* [Pi repository](https://github.com/badlogic/pi-mono)


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