Works with the AI Agents you already use

    Safe Merge Loop: Cross-Model Code Review Gate

    by ZAINSHAZ

    1

    A merge gate, not just a review.

    Free

    Security scanned
    Safe Merge Loop: Cross-Model Code Review Gate

    Safe Merge Loop: Cross-Model Code Review Gate

    Example session with this skill installed

    Use the safe-merge-loop skill. Checker: agy. Slug: fix-due-dates.
    Task: fix overdue() so a note due today is not overdue, and make sort_by_due() put the soonest date first. python test_notes.py must pass.

    • Read your context and instructions
    • Compiled the safe merge loop

    Summary

    Passed the agy check in round 1 of 3. python test_notes.py prints "all tests pass". main was not touched; the merge commands were shown, not run.

    What changed (branch sml/fix-due-dates, notes.py)

    FunctionBeforeAfter
    overdue()n["due"] <= todayn["due"] < today
    sort_by_due()sorted(..., reverse=True)sorted(...)

    REVIEW-LOG.md

    
    # Review log: fix overdue() so a note due today is not overdue, and make sort_by_due() put the soonest date first.
    - Repo: pebble-notes | Base: main | Branch: sml/fix-due-dates | Max rounds: 3
    - Builder: Claude | Checker: Antigravity CLI (agy) | Timeout: 600 s
    
    ## Round 1
    - Commit: 55719f5
    - Files: notes.py
    - Verdict: SAFE TO MERGE
    - Checker said:
        REASONS:
        none
    
    ## Result: PASSED in 1 round(s)
    

    To merge (you run these; the skill never does)

    cd "<your repo>"
    git checkout main
    git merge --no-ff sml/fix-due-dates
    git worktree remove "<your repo>-sml-fix-due-dates"
    

    When the checker says no

    In a second run with the round cap set to 1 and only half the fix made on purpose, agy answered NOT SAFE with notes.py:19 - sort_by_due() was not changed - remove reverse=True. The loop stopped, handed the problem to the human and kept the worktree for inspection.

    Next steps

    Run the merge commands above, then delete the branch with git branch -d sml/fix-due-dates. Logs stay in sml-runs\ as your audit trail.

    REVIEW-LOG.md

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A merge gate, not just a review. Claude Code builds your change in an isolated git worktree. A different model (Antigravity CLI or Gemini CLI) reviews the diff in read-only mode and must end with exactly SAFE TO MERGE or NOT SAFE. A PowerShell script reads that verdict, not the agent, and anything unclear counts as NOT SAFE.

    What you get

    • Main is never touched. The skill shows you the merge commands; you run them.
    • Up to 3 fix rounds (set 1–5), then it hands the problem to you.
    • A plain-English REVIEW-LOG.md for every run, next to the exact diff, checker input and checker output.
    • Fails closed: checker errors, timeouts, empty answers, edits by the checker, a changed reviewer prompt, or the gate phrase inside the diff all stop the run.
    • Built and tested on Windows with PowerShell 7. No bash, no WSL.

    Why a second model

    A model reviewing its own code shares its own blind spots. A reviewer from a different provider catches different bugs, and a gate it must pass beats advice you can ignore.

    Tested

    Windows, Claude Code + Antigravity CLI 1.5.19. A normal run passed in 1 round; a round-cap run handed off correctly. Includes a made-up demo repo so you can try it in 2 minutes.

    Requirements

    Windows, PowerShell 7 (winget install --id Microsoft.PowerShell), git, Claude Code, and one checker CLI installed and signed in: Antigravity CLI (agy, tested) or Gemini CLI (gemini, built from its documented flags, not yet tested with the real CLI).

    Network use

    The helper script makes no network calls. The checker CLI you choose sends the reviewer prompt and the diff to its model provider (Google) under your own account. Claude Code sends your code to Anthropic as usual. Nothing asks for or stores API keys.

    Known limitations

    Windows + PowerShell 7 only. One checker per run. The checker can be wrong, so disputed findings go to you. The Gemini CLI path is not yet tested with the real CLI.

    Open source under the MIT license (repo: zain-zilla/safe-merge-loop on GitHub).

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    • Free with an Agensi account

    Windows only

    Software
    GitPowerShell 7Claude Code
    Antigravity CLI
    orGemini CLI

    Windows ships PowerShell 5.1; install 7 with: winget install --id Microsoft.PowerShell. Sign in to agy or gemini once before the first run. The checker CLI sends the diff to Google under your own account.

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access

    Terminal: runs git and the PowerShell helper script. Read/Write files: the agent edits code only inside a new git worktree; logs go to an sml-runs folder next to the repo. Network: the helper script makes no network calls; the checker CLI you choose (agy or gemini) sends the reviewer prompt and diff to Google under your own account.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    The agent builds only inside a new git worktree on its own branch. A different model reviews the diff, and a PowerShell script (not the agent) reads its last line. Only the exact phrase SAFE TO MERGE passes. Even then, the skill only shows you the merge commands; you run them.

    Windows with PowerShell 7 (winget install --id Microsoft.PowerShell), git, Claude Code, and one checker CLI that you have signed in to once: Antigravity CLI (agy, tested) or Gemini CLI (gemini). No API keys are asked for or stored.

    A worktree folder next to your repo (<repo>-sml-<slug>) and a run folder (sml-runs\<repo>-<slug>) outside every repo. The run folder holds REVIEW-LOG.md (plain English, one entry per round), the exact diff, the checker's input and output, the locked reviewer prompt and state.json.

    The agent fixes only the listed reasons and checks again, up to the round cap (3 by default, 1–5 allowed). Then it stops and hands the problem to you with the open reasons, the log and the worktree kept. If the agent disagrees with a finding, it marks it disputed instead of changing code, and you decide.

    In Claude Code, inside your repo, say: "Use the safe-merge-loop skill. Checker: agy. Slug: fix-date-sort. Task: <what to build or fix>. <how to check it, e.g. the tests that must pass>." Optional: Max rounds, Base branch, Timeout. The repo must have no uncommitted changes when you start.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.

    Free