Cursor self-hosted cloud agent worker
The nornir:cursor-worker image is for Cursor’s self-hosted cloud agent process. It differs from the cursor-dev dev shell: it connects outbound to Cursor and runs agent worker start after preparing /workspace.
Components
Dockerfile.cursor-worker—FROM nornir:dev-cursor-base(venv + CuPy, no monorepo snapshot). Addsgit,curl, and the Cursor labagent-cli-package.cursor-worker-entry.sh— Entrypoint. RequiresCURSOR_API_KEY.
Workspace strategies (NORNIR_WORKSPACE_STRATEGY)
clone(default)Empty
/workspace→ clone fromNORNIR_CLONE_URL(defaulthttps://github.com/jamesra/nornir.git) branchNORNIR_CLONE_BRANCH(defaultdev). Existing.git→ fetch/checkout/pull.NORNIR_CLONE_REFRESH=1wipes/workspace.mountedHost bind-mount at
/workspacewith an existing checkout. Empty mount → same clone flow. Existing repo →git fetch;NORNIR_SYNC_REMOTE=1doesgit pull --ff-only.
Secrets
Copy nornir-docker/example.nornir-cursor-worker.run.env to ``D:DockerRunnornir-cursor-workernornir-cursor-worker.run.env`` (recommended) or nornir-docker/.env.cursor-worker (dev/compose fallback). Set at minimum:
CURSOR_API_KEYGITHUB_TOKEN(optional; for private submodules or rate limits)
On Windows, run Initialize-NornirCursorWorkerLayout.ps1 once to create the D:\Docker tree from examples. See Standard D:\ layout for nornir-cursor-worker.
Warning
Never commit real tokens. The GITHUB_TOKEN / GH_TOKEN variables are passed into the container only via --env-file; they are never loaded onto the host process by the launcher scripts.
Dev-container mount parity (opt-in)
By default the worker only bind-mounts /workspace. To mirror cursor-dev data paths
(/nornir-testdata, /data, test output, and in-container CIFS from nas-mounts.tsv),
configure Run\nornir-net-mounts (or legacy Run\nornir-dev) first
(see nornir-docker/windows-docker-layout/NORNIR_DEV_VOLUMES.md), then either:
Set
NORNIR_WORKER_DEV_PARITY_MOUNTS=1in the worker run env, orPass
-DevParityMountstostart-cursor-worker.ps1.
Host paths are read from Run/nornir-net-mounts/.run.nornir-net-mounts.env (preferred),
Run/nornir-dev/.run.nornir-dev.env, and nornir-docker/.env. NAS data uses path-B
in-container CIFS (NORNIR_NET_MOUNTS_*), not a host bind of the share.
Build:
docker build -f nornir-docker/dev/Dockerfile --build-arg INSTALL_MONOREPO_EDITABLES=0 -t nornir:dev-cursor-base .
docker build -f nornir-docker/Dockerfile.cursor-worker -t nornir:cursor-worker .
Compose (build then run):
docker compose -f nornir-docker/compose.cursor-worker.yaml build nornir-cursor-base nornir-cursor-worker
docker compose -f nornir-docker/compose.cursor-worker.yaml run --rm nornir-cursor-worker
Containers set nofile 65536 (same as production and cursor-dev) for long builds on NAS mounts. Check with ulimit -n inside the running container.
PowerShell launcher start-cursor-worker.ps1
start-cursor-worker.ps1 has several modes:
Default: host
git cloneinto a unique directory underD:\agents(override with-AgentCloneParent), bind-mount at/workspace, passNORNIR_WORKSPACE_STRATEGY=mounted.-LiveMount: bind-mountWorkspaceMountPathorRepoRootat/workspace,mountedstrategy.-LiveMount -UseUniqueWorkspaceFolder: empty unique folder per run underWorkspaceRunParent(defaultD:\Docker\mounted-configs\nornir-cursor-worker), mount at/workspace,clonestrategy.-UseNamedDockerVolume: named Docker volume at/workspace,clonestrategy.-RemoveCloneAfter: delete isolated host clone or per-run folder after exit (skipped ifgit status --porcelainis non-empty; seeCursorWorkerWorkspaceGit.ps1).-Rebuild: buildsnornir:dev-cursor-basethennornir:cursor-worker(orcd D:\Docker\Builds\nornirand.\build-nornir-images.ps1).-Gpu,-SmokeTest,-CloneUrl,-CloneBranch.-DevParityMountsorNORNIR_WORKER_DEV_PARITY_MOUNTS=1: same NAS/testdata mounts as cursor-dev (see above).
For the standard Windows ``D:`` layout, see Standard D:\ layout for nornir-cursor-worker.
Cleanup script Cleanup-CursorWorkerClones.ps1
Use nornir-docker/Cleanup-CursorWorkerClones.ps1 on the host to remove leftover disposable workspace folders when:
Docker:
dockermust be onPATH. The script scans all containers (running and stopped), collects each bind mountSource, and never deletes a directory whose normalized path is still a bind source.Git: Same rules as
-RemoveCloneAfter, implemented inCursorWorkerWorkspaceGit.ps1(Get-CursorWorkerRemoveCloneAfterDisposition): delete if there is no.git, or ifgit status --porcelainis empty; otherwise skip.
Scope (name patterns): under WorkspaceRunParent (default D:\Docker\mounted-configs\nornir-cursor-worker), only directories named nornir-cursor-worker-*; under AgentCloneParent (default D:\agents), only nornir-agent-*. Override parents with -WorkspaceRunParent and -AgentCloneParent.
Safety: Use -WhatIf to list removals without deleting. Confirmation uses ShouldProcess (-Confirm:$false to skip prompts).