stale-patch-reconciliation

Reconcile stale patches against a moving git checkout through read-only analysis and isolated repair.

115|9|Updated Aug 5, 2026
One-click install
npx skills add https://github.com/AtlasOmnia/donna-starter --skill stale-patch-reconciliation-atlasomnia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stale-patch-reconciliation
Source: https://github.com/AtlasOmnia/donna-starter/tree/main/skills/software-development/stale-patch-reconciliation
Command: npx skills add https://github.com/AtlasOmnia/donna-starter --skill stale-patch-reconciliation-atlasomnia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Patches and diffs go stale as upstream code evolves, and blindly applying them to a dirty or changed checkout corrupts work. This Skill determines whether a patch is still needed, whether upstream already contains the change, what drifted since it was written, and how to regenerate it safely against the current baseline. ## Core Features & Use Cases - Read-only analysis mode: Uses git history archaeology (git log -S, ancestry tests, per-file git apply --check) to classify each hunk as context-compatible or failed, and attributes drift to specific upstream commits. - Authorized repair mode: Rebuilds the patch in an isolated detached worktree using three-way apply, runs focused gates, regenerates the artifact from an explicit file allowlist, and verifies forward and reverse apply before touching the live checkout. - Concurrency safety: Detects snapshot branches with no shared ancestry, protects pre-existing dirty files, and re-verifies the tree at the end to catch concurrent writers. - Use Case: A developer returns to a month-old fix-parser.diff after upstream refactored the parser API. The Skill identifies which hunks still apply, explains that upstream renamed the target functions, and regenerates a clean patch against current HEAD. ## Quick Start Ask the agent to reconcile the stale patch file 'fix-parser.diff' against the current HEAD and report whether upstream already contains the change.

Frequently Asked Questions about stale-patch-reconciliation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if a patch still applies to current code?

Run git apply --check with the patch file to validate without modifying anything. For per-file detail, loop over the files listed in the diff headers and run git apply --check --include on each, marking files as OK or FAIL to find where rework is needed.

How to tell if upstream already contains my patch changes?

Use git log origin/main -S'<feature-string>' to search for the change on the upstream branch; an empty result means it is not upstream. Local or private feature branches carrying the commits do not count as upstream, so always check origin/main specifically.

Why does git merge-base return empty for my branch?

An empty merge-base usually means the branch is built on a parentless snapshot commit sharing no ancestry with HEAD. Confirm with git log --format='%h parents: %P' -1; in that case treat the branch's cumulative diff as the feature and ignore lineage-based comparisons.

Can I safely apply a stale patch to a dirty working tree?

No, trial-applying a stale patch directly to a dirty authoritative checkout risks corrupting unrelated work. Create a clean detached worktree from current HEAD, use git apply --3way there, resolve conflicts preserving upstream behavior, and only apply to the live tree after clean and reverse checks pass.

Why does git apply --check seem to pass but the patch fails?

When piped through commands like head, the exit code reflects the last pipeline command, not git apply. Read the actual error output text instead of relying on $? to determine whether the patch truly applies.