agentleFS
cyfung1031cyfung1031/skills/ai-dev-loop-sanitize-commits/SKILL.md

ai-dev-loop-sanitize-commits

Skill2 starsChanged 5 months agoMITView on GitHub

Sanitize unpushed local git commits from ai-dev-loop R/K loops. Use when a branch has local `R:` or `K:` commits and an agent needs to remove `.ai-dev-loop/*` artifacts, rewrite human-readable commit messages, preserve authors/dates, and prepare history before push or review.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use this skill before sharing a branch that contains ai-dev-loop review/response commits.

    line 10
  2. Distinctive:

    If any generated commit message is not good enough, create a JSON override file:

    line 32
  3. Very specific:

    Do not run rewrite --apply on a dirty worktree unless the user explicitly asks for --allow-dirty.

    line 65
  4. Very specific:

    Do not sanitize pushed commits.

    line 66
  5. Very specific:

    Do not create backup branches, temporary branches, or switch branches.

    line 67
  6. Very specific:

    Prefer --target-tail for ai-dev-loop review/response commits stacked at HEAD.

    line 68
  7. Distinctive:

    Do not use this on merge-heavy local history unless the script reports support for it.

    line 69
  8. Very specific:

    Keep the default --keep-empty-targets behavior when preserving commit count and timestamps matters.

    line 70
  9. Distinctive:

    Prefer message overrides for important commits.

    line 71

≈ “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

AI Dev Loop Commit Sanitizer

Version: 1.0.2

Use this skill before sharing a branch that contains ai-dev-loop review/response commits.

The bundled script rewrites only local, unpushed commits selected from the current branch. It removes .ai-dev-loop/* files from targeted R:/K: commits, sanitizes commit subjects and bodies, and recreates commits with the original author, committer, author date, and committer date.

v1.0.2 requirement: do not create branches and do not switch branches while using this skill. The script rewrites by building commit trees, updating the current branch ref in place, and syncing a clean worktree/index to the rewritten HEAD; it prints the original HEAD for recovery through the reflog.

Workflow

  1. Inspect the branch state. If the branch has no upstream, or the only commits to sanitize are the contiguous R:/K: commits at HEAD, prefer --target-tail:
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py plan
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py plan --target-tail
  1. Preview the rewrite:
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite --target-tail
  1. If any generated commit message is not good enough, create a JSON override file:
{
  "014e52f1": "fix pageLoadCaches visibility and cache tests\n\nMake pageLoadCaches private and add cache-path coverage for getScriptsForTab.\n\nTests: 969 pass."
}

Then preview again:

python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite --message-overrides /path/to/messages.json
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite --target-tail --message-overrides /path/to/messages.json
  1. Apply only after the preview is correct:
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite --apply --message-overrides /path/to/messages.json
python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py rewrite --apply --target-tail --message-overrides /path/to/messages.json
  1. Verify the result:
git log --stat --format=fuller <base>..HEAD
git log --name-only <base>..HEAD -- .ai-dev-loop

The second command should produce no .ai-dev-loop paths.

Rules

  • Do not run rewrite --apply on a dirty worktree unless the user explicitly asks for --allow-dirty.
  • Do not sanitize pushed commits. The script determines the default base from @{upstream} and refuses commits already reachable from remote refs.
  • Do not create backup branches, temporary branches, or switch branches. In v1.0.2 the script must keep the current branch checked out, use git update-ref only after the new commit chain is built, and sync a clean worktree/index to the rewritten HEAD.
  • Prefer --target-tail for ai-dev-loop review/response commits stacked at HEAD; it avoids scanning or replaying earlier pushed commits when the branch has no upstream or a PR ref has unusual topology.
  • Do not use this on merge-heavy local history unless the script reports support for it. The rewrite path is intentionally linear-history only.
  • Keep the default --keep-empty-targets behavior when preserving commit count and timestamps matters. Use --drop-empty-targets only if the user explicitly wants artifact-only R: commits removed.
  • Prefer message overrides for important commits. The built-in sanitizer is conservative text cleanup, not a semantic commit-message author.
  • Record the printed Original HEAD after rewrite --apply; use the reflog or git update-ref refs/heads/<branch> <original-head> to recover if needed.

Script

Run:

python3 <skill>/scripts/sanitize_ai_dev_loop_commits.py --help

Useful features:

  • plan: list local unpushed commits and show which commits match the target prefixes.
  • rewrite: dry-run by default; add --apply to rewrite the branch.
  • --target-tail: infer the contiguous R:/K: commit tail at HEAD and use its parent as the base. This is the fastest and safest mode for local ai-dev-loop cleanup.
  • --base <rev>: choose the base explicitly instead of using @{upstream}.
  • --range <rev-range>: inspect a custom range such as main..HEAD.
  • --message-overrides <json>: supply exact replacement messages by full or short SHA.
  • --drop-empty-targets: drop targeted commits that become empty after artifact removal.
  • --artifact-path <path>: remove another artifact directory in addition to the default .ai-dev-loop.

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.