Transcription
Hello. Right now, there are a million coding tools on the market, and they all differ in some way. It's very difficult to choose which programming tool for agents you need. And, in particular, the criterion for selection is how well skills, sub-agents, and rules are supported in it; rules are also often mentioned. And there are apologists for certain tools. They say something like, strange words, like: "Well, there's a sub-agent there. So what? I made a bunch of skills for myself. So what? God, what are you talking about? Today, in a very short time, I will explain to you what this is, what it's for, how to use it productively in your work. Let's go. So, let's start with rules. Well, rules, yes, sometimes I will say 'rule', I'm used to it. My language is corrupted by English. So, first, let's see what a simple chat with an agent looks like, right? Well, you start a chat with an agent and let's look at the context. At the context that the neural network itself possesses. First, you write the task text there. Then you press send. And what happens? Imagine that you have rules written somewhere in your project, right, in the cursor settings. And you have a rule like this: write in Russian. For simplicity, I've made only one rule. There can be many of them here, right? They can be long. We will mark them with some nice color now. And we attach this to our context. And it goes like this. Well, roughly so, right. In reality, it's attached at the beginning, but that doesn't matter. To the agent. This whole story is fed. The agent starts working, working, working. And what does it do? First, it throws in some artifacts that it found. The artifacts start working. There are many of these artifacts. They significantly lengthen the context. Then it does something with them, maybe it asks itself some intermediate questions and answers. That is, it makes tool calls. We'll write about tool calls separately later. Subscribe to the channel so you don't miss out. Yes, it makes tool calls, the tool call again gathers some artifacts and so on, right, it's a long, long caterpillar. Ah, and you see in the corner of the screen how the context circle fills up. This is visible in many UIs. Thus, what is a rule? It's just text that is literally placed directly into the agent's initial prompt. Sometimes, depending on how the developers made it, they can be repeated, right, sometimes they are inserted again, sometimes they are never repeated. And this is the distinguishing feature of rules. To summarize, how do rules work, what is a rule? It's the simplest instruction. It's just always on, right? The instruction is always in the context. Well, it seems like all pros, right, but we can't fit a long instruction, our context will be too overloaded. I'll tell you, in real life, these rules. You start with a rule like "write in Russian," and then you want more, more, more. And in the end, too long rules don't fit into the context, they don't fit into the context. That is, they cannot be made too long. What else is a problem, that they sit there once. And again, too long rules, some parts of them are forgotten. If you look at my lecture on context engineering, I explain why this happens. There is a phenomenon called context rot. That is, parts of the rules can be forgotten. And you, I think, have encountered this when it's written in the rules: "Ah, always do this," and the agent suddenly doesn't do it. That's the trick, right? This naturally follows from the fact that we mentioned the rule once somewhere. Then long, long work with the context occurs. I've shortened it a lot here, right, but in reality, there are many, many, many pages and hundreds of pages of text. Therefore, rules are forgotten. And in general, rules are very simple, a very simple concept, and we use it. Spoiler, right, despite more trendy things, we use rules, because basic instructions to the agent are given precisely in the form of rules. But we have a more advanced technique. What technique? The technique is called skills. What are skills and how do they differ from rules? Exactly the same way, we started a chat with an agent. Chat with an agent. That's it, it's going. And what is a skill? Any skill has two parts. There is a so-called header, and there is a body. And this is the header, what do we usually have? The header is significantly shorter than the body. Logically. Logically. And in fact, the header usually contains a description of what it is and when to apply it. For example, a skill. We can name a skill that will write tests. Let's have a skill called "write tests." What could its header be? It will be like this: "Write tests." Essence: when you need to write a test. Call me. That's roughly how it looks. Such a header. Very short. It's never too long. But what does "call me" mean? And "call me" means that here it has a body, which describes in great detail how to run these tests. Perhaps there are even some scripts here. Scripts can be attached to skills, many files can be attached to skills. How does this thing work? In a very interesting way. Let's use another one. Here, it will be beautiful. How does this thing work? The thing is, when we start a chat with an agent, we still have rules, by the way. Let's say we have a rule. We'll copy it here now. Only let our rule be this: "Write tests after the task." Imagine, the agent is performing some task. What happens? Well, all this stuff I'll duplicate. All this nonsense happens during the agent's work. That is, it does something long, long, long. Then, since it had a rule at the beginning, by the way, we need to attach it, right? Here we attached it somewhere at the beginning, since it's short, we strongly hope that it hasn't forgotten it. Well, it's most likely not going to forget it, when the rules are small, they don't forget them. Thus, it reaches the end, it already understands what is at the end, and thinks, ah, it looks at the rules and says: "We need to reason this, write tests." Ah, what happens at this moment? If we didn't have any skills, it would just start writing tests as it knows how. It would happen that, well, it started writing tests and that's it. When we have a skill, such a thing arises. It reasons: "We need to write tests." And it goes into its skill storage. In fact, where does it know where to get tests from? Because the description of the header and skills is actually attached, like a rule, to the context of the entire project. Somewhere at the beginning, right? We'll move all this nonsense again. So, in reality, in addition to the rule, we also have descriptions of all headers, all skills. Imagine, a second skill, a third skill, a fourth, a fifth. All their headers will be written here right in the prompt somewhere at the very beginning. And an additional system rule. In such a configuration, we will write a system rule. If you want to do something that requires a skill, that is described in the skills, load them into the context. This, by the way, is that all these things are very primitive. You can write them yourself. Well, that is, such a simple addition of a system rule. Skills are not some magical, probably cool neural network magic. No, it's just the simplest addition to rules, which loads the context with tool calling if it encounters something that is written here in the skill headers. And it, having these additions at the beginning, reasons: "We need to write tests, and what does that mean?" But we have a skill. We have a header for this skill about tests. And what else? And we also have, well, the header, right, the title. And we have a rule that I must load the context. Well, that is, the skill itself, the body of the skill. And what does it do? Well, it very simply makes a regular tool call. I don't know if it will appear or not. Lecture on context. It makes a tool call, in the tool call it calls for loading context. What context? Yes, this context. Here is the context. It calls for loading the skill body, which can be large. Tens, thousands of tokens, and they are attached here. And now it thinks: "Ah, now I have additional context. Now I know how." Now I know how to write tests, and I will start writing them. That's it. These are skills, this is, this is a very simple concept. Just loading additional information on demand, described, well, in some header of this skill in advance. Let's just look at an example. It's very easy to see. Here I have the code open, please. Here are its skills in this code. Let's look at them. Here I have, for example, a skill "Check Quify Reden" or something like that. Well, let's look. This is my personal skill, I wrote it, which checks my project, what changes are needed in it to deploy it using the Cliify technology. We won't dwell on it now, let's just open this skill, right, here "Open," this is just its description, and I'll open it in raw form. We want to understand, right? Look, in raw form, it's just an MD file. Here's its header, see? Name and description, what it is, what it's for, roughly speaking, when it's called. And then all sorts of more complex things follow, like how it actually works, what it is, and so on. This is just a way to load context. An elementary thing. I hope it will become less scary for you. If you want it to be not scary at all when developing C, or if all this is unclear to you now, and you want some guidance from me personally, you want to delve into this in detail, then sign up for the "Coding at Maximum" course, the link will be under the video. I personally lead it, I explain it clearly, in detail. Lots of positive feedback. In short, likes, respects, come, it should be interesting. And we continue with sub-agents. Sub-agents are the last hyped thing, what do they represent? Well, look, as usual, we have a chat with an agent. Well, skills and rules are also there. Let's write, let's just draw that they are there by default. This whole structure, and we'll draw it. Sub-agents, by the way, can exist without skills. So, you know what we'll do? We'll draw it without skills, because rules are enough. We'll leave the system rule. Now I'll show you the difference from skills, because many people think it's very similar to skills. And it is indeed similar to skills, but it differs in some way. And let's see what happens. First, the chat with the agent starts in the same way. We describe the task text and then. But there is a system rule. If you want to do something that is described in the sub-agent description, load it. Interesting, right? Not just call the context, load it. What does that mean? Let's see. Let's have a sub-agent that writes tests, right? So, we had a skill there, "writes tests," and as a result of the skill that writes tests, this same agent started writing tests in its main loop at some point. Great, right? Understandable. And here it's a sub-agent that writes tests. Let's see what happens. So, it reaches the task text. Let's go. Some rules, system rules. "Write tests after tasks." Everything is great. It executes its loop, reaches the end, reasons: "We need to write tests. We have for this, what do we have for this header. Well, now not a skill, but a sub-agent. Now the reasoning. I have a rule that I must do what? Call the sub-agent. And it does a tool call. What else? Yes, it does something. And what does it do? And it does the following. Unlike a skill, as a result of a skill's work, it loads something into its own context. As a result of calling a sub-agent, it initiates a new chat with an agent. A new chat with an agent, let's call it a chat with a sub-agent. Under the hood, it passes what? It passes, well, not just the task text, the context, let's call it that. It loads the sub-agent's system prompt here. An interesting new entity arises, right, a kind of sub-agent system prompt. What does this sub-agent system prompt do? Well, it contains instructions that the sub-agent has, how it should do things. It's attached here, and from here, right, the tool call happens. Ah, and then what? The sub-agent starts working. It's just a regular agent, right? But with a different system prompt. That is, here is the sub-agent's system prompt, it differs from the main agent's system prompt. Well, a remark, right, for those who, I didn't mention it, but there is a system prompt, in the background, right, it's definitely present here. Well, and this is the sub-agent's system prompt. And it executes the task. How does it execute it? Well, exactly the same way, it loads something, some cycles, something there. And at the end, it says: "Done." I'm done. And when I'm done, in the sub-agent's system prompt, there is a rule for transferring, ah, context back. A rule for what to give back. And what does it do? It prepares a certain artifact. Well, in parentheses, it's just text, right? Just text. Well, or text plus files, or anything else. And what does it do? It transfers this back to the agent from which it called all this. Back here it transfers it and says: "I'm done here, accordingly, this is what it says." And here it waits, for example, it can wait for it, it can work in parallel. There's complex machinery here waiting for the sub-agent's work. That's it. The trick is, what's the trick? Why so complicated? I showed you. With skills. Everything was very simple. And here it's somehow complicated. It has to call some sub-agent, wait for some, something. I'm done. And what did it do? A test, for example. I see a test written. Why so complicated? The thing is, look at my hands, here there is no additional context enrichment. There is no additional work in the main loop. Therefore, the context of the main agent, this one, is cleaner. It doesn't get cluttered with unnecessary artifacts during work. And what do we know about cleaner contexts? Cleaner contexts work better, i.e., more accurately. The neural network makes decisions more correctly, and so on. In conclusion, sub-agents are a way to improve context quality by moving unnecessary instructions, unnecessary work in general, into separate chats, unlike skills, where all this happens in the same chats. That's the whole difference. It's a rather effective methodology. There are fans, but without it, well, it also works. And now, which tool should you choose? Well, choose any. Does the system work on rules? Yes, they work perfectly. Do systems work on skills? They work perfectly, but it's slightly better. Why? Because you can create many more such skills, and they won't clutter the main contexts, they will be attached as needed. Will a system with sub-agents work? It will be better than with skills. Well, on average, better. Why? Because they've gone even further in terms of context economy, when it's, well, like, not really spent in the main loop, and these sub-agents are initialized. Is it always better? There are nuances, but overall it's a slightly better story, but it requires more complex agent mechanics. Therefore, not all tools can handle this. Therefore, we are waiting for them to be implemented in all the coolest tools. That's all. Do you want more discussions about neural networks? More such guides, explanations. Subscribe to the channel, write comments, give likes, come and check out the course.