BUILD YOUR AI BRAIN

How to install Claude Code, give it a memory, and protect it so you never lose anything. Step by step. From zero.
BEGINNER FRIENDLY — NO CODING NEEDED

WHAT'S IN THIS GUIDE

Phase 1: Install Claude Code ~15 min Phase 2: Build Your Brain (Memory File) ~10 min Phase 3: Protect Your Brain (Never Lose It) ~10 min Phase 4: Test It ~5 min FAQ — Common Questions

Total time: ~40 minutes from zero to fully set up.

What You Need Before Starting
A Mac or PC
MacBook, iMac, Windows, or Linux. Works on 8GB RAM and up. Apple Silicon (M1/M2/M3) = perfect.
Claude Account
Go to claude.ai and sign up. Free tier works. Pro ($20/mo) or Max ($100/mo) gives more usage.
Terminal
Already on your Mac — search "Terminal" in Spotlight (Cmd + Space). On Windows, use PowerShell.
~40 Minutes
That's it. Coffee helps but isn't required.
1
Install Claude Code

Claude Code is a terminal tool that lets you talk to Claude AI directly from your computer. It can read your files, write code, search the web, and remember things between conversations. It's like having an AI partner sitting next to you.

Should You Create a Separate User Account? (Optional but Smart)

PRO TIP: Before installing anything, consider creating a separate Mac user account just for AI work. Here's why:

Benefits:
• Your personal files (photos, banking, documents) are completely invisible to Claude Code
• If any AI tool ever has a security bug, the damage stays in that account only
• Clean workspace — no clutter from personal stuff
• If something breaks, delete the user and start fresh. Zero risk to your main stuff.

How to do it:
1. Go to System Settings → Users & Groups
2. Click Add User (you'll need your admin password)
3. Create a new user (name it anything — "AI Work", "Claude", whatever)
4. Check "Allow user to administer this computer" — you need this to install tools
5. Log into the new user account and follow the steps below

Don't want to bother? That's fine too. Just install everything on your main account. The security layer in Phase 3 protects you either way.

Step-by-Step (Mac)

Open Terminal

Press Cmd + Space, type Terminal, hit Enter. A black/white window will appear. This is your command line. Don't be scared — you're just typing text.

Install Node.js (Required)

Claude Code needs Node.js to run. Check if you already have it:

copy & pastenode --version

If you see a version number (like v20.x.x or higher), skip to Step 3. If you see "command not found", install it:

copy & paste# Install Homebrew first (Mac's package manager) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Homebrew install takes 2-5 minutes. It will ask for your Mac password. When you type it, nothing shows on screen — that's normal. Just type it and press Enter.

After Homebrew installs, it might show you two commands to run to add it to your PATH. Copy and run both of those commands. They look something like:

# These are EXAMPLES — use the actual ones Homebrew shows you echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"

Now install Node.js:

copy & pastebrew install node

Verify it worked:

copy & pastenode --version

You should see something like v22.x.x. If yes, you're good.

Install Claude Code

One command. That's it.

copy & pastenpm install -g @anthropic-ai/claude-code

This downloads and installs Claude Code globally on your machine. Takes about 30 seconds.

Launch Claude Code
copy & pasteclaude

First time it runs, it will ask you to log in to your Anthropic account. A browser window will open — sign in with the same account you use at claude.ai.

Once logged in, you'll see a prompt where you can start typing to Claude. You're in.

That's it. You now have an AI that can read files on your computer, write code, run commands, and help you build things. But right now it has amnesia — every time you close Terminal, it forgets everything. Let's fix that.

Step-by-Step (Windows)

Windows Installation

Open PowerShell (search in Start menu). Then:

# Install Node.js from nodejs.org first, then: npm install -g @anthropic-ai/claude-code

Then type claude to launch. Same login flow as Mac.

2
Build Your Brain (Memory System)

Right now Claude Code is smart but has no memory. Every time you start a new conversation, it starts from zero. It doesn't know who you are, what you're working on, or what you've built before.

We're going to give it a brain file — a document it reads automatically every single session. Think of it as a notebook Claude opens before every conversation.

How It Works

Claude Code automatically looks for a file called CLAUDE.md in your home directory. If it exists, Claude reads it before every conversation. This is your brain file. Put your goals, your projects, your preferences, your rules in there — and Claude will know you from the very first message.

Create Your Brain File

In Terminal (you can exit Claude Code first by typing /exit), run this:

copy & pastenano ~/CLAUDE.md

This opens a simple text editor inside Terminal. Now paste the template below (or type your own):

Paste This Brain Template

Copy everything inside the yellow box below. Then go back to Terminal and paste it (Cmd+V):

# MY AI BRAIN ## Last Updated: [Today's date] --- ## WHO I AM - Name: [Your name] - Age: [Your age] - Location: [City, Country] - Background: [What you do / your experience level] - Goal: [What you're trying to achieve with AI] --- ## MY RULES FOR CLAUDE 1. Be direct. No fluff. Explain the WHY behind every step. 2. I'm a beginner — explain things simply but don't dumb it down. 3. Challenge bad ideas. If something is a waste of time, say so. 4. Step by step with reasoning, not just instructions. 5. [Add your own rules here] --- ## WHAT I'M WORKING ON - [Project 1: description] - [Project 2: description] --- ## TOOLS I USE - [List your tools, apps, subscriptions] --- ## DECISIONS MADE [As you work with Claude, log important decisions here so future sessions remember them] --- ## THINGS TO REMEMBER [Anything else Claude should know about you every session]
Save and Exit

After pasting the template:

1. Press Ctrl + O (that's the letter O, not zero) — this saves the file

2. Press Enter to confirm the filename

3. Press Ctrl + X to exit the editor

Fill It In With Your Real Info

The template has placeholders like [Your name]. Replace them with your actual info. The more specific you are, the better Claude will know you.

You can always edit it later:

copy & pastenano ~/CLAUDE.md
Pro tip: You can also just launch Claude Code and say "Help me fill in my CLAUDE.md file" — it will interview you and write it for you. That's what AZ did.
Test It

Launch Claude Code again:

copy & pasteclaude

Then type something like:

type thisWhat do you know about me?

Claude should respond with information from your brain file. If it does — your brain is working.

WHY THIS MATTERS: Without a brain file, you're starting from scratch every session. With it, Claude knows your name, your goals, your projects, your preferences — instantly. It's the difference between talking to a stranger and talking to a partner who knows your whole story.
3
Protect Your Brain (Never Lose It)

Here's something I learned the hard way: I spent hours building plans with Claude, and then my terminal crashed. Everything was gone. Hours of work, decisions, strategy — vanished.

The brain file (CLAUDE.md) is safe — it's a regular file on your computer. But your conversations exist only inside the terminal session. If the session crashes, gets too long, or you close the terminal — the conversation is gone.

Here's how to set up automatic backups so that never happens to you.

Install GPG (Encryption Tool)

We're going to encrypt your backups so even if someone gets your files, they can't read them.

copy & pastebrew install gnupg

If you don't have Homebrew yet (you installed it in Phase 1), go back and do that first.

Create the Backup Folders and Encryption Key

Copy and paste this entire block. It creates the folders, generates a random encryption key, and locks everything down:

copy & paste ALL of this# Create backup folders mkdir -p ~/.claude/hooks mkdir -p ~/.claude/memory-backups # Generate a random encryption key openssl rand -base64 32 > ~/.claude/.backup-key # Lock everything down — only YOUR account can access these chmod 700 ~/.claude/hooks chmod 700 ~/.claude/memory-backups chmod 600 ~/.claude/.backup-key
Create the Backup Script

This script runs automatically before Claude compresses your conversation or when the terminal closes. It saves a copy and encrypts it.

copy & pastecat > ~/.claude/hooks/auto-backup.sh << 'SCRIPT' #!/bin/bash INPUT=$(cat) TRANSCRIPT=$(echo "$INPUT" | /usr/bin/jq -r '.transcript_path // empty') SESSION_ID=$(echo "$INPUT" | /usr/bin/jq -r '.session_id // empty') if [ -z "$TRANSCRIPT" ] || [ ! -f "$TRANSCRIPT" ]; then exit 0 fi BACKUP_DIR="$HOME/.claude/memory-backups" mkdir -p "$BACKUP_DIR" TIMESTAMP=$(date +"%Y%m%d_%H%M%S") BACKUP_FILE="$BACKUP_DIR/${TIMESTAMP}_backup.jsonl" cp "$TRANSCRIPT" "$BACKUP_FILE" KEYFILE="$HOME/.claude/.backup-key" if [ -f "$KEYFILE" ]; then gpg --batch --yes --symmetric --cipher-algo AES256 \ --passphrase-file "$KEYFILE" \ --output "${BACKUP_FILE}.gpg" "$BACKUP_FILE" 2>/dev/null [ -f "${BACKUP_FILE}.gpg" ] && rm -f "$BACKUP_FILE" fi echo "[$(date)] Backed up session $SESSION_ID" >> "$BACKUP_DIR/backup.log" ls -t "$BACKUP_DIR"/*.gpg 2>/dev/null | tail -n +31 | xargs rm -f 2>/dev/null exit 0 SCRIPT chmod 700 ~/.claude/hooks/auto-backup.sh
Tell Claude Code to Use the Backup Script

This connects the script to two events: before compression and when the session ends.

copy & pastecat > ~/.claude/settings.json << 'CONFIG' { "hooks": { "PreCompact": [ { "matcher": "", "hooks": [ { "type": "command", "command": "bash ~/.claude/hooks/auto-backup.sh" } ] } ], "SessionEnd": [ { "matcher": "", "hooks": [ { "type": "command", "command": "bash ~/.claude/hooks/auto-backup.sh" } ] } ] } } CONFIG
IMPORTANT: If you already have a ~/.claude/settings.json file with other settings, this will overwrite it. If you're not sure, check first by running: cat ~/.claude/settings.json
Test the Backup

Launch Claude Code, have a short conversation, then type /exit. Then check:

copy & pastels -la ~/.claude/memory-backups/

You should see an encrypted .gpg file. That's your backup. If you see it — you're protected.

What just happened: Every time your Claude Code session ends (even from a crash), your entire conversation is automatically backed up and encrypted with military-grade AES-256 encryption. Only your Mac account can decrypt it. No one else can read your conversations — not hackers, not other AI tools, not anyone.

How to Read a Backup (If You Ever Need It)

copy & paste# List your backups ls ~/.claude/memory-backups/*.gpg # Decrypt and read the most recent one gpg --batch --decrypt --passphrase-file ~/.claude/.backup-key \ $(ls -t ~/.claude/memory-backups/*.gpg | head -1)
4
Test Everything

Let's make sure the whole system works end to end.

Launch Claude Code
copy & pasteclaude
Ask Claude About Yourself
type thisWhat do you know about me from my brain file?

Claude should recite info from your CLAUDE.md. If it does, the brain is working.

Have a Real Conversation

Ask Claude to help you with something. A project idea, a question, anything. Build up some conversation history.

Exit and Check Backup

Type /exit in Claude Code, then:

copy & pastels -la ~/.claude/memory-backups/

If you see an encrypted .gpg file — everything is working. Your brain is built, your conversations are protected, and you're ready to build.

YOU'RE DONE. You now have:

1. Claude Code installed and running on your machine
2. A brain file that Claude reads every session (it knows you)
3. Automatic encrypted backups (you'll never lose a conversation again)

You're ahead of 99% of people using AI right now. Most people just chat in a browser and start from zero every time. You have a system.
Frequently Asked Questions
Does this work on an 8GB MacBook?
Yes. Claude Code runs in your terminal and sends requests to Anthropic's servers. The AI runs in the cloud, not on your machine. Even an old MacBook Air with 8GB RAM works perfectly.
Is Claude Code free?
Claude Code itself is free to install. But it uses your Claude account, which has usage limits. The free tier works for learning. Pro ($20/mo) gives much more usage. Max ($100/mo) is unlimited for heavy users.
What's the difference between Claude Code and claude.ai?
claude.ai = browser chat. Good for quick questions.
Claude Code = terminal tool. Can read/write files on your computer, run commands, build software, and use the brain file system. It's the power-user version.
Can I edit my brain file anytime?
Yes. Just run nano ~/CLAUDE.md in Terminal, make changes, save (Ctrl+O, Enter, Ctrl+X). The next Claude Code session will read the updated version. You can also ask Claude to edit it for you during a session.
Are my conversations private?
Your conversations go to Anthropic's servers (same as using claude.ai). The backup files stay on YOUR computer and are encrypted. No one else can read them without your encryption key.
What if I close the terminal by accident?
That's exactly what the backup system prevents. The SessionEnd hook fires even on accidental closes and saves your conversation before it's lost.
Can I use this on multiple computers?
Yes. Install Claude Code on each machine. Copy your CLAUDE.md brain file to each one. Run the backup setup on each one. Same brain, multiple machines.
I got an error. What do I do?
Copy the exact error message and paste it to Claude at claude.ai — or launch Claude Code and paste it there. AI is really good at debugging its own install issues.