Skip to main content
coreydaley.dev

Making my Claude config public

gitleaks found nothing in my Claude Code config’s history. That was the problem.

In June I folded agent-config, my Claude Code configuration, into my private dotfiles repo under a claude/ folder. One repo, one make all, done. It was tidy, and it was private, which meant I stopped thinking about what went into it. This week I split it back out and made it public again. The split took one command. Making the result safe to publish took the rest of the week, and almost none of that time went to secrets.

Splitting it back out

The mechanical part was pleasantly boring:

git subtree split --prefix=claude -b agent-config-split

git subtree split rebuilds a history containing only the commits that touched claude/, with paths rewritten as if that folder had always been the repo root. Because the merge had kept the original agent-config history, the split fast-forwarded cleanly onto the old agent-config main, with all 172 commits intact. I re-pointed the ~/.claude symlinks at the new checkout and Claude Code never noticed.

Then I had to decide whether that history was something I was willing to publish.

Nothing secret isn’t nothing personal

The first pass was the obvious one: gitleaks over the full history. Clean. No tokens, no keys, no .env files.

That’s where I could have stopped, and I think it’s where a lot of people do stop. But a secret scanner answers one narrow question: is there a credential in here? It says nothing about whether the repo is something you want strangers reading. So I did the tedious thing and audited the full history manually: every version of every file, not just HEAD. By then, with the week’s hardening commits on top of the split, that was 2,323 file versions across 176 commits.

I found three things gitleaks was never going to flag:

  1. Proprietary files. At one point I had vendored Anthropic’s docx, pptx, pdf and xlsx skills into the repo. Their license reads “All rights reserved.” I deleted them months ago, but deleted isn’t gone. Every one of those files was still in history, one git checkout away.
  2. A map of my old home lab. Earlier versions of the config pointed at self-hosted Forgejo and Outline instances, my Mac mini’s hostname, and internal IP addresses. All decommissioned, none of it secret, and together a tidy little network diagram of my house.
  3. My personal email on every commit. Not in any file. In the author field of every commit.

The commit messages were clean too, which I’d rather confirm than assume.

The lesson I keep relearning: deleting a file only changes the next snapshot. Every earlier commit still has it. If you ever committed something you wouldn’t publish, removing it from HEAD does nothing for a public history.

Fixing the present first

Some of the personal details weren’t history at all. They were live config. My xcuitest-on-mini skill, which runs UI tests on a Mac mini over SSH, had the mini’s hostname baked in. Now it reads XCUITEST_ON_MINI_HOST from the environment, and that variable is set in my private dotfiles. The public skill says what it needs; the private repo says where it is.

I wrote that into the repo’s CLAUDE.md as a rule: no secrets, personal details or machine-specific values in the public config; read them from the environment. That matters more than usual here, because the config is also instructions to the agent that edits it. Claude reads the rule before it writes the next skill.

Rewriting history, carefully

With HEAD clean, the job was to make the past match it. I used git filter-repo, the git project’s recommended replacement for filter-branch. The rewrite:

  • dropped 16 vendored skill folders from every commit: the proprietary ones, plus third-party Apache-2.0 skills that were legal to redistribute but dead weight I no longer used;
  • replaced the Mac mini’s hostname with a placeholder;
  • replaced internal IPs with addresses from 192.0.2.0/24, the TEST-NET-1 range reserved for documentation;
  • replaced absolute /Users/<name>/ paths with ~/;
  • applied a mailmap that rewrote my author email to my GitHub noreply address.

The check I cared about most was that the HEAD tree came out byte-identical. The rewrite was supposed to change the past, not the present, and comparing tree hashes before and after proves it did exactly that. A few commits that had only touched vendored skills became empty and dropped out, leaving 173, and the repo shrank from 5.9 MB to 3.1 MB.

Before pushing, I made a git bundle backup of the original history. Then I pushed with --force-with-lease, which refuses to overwrite the remote if it changed since I last fetched, and pinned the repo-local user.email to the noreply address so the next commit doesn’t quietly undo the mailmap.

One honest caveat: a rewrite only fixes the copy you control. agent-config was public before the June merge, so I have to assume some of this was already out there. Anyone who cloned or forked it still has the old history, and GitHub can keep old commits reachable by SHA. The rewrite stops me from publishing these things again; it doesn’t unpublish them. If you’re doing this for a repo that has never been public, you’re in a much better position. Do it before the first push.

Guarding the denylist

Hooks keep the repo clean from here on, and the safety hooks docs cover them in detail. The short version: alongside gitleaks, a personal-info check blocks generic patterns on staged lines: *.local hostnames, private IPs, email addresses, phone numbers and /Users/<name>/ paths.

Generic patterns can’t catch everything. They don’t know my family’s names, my employer, or a side project’s codename. For that, the check reads a private denylist: a file of regexes under ~/.config/, mode 600, outside the repo.

Here’s the catch. The list of things you want to hide is itself one of the most sensitive files you own. It’s a neatly curated index of exactly what matters to you. If it ever got committed, the hook would have published the very thing it exists to protect.

So the check guards the denylist from itself:

  • any file named like *denylist* is blocked;
  • the marker line the setup script writes at the top of the denylist is blocked;
  • any line that’s a verbatim copy of a denylist pattern is blocked;
  • none of those can be allowlisted.

When a denylist pattern matches, the check reports the file and line number but doesn’t echo the line. Otherwise the hook’s own output would leak the match into terminal scrollback, CI logs, or an agent’s context window.

A slow hook is a skipped hook

My first version of the personal-info check was bash. It looped over lines and ran a grep per line per pattern, which on a full-repo scan meant thousands of process launches and more than five minutes. A pre-push hook that slow doesn’t protect anything, because you start reaching for --no-verify.

The Python rewrite compiles every pattern once and scans the whole repo in about 0.4 seconds. The fast version is the one that actually runs.

Defense in depth

The final setup has four layers, each covering for the one before it:

LayerWhat it scans
pre-commitblocked file types, gitleaks protect --staged, personal-info check on staged lines
pre-pushgitleaks over full history, personal-info check on all tracked files
CIthe same scans, with gitleaks downloaded and checksum-verified
GitHubsecret scanning and push protection

Local hooks can be skipped with --no-verify, so CI is the backstop. CI can’t see the private denylist, so it runs only the generic patterns. GitHub’s push protection catches provider tokens even if everything else is bypassed. I wanted its non-provider pattern scanning too, the generic checks for things like private keys and connection strings, but that isn’t available on a personal account.

An honest README

The last piece was documentation. I rewrote the README to match what’s actually in the repo, and it now opens with a warning: settings.json is deliberately permissive. It allows every tool. That’s my machine and my risk tolerance, and nobody should copy it as-is. A public config is something people borrow from, so the risky parts need a label.

The checklist

If you’re about to publish a repo that started life as private, here’s what I’d do again:

  1. Scan for secrets, then keep going. A clean gitleaks run is the floor, not the finish.
  2. Audit history, not just HEAD. Deleted files are still there.
  3. Check the licenses of anything you vendored. “All rights reserved” in a deleted folder is still redistribution once the history is public.
  4. Look at commit metadata. Your author email is on every commit.
  5. Fix the present first. Move machine-specific values into environment variables set somewhere private.
  6. Back up, then rewrite with filter-repo. A git bundle costs nothing.
  7. Verify HEAD is unchanged, then push with --force-with-lease.
  8. Keep a private denylist, and protect it from itself.
  9. Layer the checks. Local hooks for speed, CI for when hooks get skipped, platform scanning as the last net.
  10. Make the README honest about anything risky to copy.

The repo is back at github.com/coreydaley/agent-config.

What’s sitting in your repo’s history that a secret scanner would never flag?

Related posts