# Merge Loss Guard

> Dry-run any git merge and prove nothing was lost: reverted merges, forbidden branches, deleted files and dropped lines.

Merge Loss Guard is a free AI agent skill on Agensi by Nahid hossain. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Nahid hossain](https://www.agensi.io/creators/nahid-hossain)
- Version: 1.0
- Last updated: 2026-12-02
- Security: scan passed (2026-12-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/merge-loss-guard
- Tags: git, merge, safety

## About this skill

### The problem
Merges lose work quietly. A merge that was reverted earlier leaves its work out when you merge again. A branch started from the wrong place brings in commits nobody meant to ship. A conflict resolved by "take theirs" drops the other side's fixes.

### What it does
- Previews the merge before it happens without changing your branches
- Finds reverted merges and commits that a plain merge would silently skip
- Flags commits from branches that must never reach the target
- Lists files the merge deletes and files that lose many lines
- After you resolve conflicts, lists every line either side added that is missing from the result
- Proves the finished merge kept everything and that the tests pass

### Why not just prompt your agent?
An agent will merge and report success. This skill adds a read-only preview and a line-by-line check that shows exactly what was lost.

### Works with
Any git repository. Needs git 2.38 or newer and Python 3.8 or newer.

### Test prompts
- Merge feature/payments into main.
- We reverted that merge last week and now want it back in.
- Code went missing after the merge. Find what was lost.
- Merge this branch but nothing from the experimental branch may come along.

### Safety
It never commits, pushes, resets or switches branches without your approval. The script only reads and uses no network.

### Where it stops
It reports what is missing but cannot judge whether a dropped line was meant to go, so you confirm each one.

## Requires

- Git

## Known limitations

Looks for reverts only in the last 3,000 commits of the target branch. Compares added lines of 4 or more characters, so very short lines, meaning changes and binary files are not checked, and a line moved elsewhere in the same file counts as present. Lines replaced on purpose are listed too, so review each one. A commit cherry-picked from a forbidden branch is not recognised as coming from it. Needs git 2.38+ and Python 3.8+. Review all changes.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Merge Loss Guard skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill prevent code from going missing during a complex merge?

This skill performs a read only dry run of a git merge to identify reverted work that might be silently skipped, forbidden branch contamination, and accidental data loss during conflict resolution. It provides mathematical proof that every intended line of code survived the merge process rather than relying on LLM guesswork.

### What software versions are required to run these merge checks?

You need a repository running Git 2.38 or newer to use the preview features, along with Python 3.8 or higher to execute the included guard script. If you are using an older version of Git, the skill will instead guide the agent to perform the merge in a temporary throwaway worktree folder.

### What kind of report or output should I expect to see?

The skill produces a verdict report that flags specific findings like reverted work, forbidden commits, and conflicted files. It also provides a list of specific git commands to resolve these issues, such as revert-the-revert or selective cherry-picking, followed by a proof report showing any lines lost during the process.

### Are there any specific git workflows that this skill does not support?

This skill is not designed for rebasing or performing squash-merges. It focuses specifically on standard git merges and requires user approval before any commands that change branches, such as reverts or cherry-picks, are executed.

### How do I tell my agent to start a merge using these safety checks?

You can prompt your agent to merge one specific branch into another while checking for data loss. You should also mention if there are any specific branches, such as private or experimental tracks, that must never be allowed to reach your target branch.

### Does it change my repository?

No. The script only reads. Branch changes happen only after you approve them.

### What if my git is than 2.38?

The skill falls back to a merge in a throwaway worktree.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
