Cursor

Verified against Cursor · 2026-07-05

Tell Cursor which package actually owns a change in a multi-root monorepo

A context brief for Cursor's multi-root workspace support that names the owning package, treats sibling packages as read-only context, and states shared-file boundaries, so the agent doesn't cross package lines while searching the whole workspace.

Cursor 2.1

The prompt

Ready to copy — highlighted parts are example details you can swap.

This workspace has multiple roots open at once. Before editing anything, confirm which root and package you're in.

OWNING PACKAGE FOR THIS CHANGE
packages/checkout-service

SIBLING PACKAGES IN THIS WORKSPACE — context only, do not edit these
packages/shared-ui, packages/payments-sdk, packages/admin-dashboard

SHARED FILES / BOUNDARY RULES
pnpm-workspace.yaml and the root tsconfig.base.json are off-limits without asking first. packages/shared-ui/src/index.ts (the public export list) requires confirmation before adding new exports.

RULES
- Make all edits inside the owning package unless a shared file must change to satisfy the task — if so, name the shared file and ask before editing it.
- If a symbol or type you need already exists in a sibling package, import it. Do not redefine or fork it locally, even if that seems faster.
- Don't run a workspace-wide build, lint, or test command when a package-scoped one exists — name the package-scoped command you're using.
Customize the highlighted detailsoptional — the prompt above already works

Why this works

Multi-root workspace support means Cursor's indexer sees several package roots at once and its semantic code search treats them as one searchable space by default — that's the point of the feature, but it also means a similarly named file or function in another root is a plausible edit target unless the agent is told which root actually owns the change. Without OWNING PACKAGE stated explicitly, a 'closest semantic match' search across roots can surface a same-named helper in a sibling package as the thing to edit, or the model can duplicate a type that already exists in a package it was never told to treat as read-only. Naming shared-file boundaries closes a second, more damaging gap: monorepo root config (workspace manifests, base tsconfig) affects every package silently, so an edit there is exactly the kind of change an agent should never make without an explicit ask, even though nothing about the task description would obviously exclude it. Requiring package-scoped commands over workspace-wide ones prevents a slower but real failure mode: a workspace-level build or test run silently exercising and reporting on packages the change never touched.

Verified against

Cursor 2.1 · 2026-07-05

Changelog

  • 2026-07-05 Initial publish, verified against Cursor 2.1 multi-root workspace support in a pnpm monorepo.

Need this built into your business?

If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All Cursor prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY