Sub topic 2
Ask, edit, and agent modes compared
This chapter assumes you can work in VS Code, use Git for commits and diffs, and run build or test commands in a terminal. It also assumes you have used a chat-based coding assistant before. The chapter compares the three chat modes, shows how to pick one, and covers the errors people hit when they pick the wrong one. The names and menus below follow VS Code with GitHub Copilot. Other editors use similar ideas under different labels, which a later chapter covers.
Why there are three modes
A chat panel in an editor can do very different amounts of work on your behalf. At one end it only answers questions. At the other end it plans, edits many files, runs commands, and checks its own results. Putting all of that behind one prompt box would be risky and confusing. Editors therefore expose a mode picker, usually a dropdown in the chat input, so you choose how much the assistant may do before you send a message.
The three modes differ along two axes:
- Who chooses the files. In some modes you pick the files. In others the assistant finds them.
- What the assistant can touch. It may only reply with text, it may propose edits, or it may also run tools such as the terminal.
The three modes
Ask mode
Ask mode is for questions. You give the assistant some context, and it replies with an explanation, a suggestion, or a code snippet in the chat. It does not change your files. If it shows code, you copy it or insert it yourself.
Use ask mode when you want to:
- understand unfamiliar code ("What does this middleware do?")
- compare approaches before committing to one
- get a regex, a SQL query, or a shell command explained
- learn how a library works
Ask mode is the safest mode because nothing in your workspace changes unless you apply it by hand. Its limit is that you carry the result into the project yourself.
Edit mode
Edit mode is for changes to files you choose. You add the files to the chat as context, describe the change, and the assistant proposes edits to those files. You see the edits as diffs in the editor and accept or discard them.
The key property is that you define the scope. The assistant edits only the files you attached, and it does not run commands or search for other files on its own. This makes edit mode predictable. It fits when you already know which files need to change.
Use edit mode when you want to:
- rename a function and update its two known callers
- add a parameter and update the files you list
- reformat or restructure a specific file
- make a small, bounded change you can review in one pass
Its limit is that it cannot discover what it was not given. If the change needs a file you forgot to attach, the result will be incomplete. It also cannot run your tests to find out.
Agent mode
Agent mode is for tasks where you describe a goal and the assistant works out the steps. It searches the workspace, reads files, edits several files, runs terminal commands, reads the output, and tries again if something fails. It keeps going until it decides the task is done or it needs your input.
Use agent mode when you want to:
- implement a feature that touches several files
- fix a failing test, where the assistant needs to run the test to see the error
- migrate code across a project
- do work that needs a build or test run to verify
The cost is less predictability. The assistant picks the files and the commands, so you must review more and approve tool calls along the way. The loop it follows is the subject of the next chapter.
Side-by-side comparison
| Feature | Ask | Edit | Agent |
|---|---|---|---|
| Changes files | No | Yes, in files you attach | Yes, in files it chooses |
| Who selects files | You | You | The assistant, plus anything you attach |
| Searches the workspace | Only if you ask it to use workspace context | No | Yes |
| Runs terminal commands | No | No | Yes, with your approval |
| Can use extra tools (MCP) | No | No | Yes |
| Checks its own work | No | No | Yes, by running tests or builds |
| Number of steps per request | One reply | One round of edits | Many, in a loop |
| Review effort | Low | Medium | Highest |
| Best for | Understanding | Known, bounded edits | Open-ended multi-step tasks |
Treat the table as a guide for VS Code. Product versions change, and some editors let ask-style chat read files or use tools. Check your editor's current documentation if a cell does not match what you see.
Choosing a mode
Start from what you know about the task. The diagram shows a simple decision path.
Two further criteria help when the path is not clear:
- Blast radius. How much could go wrong if the result is bad? A bounded edit in two files is cheap to inspect. A project-wide change is not.
- Verification. Can the assistant check its own work? If a test suite can confirm the change, agent mode gains a lot. If correctness depends on judgment, such as naming or design, the loop adds less.
A common pattern is to combine modes in sequence. Use ask mode to explore a design, then agent mode to implement it, then ask mode again to have the assistant explain a diff you do not understand.
Worked example: one task, three modes
Suppose a TypeScript project has a createUser function with no input validation.
In ask mode, you attach src/users.ts and write:
How should I validate the name and email arguments in createUser? Show a minimal approach without adding a library.The assistant replies with a code snippet and an explanation. Your files are unchanged.
In edit mode, you attach src/users.ts and src/users.test.ts and write:
Add validation to createUser: reject empty names and malformed emails by throwing an Error with a clear message. Add one test for each case.The assistant proposes diffs to the two files. You review them and accept. You then run npm test yourself, because edit mode cannot.
In agent mode, you write:
Add input validation to createUser in src/users.ts. Reject empty names and malformed email addresses with a clear error. Add unit tests for both cases next to the existing tests, then run `npm test` and fix any failures.The assistant finds the file, reads the existing tests to match their style, edits both files, asks permission to run npm test, reads the failures, fixes them, and runs the tests again. You review the final diff.
All three can produce the same code. The difference is how much work you do and how much the assistant does without you.
Common errors and how to avoid them
Using agent mode for a simple question
Asking "what does this function do?" in agent mode may lead the assistant to search files, run commands, or even edit code you did not want touched. Switch to ask mode for read-only questions. It is faster and has no side effects.
Expecting edit mode to find files
If you write "update all callers of parseDate" in edit mode, the assistant knows only about the files you attached. It will update those and may miss the rest. Either attach every caller or use agent mode, which can search for them.
Expecting ask mode to change files
In ask mode, code in the reply is only text. If nothing changed in your editor, that is the expected behavior. Apply the snippet yourself or switch modes.
Switching modes mid-conversation without checking context
When you change modes, the earlier messages usually stay in the chat, but the assistant's abilities change. A plan made in ask mode does not carry out itself. After you switch, restate the goal in a short message instead of assuming the new mode will act on the old discussion. Some editors also warn you or clear the session when you switch, so check what your editor does.
Skipping verification in edit mode
Edit mode will not run your tests. A diff that looks right can still fail to compile. Run the build or tests yourself before you commit.
Letting agent mode run unreviewed
Agent mode can touch many files. Keep your working tree clean before you start, so git diff shows exactly what the agent changed. Commit or stash first. Later chapters cover approval prompts and undo in detail.
Summary of the decision
- Use ask when you want an answer and no file changes.
- Use edit when you know the files and the change is bounded.
- Use agent when the task spans files you have not identified, or needs commands to verify.
- Move down from agent to edit or ask whenever the task is smaller than you first thought. Less autonomy means less to review.
Exercise
You need to rename an exported function fmtDate to formatDate. It is used in about 30 files across the repository, and you have not listed them. Which mode do you choose, and why? What should you do first to protect your work?
Show answer
Agent mode. It can search the workspace to find every caller, edit all of them, and run the build or tests to confirm nothing broke. Edit mode would only update the files you attach, and ask mode would change nothing. Before starting, commit or stash your current work (or create a branch) so that git diff shows only the agent's changes and you can discard them if the result is wrong.
Exercise
A colleague runs a request in edit mode: "Fix the failing test in checkout.test.ts." They attach only that test file. The assistant edits the test so it passes, but the real bug in src/checkout.ts remains. Name two reasons edit mode was a poor fit, and say which mode to use instead.
Show answer
First, edit mode only works on attached files, so it could not look at src/checkout.ts, and it changed the test, which was the only file it had. Second, edit mode cannot run the tests, so it had no way to find out what the failure was or to confirm a fix. Agent mode is the better fit. It can read the source, run the test, see the error, edit the right file, and rerun the test. The reviewer should also check that the agent did not simply weaken the test.
Exercise
Which mode, if any, would you use to understand what a 200-line legacy function does before deciding whether to change it? What does that choice guarantee about your files?
Show answer
Ask mode. It answers questions and does not change files, so your workspace stays exactly as it was. You can then switch to edit or agent mode once you know what change you want.