
Lesson Description
The "Subagents" Lesson is part of the full, Cursor & Claude Code: Professional AI Setup course featured in this preview video. Here's what you'd learn in this lesson:
Steve introduces Subagents, which run in the project using their own context window. This frees up the main agent from having to compact the context window during subsequent requests.
Transcript from the "Subagents" Lesson
[00:00:00]
>> Steve Kinney: The one that came out four or five days ago is this new concept called subagents. And there have been a lot of what we could maybe call frameworks around Claude and Cursor. Where it's definitely a somewhat hacky system of commands and hooks in an MCP server to try to create these different roles and personas.
[00:00:26]
And it's super kinda wild to watch. Some of them have an idea of there's a product owner and there's a Scrum master and then there is a head engineer and then there is the engineering manager. And you give them these commands, you kinda give it enough context to have it believe it's one of those things and then only use these certain tools.
[00:00:52]
So hot take is Rylan and I played around with them. We're like, this doesn't make us feel any more productive than just using these tools. But there are some people who won't stop, they're on YouTube, they're really into talking about them. Maybe they're having better results than I am.
[00:01:11]
They must be because Claude added it as a feature to the actual thing, so now I don't have to learn any of these systems. But subagents do something that none of these other systems do. Which is basically you have your main agent, that's the one where you fire up Claude, Claude-continue, whatever.
[00:01:30]
You fire up Claude, that's your main agent, and your main agent has a context window, right, talked about that once or twice today. The cool thing is subagents have their own context window, right? Which means they don't share the main context window, which means you can splinter off your context windows without polluting the main one.
[00:01:53]
And each one has their own mini-context window that it does stuff with, which means you can avoid compaction and all those other things. And it can do stuff with its own persona and then do its thing, get the result, and just respond back with the result back to the main agent.
[00:02:11]
So it gives you a way to shard and preserve. You're still paying the token cost for uses limit, in fact, you'll probably run it up faster because you're parallelizing it. But in terms of you losing packets of information, you are preserving it. So yeah, it gets its own system prompt.
[00:02:30]
This is one of the things I don't understand how this works at all, telling an AI that it is a frontend architect, it gets it to better decisions. Yes, and I don't really know why, I've read the stuff, I went real deep, and yet I'm still like, I don't know.
[00:02:45]
But it gets its own system prompt, it can be convinced that it looks at things from a certain angle, somehow, wildly, it works. But more importantly, the ability to have sharded context windows and then being able to pull them back without overloading the main context window is really, to me, what makes it wild.
[00:03:05]
And so you can access this at any time by doing /agents. And you can go ahead and it'll say, hey, would you like to see what agents you have? And you can do it at a user level and you can do it at a project level. This is the only one where I do have one at a user level, which is called copyeditor, which is, fix my typos, [LAUGH] with enough knowing about what is a TypeScript word and not actually a typo, but please fix my typos.
[00:03:34]
That one I have as a user level, cuz thank you, to all of you who have opened pull requests up onto my course materials, finding all my typos. I aspire to not make you have to do that anymore. So that one I have at a user level cuz I make typos across all my projects, and that one I felt comfortable knowing that I make typos.
[00:03:55]
So /agents will pull it up, we'll see that in a second. As somebody who used to be a frontend-architect, making a subagent who I've convinced is a previous version of myself is a very surreal experience, and why it works is weird to me. But look, a typo and test-strategist.
[00:04:16]
Unfortunately, this does not work on keynote slides. But you can kind of create, and I'll show you how you make one of these in a second, but you can create these subagents with all of this, hey, your job is to do this. These are things you care about, look at it, and it'll be loaded up with that system prompt.
[00:04:37]
And you can say, you only have access to these tools, you only have access to these tools. You can load in, theoretically, all those at-commands work. So you could basically have with different references to different files, and again, everything that they get does not go into the main agent's context window.
[00:04:55]
So you can say for a moment you have all this stuff in context, do your thing and give a report back to the main agent. And then so that main agent does not have its context window all polluted, it does the thing, it comes back with its thoughts and opinions, very tidy, neat package.
[00:05:13]
Sure, it's costing you a lot of tokens because you're doing now four different things and reporting back, but you're not polluting the context window. So frontend-architecture that's like that one in back, You see this a lot in the frameworks I was reading and it seems to work, I don't believe it.
[00:05:30]
The one that I use the most is. I think I said there's all those commands and prompts and rules that we saw earlier, you are a senior TypeScript engineer. I've never gotten better results from convincing an AI that it's just supposed to be better at it than it is, you are a junior engineer, ask all of the questions.
[00:05:50]
Anything that is unclear, point it out and bring back all of your concerns around this project, worth its weight in gold. And so it just comes back with everything, it's like, what do you mean by that? And a lot of times I'll have that right to a list of questions that I will then have to go and answer.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops