Agent, Chat, Manual (⌘/Ctrl J)
Sweep is the fastest and highest quality agent in JetBrains. We support three modes: Chat, Manual, and Agent.
- Agent automatically searches the codebase and applies code changes
- Chat searches the codebase for context and doesn't automatically edit your code
- Manual does not search the codebase and doesn't automatically edit your code
In this example, Sweep (Agent mode) is fixing a bug introduced in a previous commit. It uses the terminal to run commands (like git
), edit files, and use the PyCharm static analysis tool to verify its code.
Using Agent
Press ⌘/ctrl
J
or click the Sweep icon to open our sidebar.
Use @
to mention files in your chat. For example, @auth.py
will add the file auth.py
to the context of the chat.
Accept/Reject changes
In each Agent chat, Sweep automatically applies changes to the files. You can click "Accept/Reject" on each change, or click "Accept All/Reject All".
Checkpoints
One of the core features of Sweep is the ability to "checkpoint" and rollback to previous states. This gives you the freedom to experiment without losing your progress.
To do this, you can click "Revert Changes," and either revert changes in bulk or one at a time. We track all changes since the chat was sent.
Tips & best practices
Sweep won't always get what you want. If you're not getting good results, here are things you can do:
One chat per task
It's best to keep the conversation focused on one task at a time. Otherwise, the previous messages in the thread can hurt the intelligence of the model.
To create a new chat, you can press (⌘/ctrl N) or click "+ New Chat."
Describe the current and expected state
- Start by describing the current state:
currently, our app does xyz. I believe this happens in foo.py and it uses utils from bar.py. please confirm you understand
. - Ask Sweep to confirm it sees all relevant files for this. If not, work with Sweep to give it the relevant files using
@
-mentions. - Finally, ask it to implement what you want.
if the user clicks submit, we should save their data to disk. if this fails i want you to show an error screen, similar to the error screen from in auth.tsx
.
Use Manual mode and point out the relevant files
Having more than 10 files or files that are over 2k lines of code in context can hurt performance.
You can avoid this by switching to manual mode and specify exactly the files you want the agent to look at.
You can also select specific lines of code by highlighting them and pressing ⌘/ctrl j
. This will help the AI make the change in the exact location you want.
Aggressively checkpoint and retry
Sometimes it's hard to know what will work. If your code change can be tested fairly quickly, we recommend having the AI try one of your ideas and click "Revert Changes" if it's not working.
After each attempt, you can edit your previous message or follow up to tell Sweep to try something else. We recommend editing your previous message to guide Sweep in the right direction.
Custom Rules with SWEEP.md
You can create a SWEEP.md
file in your project root to provide custom rules and context for Sweep. This file serves multiple purposes:
- Store frequently used commands - Build, test, lint commands so Sweep can run them without searching
- Define code style preferences - Naming conventions, preferred libraries, formatting rules
- Document codebase structure - Important architectural decisions and organization principles
- Provide domain-specific context - Business logic, requirements, or constraints specific to your project
Sweep will automatically read and follow the guidelines in your SWEEP.md
file when making changes to your code.
Note: A CLAUDE.md
file in the project root will be used for custom rules and context if no SWEEP.md
file is present.
Keyboard Shortcuts
You can open Sweep using ⌘ J
or Ctrl J
or by clicking the Sweep icon in the sidebar.
Action | Mac | Windows/Linux |
---|---|---|
Open/Close Chat/Add Code to Context | ⌘ J | Ctrl J |
New Chat | ⌘ N | Ctrl N |
Toggle Normal/Search | ⌘ . | Ctrl . |