Claude Code built this site. This post is about the setup around it: what I told it, what it’s allowed to do, and how it remembers things between sessions.
Every piece is a small text file, and you can copy the lot in ten minutes. Below is each file, what it does, and where it’s riskier than it looks.
- rules file
- 1
- pre-approved commands
- 14
- shared plan
- 1
- saved memories
- 10
- hooks
- 2
Counts as of 21 October.
~/dev/my-website/
├── CLAUDE.md → AGENTS.md
├── .claude/
│ ├── settings.json
│ ├── settings.local.json
│ └── worktrees/
├── docs/plan.md
└── scripts/agent-hooks.mjs
~/.claude/projects/…/memory/
Dotted words have a definition: tap them. The real files are folded away.
1. Standing rules: CLAUDE.md
Claude Code starts every session knowing nothing about your project. The
first thing it reads is CLAUDE.md in the project folder, so that’s where
anything it should always know goes.
Mine is a symlinkSymbolic link: a file that just points to another file. Opening either one opens the same text. to AGENTS.md. Other coding agents
look for AGENTS.md, so one file serves all of them.
Typing /init inside Claude Code writes a first version: how to run the
project and how the code is laid out. That part is useful but generic. The
part that changes how it behaves is what you add about yourself and how you
want to work. Mine says I’m learning, so explain every change and the
reasoning; ask before adding a dependency; and read the roadmap before
starting a feature.
The rules changed as I trusted it more. You can see it in the git history of the file’s push rule:
- 8 October: “Never push without being asked.” Everything went through a branch and a previewA private copy of the site, with its own link, built from a branch so you can check it before it goes live. I checked on my phone.
- 16 October: added “open preview links in my browser” instead of only printing them.
- 17 October: small, safe changes (copy tweaks, small CSS fixes, docs) go
straight to
mainand get pushed, as long as the type check and the build pass and it checked a screenshot. Anything risky still gets a branch.
Worth knowing: the file is loaded when a session starts. If you change a rule mid-session, tell the running session too, or start a new one, rather than assuming it noticed.
2. Permissions: settings.json
Rules are advice. Permissions are enforced: Claude Code can’t run a command it isn’t allowed to.
.claude/settings.json lists 14 commands that are always fine: build,
preview, the type check, the dev server, reading git history, staging and
committing, pushing, opening links, installing packages, the search indexer,
and fetching pages from my own dev server. Those run without a prompt.
Everything else goes through auto mode. Before each action a separate check decides whether it’s safe, and only asks me when it isn’t sure. So it’s not “anything else needs a yes”: most other actions go ahead after that check, and I only see the ones it’s unsure about. The claude.ai chat suggested leaving auto mode off while learning, so I’d see every step. I turned it on anyway.
git push is on the list, yet the rules above say when not to push. The
permission decides whether it can; CLAUDE.md says when it should.
Hooks: making sure no agent’s work gets lost
Hooks are scripts Claude Code runs at fixed moments. Unlike CLAUDE.md,
they always run, so they’re for things that must never be skipped. I added
two on 21 October, once I was sending out several helper agents at a time
and their findings kept getting lost in the scrollback:
- SubagentStop: when a helper agent finishes, a small script adds a line to an inbox file naming the agent and the report it wrote.
- Stop: when the main session tries to end its turn, the same script stops it once for each new inbox line and tells it to copy that result into my follow-up list and tick the line. It’s a nudge, not a lock: it won’t block twice for the same line.
What could go wrong
Some of these rules are broader than they look, and I haven’t narrowed them yet.
git push *also allows a force-push.git push --forcecan overwrite the history on GitHub. Nothing in the settings stops it: only the rules inCLAUDE.mdand auto mode’s check stand in the way. A normal push tomainalso goes live on Vercel straight away. If a bad one gets through, Vercel keeps every earlier deploy, so I can roll back, and my Mac still has the full git history.npm install *installs anything. A package can run its own scripts the moment it’s installed, so a mistyped or malicious package name runs code on my Mac. The only guard is theCLAUDE.mdrule to ask before adding a dependency, and that’s advice, not enforcement.- Connectors reach beyond the repo. My Claude account has connectors for email, calendar, files, a task manager and hosting, and Claude Code sessions can use them. Claude in Chrome can also click around in my own signed-in browser. A web page or an email with hidden instructions could try to get it to send or share something. Auto mode’s check is the main thing in the way.
The fix for the first two is a deny list in settings.json (for example
Bash(git push --force *), though that won’t catch every way of writing it)
and taking npm install * off the allow list. I haven’t done either yet.
3. Shared memory with the design chat: docs/plan.md
I talk through design in the claude.ai app, and Claude Code builds. The two
can’t see each other, so they share one file: the roadmap, the decisions, and
a “Build notes” log of every time the build departed from the plan. The rule
in CLAUDE.md above is what keeps it current.
4. Memory: what it learned about me
CLAUDE.md holds the rules I write down. Memory holds what Claude Code
notices on its own: when I correct it, or ask for something to happen every
time, it saves a short note.
The notes live outside the repo, in ~/.claude/projects/<project>/memory/:
one file per fact, plus a MEMORY.md index that’s loaded into every session.
I had two when I first wrote this, on 17 October. By 21 October there were
ten. The first two:
- Delete merged branches. I asked why deleting branches was necessary. It isn’t: a merged branch is just a label. I said yes to cleaning them up, and now it does that after every merge without asking.
- Buttons, not typing. I often follow along on my phone, so I asked it to end each turn with clickable options (“push”, “merge”, “change something”) instead of making me type.
Each note records why, not just the rule. That’s what lets it handle cases the rule doesn’t name: “‘Push’ in a button still counts as being asked to push.”
5. Parallel agents: worktrees
One Claude Code session works on one folder. Two sessions in the same folder would edit the same files and trip over each other.
A worktreeA second working folder for the same repo, checked out on a different branch. Both share one history. solves that: a second folder for the
same repo, on its own branchA separate copy of the code where you can try a change without touching the live site.. Both share one git
history, so finished work merges back like any other branch. Claude Code
can create them itself, under .claude/worktrees/.
The analytics step was built that way, in a second session, while the first
was still polishing the homepage. This post is too: it was written in
.claude/worktrees/post-3 while another session worked on a different post.
Two things to watch. Pull main before merging, because the other session
may have merged first. And some things are shared between worktrees even
though the folders aren’t: git stash is one stack for all of them, so one
session can pop another’s stash.
6. Eyes and hands
Last, the things that let it check its own work and reach outside the repo.
- Screenshots. Before showing me a layout, Claude Code opens the page in a headlessA browser running without a window, controlled by a program. It can still load pages and take screenshots. Chrome at phone, tablet and desktop sizes and looks at the screenshots. That way it can catch layout problems before I see them. (Headless Chrome won’t make a window narrower than about 500 px, so for phone width it loads the page inside a 390 px-wide frame.)
- Vercel. A connectorModel Context Protocol: a standard way to plug outside tools, like your hosting account, into an AI agent. to my Vercel account let it buy and connect my domain and open the analytics. To check whether a deploy worked, it asks GitHub for the commit’s status, which Vercel reports there.
- Previews on my phone. It pushes the branch, Vercel builds a preview, it opens the link, and I look at it on my phone.
- Following along from anywhere. I use Claude Code in the terminal on my Mac, in the desktop app, and from my phone with Remote Control, which connects the Claude app to a session running on my Mac. The buttons from memory note #2 make the phone part easy.
What I haven’t set up
All of these came up in my chats, and I haven’t needed them yet:
- My own skills: saved instructions for a task you repeat, like “new post”. The advice I got was to do the task by hand twice before writing one.
- Plan mode: Claude Code proposes a plan and waits for a yes before touching any files.
Copy this setup
Claude Code drafted this post from its own config files, the git history and notes from my chats. I chose what went in.
Get new posts by email
My next AI experiment by email: what I built, what broke, and the honest result.
One email per new post, a few a month at most. No spam, unsubscribe anytime.
You'll get an email to confirm. Or follow along via RSS.

Comments · Sign in to start the discussion
Comments
Sign in to comment