WEBVTT

00:00:00.040 --> 00:00:03.220
Permissions are an important topic
when working with Claude Code.

00:00:03.260 --> 00:00:07.220
So I have to get back to those because we
already saw that Claude

00:00:07.260 --> 00:00:10.000
Code asks for permissions from time to
time.

00:00:10.040 --> 00:00:13.860
For example,
it asks for permissions before it starts

00:00:14.020 --> 00:00:17.900
files. At least it does that
if you send your prompt in

00:00:17.960 --> 00:00:21.540
the normal default mode you get out of the
box.

00:00:21.580 --> 00:00:25.120
So for example, if I
were to send this prompt in a new session

00:00:25.180 --> 00:00:28.240
without any other changes,
also no changes in my

00:00:28.280 --> 00:00:32.140
settings, then after evaluating my prompt,

00:00:32.180 --> 00:00:35.780
Claude will ask me for permission to edit
this page TSX

00:00:35.800 --> 00:00:39.240
file,
also by showing me the changes it wants to

00:00:39.300 --> 00:00:42.940
So as before,
I can choose yes to grant this permission

00:00:43.060 --> 00:00:46.740
asked again if it wants to edit another
file, or choose the

00:00:46.800 --> 00:00:50.300
second option, or hit shift tab
if I want to

00:00:50.360 --> 00:00:52.220
permanently grant this permission.

00:00:52.260 --> 00:00:55.800
And with escape,
I can cancel this edit

00:00:56.060 --> 00:00:59.160
actually,
and I could send up follow-up messages to

00:00:59.180 --> 00:01:03.040
Of course, it's quite likely
that you want to allow Claude Code to

00:01:03.100 --> 00:01:06.840
edit your files and you don't want to wait
for it to ask you for

00:01:06.880 --> 00:01:10.130
permission because you want to go grab a
coffee right away.

00:01:10.130 --> 00:01:13.780
You can therefore switch the mode from the
default mode by

00:01:13.820 --> 00:01:17.620
hitting shift tab to switch to this accept

00:01:17.680 --> 00:01:20.840
edits mode here, and
that does just what the name implies.

00:01:20.880 --> 00:01:24.500
It will automatically accept file edits
inside of your project.

00:01:24.540 --> 00:01:28.110
Claude Code still can't access anything
else on your system.

00:01:28.160 --> 00:01:30.620
We're talking about files in your project.

00:01:30.660 --> 00:01:34.560
So if I run the same prompt in this mode,
it will do the same

00:01:34.600 --> 00:01:38.420
research,
come to the same conclusion probably,

00:01:38.460 --> 00:01:42.360
file without asking me first.
As you see here, I did not have

00:01:42.380 --> 00:01:46.320
to grant it permissions. However,
it's important to understand

00:01:46.360 --> 00:01:49.640
that even in this mode, it still
is not allowed to do everything.

00:01:49.700 --> 00:01:52.440
It's just allowed to edit your code files.

00:01:52.460 --> 00:01:55.720
But what if I ask it to create a new git
commit

00:01:56.260 --> 00:02:00.080
about these changes it made because I'm
too lazy to type out the git commit

00:02:00.140 --> 00:02:03.900
message myself? As you will see,
it uses the bash tool

00:02:03.940 --> 00:02:07.920
here a couple of times to check the
current status and

00:02:08.000 --> 00:02:11.820
find out what happened in the past
and what changed so that it can craft a

00:02:11.860 --> 00:02:15.580
proper commit message. But then
when it wants to run

00:02:15.600 --> 00:02:19.440
git add, which of course is a command
that changes something,

00:02:19.520 --> 00:02:22.280
and also then git commit to commit that

00:02:23.140 --> 00:02:26.380
snapshot,
it does ask for permission again.

00:02:26.400 --> 00:02:30.340
Because by default, Claude Code
is configured to not be allowed to

00:02:30.380 --> 00:02:34.269
do everything,
even in this except edits mode,

00:02:34.300 --> 00:02:38.080
editing a file in this project.
Instead here we're creating a git commit.

00:02:38.090 --> 00:02:41.820
And the same would be true if it,
for example, wanted to create a

00:02:41.920 --> 00:02:45.860
new folder or do anything else that's not
just editing a code

00:02:45.880 --> 00:02:49.820
file. So in that case,
you still have to make a choice, and you

00:02:49.840 --> 00:02:53.760
can either allow this one time
or in general tell it

00:02:53.820 --> 00:02:57.620
to not ask again for git add
and git commit commands, which

00:02:57.660 --> 00:03:01.540
means it will still come back to you
if it wants to use some other command

00:03:01.600 --> 00:03:05.300
that changes something like git restore
or other

00:03:05.320 --> 00:03:08.920
bash commands. But for these commands,
it won't ask again.

00:03:08.940 --> 00:03:12.930
And here I'll just accept this this one
time because I want to get asked again in

00:03:12.940 --> 00:03:16.840
the future, let's say.
So it's important to understand how it

00:03:16.860 --> 00:03:20.190
and that even this except edits mode does
not allow everything.

00:03:20.200 --> 00:03:23.690
But let's say you really want to be able
to move away from your machine and let

00:03:23.740 --> 00:03:27.040
Claude Code do its thing without it ever
asking for any

00:03:27.080 --> 00:03:30.329
permissions. If that is what you want,
you can start a new Claude

00:03:30.420 --> 00:03:34.269
session by adding the --dangerously

00:03:35.200 --> 00:03:39.140
skip permissions flag. And that does

00:03:39.200 --> 00:03:42.609
just what it sounds like. It skips all

00:03:42.640 --> 00:03:45.990
permission requests.
It will always grant those

00:03:46.020 --> 00:03:49.280
permissions Claude Code wants. And it's

00:03:49.320 --> 00:03:53.160
dangerous because of course you then got
no control over

00:03:53.220 --> 00:03:57.180
what it does.
It still can't access your hard

00:03:57.220 --> 00:04:01.020
drive outside of your project,
but it can erase your

00:04:01.100 --> 00:04:04.760
git history, erase files
that can't be brought

00:04:04.820 --> 00:04:08.790
back in this project.
It could write a script that

00:04:08.800 --> 00:04:12.520
then is able to do something outside of
your project.

00:04:12.600 --> 00:04:16.469
If it writes a bash script
that erases your hard drive and it

00:04:16.500 --> 00:04:20.339
executes that in your project,
then this should work and should

00:04:20.519 --> 00:04:24.420
destroy your machine.
Obviously that's not necessarily super

00:04:24.560 --> 00:04:27.340
likely to happen, but it could happen.

00:04:27.350 --> 00:04:30.560
And that is why you should use this flag
with care.

00:04:30.580 --> 00:04:34.370
But you can of course use it.
You then get a warning what this

00:04:34.380 --> 00:04:37.780
does, and you can then accept that you
are aware of that.

00:04:37.790 --> 00:04:41.740
And then I could send a prompt like this
where I ask it to edit something

00:04:41.920 --> 00:04:45.780
and also commit the changes,
and then I could leave and come

00:04:45.860 --> 00:04:49.510
back once it's done
and it will never ask for any permissions.

00:04:49.510 --> 00:04:53.340
So as you see,
it edited the file without asking for

00:04:53.440 --> 00:04:56.000
it created that commit.
