The technical setup¶
This is the optional extra from the primer. It takes the same habits and builds them on GitHub, so every subject has a full history of every change and the assistant can read and save files directly. You'll want to be comfortable typing a few commands, but you don't need to be a programmer. If you'd rather not type any, GitHub without the terminal does the simple version in a web browser.
- A few words first
- How the pieces fit
- One repo per subject, plus an index
- The rules file
- Letting it save without asking
- Keeping it safe
- Handy extras
- When something doesn't work
- Getting set up in an afternoon
- Prompts to copy
- Going deeper
A few words first¶
- Git: a free program that saves every version of your files, each with a short note about what changed. Any earlier version is one step away.
- Repository, or repo: one folder that Git keeps track of.
- GitHub: a website that keeps an online copy of your repos. The free plan includes private repos.
- Commit: one saved change, with its note.
- Push and pull: sending your saved changes up to GitHub, and bringing new ones down to your computer.
- Branch: a side copy for trying out a change without touching the real thing. The
real thing is called
main. - Pull request and merge: a request to fold a branch into
main, and the folding in. - CLAUDE.md: the rules file Claude reads every time it opens a repo.
- Dry run: a mode where a script shows what it would do and changes nothing.
How the pieces fit¶
Here's the whole setup on one page, before the details:
You ask
│
▼
The assistant reads CLAUDE.md,
then works in the repo
│
├─ notes and documents
│ └─> saved straight to main
│ on GitHub
│
└─ scripts and settings
└─> a branch and a
pull request
│
▼
you look it over and
say "merge it" ──> main
main on GitHub
└─> sync.sh (or git pull)
└─> every computer you use
Four small things make it work:
| Piece | Its job | Where it lives |
|---|---|---|
CLAUDE.md |
The judgment: what goes straight to main, what waits for you, what's never saved |
The top of each repo |
.claude/settings.json |
The gate: which commands run without a prompt, and which never run | Each repo |
repos.txt and sync.sh |
Keeping every computer up to date with every repo | The library repo |
| The GitHub App | Letting an assistant that runs in the cloud reach your repos at all | Your GitHub account's settings |
Everything else is ordinary Git. If you've never used it, Working with Git covers the everyday commands and how to undo things.
One repo per subject, plus an index¶
This is habit 1 from the primer, done with Git. Each subject gets its own private repo, and one small "index" repo keeps the list of all of them:
your-folder/
├── library/
├── notes/
├── house/
├── cooking/
└── ...
library/is the index: the list of every repo, a sync script and starter files.notes/holds quick how-to notes, one file per topic.house/has the manuals, the repair log and project plans.cooking/has recipes and meal plans....stands for one more repo per subject, added the first time it comes up.
We weighed this against one big repo with a folder per subject. One big repo is simpler, but it's all or nothing on every computer, and it has one privacy setting for everything. One repo per subject gives each subject its own history and privacy, and keeps one subject's big files (photos, audio) from slowing down the rest. The cost is more repos to keep track of, and the index takes care of that.
Inside a subject repo¶
Every subject repo has the same shape:
cooking/
├── README.md
├── CLAUDE.md
├── .gitignore
└── <project>/
├── README.md
├── <files>
└── config.example.*
README.mdsays what's in here, one line per project folder.CLAUDE.mdis the rules file..gitignorelists the files Git should never save.-
Each
<project>/folder has its ownREADME.md, saying what it is and how to use it, its files, and aconfig.example.*with placeholder settings. The real settings file stays on your computer. -
One folder per project, each with its own
README.md. - A contents table in the top
README.md, one line per folder. Once a repo has a dozen or so folders, two changes editing that table at once start to collide. We fixed that with a hidden one-line description in each folder's README and a small GitHub Action that rebuilds the table after every merge (it's in Scripts and automation). Until then, editing it by hand is fine. - A
notesrepo for quick how-tos you'll want again: one Markdown file per topic, grouped in folders. A note that grows into something bigger moves into a subject repo. - An
IDEAS.mdfor the someday list, and ahandoffs/folder for where-we-left-off notes, namedYYYY-MM-DD-<topic>.md. - Work that belongs to a group (a club, a team, a volunteer group) goes in that group's own GitHub organization, so it never mixes with yours. One GitHub login can belong to both.
The index repo¶
The library repo holds:
- a
README.mdwith a table of every subject repo; repos.txt, the same list for the script, one repo per line;sync.sh, a small script that downloads any repo you don't have yet and updates the rest;template/, the starter files for a new subject repo.
On a new computer, that's all it takes:
git clone https://github.com/<your-account>/library.git
cd library
./sync.sh --dry-run # shows what it would do, changes nothing
./sync.sh # downloads what's missing, updates the rest
Ours puts the subject repos next to library and never overwrites changes you haven't
saved (it tells you and moves on). The whole script is in
Scripts and automation, ready to copy, or you can ask
your assistant for one with a dry-run mode. Either way, run the dry run yourself first.
Adding a subject¶
- Make an empty private repo on GitHub, with the README, .gitignore and license boxes unticked so it starts empty. (Our assistant couldn't create repos itself, so this was always our step. Yours may be able to.)
- Copy
library/template/into it and fill in the README. - Add it to
repos.txtand to the table in the index README.
The rules file¶
Claude reads CLAUDE.md at the top of a repo every time it starts working there. Other
assistants have their own name for it, such as AGENTS.md. These are the rules that
helped us most.
Where changes go
- Notes and documents (Markdown files, diagrams and their images) go straight to
main. There's no need to review a plan before you can read it. - Everything else, like scripts and settings, goes on a branch for you to look over
first. Tiny fixes, like typos, can go straight to
main. - When you say "merge it", it merges the branch without asking again.
- Before handing a branch over, it brings in the latest
mainand opens a pull request, so the merge goes cleanly. - It never rewrites history on
main. - Each saved change gets a plain note saying what changed and why.
Scripts
- Every script that changes anything has a
--dry-runmode. - You run the first test yourself. The assistant hands the script over with its dry-run command instead of running it on your real computer first.
Private details
- No passwords, keys or tokens in Git, ever.
- Anything specific to your home or office (network names, addresses, account names) is
read from a settings file that Git ignores. A
config.examplefile with placeholders sits next to it. - No real names of people or organizations; use placeholders such as
example.com. - Before old files go into Git for the first time, the assistant checks them for all of this and shows you what it found. Git remembers everything, so it's worth the check.
Keep the rules the same in every repo by changing the copy in library/template/ first.
A small check tells you when a repo's copy
has fallen behind. A ready-to-edit version is in
templates/CLAUDE.example.md.
Letting it save without asking¶
This is habit 3 from the primer, done with a settings file.
Even with good rules, the assistant had to stop and ask before every git push. So
"put the plan in the repo" really meant "put the plan in the repo, then wait for me to
come back and approve it". The fix comes in two parts:
| Part | What it does | Where it lives |
|---|---|---|
| The gate | Lets a push go through without a prompt, and blocks force pushes completely | .claude/settings.json in the repo |
| The judgment | Decides what can go straight to main and what goes on a branch for you |
CLAUDE.md |
Opening the gate doesn't change the judgment. Scripts still go on a branch, and the assistant still waits for you to say "merge it".
The gate: .claude/settings.json¶
Claude reads permission rules from .claude/settings.json in the repo. Ours:
{
"permissions": {
"allow": [
"Bash(git push *)",
"Bash(git -C * push *)",
"Bash(git -c push.negotiate=true push *)",
"Bash(git -C * -c push.negotiate=true push *)"
],
"deny": [
"Bash(git *push*--force*)",
"Bash(git *push* -f*)",
"Bash(git *push*+*)",
"Bash(git *push*--mirror*)",
"Bash(git *push*--delete*)",
"Bash(git *push* -d *)",
"Bash(git *push* :*)"
]
}
}
allowcovers the ways the assistant writes an ordinary push, so none of them stop for a prompt. Keep the-cforms pinned topush.negotiate=true, the one setting cloud sessions add. Don't widen them to-c *: a Git-csetting can make Git run another program, sogit -c * push *would let a push carry anything along with it.denycovers the common ways of writing a push that rewrites history or deletes:--force(and--force-with-lease),-f, a+in front of a branch name,--mirror,--delete,-d, and:branch. A deny rule wins over an allow rule, so those are refused even though ordinary pushes are fine. The patterns lean strict: a push that merely mentions a+is refused too, and you can run that one yourself.- Pattern rules can't catch every spelling (bundled flags like
-ufslip past), so treat this file as a seatbelt, not a wall. The technical edition has a hook that checks each push more carefully, and GitHub's own branch rules are the real wall (see keeping it safe). - It's a settings file, so add it on a branch and merge it like anything else.
To check it works, merge it, start a fresh session in that repo and ask for a small change to a note. If it saves and pushes without a prompt, it's working. If the session still asks once when it first opens the repo, that's a separate question about connecting, and this file only covers the push.
Where settings live¶
Claude reads its settings from a few places and combines them:
| File | Covers | Shared? |
|---|---|---|
~/.claude/settings.json |
Every repo on this computer | No, it's only on this computer |
.claude/settings.json in a repo |
That repo, wherever it's opened | Yes, it's saved in Git like any other file |
.claude/settings.local.json in a repo |
That repo, on this computer only | No, Git ignores it |
- Put the push gate in the repo's file. An assistant that runs in the cloud never sees the file in your home folder, but it does see the repo, so the repo's file is the one with the best chance of being read. Not every cloud session reads it, though (see keeping it safe).
- A deny anywhere wins. Rules from all the files are combined, and a deny in any of them beats an allow in another. So you can block something on one computer without touching the repo.
- Work computers may have one more layer. An organization can set rules of its own that no file of yours can change. If something you've allowed still asks, that may be why.
What can still go wrong¶
With pushes alone, nearly any mistake is a change you can undo. A push can also delete
a branch on GitHub, which is why the deny list blocks --delete, -d and :branch.
If you'd rather the assistant could delete branches when you ask, take those three out
and rely on the rules file's "ask before deleting". Keep your repos private and your
secrets out of them, and a bad push stays a small problem.
Keeping it safe¶
A short checklist. Most of it takes a minute, once.
- Private by default. Check each repo's visibility on GitHub. Making a repo public makes its whole history public too, including anything you deleted along the way.
- Two-factor sign-in on GitHub. Your repos are only as safe as your login.
- Only the repos it needs. When you install the assistant's GitHub App, choose "Only select repositories" and add repos one by one. Look over the list now and then.
- Secrets stay out. Settings files that hold anything private are in
.gitignore, with aconfig.examplebeside them. The secret check stops the common slips before they're saved. - No force pushes, no deleting branches without you. The gate's deny rules block the common forms of both.
- The gate works on your computer. Those deny rules only work where the assistant
reads
.claude/settings.json, which mostly means your own computer. Some cloud sessions read the repo'sCLAUDE.mdbut skip its settings. A rule that must hold everywhere belongs on GitHub's side. - GitHub's own rules, if your plan has them. GitHub can also refuse force pushes and
deletion of
mainon its side, through branch protection or rulesets. On the free plan that only works for public repos; private repos need a paid plan. Without them, checks on every change still flag problems before a merge, and the copy below is how you'd put things back. - A second copy of what matters. GitHub is a good backup of your computer, but for a
repo you'd hate to lose, keep a full copy somewhere else too.
A nightly copy at home keeps one of
every repo, and keeps old versions even after a force push. A plain
git clone --mirroris a start, but it lets those old versions be cleaned away within weeks. - A look now and then. Once a week or so, ask "what did you save this week?" or run
git log --since="1 week ago". It takes a minute, and you'll know what's in there.
Handy extras¶
- Where-we-left-off notes in the repo. Save them in
handoffs/with a status line at the top (open, done, or replaced by a newer note). The next session starts with one line:Read handoffs/2026-01-15-garden-watering.md in <account>/<repo> and follow it.Add a line toCLAUDE.mdtoo: before starting, checkhandoffs/for an open note on the same subject. - A sorting list for old files. Before importing an old folder, ask for a checklist in the repo with one line per file (keep, note, let go, ask). You tick the lines, and only ticked files get imported, each on its own branch, with any secrets moved out first.
- Your notes app, in Git. Markdown notes apps such as Obsidian keep their notes as a plain folder of files. Make that folder a repo, and the assistant can read and update your notes too.
- A plain folder for your repos. Keep them somewhere like
~/src, not inside iCloud Drive, Dropbox or OneDrive. Those services make duplicate files that confuse Git. - A ping on your phone. When the assistant in a terminal is waiting for your yes, a small hook can send a notification to your phone, so it doesn't sit there waiting. It's in Scripts and automation.
- Step-by-step skills on your account. A skill is a short file of steps the
assistant follows for a job you repeat, like writing a where-we-left-off note or
starting a new project folder. Skills saved inside a repo only work where that repo's
settings are read. Skills you upload to your Claude account work in the app and in
cloud sessions, and the terminal picks them up once you're signed in. Keep the rules
(what may happen without asking) in
CLAUDE.md, and put only the steps in the skill.
When something doesn't work¶
| What's happening | Likely cause, and the fix |
|---|---|
| It still asks before every push | The settings file isn't on main yet, or the session started before you merged it. Merge it, then start a fresh session in that repo. |
| It asks before a push only now and then | It wrote the push in a form your allow list doesn't cover. Ask which command it ran, and add that form. |
Git says your branch and origin/main have diverged |
Both sides have changes the other lacks, usually because something was saved from another computer. Don't force anything. Run git log --oneline main origin/main -5 to see both sides, then ask the assistant to explain the difference before anything is changed. git pull --rebase is the usual fix once you know what's there. |
| Two changes keep colliding in the README's contents table | The table is being edited by hand in two places at once. Let one change finish before the next starts, or set up the contents Action. |
Files like README 2.md appear |
The repo is inside iCloud Drive, Dropbox or OneDrive. Move it to a plain folder like ~/src. |
| The assistant can't see a repo | The GitHub App hasn't been given that repo. Add it in the app's settings on GitHub. |
| A password or key got saved into Git | Change the password or key right away, because the old one stays in the history. Then move it into the ignored settings file. Scrubbing it from the history is possible but fiddly, so ask for help before you try. |
Getting set up in an afternoon¶
- Make a free GitHub account. Install Git and the GitHub command-line tool, then sign
in with
gh auth login. - On GitHub, make empty private repos:
library,notes, and one or two subjects. - Connect your assistant to GitHub. For Claude, install the Claude GitHub App on your account and give it those repos.
- Paste prompt 1 below. It builds the index, the starter files and the rules.
- Download
libraryinto a plain folder like~/src, run./sync.sh --dry-run, then./sync.sh. - Paste prompt 2 to add the gate. Look over the branch, then say "merge it".
- Pick one project you've been putting off and ask for a plan. Do the tiny first step tonight.
Prompts to copy¶
1. Set up the library
I've made empty private GitHub repos: library, notes,
<subject-1>,<subject-2>. Set them up as a personal library, one repo per subject:
- library: a README with a table of the subject repos; repos.txt with one repo per line; sync.sh, which downloads missing repos next to library and updates the rest (never overwriting unsaved changes, with a --dry-run mode); and a template/ folder with a README, CLAUDE.md and .gitignore for new subject repos.
- notes and each subject repo: a README, CLAUDE.md and .gitignore from the template.
Use the rules file I'm pasting below for every CLAUDE.md. The repos are empty, so the first version can go straight to main. Don't run sync.sh; give me its dry-run command.
<paste templates/CLAUDE.example.md here>
2. Let it save without asking
In
<repo>, add .claude/settings.json with the push gate from the primer's GITHUB.md: ordinary pushes run without a prompt (including git -C<folder>push and git -c push.negotiate=true push), and force pushes, mirror pushes and branch deletes are denied. Don't allow git -c with any other setting. Put it on a branch for me to look over, and tell me how to test it in a new session.
3. Where we left off
We're stopping here. Write a where-we-left-off note in
<repo>/handoffs/ from the template: status, what to read first, where things stand, what's decided, what's still open, and exactly one next step. Then give me the one line that starts the next session.
The starter files for this setup (CLAUDE.md, .claude/settings.json, .gitignore and
repos.txt) are in templates/README.md.
Going deeper¶
- Working with Git: the everyday commands, how to look over a branch, how to put things back, and what to do when Git says no.
- Scripts and automation: the full sync script, a check that catches secrets before they're saved, and a contents table that keeps itself up to date.
- This website: how these pages become a website, and how to publish your own copy for free on DigitalOcean.
- The technical edition: the habits for engineers working with coding agents, with permission rules, hooks, sandboxes, evals and worked examples.
← Back: GitHub without the terminal · Next: Working with Git → · Back to the start