AI Chat
Cursor's Chat panel is a persistent side-panel conversation that has access to your entire codebase β not just the file you have open. You can ask it anything from βwhy does this function throw?β to βrefactor this module to use a repository patternβ, and it understands your project structure, imports, and conventions before answering.
Opening Chat
Open the Chat panel with Cmd+L (Mac) or Ctrl+L (Windows/Linux). For a quick inline edit on a selection without opening the full panel, use Cmd+K / Ctrl+K β this opens a small floating prompt bar directly in the editor.
@ Context Mentions
Type @ inside Chat to inject specific context. Cursor resolves the reference and includes it in the model's context window.
@fileInclude the full contents of a specific file. Useful when asking about a particular module.
@folderInclude all files in a directory. Good for subsystem-level questions.
@codebaseAsk a question against a semantic search of the entire codebase β Cursor retrieves the most relevant snippets automatically.
@docsPull in documentation from an indexed external source (e.g., a library's docs site you've added to Cursor).
@webSearch the web and include results as context. Useful for questions about APIs or recent library releases.
@gitReference recent git history β commits, diffs, blame β to give the AI context about recent changes.
Inline Edit (Cmd+K)
Cmd+K is the fastest way to make a targeted change. Select some code, press Cmd+K, type your instruction, and Cursor generates a diff inline β you accept or reject before anything is written. This is faster than opening Chat for small, focused changes where you already know what you want.
Use Cmd+K when
- β’ You have a selection and want a quick targeted change
- β’ You're renaming, extracting a function, or fixing a specific bug
- β’ You don't need a back-and-forth explanation
Use Chat (Cmd+L) when
- β’ You want to explore or understand something before changing it
- β’ The task spans multiple files or requires reasoning about the broader architecture
- β’ You want to iterate with follow-up messages
Chat vs Agent Mode
Chat is conversational β you drive the session, review responses, and apply changes manually or accept diffs one at a time. Agent Mode is autonomous β you give a goal and the agent executes it across files, runs commands, and iterates on its own until done.
Chat is better for understanding, exploration, and controlled edits. Agents are better when you have a clearly specified task and want Cursor to execute it without step-by-step approval. Start with Chat when you're unsure β switch to Agent when the task is well-defined and you trust the outcome.
Codebase Indexing
The first time you open a project, Cursor indexes it semantically in the background. This creates a searchable representation of your codebase β every function, class, import, and comment β that Chat and Agents query when you ask questions. Large repos take a few minutes. The index updates incrementally as you make changes. For @codebase queries, Cursor retrieves the most relevant snippets rather than dumping everything into the context window, which keeps responses fast and accurate.
Checklist: Do You Understand This?
- Cmd+L opens the Chat panel; Cmd+K opens the inline edit bar on a selection
- @ mentions let you inject files, folders, docs, web results, or git history into context
- @codebase does a semantic search β Cursor retrieves relevant snippets, not the whole repo
- Chat is conversational and controlled; Agent is autonomous and goal-directed β use each accordingly
- Codebase indexing happens automatically in the background on first open