agentleFS
SamuelNDCESamuelNDCE/ai-workbench/skills/public-repo-leak-retraction/SKILL.md

Public Repo Leak Retraction

Skill1 starsChanged 4 months agoMITView on GitHub

Something business-identifying, client-identifying, or secret already got pushed to a public repo. Scrub current files, rewrite git history to remove it everywhere, force-push, and verify zero trace via GitHub code search. Use when asked to get something out of a public repo 'with no trace', this is reactive, after-the-fact cleanup, not pre-publish prep (see opensource-pipeline for that).

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't assume the wording is identical everywhere.

    line 17
  2. Distinctive:

    2. Fix the working tree first, with a normal commit: Remove/genericize the current files, commit, push normally.

    line 19
  3. Very specific:

    Use broad single-word substring rules (e.g.

    line 30
  4. Distinctive:

    Check for legitimate unrelated uses of the term being scrubbed before a blanket replace (e.g.

    line 31
  5. Very specific:

    5. Verify, don't assume, run it twice: After the first pass, re-grep the full rewritten history (git log --all -p | grep -i "<term>").

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Public Repo Leak Retraction

Reactive cleanup for a repo that's already public and already contains something it shouldn't. Different from a project's initial "sanitize before first release" pass: this assumes the repo has real history that needs surgery, not just a working-tree fix.

Procedure

1. Find every occurrence, in content AND commit messages, not just the obvious file.

git log --all -p | grep -i "<term>"           # every historical variant, in diffs
git log --all --format='%H %s%n%b' | grep -i "<term>"   # commit message mentions too

Don't assume the wording is identical everywhere. Check all historical variants before writing replacement rules.

2. Fix the working tree first, with a normal commit. Remove/genericize the current files, commit, push normally. This gets the live HEAD clean immediately, before touching history (which takes an extra step and a force-push).

3. Rewrite history with git-filter-repo (not filter-branch, deprecated and much slower):

git filter-repo --path <leaked-file-or-dir> --invert-paths \
  --replace-text <content-rules-file> \
  --replace-message <message-rules-file> \
  --force
  • --replace-text: literal substitutions applied to file content across every historical blob.
  • --replace-message: same syntax, applied to commit/tag messages, easy to forget, and old commit messages often repeat the exact term you just scrubbed from content.
  • Use broad single-word substring rules (e.g. BusinessName==>the-store) rather than trying to match every phrasing variant exactly. It's safer and catches variants you didn't enumerate.
  • Check for legitimate unrelated uses of the term being scrubbed before a blanket replace (e.g. a generic platform name used elsewhere for a real, unrelated technical reason). Don't collateral-damage content that has nothing to do with the leak.

4. Filter-repo removes the origin remote as a safety measure. Re-add it and force-push:

git remote add origin <url>
git push --force origin main

5. Verify, don't assume, run it twice. After the first pass, re-grep the full rewritten history (git log --all -p | grep -i "<term>"). It's common to catch content on pass one but miss commit-message-only mentions; add a second --replace-message rule and re-run rather than assuming clean.

6. Confirm zero-trace on the live remote, not just locally:

gh api "search/code?q=<term>+repo:<owner>/<repo>" --jq '.total_count'

GitHub's code search index can lag slightly, but combined with your own full-history grep this is strong confirmation.

Constraints

  • This force-pushes and rewrites commit SHAs. Get explicit confirmation before running it, especially on a repo other people may have cloned. It is not silently reversible for anyone who already has a copy.
  • Apply to every mirror/fork of the repo you control, not just the primary one. Inconsistent copies defeat the point.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.