Lompat ke konten

Pelajaran 10 ยท Agent Mode

Plan Mode in Cursor

Use Cursor Plan mode to research, answer questions and review a written plan before any code changes, and learn how to critique that plan properly.

One of the most expensive mistakes with an agent is building the wrong thing very quickly. Plan mode puts a pause between your idea and the code. The agent researches the codebase, asks clarifying questions and writes an implementation plan that you review before anything is built.

Start a plan

Press Shift+Tab in the chat input to rotate to Plan mode, or choose it in the mode picker. The editor may also suggest it when your request sounds complex.

The documented flow is:

  1. The agent asks clarifying questions.
  2. It researches your codebase.
  3. It writes a detailed plan.
  4. You review and edit it, through chat or Markdown files.
  5. You click to build when the plan is right.

Plans are saved in your home directory by default. A "Save to workspace" option moves one into your project, where you can share it with teammates and keep it as documentation.

When to plan

Plan first Just do it
Several reasonable designs exist A typo or one-line fix
Many files or systems are involved A change you know well
Requirements are unclear A small, easily reversed edit
Architecture or data model decisions A throwaway experiment

A request for a good plan

TEXT
Plan: add password reset by email to this web app.
Ask me about anything unclear before you write the plan.
The plan should list: files to change, new files, database changes,
security risks, how we test it, and what is out of scope.

Review the plan like a design document

Do not skim it. Check each of these:

  • Scope: does it do what you asked, and nothing extra?
  • Facts: do the files and functions it names exist?
  • Data: are schema changes safe for existing records?
  • Security: who can call this, and what happens with bad input?
  • Tests: does each important behavior have a check?
  • Order: can each step be verified before the next one?
  • Rollback: how would you undo it?

For a password reset, a strong review asks: Does the token expire? Can it be used only once? Does the response reveal whether an email address has an account? Is the token stored only as a hash?

Those questions turn into tests. Here is real Python for the core rules of a reset token. It is for learning; in a real app, use your framework's built-in password reset.

Python Turn plan requirements into checks

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Passing now as a parameter makes expiry easy to test. That is a design choice you could ask for in a plan.

Fix the plan, not only the code

If the result does not match your intent, the documentation suggests reverting the changes, making the plan more specific and running it again. This is often faster and cleaner than correcting a running agent with many follow-up messages.

The plan is the cheap place to change your mind. Editing two sentences costs far less than reviewing two wrong files.

Split big plans

A plan with fifteen steps is hard to verify at once. Ask for milestones that each end in a working, tested state. Build one, review, commit, then continue.

Order matters too. This small script sorts plan steps by their dependencies.

Python Check that plan steps are in a valid order

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You do not need code to plan. It simply shows the idea: dependencies decide order. If a plan tests something before building it, ask why.

The terminal companion product has its own plan mode, with different commands and approval screens. This lesson describes the desktop app.

Push back with questions

A plan is a draft, and you are its reviewer. These follow-ups tend to expose weak spots:

TEXT
What did you assume that you could not confirm in the code?
What is the smallest version of this that would be useful?
Which step is most likely to fail, and how would we notice?
Is there an existing function or library we should reuse?
What happens to existing users and data during the change?

Then verify the answers that matter. If the plan says a helper exists, open it. If it says a library supports a feature, check the version in your project.

Plans as shared documents

A saved plan helps other people. A teammate can comment on the approach before code exists, and a reviewer can later compare the pull request with what was agreed. Keep the plan honest: if the work changes direction, update the plan or say so in the pull request. An outdated plan in the repository can also mislead a later agent that reads it, so delete or mark plans that no longer apply.

Common mistakes

  • Approving a long plan without reading it.
  • Answering clarifying questions with "whatever you think". Those answers shape the design.
  • Letting the plan add features you did not request.
  • Forgetting to ask how the work will be verified.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. What does Plan mode produce before building?

    The agent researches and asks questions, then writes a plan for your review.
  2. 2. Which task benefits most from planning?

    Multi-file work with design choices and security impact deserves a plan.
  3. 3. The build went in the wrong direction. What does the documentation suggest?

    A sharper plan often beats patching a flawed implementation.

Summary

  • Plan mode researches, asks and writes a plan before code changes.
  • Use it for unclear, large or design-heavy tasks.
  • Review scope, facts, data, security, tests and order.
  • When the result is wrong, improve the plan and rebuild.

Next: Debug Mode in Cursor

Progres Anda disimpan di browser ini. Tidak perlu akun.