The forms AI coding tools take
Completion, chat, in-editor agents and command-line agents are roughly the four kinds of AI coding tool. What each does, what tasks it suits, and how to control which parts of your computer an agent can touch.
- About 30 minutes
- Level: Beginner
- Tested: 2026-09-14; product features per their official docs; nothing to run
Code and program output are shown exactly as they ran, so comments and printed output are in Chinese.
The names of AI coding tools change quickly, with new products and features every few months. But sorted by "how much it can do for you", there are roughly only four forms. Understanding what each form does is more useful than remembering which product has which button: switch tools and these judgements still hold.
1. Completion
As you type in the editor, it predicts what you'll write next in grey text after the cursor; press Tab to accept, or keep typing to ignore it. GitHub Copilot first made many people familiar with this form, and most editors now have it built in. In Cursor, for example, the completion feature is called Tab, which officially makes suggestions based on your recent edits, the surrounding code and linter errors.
From Module 01's point of view, this is the most direct application of "predicting the next token": take the code before and after the cursor as input and predict what comes next.
Suits: you know what to write and just don't want to type every character. Finishing the rest of a function, writing repetitive boilerplate, writing the next line following the pattern of the previous one.
Doesn't suit: you haven't worked out what to write yet. Completion only continues along the line you started; it doesn't help you come up with an approach.
Watch out: it's fast and looks convincing, so it's easy to press Tab without thinking. Parameter names and function names it completes are "predicted" by the model and may not actually exist (the hallucination from Module 01, Lesson 2).
2. Chat
Ask questions in a chat window: "what does this error mean?", "write me a function to parse CSV". It could be a chatbot on a web page, or a chat panel in the editor's sidebar.
The difference from completion: you describe what you need, it gives you a whole block of code or an explanation, and you decide how to use it. It can only see what you paste to it (the chat panel in an editor can usually include the current file automatically).
Suits: explaining code you don't understand, asking about a concept, writing a standalone small function, discussing the pros and cons of several approaches.
Doesn't suit: tasks that require understanding and modifying many files at once. You'd have to paste all the relevant files to it by hand, and then put its answer into the right files by hand, which makes it easy to miss something.
3. In-editor agents
Give it a task in the editor, and it reads the project's files itself, decides where to make changes, edits the files directly, and some can also run commands (run tests, install dependencies). Cursor's Agent mode and the "agent mode" in various editors all belong here.
This is the agent from Module 05: a model plus a set of tools (read files, search code, edit files, run commands), deciding what to do next in a loop. The little-over-a-hundred-line loop from Module 05, Lesson 2 is their core.
Suits: changes across several files, tasks where you need to understand the code before acting, tasks that need tests run to verify the change.
Watch out: it edits your files directly. The changes are shown in the editor and you can accept or undo them one by one. Once there are many changes, you need git to manage them (Lesson 3).
4. Command-line agents
Also agents, like the previous kind, but running in the terminal instead of an editor. As of September 2026, common ones include Anthropic's Claude Code and OpenAI's Codex CLI. Taking Claude Code as an example, per the official docs, install it on macOS or Linux and start it in your project directory:
curl -fsSL https://claude.ai/install.sh | bash
cd 你的项目
claude
One way to install Codex CLI is npm install -g @openai/codex; once installed, run codex.
Command-line agents aren't tied to an editor; you can use any editor you like. They're also easier to put into scripts and automation, for example having one run a fixed task in continuous integration.
Suits: larger tasks, tasks that need lots of commands run (running tests, reading logs, working with git), tasks you want it to work on continuously for a while.
Watch out: it can run commands on your computer. That's what makes it most useful, and what calls for the most care.
Controlling what an agent can do
The last two forms are both agents; both can touch your files and run commands. As Module 05, Lesson 8 explained, an agent that can act must have its permissions limited. Fortunately these tools all provide controls. Taking the two command-line tools as examples (per their official docs as of September 2026):
Claude Code's permission modes can be switched with Shift+Tab, or set at launch with --permission-mode:
| Mode | What it can do without asking |
|---|---|
default (shown as Manual) |
Only read files; everything else needs your confirmation |
acceptEdits |
Read and edit files, plus common file operations like mkdir and mv |
plan |
Read only; it proposes a plan first and changes no files until you approve |
auto |
Everything, with a separate model doing safety checks in the background |
dontAsk |
Only pre-approved tools, everything else refused; suited to automation scripts |
bypassPermissions |
Everything, with no checks at all; the official docs say to use it only in an isolated container or virtual machine |
Codex CLI's sandbox and approvals are set separately along two dimensions. The sandbox decides what it can touch: read-only, workspace-write (can write only inside the working directory; the default), and danger-full-access (no limits; not recommended officially). The approval policy decides when it asks you: the default on-request asks when it wants to write outside the working directory or access the network, while never never asks.
The exact mode names may change, but the idea is general, and it matches the conclusion of Module 05, Lesson 8 exactly:
- For unfamiliar projects and important changes, start in plan mode or read-only mode. Let it read the code and propose an approach, and loosen things up once you've checked it.
- Let it write only inside the working directory. Don't let it freely change other files on your computer.
- When you need "everything allowed", put it in a container or virtual machine. If something goes wrong, your real environment isn't affected.
- Dangerous operations need your confirmation. Pushing code, deleting files, accessing the network, installing dependencies: it shouldn't decide these on its own.
How to choose
| Task | Suitable form |
|---|---|
| Completing code as you write | Completion |
| Not understanding some code or an error | Chat |
| Writing a standalone small function or script | Chat |
| Changing a feature that touches three to five files | In-editor agent |
| Fixing a bug that needs tests run repeatedly to confirm | In-editor or command-line agent |
| Large refactors, upgrading dependencies | Command-line agent, on a separate git branch |
Most people use several at once: completion on while writing code, chat when stuck, and agents for bigger tasks.
The difference between the forms is, at bottom, how much control you hand over: completion writes a few characters for you, and each one needs your Tab to confirm; chat writes a block, and you decide whether to use it; an agent decides for you which files to change and which commands to run. The more control you hand over, the more work it saves, and the more you need to check. The next lesson covers helping it understand your project better, and Lesson 3 covers checking what it did.
Exercises
- Take a small feature you wrote recently and have AI implement it twice, once with chat and once with an agent. Compare: how much time did you spend describing what you wanted, and how much checking the result?
- In the AI coding tool you use, find its permission or sandbox settings. What does it allow by default? What does it ask you about? Adjust it to the level you think is right.
- In an unimportant project, give an agent a task in plan mode (or allow it only to read, not edit), and look only at the approach it proposes without letting it act. How does its approach differ from what you had in mind?
Self-check
1. What is the most fundamental difference between completion, chat and agents?
How much control you hand over. Completion only predicts the next few characters and needs your confirmation each time; chat gives a block of code and you decide how to use it; an agent decides for itself which files to read, where to change things and which commands to run. The more control, the more work saved, and the more there is to check.
2. The first time you have an agent work on an unfamiliar project, what permission settings should you use?
Start in plan mode or read-only mode, let it read the code and propose an approach, and allow it to make changes once you've checked it. Restrict writing to the working directory, and require your confirmation for operations like pushing, deleting, network access and installing dependencies.
3. Why should an agent's "everything allowed" mode be used only in a container or virtual machine?
In that mode it runs any command without checks. If it makes a wrong decision, or is manipulated by content it reads (the prompt injection from Module 05, Lesson 8), it might delete files, leak keys or break the system. In an isolated environment, problems don't affect your real computer and data.