WEBVTT

00:00:00.080 --> 00:00:03.980
So Cursor offers different modes for
running these

00:00:04.059 --> 00:00:07.720
agents, these local agents at least,
Agent,

00:00:07.760 --> 00:00:11.360
Plan, and Ask,
at the point of time where I'm recording

00:00:11.380 --> 00:00:15.140
I'll get back to Ask mode.
When writing code, you typically

00:00:15.220 --> 00:00:18.640
work with Agent and/or Plan. Now,
what's the

00:00:18.700 --> 00:00:22.520
difference? If you have a simple,
clearly specified task

00:00:22.580 --> 00:00:26.210
like this one here arguably is,
you can use Agent mode.

00:00:26.220 --> 00:00:30.120
And if you use that mode and you hit
that Enter button or send that

00:00:30.160 --> 00:00:34.100
message, Cursor will go ahead
and use AI to fulfill

00:00:34.160 --> 00:00:36.610
this task and to write the appropriate
code.

00:00:38.040 --> 00:00:41.900
Now, if you're not sure
if you did a good job specifying that

00:00:42.020 --> 00:00:45.720
task,
if you're maybe working on a more complex

00:00:45.800 --> 00:00:49.140
sure that you didn't forget anything
that might be important to the

00:00:49.240 --> 00:00:53.040
AI, you can switch to Plan mode.
You can also get there by

00:00:53.200 --> 00:00:56.900
simply hitting Shift+Tab. In Plan mode,
when you

00:00:57.120 --> 00:01:00.800
send this command,
Cursor will not go ahead and write

00:01:00.820 --> 00:01:04.599
code immediately. Instead,
it will first analyze your

00:01:04.660 --> 00:01:08.160
task,
possibly ask for some clarification if

00:01:08.200 --> 00:01:11.560
needed, and then make a plan. It will then

00:01:11.800 --> 00:01:15.700
execute step by step.
So even though the task is simple here,

00:01:15.760 --> 00:01:19.280
let's do that.
I'll send this to Cursor using Plan

00:01:19.340 --> 00:01:23.140
mode. And now you can see the output here

00:01:23.320 --> 00:01:26.120
as it's thinking and generating tokens.

00:01:26.180 --> 00:01:30.080
If you had multiple Cursor sessions,
you could switch between them here with

00:01:30.120 --> 00:01:34.060
help of this button.
You see active sessions indicated here

00:01:34.100 --> 00:01:38.060
by this blue dot. You can also rename
and delete sessions here, by the

00:01:38.100 --> 00:01:41.920
way, if you want to.
And we could now definitely also open a

00:01:41.930 --> 00:01:45.870
session if we had another task we already
might wanna work on.

00:01:45.900 --> 00:01:48.850
And you can also run multiple tasks at the
same time.

00:01:49.120 --> 00:01:53.100
You just might wanna be careful
that they don't clash with each other,

00:01:53.110 --> 00:01:56.950
though if you're using Git worktrees,
for example, you could even work on the

00:01:57.000 --> 00:02:00.900
same files in different work trees at the
same time if you wanted to.

00:02:00.920 --> 00:02:04.780
Now, here we only need one task, though,
so I'll switch back to that.

00:02:04.860 --> 00:02:08.538
In my case here,
I didn't get any follow-up questions

00:02:08.600 --> 00:02:12.160
because this is a simple task
and I had pretty clear instructions.

00:02:12.220 --> 00:02:15.440
For more complex tasks,
you might definitely get some.

00:02:15.460 --> 00:02:19.310
What I do get here, however, is a plan,
which also opened up here in the

00:02:19.380 --> 00:02:22.590
left. And you can also click View Plan to,
well, view

00:02:22.620 --> 00:02:26.360
it.
This plan is a Markdown file created by

00:02:26.400 --> 00:02:29.410
Cursor,
which is not stored in the project by

00:02:29.460 --> 00:02:33.360
It's loaded in memory, so to say.
And this plan highlights what

00:02:33.420 --> 00:02:36.680
Cursor wants to do in the next steps.

00:02:36.720 --> 00:02:40.460
And it's easy to just click Build here
and accept the plan, but my

00:02:40.520 --> 00:02:44.190
clear recommendation is to rate
that plan to make sure that

00:02:44.240 --> 00:02:46.310
Cursor will do what you want it to do.

00:02:46.340 --> 00:02:48.930
You can also tweak that plan
if you want to.

00:02:50.280 --> 00:02:54.140
So as we see here,
it wants to start by importing necessary

00:02:54.200 --> 00:02:57.880
able to read files.
Then it wants to scan for Markdown files

00:02:57.940 --> 00:03:01.660
inputs folder.
It then wants to read it with

00:03:01.800 --> 00:03:05.080
read_text and then print the filename
and content_length for

00:03:05.200 --> 00:03:09.080
verification since, for the moment,
we don't have any follow-up steps yet for

00:03:09.160 --> 00:03:12.060
first task, which was only to read those

00:03:12.160 --> 00:03:16.020
files. Now, it automatically detected

00:03:16.060 --> 00:03:18.600
that it should probably do
that in main.py.

00:03:18.820 --> 00:03:22.640
I haven't told it so,
but it's the only file we have here,

00:03:23.320 --> 00:03:26.080
and then we have some extra notes here.
And again, we could edit this.

00:03:26.100 --> 00:03:29.000
We could add more if we had some extra
instructions.

00:03:29.080 --> 00:03:32.670
But I'm happy with that plan,
so I can click Build here

00:03:33.500 --> 00:03:37.170
or also here, and
that will then accept the

00:03:37.200 --> 00:03:40.820
plan, and if I do that,
automatically switch to Agent

00:03:40.880 --> 00:03:44.480
mode. So now that plan, together with our

00:03:44.540 --> 00:03:48.280
original instruction,
is used to write that

00:03:48.340 --> 00:03:52.320
code. By the way,
when working in Agent mode,

00:03:52.340 --> 00:03:55.800
entire chat history that's used as
context.

00:03:55.880 --> 00:03:59.460
So you can send follow-up messages,
and those messages or

00:03:59.760 --> 00:04:03.549
the AI, when handling those messages,
will be aware of

00:04:03.600 --> 00:04:07.109
this entire chat history.
That's important to know.

00:04:07.140 --> 00:04:11.000
So here it's done,
and I'll close this plan.

00:04:11.070 --> 00:04:14.840
And now you see which files
were edited by Cursor.

00:04:14.920 --> 00:04:18.899
You can decline or accept those changes,
but most importantly, you

00:04:18.940 --> 00:04:22.630
can click on those files to see those
changes, which, of course, is important

00:04:22.700 --> 00:04:26.540
because again,
it's easy to just always accept

00:04:26.560 --> 00:04:29.969
but then you're doing wipe coding,
which might be fine.

00:04:29.980 --> 00:04:33.400
But of course,
the strength of being an engineer

00:04:33.420 --> 00:04:37.220
developer is that you can rate
that code and decide whether

00:04:37.260 --> 00:04:41.080
you're happy with the code produced by
Cursor or not.

00:04:41.100 --> 00:04:45.050
So here I'm in main.py,
and you can see in green I see all the

00:04:45.120 --> 00:04:47.930
was added. In red, I see the code that
was removed.

00:04:47.980 --> 00:04:51.860
I can hover over the code to undo
or accept it

00:04:51.940 --> 00:04:55.660
on a block-by-block basis.
And here I only got two

00:04:55.680 --> 00:04:59.570
blocks. I got the imports,
so I could click Keep here,

00:04:59.620 --> 00:05:03.420
that because you can always accept
everything in that file here by

00:05:03.460 --> 00:05:05.150
clicking this button on the bottom.

00:05:05.180 --> 00:05:08.860
If you had multiple files in
which edits were made, which Agent mode

00:05:08.920 --> 00:05:12.620
can do,
you will also have buttons for switching

00:05:12.680 --> 00:05:16.290
here. So here the import looks good to me,
and

00:05:16.340 --> 00:05:19.620
then we're reading those files
and printing some information.

00:05:19.740 --> 00:05:23.680
I can therefore click Keep all.
But before I do that, I also wanna

00:05:23.720 --> 00:05:27.390
show you that even before accepting this,
you can test these

00:05:27.420 --> 00:05:31.280
changes, which is very nice.
So I'll open my terminal here, the

00:05:31.360 --> 00:05:35.100
one integrated into Cursor,
and I'll use this uv tool, which I

00:05:35.160 --> 00:05:38.420
installed to run this main.py file.

00:05:38.430 --> 00:05:42.380
And if I do that, you see it went

00:05:42.400 --> 00:05:45.960
through that file and then gave me that

00:05:46.000 --> 00:05:49.400
output, which proves that this code works.

00:05:51.580 --> 00:05:54.040
So with that, I'll then click Keep all.

00:05:54.050 --> 00:05:57.460
And that's in a nutshell how you can use
Agent mode.

00:05:57.480 --> 00:06:01.300
But of course, there's more to it.
