Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

docs: Document SANDBOX_REPO_MOUNT_MAP for local Docker sandbox development (#54100)

inkeep[bot]fadd0b0aefd2
diff --git a/docs/internal/sandboxes-setup-guide.md b/docs/internal/sandboxes-setup-guide.md
index c77edaddd002..d78589256df7 100644
--- a/docs/internal/sandboxes-setup-guide.md
+++ b/docs/internal/sandboxes-setup-guide.md
@@ -197,6 +197,22 @@ cd /path/to/posthog-code/packages/agent && pnpm build
| `MODAL_DOCKER` | `SANDBOX_PROVIDER=MODAL_DOCKER` | **Local development with Modal.** Same as `modal` but uses a separate Modal app (`posthog-sandbox-modal-docker-*`) so local image builds don't pollute the production app cache. When `LOCAL_POSTHOG_CODE_MONOREPO_ROOT` is set, the local agent packages are overlaid onto the image. |
| `docker` | `SANDBOX_PROVIDER=docker` | Local-only Docker containers (`DEBUG=True` required). No Modal account needed. |
+### Optional: local repository mounts (Docker only)
+
+If you already have a repository checked out locally, you can skip cloning by
+bind-mounting it into the Docker sandbox:
+
+```bash
+# Format: org/repo:/local/path,org2/repo2:~/other/path
+SANDBOX_REPO_MOUNT_MAP=PostHog/posthog:~/Developer/posthog
+```
+
+When configured, matching repositories are mounted read-write from your host
+into the container, and `clone_repository` becomes a no-op for those
+repositories.
+
+> **Note:** This only works with `SANDBOX_PROVIDER=docker`.
+
### How `MODAL_DOCKER` works
When both `SANDBOX_PROVIDER=MODAL_DOCKER` and `LOCAL_POSTHOG_CODE_MONOREPO_ROOT` are set:
diff --git a/docs/published/handbook/engineering/ai/sandboxed-agents.md b/docs/published/handbook/engineering/ai/sandboxed-agents.md
index b2477c5b0722..7851e6aefed1 100644
--- a/docs/published/handbook/engineering/ai/sandboxed-agents.md
+++ b/docs/published/handbook/engineering/ai/sandboxed-agents.md
@@ -306,6 +306,8 @@ The setup command is idempotent and handles:
For advanced setup options (Modal sandboxes, local agent packages, MCP), see the [Cloud runs setup guide](https://github.com/PostHog/posthog/blob/master/docs/internal/sandboxes-setup-guide.md).
+**Tip:** Set `SANDBOX_REPO_MOUNT_MAP` to bind-mount local repositories into the Docker container and skip cloning from GitHub. Format: `SANDBOX_REPO_MOUNT_MAP=org/repo:/local/path` (e.g., `SANDBOX_REPO_MOUNT_MAP=PostHog/posthog:~/Developer/posthog`). This can significantly reduce sandbox startup time for large repos.
+
## Questions?
If you're unsure whether a sandboxed agent is the right fit for your use case,