The agent from windsurf Cascade is already pretty powerful, but to properly adapt it to our needs and
preferences, we need to specify some rules and this is a more advanced feature.
It's not for everyone.
So if you notice that the AI is doing something that you really don't like, you want to change that
behavior and change that behavior permanently and not constantly say that in the chat.
And it makes sense to add some rules.
So we can find this here inside windsurf settings.
And if we click here on Memories and Rules and select manage, we're going to find here rules.
Now first of all in the past these rules were stored in a files called windsurf rules.
But this is now deprecated.
And there are other files.
And the UI can really help us guide where we want to store these rules.
And we can store global rules and workspace rules.
So global rules we're going to be valid for all our projects.
And obviously workspace rules is just going to be valid for a single project, so it's totally up to
you how you want to do it.
If you click here on Global Rules, it's already giving you here like an idea what kind of rules you
can store.
So it's giving you even an example here.
I generally don't like global rules because sometimes, you know projects they do have their own things.
So if I have something globally I can just copy some configuration from one project to another.
So instead what I generally like to do is to specify workspace rules.
So I can click here on plus say workspace rules.
And we can simply go ahead with one of these rules.
We can provide here a rule name.
So I'm going to just call it comments.
So my rule is going to be in regards to writing comments for the code that's being generated.
And we have a few important settings here.
So first of all we have the activation mode.
Currently if it's set to manual we need to manually activate this particular rule.
So this is like a shortcut.
Instead of typing a prompt we can simply type a shortcut to the prompt and just activate that rule.
So we need to use this mention here.
That's going to be available inside the editor itself.
Ideally you want to have something that's always on but really depends.
So the kind of rule that I want to use is something that's describing here that only functions must
have some documentation and also one sentence comment with it.
So this would be an example of a rule.
So I can simply save it.
This is going to be part of the project itself.
It's going to be here inside the directory dot windsurf or slash rules.
So this is something that's created automatically.
And of course we can have multiple files here.
So if we click again on workspace we can go ahead and create another rule.
Just as what I wanted to briefly show you how we can do this here.
So if you're here in Cascade we add you can simply reference here rules and specify this particular
rule.
And that particular rule is then going to be executed just in case.
It's not always on like this one.
I'm going to set it to manual Annual and save it.
So that would be the first thing that you should know about.
Now, in terms of inspiration, there is a very nice website from windsurf, the windsurf rules directory.
So you can find here some rules, for example for front end or for new coders.
General rules.
There are a lot of things that you could use.
For example let's look at this one here.
So there are a few interesting ideas that you can use in terms of rules like break problems into smaller,
manageable steps and help me think through them.
So this is a nice rule.
It really depends on if you notice a behavior that you don't like.
Now what I wouldn't do is I wouldn't go here, select all, copy the rule, put everything inside windsurf
because you should really understand what that particular rule does.
The more rules and the more context and the more text you add to the model, the more difficult is going
to be for it to follow.
So if you have a lot of trash here that you don't really need, that's not really helpful.
So try to correct through these rules a behavior that you currently don't like about that particular
model.
And that's pretty much all about it.
There's one additional important thing that you should know about because I mentioned here earlier models,
if you go here to manage, we're going to have here the rules.
So if you take a look here, this is one of the rules that we have.
So we can edit the rule.
And we're going to take a look here also model decision.
So model decision is it really depends on the model if it should apply this rule.
So it really depends on the model if it should apply this particular rule.
So you can even say here this rule should be applied based on the condition.
Theoretically you can also write here a condition like if you are model X then apply this rule.
If you're not model X then do not apply it just as an example.
Anyway, this is what rules are for.
As I was saying, a more advanced feature.
Add only the rules that you need.
And generally I recommend adding rules to your project.
You can easily copy them around if you need to.
It's in essence just a file that is well integrated here with the IDE.