Your First Session
Open Grok in a folder, send a clear goal, approve a tool if asked, and check that the result is correct.
Complete Getting Started so grok runs and you can sign in. You do not need to know how to program yet—we use tiny practice files.

Open a session safely
- Open your terminal (the text command window from Lesson 1).
- Go to a project folder
For practice, reuse the lab folder:
cd ~/tmp/grok-labIf that folder does not exist, recreate it as in Lesson 1. For real work later,
cdinto your game or app folder instead. - Start Grok
Type
grokand press Enter. Wait until you can type at the bottom of the screen.
- A large history area (may be empty or show a welcome).
- A typing area at the bottom—this is the prompt.
- Your words appear in the history after you press Enter.
Why start inside a project folder? Grok focuses on the files around you. Starting in the right folder prevents it from editing the wrong place.
What happens when you send a message (the “turn”)
One turn is one full round of work:
- You send a goal
You type what you want and press Enter. Clear goals work better than vague ones (examples below).
- Grok plans and uses tools
A tool is an action Grok takes: open a file, edit a file, run a command, or search the web. You will see each action appear in the history area above as it happens.
- You may get a permission question
By default Grok often asks before changing files or running shell commands. That is intentional safety—not an error.
- Grok continues until the goal is met—or asks you something
If your message said “run the tests and fix failures,” a good run keeps going until tests pass or it truly cannot.
- You reply with the next instruction
Conversations are multi-turn. Each new message can refine the work.
How to write instructions Grok can follow
Grok is powerful, not psychic. A strong message has five parts. You can write them as a short list:
Goal: what “done” looks like for a human user
Context: which files matter (or “look around first”)
Constraints: rules (no new libraries, keep the same style, …)
Non-goals: what to leave alone
Verification: how to prove it worked (a command or manual check)Goal = the outcome. Context = where to look. Constraints = guardrails. Non-goals = do not wander. Verification = the test you will believe.
“Fix the game, something is broken.”
“Open hi.js. Change the greeting from hi to hello. Do not create new files. When done, show me the full file contents.”
When you know file names and tests exist, include them:
“Combat is wrong.”
“In combat-helpers.js, critical hits seem to add strength twice. Add a failing test if tests exist, fix the formula, run the project’s test command until it passes.”
Point at files with @
Typing @ in the prompt opens a file picker (a searchable list of files). This attaches those files to your message so Grok does not have to guess which file you mean.
- Click in the prompt (bottom).
- Type
@. - Start typing a file name (for example
hi). - Use arrow keys to highlight a file, press Enter to attach it.
- Finish your sentence after the attachment, then send.
@hi.js
Please add a comment at the top that says practice file.Useful patterns (you will grow into these):
@src/main.js # whole file
@src/main.js:10-50 # only lines 10–50
@src/ # browse a folder
@!.env # include a hidden file (the ! matters)Why bother? Attaching the right file is the #1 way beginners get accurate edits on the first try.
When Grok asks permission
A permission prompt is a pause that asks you to allow a tool. Read it. If the command looks destructive (deleting everything, force-pushing git, weird network calls), deny and ask Grok to explain.
- Ask mode (default)
- Grok asks before many edits and shell commands. Best while learning.
- Always-approve (sometimes called YOLO)
- Skips most questions. Faster; only use on machines and projects you fully trust. Toggle later with
/always-approveor the keyboard shortcut covered in the keyboard lesson. You can also start withgrok --yolo. - Auto mode
- A middle ground: safe actions may auto-run; riskier ones still ask. Available when enabled as
/auto.
While learning: stay in default ask mode. Never always-approve on a folder full of secrets or on someone else’s untrusted project.
Always say how to check the work
If you do not define “done,” Grok may stop too early or polish the wrong thing. Put the check in the message:
- Command check: “Run
npm testand fix until it passes.” (Only if that project uses npm tests—ask Grok how to test if you are unsure.) - File check: “Show me the full contents of hi.js when finished.”
- Human check: “I will open index.html in a browser; there must be no errors in the console.”
This single habit separates toy demos from reliable engineering with an AI pair.
Change course while Grok is working
- Cancel: Press Esc to stop the current turn (in normal setups). Your draft text is usually kept.
- Queue a follow-up: While Grok is busy, type another message and press Enter—it often waits in line for after the current turn.
- Correct course: After it finishes, say exactly what to stop doing: “Ignore styling. Only fix the test failure.”
You will learn more keys in the Keyboard lesson. For now, Esc and clear follow-ups are enough.
Guided lab — a complete mini session
- Enter the lab folder and start Grok
cd ~/tmp/grok-lab grok - Attach the file and give a full instruction
Type
@, selecthi.js, then send:@hi.js Goal: print both a greeting and the current year. Constraints: keep this as a simple script; do not add libraries. Verification: show me the final file contents in your reply. - Approve edits if asked — read the proposal first.
- Read Grok’s reply — does it show the final file? If not, send: “Please print the full final contents of hi.js.”
- Optional rename — type
/rename first-session-laband Enter so you can find this chat later. - Leave cleanly — type
/quitwhen finished (or leave the window open if you are continuing to the next lesson).
- @ does nothing: Click the bottom prompt first so it is focused, then type @.
- Grok edited the wrong file: Say “Revert that. Only edit hi.js.” Better: use @ next time.
- You approved something scary: Stop with Esc. Ask Grok to undo. If you use Git (later), restore from version control.
You can start Grok in a folder, send a goal with verification, use @ at least once, handle a permission prompt calmly, and understand what a “turn” is.
If the lab worked, you have two real wins: Grok is installed, and you can run a full session with a goal, @file, and a permission check. Next big win: finish a First Game or First App walkthrough (express path). Screen and Keyboard lessons help if the terminal feels new—skip them only if you already know the UI.
Next: The Grok Screen, then the keyboard lesson. After Beginner, ship a game or app walkthrough.
Self-check
Answer to confirm you understood this lesson. You can still mark the lesson complete after.