Cursor

Verified against Cursor · 2026-07-24

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

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 semantic search across the flattened index doesn't cross package lines while looking for a similarly named symbol.

Cursor 2.24 fillable variables

The prompt

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

This workspace has multiple roots open at once, and the codebase index treats them as one searchable space by default. Before editing anything, confirm which root and package this change actually belongs 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 / ROOT-LEVEL 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.

PACKAGE-SCOPED COMMANDS TO USE
pnpm --filter checkout-service test, pnpm --filter checkout-service lint, pnpm --filter checkout-service build

RULES
- Make all edits inside the owning package unless a shared file must change to satisfy the task — if so, name the shared file explicitly and ask before editing it, even if the change looks trivial.
- If a symbol, type, or utility you need already exists in a sibling package, import it from there. Do not redefine or fork a local copy inside the owning package, even if that seems faster or avoids adding a cross-package dependency — say if importing it would require adding one, and ask first.
- Don't run a workspace-wide build, lint, or test command when a package-scoped equivalent exists. Use the commands named above and state exactly which one you ran and against which package.
- If the semantic search for "where does X live" surfaces a same-named symbol in more than one package, stop and confirm which one is actually relevant before assuming it's the one in the owning package.

Before finishing, state explicitly whether any shared or root-level file was touched, and if so, why it was unavoidable given the task.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

Multi-root workspace support means Cursor's indexer sees several package roots at once and its semantic code search treats that as one searchable space by default — that's the point of the feature for cross-package navigation, but it also means a similarly named file or function in another root is a plausible edit target unless the agent is explicitly told which root actually owns this specific change. Without OWNING_PACKAGE stated up front, a "closest semantic match" search across roots can surface a same-named helper in a sibling package as the thing to modify, or the model can duplicate a type that already exists in a package it was never told to treat as read-only, producing two divergent copies of the same concept that will silently drift apart the moment one gets updated and the other doesn't. Naming shared-file boundaries closes a second, more damaging gap: monorepo root config — workspace manifests, base tsconfig, a shared package's public export list — affects every package silently and simultaneously, so an edit there is exactly the kind of change that should never happen without an explicit ask, even though nothing in a narrowly scoped task description would obviously exclude it from an agent reasoning purely from "what files need to change to make this work." Requiring package-scoped commands over workspace-wide ones prevents a slower but real failure mode where a workspace-level test run silently exercises and reports on packages the change never touched, producing a results summary that looks like broader verification happened when it actually just added noise and runtime without adding signal. The explicit stop-and-confirm rule for ambiguous same-named symbols matters because that ambiguity is invisible from inside a single search result — the agent sees one plausible match per package and has no built-in reason to suspect there's a second one worth checking unless told the possibility exists.

Verified against

Cursor 2.2 · 2026-07-24

Changelog

  • 2026-07-24 Initial publish, verified against Cursor 2.2 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
Brief Cursor's Agent mode to build a multi-file feature without wandering into untouched filesA Composer/Agent-mode brief that names the files in scope, the data contract between them, the codebase's existing conventions, and what to leave alone, plus a forced pre-edit plan, so an autonomous multi-file build stays inside the feature you actually asked for instead of expanding into whatever the semantic index surfaces as related.Cursor 2.22026-08-05Force Cmd+K to change only the highlighted lines, not the whole block around themA Cmd+K inline-edit instruction that states the transformation, an explicit byte-identical preserve list, and a fallback rule for when the transformation can't be done cleanly, tuned for the selection-scoped inline editor rather than a whole-file Agent pass.Cursor 2.22026-07-22Point Cursor BugBot at the actual risk in a PR instead of a generic pass over the diffA PR description written for BugBot, Cursor's automated PR-review agent, that states risk areas and known trade-offs up front and defines exactly how findings must be classified and cited, so its comment thread concentrates on real logic and security risk instead of restating the diff or re-litigating a deliberate choice.Cursor BugBotCursor 2.22026-07-30Write a Background Agent brief that survives running with nobody watchingA self-contained task brief for Cursor's Background Agents — the async, remote-run agent mode — with success criteria, a conservative-default policy for ambiguity, and a reviewable-PR requirement, since no one answers follow-up questions while it works in an isolated container.Cursor Background AgentsCursor 2.22026-08-02
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