skip to content

Cursor

The VS Code-based AI editor: Tab predictions, inline edit, an Agent with Ask, Plan and Debug modes, project rules, cloud agents and Bugbot. Interviewers ask how you steer and bound its agent.

part ofAI coding toolsread it →
on this pageshow

explore

questions

24

In Cursor, when should a selected function be changed with inline edit (Cmd/Ctrl+K) rather than sent to Agent with Cmd/Ctrl+L?

level: juniorimportance: must knowfreq 18%

answer

  1. the change's reach decides
  2. selection in, edit in place
  3. Return applies, a follow-up refines
  4. Cmd/Ctrl+L opens Agent with the selection
  5. multi-file or complex work goes to Agent

basics

~20 s

Use Cursor's inline edit (Cmd/Ctrl+K) when the change belongs to the selection: one instruction, applied in place, refined by follow-ups. Use Cmd/Ctrl+L when it spans files or needs exploring, so Agent starts with the selection as context.

solid answer

~40 s

Cursor's **inline edit** is the targeted surface: select code, press `Cmd+K` (`Ctrl+K` on Windows/Linux), type an instruction such as "Convert this to an async function" and press Return; Cursor applies the edit to the selected code without opening the chat panel, and another instruction plus Return refines the same edit. When the change will not stay inside the selection — callers in other files, a multi-file refactor, anything that needs searching or running commands — select the code and press `Cmd+L` (`Ctrl+L`) instead: that opens **Agent** with the selection as context, and Agent searches the codebase, edits several files and runs terminal commands on its own. The decision is about the reach of the change, not its difficulty.

go deeper

for a junior

Recall the two keys: Cmd/Ctrl+K edits the selected code in place from one instruction, and Cmd/Ctrl+L opens Agent with the selection as context. Know that a follow-up instruction refines an inline edit.

for a middle

Explain the boundary in terms of reach: inline edit acts on the selection, Agent searches, edits several files and runs commands. Mention Cmd+L versus Cmd+Shift+L for a new or an existing chat.

for a senior

Show judgement about the ripple: an async conversion done with Cmd+K leaves the callers to you. Note that rules reach Agent but not inline edit, which matters when conventions must hold.

for a principal

Frame the choice as review cost: a one-selection change is cheap to verify, a multi-file Agent run is not. Guide a team on when each surface keeps diffs small enough to review well.

## Two surfaces for one selection Cursor gives a developer two ways to act on code they have just selected. **Inline edit** (`Cmd+K` on Mac, `Ctrl+K` on Windows/Linux) works on the selection itself. **Agent**, opened with the selection by `Cmd+L` (`Ctrl+L`), is Cursor's assistant that "searches your codebase, edits multiple files, runs terminal commands, and fixes errors on its own". Both start from the same highlighted function; they differ in how far the result is allowed to travel. | | Inline edit (`Cmd/Ctrl+K`) | Agent via `Cmd/Ctrl+L` | |---|---|---| | Where you type | A prompt on the selection, in the editor | The Agent side panel | | What it changes | The selected code, in place | Whatever files the task needs | | Other tools | None described on the help page | Codebase search, file edits, terminal commands, web | | Iterating | A follow-up instruction plus Return | Further chat messages | | Best for | Quick, targeted changes | Multi-file edits or more complex changes | ## How an inline edit runs Cursor's help page describes the flow in five steps: 1. Select the code you want to change. 2. Press `Cmd+K` on Mac or `Ctrl+K` on Windows/Linux. 3. Type the instruction, for example "Convert this to an async function." 4. Press Return; Cursor applies the edit to the selected code. 5. To refine, add a follow-up instruction and press Return again. The point of step 5 is that you do not throw a near-miss away. If the async conversion used the wrong error type, the next instruction ("keep throwing `IOException`") refines the same edit rather than starting over. The same prompt also has a question mode (`Opt+Return` on Mac, `Alt+Return` on Windows/Linux) for asking about the selection instead of changing it. ## When the change outgrows the selection The help page draws the line itself: "For multi-file edits or more complex changes, select code and press Cmd + L on Mac (Ctrl + L on Windows/Linux). This opens Agent with your selected code as context." Typical signs that you have crossed it: - making a function `async` means every caller must now `await` it, and the callers live in other files; - the instruction starts with "find" or "everywhere" — inline edit acts on what you selected, Agent searches; - the change needs a command run to confirm it, such as a test or a build; - you want Agent's working style for the job: its mode picker (Ask, Plan, Debug) and its project rules apply there. The keyboard reference adds a nuance worth knowing: with code selected, `Cmd+L` is "Add selection to new chat", while `Cmd+Shift+L` is "Add selection to Chat", attaching it to the conversation already open. Use the first to start a fresh task from the selection and the second when the selection is extra evidence for a task Agent is already doing. ## The divergence scenario: one function, nothing else A developer wants a single function converted to async and explicitly does not want any other file touched. That is inline edit's job: select the function, `Cmd+K`, state the conversion, Return, and review the result in place. The trade-off is that the developer, not the tool, now owns the ripple — any caller that needs an `await` is theirs to find. If the developer actually wants the callers updated too, the honest choice is `Cmd+L`, letting Agent find and edit them, and reviewing a multi-file diff instead of a one-function change. ## What does not change between the two Some controls apply to both surfaces, so the choice is not a security decision: - files listed in `.cursorignore` are blocked from inline edit as well as from Agent and Tab; - the hooks page lists its Agent hooks as applying to Cmd+K as well as Agent Chat operations. One thing does differ: the rules system (project, team and user rules) is applied in Agent's conversations, not to inline edit — a team that relies on rules for conventions should know which surface they reach. ## Common mistakes - Treating `Cmd+K` as "small Agent": it does not go searching other files for you. - Repeating a whole `Cmd+K` from scratch instead of refining it with a follow-up instruction. - Expecting `Cmd+L` to apply an edit straight away: it hands the selection to Agent as context, and Agent decides what to edit. - Splitting a genuine multi-file change into a string of single-selection edits, losing the search that finds the places you forgot.

  • In Cursor, what is the difference between Cmd+L and Cmd+Shift+L with code selected?
    Cursor's keyboard reference lists `Cmd+L` as "Add selection to new chat" — it opens Agent with the selection as context for a fresh task. `Cmd+Shift+L` is "Add selection to Chat": it attaches the selection to the conversation already open, which suits giving Agent extra evidence mid-task. Both keys are remappable in Keyboard Shortcuts.
  • An inline edit result in Cursor is nearly right. Do you cancel and start again?
    No. Cursor's documented flow is to add a follow-up instruction to the same inline edit and press Return again; the edit is refined rather than redone. Starting over discards the part that was already right and usually costs another round of review.
  • Does sending a selection to Agent with Cmd/Ctrl+L change which conventions are applied?
    Yes. Cursor applies project, team and user rules in Agent's conversations (Agent, Ask, Plan and Debug modes), but its rules documentation says rules do not apply to inline edit. A change that must follow written team conventions reaches them through Agent; with `Cmd+K` the conventions have to be in the instruction itself.

  • Cmd+K hands the selection to Agent, which may then edit other files.
  • Cursor's inline edit only works from inside the chat panel.
  • Cmd+L applies the edit directly to the selection, just like Cmd+K.
  • To refine an inline edit you must cancel it and write a new one.
  • Cmd+L and Cmd+Shift+L both open a new Agent chat with the selection.
open as a page

After renaming a parameter in Cursor, how does Tab propagate the edit across the file and other files, and how do you accept it?

level: juniorimportance: must knowfreq 18%

basics

~20 s

Cursor Tab predicts multi-line edits from your recent edits, nearby code and linter errors: it rewrites the remaining uses, adds missing imports, jumps to the next edit when you press Tab again, and offers other-file edits in a portal window.

open as a page

Cursor's Agent keeps ignoring conventions saved in `.cursor/rules/api-style.md` — where do project rules live, and why is this file never applied?

level: juniorimportance: must knowfreq 18%

basics

~20 s

Cursor project rules are .mdc files in .cursor/rules, committed with the repository. A plain .md file there is ignored because it has no frontmatter saying when it applies; rename it to .mdc with frontmatter, or put plain markdown in AGENTS.md.

open as a page

A security lead asks what Cursor uploads to search a proprietary repository — how does Agent find code, and what still leaves the machine?

level: middleimportance: must knowfreq 12%

basics

~20 s

Cursor's Agent searches with Instant Grep, a regex index built and queried on your machine; Cursor uploads no paths or code to build it and stores no codebase embeddings. File content Agent opens can still go to the model.

open as a page

A Cursor team on Auto-review allowlisted `npm`, and Agent ran `npm run db:reset` with no prompt — why did nothing stop it, and how should the team set Run Modes?

level: seniorimportance: must knowfreq 13%

basics

~20 s

Under Cursor's Auto-review, an allowlisted command runs immediately, outside the sandbox and without the classifier, and the entry npm prefix-matches every npm command, including any script. Narrow the allowlist to exact commands and let everything else go to the sandbox and classifier.

open as a page

In Cursor's Agent panel, how do Plan mode and Debug mode change what the agent does before it edits code?

level: juniorimportance: should knowfreq 16%

basics

~20 s

Plan mode asks clarifying questions, researches the codebase and writes an editable plan, coding only after you click Build. Debug mode forms hypotheses, adds logging that reports to a local debug server, has you reproduce the bug, fixes it, then removes the logging.

open as a page

Before anyone writes a .cursorignore, which files does Cursor already keep away from Agent and Tab, and where do cross-project ignore patterns go?

level: juniorimportance: should knowfreq 7%

basics

~20 s

Cursor already ignores everything in .gitignore plus a built-in default list: .env* files, .git/, lock files, binaries, media, archives and folders like node_modules/. Global ignore patterns in user settings cover every project, but that list starts empty.

open as a page

In Cursor, what does restoring an Agent checkpoint revert, what does it leave alone, and why is it no substitute for Git?

level: middleimportance: should knowfreq 11%

basics

~20 s

Restoring a Cursor checkpoint reverts the files back to that point while every chat message stays. Checkpoints are local snapshots kept apart from Git, meant only for undoing Agent's changes; Git remains the permanent, shareable history.

open as a page

In Cursor, when do you use read-only Ask mode, and when inline edit's quick question (Opt/Alt+Return), to understand unfamiliar code?

level: middleimportance: should knowfreq 12%

basics

~20 s

Cursor's quick question (Cmd/Ctrl+K, then Opt/Alt+Return) asks about the selected code and can apply its suggestion when you type "do it". Ask mode, chosen in the Agent panel with Shift+Tab, explores the whole codebase read-only and never edits.

open as a page

In Cursor's model picker, what changes when you choose Auto instead of pinning a specific model, and how is an Auto request billed?

level: middleimportance: should knowfreq 9%

basics

~20 s

Auto lets Cursor Router choose the model for each request, steered by the Cost, Balance or Intelligence mode instead of by you; every Auto request still bills at the list price of the model it was routed to.

open as a page

In a Cursor monorepo, how do you give the `payments/` folder its own Agent instructions, and how do they combine with the root ones?

level: middleimportance: should knowfreq 7%

basics

~20 s

Add payments/AGENTS.md: Cursor applies nested AGENTS.md files when Agent works on files in that folder, combined with the root AGENTS.md, the more specific winning on conflicts. Or write a .cursor/rules project rule with globs: payments/** and alwaysApply: false.

open as a page

How do Cursor's four project-rule types map onto `alwaysApply`, `description` and `globs`, and when does each one reach Agent?

level: middleimportance: should knowfreq 11%

basics

~20 s

alwaysApply: true is Always Apply, in every chat. globs with alwaysApply: false is Apply to Specific Files, attached when a matching file is in context. A description alone is Apply Intelligently, Agent decides. None of them is Apply Manually, used only when @-mentioned.

open as a page

When a Cursor team moves long agent tasks onto Cloud Agents, what defines each VM's environment, and what replaces the local approval prompts?

level: seniorimportance: should knowfreq 9%

basics

~20 s

A Cursor Cloud Agent boots an isolated VM from its environment's latest successful Build, defined by agent-led setup, a snapshot or a Dockerfile in .cursor/environment.json. Run Modes don't apply there: it runs every command itself, so secrets and network egress are the controls.

open as a page

A Cursor team keeps its conventions in project rules, yet Cmd/Ctrl+K inline edits keep ignoring them — why, and what does reach inline edit?

level: seniorimportance: should knowfreq 8%

basics

~20 s

Cursor's rules apply only to Agent (Chat) — Agent, Ask, Plan and Debug modes — not to Tab, inline edit or Bugbot, and User Rules skip inline edit too. Hooks do reach it: Cursor says its Agent hooks cover Cmd+K.

open as a page

Cursor's Agent printed a key from secrets/prod.env even though .cursorignore lists secrets/ — how did it read the file, and what actually stops that?

level: seniorimportance: should knowfreq 6%

basics

~20 s

.cursorignore governs only Cursor's own file access: Agent's reads, search, Tab, Inline Edit and @-mentions. Terminal commands and MCP tools run outside it, so a cat reads the file. File system permissions or encryption, plus command hooks, are what stop it.

open as a page

Why might a Cursor Teams member exhaust the Other Models allowance mid-month while saying they only ever pick Auto or Composer in the model picker?

level: seniorimportance: should knowfreq 5%

basics

~20 s

Cursor bills each request to the pool of the model that actually ran: Auto can route to third-party models, subagents can run a named third-party model, and on Teams personal-key requests charge the Cursor Token Rate to Other Models.

open as a page

A Cursor Team Rule and a repository's project rule give conflicting guidance — which one wins, and can a developer switch the Team Rule off?

level: seniorimportance: should knowfreq 6%

basics

~20 s

Cursor merges all applicable rules and, on a conflict, gives precedence in the order Team Rules, then Project Rules, then User Rules. A developer can turn a Team Rule off in Customize unless an admin set it to Enforce this rule.

open as a page

In Cursor, what can an Agent terminal command reach inside the sandbox by default, and when does it run outside it?

level: middleimportance: nice to knowfreq 5%

basics

~20 s

A sandboxed Cursor terminal command can read and write the workspace and temp directories, cannot write protected paths, and reaches only allowlisted domains. Commands needing more access run outside the sandbox, after the Auto-review classifier allows them or you approve.

open as a page

In Cursor, how are changes from a Cmd/Ctrl+K inline edit and from Agent each refined, accepted or rejected?

level: middleimportance: nice to knowfreq 5%

basics

~20 s

Cursor's inline edit applies the instruction to the selection on Return; a follow-up plus Return refines it, and Cmd+Shift+Backspace cancels. Agent's edits appear in the diff view as it works; with changes pending, Cmd+Return accepts all and Cmd+Shift+Backspace rejects all.

open as a page

A gitignored generated client is invisible to Cursor's Agent — how does .cursorignore re-include it, and when does a ! negation fail?

level: middleimportance: nice to knowfreq 3%

basics

~20 s

Add a ! pattern for the directory to .cursorignore, such as !src/generated/, which overrides .gitignore and the default list. Negating a single file fails when a parent directory is excluded, because excluded directories are not traversed.

open as a page

In Cursor, what is Composer 2.5, and what changes in speed, usage pool and cost when you pick it instead of a third-party model?

level: middleimportance: nice to knowfreq 4%

basics

~20 s

Composer 2.5 is Cursor's own agentic model, tuned for tool use, file edits and terminal work in Cursor; it runs its fast variant by default, draws from the Cursor Models pool and, unlike third-party models, carries no Cursor Token Rate.

open as a page

In Cursor's Agent chat, what do `@Commit (Diff of Working State)` and `@Branch (Diff with Main)` attach, and when do you use each?

level: middleimportance: nice to knowfreq 5%

basics

~20 s

In Cursor's Agent chat, @Commit (Diff of Working State) attaches your uncommitted changes, not a past commit; @Branch (Diff with Main) attaches your full branch diff against main. Use the first for work in progress, the second for the whole feature.

open as a page

In Cursor Bugbot, which check conclusion does a review with findings publish by default, and what does requiring the `Cursor Bugbot` check therefore enforce?

level: seniorimportance: nice to knowfreq 7%

basics

~20 s

A Bugbot review with findings concludes neutral by default, which does not block a merge. Requiring the Cursor Bugbot check therefore ensures a review ran, not that findings were fixed; a failing status needs the fail-on-unresolved-issues behaviour, where your organization has it.

open as a page

A team wants Cursor Tab kept away from certain files and every Tab edit audited; which controls reach Tab, and which Agent-side settings do not?

level: seniorimportance: nice to knowfreq 3%

basics

~20 s

Tab is governed by .cursorignore and by two Tab-only hooks, beforeTabFileRead (allow or deny a read) and afterTabFileEdit (audit an edit); rules, Agent hooks such as beforeReadFile, personal API keys and the model picker do not reach Tab.

open as a page