The terminal is just another window. With six commands, you can move through your folders; with an AGENTS.md, the agent knows who you are and what it can do; with Git, you can undo any mistake.
Objective: set up the agent’s work folder with rules, a safety net, and secrets kept out of the text.
01 · How the pieces fit together
You give the task, the agent works inside the folder, and you review it.
Lesson 201 · How the pieces fit togetherYou give the task, the agent works inside the folder, and you review it.
Not happy with it? git restore returns the file to the last saved version
1/5
You
You’re still the one who decides: you ask, review the result, and accept or undo it. Giving the task, reviewing, and deciding is management.
Scroll down: each step below lights up its part of the diagram.
1/5
You
You’re still the one who decides: you ask, review the result, and accept or undo it. Giving the task, reviewing, and deciding is management.
2/5
Terminal
This is how you get to the folder and call the agent. On Windows, use cmd; on Mac and Linux, use the Terminal.
3/5
Project folder
Everything the agent needs to know goes here: the rules in AGENTS.md, the work in the files, the keys in .env (which Git ignores), and the history in .git.
4/5
Agent
The agent reads AGENTS.md before starting, works on the files in the folder, and, if the rules require it, says what changed and how you can review it.
5/5
The full cycle
You ask, the agent works inside the folder following AGENTS.md, and says what changed. You review it. If you like it, commit; if not, use git restore.
The same files work for Claude Code and Codex: both read AGENTS.md.
02 · The work cycle with the agent
Click each step.
1. Ask
Inside the folder, run claude or codex and ask for one thing, with the result you expect.
Start by asking it to read AGENTS.md so it follows your rules.
RequestRead AGENTS.md. Create an index.html with a simple page about me, using the information there.
2. Run
The agent creates and edits files in the folder. It may ask permission before running commands.
Your role here is to read what it proposes, not type for it.
What appearsThe agent creates index.html and explains what it did.
3. Review
Open the result (the page in your browser, the summary, or the file) and compare it with what you asked for.
Ask for at least one correction: that’s the habit that separates using from managing.
CorrectionChange the title to "HR Consulting" and add a contact section.
4. Save or undo
Like it? git add . and git commit -m "..." save the version.
Don’t like it? git restore index.html restores the saved version. No panic.
Golden ruleMake a commit before asking for a big change.
03 · The files and commands in this sequence
Copy and use them. Replace the text between the < > signs with your own.
Terminal · first folder
mkdir projetos
cd projetos
mkdir meu-primeiro-agente
cd meu-primeiro-agente
dir # Windows (on Mac and Linux: ls)
AGENTS.md
# Who I am
<your name, your profession, who you work for>
# Rules for this project
- Write in Portuguese, using short sentences.
- Don’t delete files without asking.
- Before finishing, say what changed and how I can check it.
- Never write keys or passwords in a text file; they belong in .env.
# What’s here
- index.html: my page
Terminal · Git and keeping secrets out of text
git init
echo .env> .gitignore
git add .
git commit -m "primeira versão"
# undo an agent's change:
git restore index.html
# .env must NOT appear here:
git status
Repository example
You can reach the folder using only the terminal and say which folder you’re in.
AGENTS.md has at least three rules you wrote.
The page opens in your browser, and you asked for at least one correction.
git status does not show .env.
Skipping Git: the agent’s first bad change means manual rework.
Key in AGENTS.md: anything in plain text could end up on GitHub. Keep keys only in .env.
Vague request: "improve the page" leads to changes you don’t know how to check. Ask for a result you can see.
04 · Practice: the 6 exercises in sequence 1
Do them in order. Move on only when the "done when" condition is true.
E1 · First folder using the terminal
10 min
Create projetos/meu-primeiro-agente, go into it, and list its contents. Open the same folder in File Explorer (or Finder) and compare.
Done when: you can reach the folder using only the terminal, without the mouse, and say which folder you’re in.
E2 · The employee handbook
15 min
Create AGENTS.md with who you are, the project rules, and what’s in the folder.
Done when: the file exists and has at least three rules that you wrote yourself.
E3 · The first task
15 min
Call the agent and ask it to create index.html based on AGENTS.md. Open it in your browser and ask for a change.
Done when: the page opens, and you asked the agent for at least one correction.
E4 · The safety net
20 min
Run git init, add, and commit. Ask for a big change, and if you don’t like it, revert it with git restore.
Done when: you undid an agent’s change with one command, no panic.
E5 · Keep secrets out of the text
10 min
Create a .env file with a fake key and a .gitignore file with the line .env. Add the rule to AGENTS.md.
Done when: git status does not show .env.
E6 · The agent reads your files
20 min
Put three of your own texts in the folder and ask for a resumo.md with 5 decisions and 5 open items, citing the source of each one.
Done when: you found at least two of the quoted sentences in the original.
The agent made a big change you didn’t approve. What should you do?
Correct
With a commit made before the change, git restore returns the file to its previous state in one command. That’s why the rule is: commit before asking for a big change.
Not quite
With a commit made before the change, git restore returns the file to its previous state in one command. That’s why the rule is: commit before asking for a big change.Review: The work cycle with the agent
Question 3 of 3
What is AGENTS.md for?
Correct
AGENTS.md is the employee handbook. Claude Code and Codex read the same file, so the rules apply to both.