WEBVTT

00:00:00.160 --> 00:00:01.920
The long awaited

00:00:01.920 --> 00:00:13.360
goal command in Code has shipped. It's now available in Claude Code as of about forty eight hours ago. If you don't know, this lets you set a condition,

00:00:13.725 --> 00:00:17.245
and Cloud Code will work on that task until

00:00:17.245 --> 00:00:19.085
it is completed.

00:00:19.085 --> 00:00:21.805
A must have tool in your toolkit.

00:00:22.045 --> 00:00:29.810
By the end of this video, you'll understand all the flexibility you have with the goal command, how the agents work under the hood.

00:00:30.130 --> 00:00:45.525
We'll demo a couple uses of goals and teach you how to effectively get the most out of this command. I'm Matt Kuda. Let's dive in. Using goal is straightforward in Cloud Code. Make sure you update your Cloud Code. If you haven't, then use slash goal,

00:00:45.765 --> 00:00:52.565
and you'll see the command there. Set a goal. Keep working until the condition is met.

00:00:52.885 --> 00:00:59.060
Looking at the docs here, they give a bunch of examples, explain how it works,

00:00:59.300 --> 00:01:02.420
how to write effective conditions, which we'll talk about later.

00:01:02.580 --> 00:01:11.465
You can use slash goal again to see the status of the goal or slash goal clear to clear a new one. You could also add on additions

00:01:11.465 --> 00:01:18.665
like stop after 20 turns so that way it doesn't burn through all your tokens because this goal command

00:01:18.905 --> 00:01:25.050
will possibly up your token usage. Now let's talk about how the actual

00:01:25.370 --> 00:01:28.250
loop works under the hood.

00:01:28.570 --> 00:01:32.570
So you, the user, put in your goal here. So goal,

00:01:32.570 --> 00:01:34.730
add a user settings page.

00:01:34.970 --> 00:01:48.545
And then worker agent or agents are gonna spin up to work on this task. They're gonna be Sana or Opus depending on what you have set. Now these agents work just like the ones when you prompt Cloud Code. They can edit the code,

00:01:48.865 --> 00:01:50.865
run tools, use MCP,

00:01:51.600 --> 00:01:55.520
stuff like that. Then when they're done, they're gonna give a text

00:01:55.520 --> 00:01:56.400
transcript

00:01:56.640 --> 00:01:58.800
to a separate evaluator

00:01:59.040 --> 00:02:02.640
agent. Now this is Haiku by default. That can be changed.

00:02:02.800 --> 00:02:05.360
It's important to note that this actual agent

00:02:05.495 --> 00:02:10.375
can't inspect the work. It just has the transcript of what the worker agents

00:02:10.455 --> 00:02:14.295
give you. Now this agent will say, based on that transcript,

00:02:14.295 --> 00:02:15.895
is the work done

00:02:15.895 --> 00:02:16.855
or not?

00:02:17.175 --> 00:02:21.940
If it's a no, it's gonna go back into the worker agent.

00:02:22.020 --> 00:02:26.340
They'll have a new reason that becomes this next turn guidance

00:02:26.420 --> 00:02:29.460
to operate off. So if you wanted to build a settings page,

00:02:29.860 --> 00:02:32.580
these guys build it out, but there was no

00:02:33.205 --> 00:02:40.965
default dark mode toggle. The valuer agent says, hey. Not in there. That missing default dark toggle will be in this next turn guidance,

00:02:41.125 --> 00:02:48.725
then the workers will complete it again in a new turn. So this loop will continue until the goal is met determined by the evaluator,

00:02:49.180 --> 00:02:58.700
which case the goal is cleared and full control is given back to the user. Okay. Now let's see this goal feature in action. So here I'm in my

00:02:59.100 --> 00:02:59.980
LifeOS

00:02:59.980 --> 00:03:03.420
application where I track my tasks, deep work, goals,

00:03:04.125 --> 00:03:05.085
stuff like that.

00:03:05.405 --> 00:03:17.560
And the deep work page isn't very fleshed out. The styling is not great. I can't set a goal limit. Clearly not complete. So I'll go to Cloud Code using the goal command. I'll give it a pretty thorough

00:03:17.640 --> 00:03:23.720
prompt on exactly what I want, what the conditions are, like a circular elapsed countdown time,

00:03:23.960 --> 00:03:26.920
and allow people to add deep work sessions outside

00:03:27.080 --> 00:03:28.280
of the timer.

00:03:28.600 --> 00:03:29.720
So when I kick this off,

00:03:30.455 --> 00:03:44.535
this prompt again will get sent to the worker agents and will continue to work until the evaluator deems it as done. And after nine minutes and only one turn, meaning the evaluator agent approved the work on the first try,

00:03:45.260 --> 00:03:47.580
We can see the feature

00:03:47.660 --> 00:03:48.780
is done.

00:03:49.100 --> 00:03:51.340
Here, we have the stopwatch functionality

00:03:51.420 --> 00:03:53.500
or count now, which is what you wanted.

00:03:53.740 --> 00:03:54.780
Click start.

00:03:54.860 --> 00:03:56.940
We get that nice elapsed

00:03:56.940 --> 00:03:58.140
circle thing here.

00:03:58.715 --> 00:04:05.435
Probably a couple style things I'd still give as feedback. As another example for how far you can push this goal feature

00:04:05.675 --> 00:04:10.075
in this recruitment CRM I'm building for a client, we have AI

00:04:10.155 --> 00:04:13.035
matching functionality to put candidates to positions.

00:04:13.750 --> 00:04:29.430
Though right now, you could really only do this through the candidate page along with some other features like drafting follow-up emails. So I wanted a dedicated AI chat page that had an agent that could do any of these tasks based on what the user is chatting on and keep it all in context.

00:04:30.045 --> 00:04:34.685
So for my goal command, I was pretty thorough about what I wanted, a full new page,

00:04:35.325 --> 00:04:37.165
use a LLM agent,

00:04:37.565 --> 00:04:45.820
no need to store chat history. So I had what I wanted and what I didn't want just so it didn't go overkill and burn too many tokens and knew what the scope

00:04:46.060 --> 00:04:46.700
was.

00:04:47.020 --> 00:05:05.765
So this ran for, let's see, only five minutes and one turn, and it got it done. Did have a little style follow-up prompt at the end. And if we go to this page, it is exactly what we wanted, a free form text box with some ready prompts already to show off the tools available.

00:05:06.005 --> 00:05:09.205
I did pass it a dribble example just for some inspiration.

00:05:09.690 --> 00:05:19.450
Highly recommend doing that in general, and it was able to nail it in one turn. And when you're using the goal command, you wanna make sure your conditions are thorough.

00:05:19.690 --> 00:05:32.695
Right? A bad command might just be dark mode works. You know? That can mean a lot of things, but having a good prompt, like, there's a toggle clicked, the data theme fixed, that works with your style guide, local storage to store it, CSS variables,

00:05:32.695 --> 00:05:39.660
screenshots reported. That way, your worker agents can use Chrome MCP. Remember, your evaluator agent can't.

00:05:39.740 --> 00:05:45.420
But in my tasks, all the worker agents do have access to that to formalize the transcript.

00:05:45.660 --> 00:05:52.775
So make sure you're thorough. And remember, just the end state is not enough. Just saying dark mode is not it. Add as much context

00:05:53.015 --> 00:05:57.255
as you have. Use voice to text to really get it down easily.

00:05:57.495 --> 00:06:00.935
Remember, the condition can be a max of 4,000 characters,

00:06:01.415 --> 00:06:14.970
but that should be plenty for an effective goal. So when should you use goal and when to skip it? Anything that has multi turn work such as build the settings page, then build the APIs on top of it,

00:06:15.370 --> 00:06:22.005
then use Chrome MCP to verify it. That'd be a great use case for GOL. Or if there's a big migration or refactor

00:06:22.005 --> 00:06:24.965
where the work is a little vague, the path is unknown,

00:06:25.205 --> 00:06:35.420
use GOL to state exactly what you want, what you currently have, put that in your condition. Any big features you wanna try to one shot similar to the Ralph Wiggum loop as before.

00:06:35.740 --> 00:07:00.740
I'm sure you could build a lot of full stack Next. Js apps if you're crisp enough with what you want and you don't want it to stop and ask requirements just to work until it's done. And any type of headless runs, like you wanna clean up all your backlog, get that work done, you can use goal. When to skip it, subjective work with no clear end state. Like, if you were just to say improve the

00:07:00.900 --> 00:07:02.340
onboarding experience,

00:07:02.340 --> 00:07:12.885
that'd be a little vague because you wouldn't have actually the requirements for the screens and questions you wanna ask there. Simple stuff like fix the styling on this button or show the username on the top right.

00:07:13.125 --> 00:07:25.525
No need to use goal. Just prompt directly. Save yourself the time. Any conditions that Claude can't prove in the transcript, whether it doesn't have tool access or it's way too vague, don't use goal for that. If you wanna pull eternal state consistently,

00:07:26.080 --> 00:07:30.320
use the slash loop command. This will allow you to run a command every five minutes.

00:07:30.800 --> 00:07:32.720
Like, hey. Check this endpoint.

00:07:32.960 --> 00:07:46.805
Pull every five minutes until the cache is cleared. I wanna make sure our changes went live. That will do it for today's video. If you learned anything, you are obligated to like. Subscribe for more AI workflows like these and the latest news in the tech world.

00:07:47.045 --> 00:07:50.085
Thank you guys so much for watching. I'll see you in the next one.
