WEBVTT

00:02.080 --> 00:08.960
The agent from windsurf Cascade is already pretty powerful, but to properly adapt it to our needs and

00:08.960 --> 00:14.040
preferences, we need to specify some rules and this is a more advanced feature.

00:14.040 --> 00:15.400
It's not for everyone.

00:15.400 --> 00:20.400
So if you notice that the AI is doing something that you really don't like, you want to change that

00:20.400 --> 00:24.960
behavior and change that behavior permanently and not constantly say that in the chat.

00:25.120 --> 00:27.480
And it makes sense to add some rules.

00:27.480 --> 00:31.000
So we can find this here inside windsurf settings.

00:31.720 --> 00:38.840
And if we click here on Memories and Rules and select manage, we're going to find here rules.

00:39.280 --> 00:44.960
Now first of all in the past these rules were stored in a files called windsurf rules.

00:45.120 --> 00:46.880
But this is now deprecated.

00:47.120 --> 00:48.600
And there are other files.

00:48.600 --> 00:52.560
And the UI can really help us guide where we want to store these rules.

00:52.800 --> 00:56.400
And we can store global rules and workspace rules.

00:56.400 --> 00:59.920
So global rules we're going to be valid for all our projects.

00:59.920 --> 01:04.930
And obviously workspace rules is just going to be valid for a single project, so it's totally up to

01:04.930 --> 01:06.010
you how you want to do it.

01:06.050 --> 01:11.290
If you click here on Global Rules, it's already giving you here like an idea what kind of rules you

01:11.290 --> 01:11.890
can store.

01:11.890 --> 01:14.930
So it's giving you even an example here.

01:15.770 --> 01:21.330
I generally don't like global rules because sometimes, you know projects they do have their own things.

01:21.330 --> 01:26.170
So if I have something globally I can just copy some configuration from one project to another.

01:26.450 --> 01:31.050
So instead what I generally like to do is to specify workspace rules.

01:31.210 --> 01:35.210
So I can click here on plus say workspace rules.

01:35.410 --> 01:38.970
And we can simply go ahead with one of these rules.

01:38.970 --> 01:41.730
We can provide here a rule name.

01:41.730 --> 01:43.490
So I'm going to just call it comments.

01:44.490 --> 01:50.810
So my rule is going to be in regards to writing comments for the code that's being generated.

01:51.130 --> 01:54.050
And we have a few important settings here.

01:54.050 --> 01:56.450
So first of all we have the activation mode.

01:56.970 --> 02:01.290
Currently if it's set to manual we need to manually activate this particular rule.

02:01.490 --> 02:03.530
So this is like a shortcut.

02:04.290 --> 02:10.220
Instead of typing a prompt we can simply type a shortcut to the prompt and just activate that rule.

02:10.220 --> 02:12.540
So we need to use this mention here.

02:12.540 --> 02:15.820
That's going to be available inside the editor itself.

02:16.180 --> 02:20.860
Ideally you want to have something that's always on but really depends.

02:20.860 --> 02:27.420
So the kind of rule that I want to use is something that's describing here that only functions must

02:27.420 --> 02:31.540
have some documentation and also one sentence comment with it.

02:31.540 --> 02:33.580
So this would be an example of a rule.

02:33.580 --> 02:35.460
So I can simply save it.

02:35.540 --> 02:38.420
This is going to be part of the project itself.

02:38.420 --> 02:42.260
It's going to be here inside the directory dot windsurf or slash rules.

02:42.260 --> 02:44.220
So this is something that's created automatically.

02:44.220 --> 02:45.980
And of course we can have multiple files here.

02:45.980 --> 02:49.660
So if we click again on workspace we can go ahead and create another rule.

02:50.140 --> 02:53.180
Just as what I wanted to briefly show you how we can do this here.

02:53.180 --> 03:01.380
So if you're here in Cascade we add you can simply reference here rules and specify this particular

03:01.380 --> 03:01.780
rule.

03:01.940 --> 03:05.860
And that particular rule is then going to be executed just in case.

03:05.860 --> 03:07.300
It's not always on like this one.

03:07.300 --> 03:10.740
I'm going to set it to manual Annual and save it.

03:10.740 --> 03:13.740
So that would be the first thing that you should know about.

03:14.180 --> 03:19.660
Now, in terms of inspiration, there is a very nice website from windsurf, the windsurf rules directory.

03:19.660 --> 03:24.140
So you can find here some rules, for example for front end or for new coders.

03:24.660 --> 03:25.900
General rules.

03:26.220 --> 03:29.220
There are a lot of things that you could use.

03:29.660 --> 03:31.500
For example let's look at this one here.

03:31.500 --> 03:36.260
So there are a few interesting ideas that you can use in terms of rules like break problems into smaller,

03:36.260 --> 03:38.660
manageable steps and help me think through them.

03:38.980 --> 03:40.220
So this is a nice rule.

03:40.260 --> 03:44.060
It really depends on if you notice a behavior that you don't like.

03:44.340 --> 03:51.700
Now what I wouldn't do is I wouldn't go here, select all, copy the rule, put everything inside windsurf

03:52.060 --> 03:55.220
because you should really understand what that particular rule does.

03:55.260 --> 04:00.580
The more rules and the more context and the more text you add to the model, the more difficult is going

04:00.580 --> 04:01.500
to be for it to follow.

04:01.500 --> 04:05.660
So if you have a lot of trash here that you don't really need, that's not really helpful.

04:05.660 --> 04:10.940
So try to correct through these rules a behavior that you currently don't like about that particular

04:10.940 --> 04:11.460
model.

04:11.980 --> 04:13.990
And that's pretty much all about it.

04:14.430 --> 04:19.470
There's one additional important thing that you should know about because I mentioned here earlier models,

04:19.470 --> 04:23.910
if you go here to manage, we're going to have here the rules.

04:23.950 --> 04:26.350
So if you take a look here, this is one of the rules that we have.

04:26.350 --> 04:27.710
So we can edit the rule.

04:28.870 --> 04:32.110
And we're going to take a look here also model decision.

04:32.110 --> 04:37.190
So model decision is it really depends on the model if it should apply this rule.

04:37.750 --> 04:41.230
So it really depends on the model if it should apply this particular rule.

04:41.790 --> 04:46.070
So you can even say here this rule should be applied based on the condition.

04:46.230 --> 04:52.870
Theoretically you can also write here a condition like if you are model X then apply this rule.

04:52.870 --> 04:56.550
If you're not model X then do not apply it just as an example.

04:56.830 --> 04:59.270
Anyway, this is what rules are for.

04:59.310 --> 05:01.510
As I was saying, a more advanced feature.

05:01.550 --> 05:03.070
Add only the rules that you need.

05:03.590 --> 05:06.870
And generally I recommend adding rules to your project.

05:06.870 --> 05:08.990
You can easily copy them around if you need to.

05:09.030 --> 05:13.910
It's in essence just a file that is well integrated here with the IDE.
