All courses

A safe first project: folder, git, clean state

Set up a dedicated project folder under git with a first commit and a `.gitignore` for secrets. Start your chosen agent from that folder with cautious approvals, so every change is visible and reversible.

Builds on: Choosing a tool for how you work, Git commits as snapshots you can return to, What never to let an agent touch

Read it card by card Start the whole course

Where do you start the agent?

You've installed an agent and want to try it on a small idea: a script that renames your holiday photos by date. The quickest move is to open your terminal, which starts in your home directory, and launch the agent right there. Or launch it inside an old work folder full of half-finished edits. What could go wrong, and what should be in place first?

The folder is the agent's workspace

An agent treats the folder you start it from as its workspace. By default it reads, creates and runs things there. Tools differ in how strictly they stay inside it, and a command it runs can reach further, so think of it as a default area, not a wall. Your home directory holds everything you own, so it's the wrong place. A **dedicated folder** keeps unrelated files out of that default area. A **first commit** records a known starting snapshot you can compare later changes with and return to. A **clean start**, with your own work committed, keeps your uncommitted edits from mixing with the agent's.

Checklist before the first prompt

1. Make a new, empty folder only for this project, not your home directory, Desktop or Downloads. 2. Run `git init` inside it. 3. Add a `.gitignore` listing secret files, such as `.env` and `*.key`. 4. Make a first commit. 5. Check with `pwd` that you're inside the folder, then start the agent there. In an editor, open exactly that folder. 6. Keep approvals on ask-every-time.

The setup in one terminal session

Each line starting with `$` is typed by you. Most commands' output is left out here. `printf` writes the two patterns into `.gitignore`, one per line. `echo` writes a one-line `README.md` describing the project. `git add .` stages everything, including `.gitignore` itself. If `git commit` stops and asks who you are, run the two `git config` lines it suggests, then commit again. `git log --oneline` confirms the first commit exists. `pwd` confirms where you are before you launch. Text after `#` is a comment, which the terminal ignores.
$ mkdir photo-renamer
$ cd photo-renamer
$ git init
$ printf '.env\n*.key\n' > .gitignore
$ echo "# Photo renamer" > README.md
$ git add .
$ git commit -m "Project start"
$ git log --oneline
3f2a1c9 Project start
$ pwd
/home/sam/code/photo-renamer
$ claude   # or your tool's command

First contact, with the brakes on

▸ You: Look around this folder and tell me what's here. Don't change anything. ⚙ Run: `ls -a` [Approve? yes / no / always] Pick **yes**, not **always**. "Always" stops the agent asking about that kind of action for the rest of the session, and some tools remember it for the project. Some tools run read-only commands like this without asking, but edits and other commands still stop for you. Note that `.gitignore` only keeps `.env` out of commits. It does **not** stop the agent reading the file, so keep real secrets out of this folder.

Remember

Before the first prompt, set up a dedicated folder, run `git init`, add a `.gitignore` for secrets, and make a first commit. Then start the agent from inside that folder with approvals on ask-every-time. Every action then passes in front of you, and any change to the project's files can be undone by returning to the first commit.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.