harvest-agent-branches
Skill1 starsChanged 3 months agoMITView on GitHub
Inspect and recover coherent work from stale, divergent, abandoned, or oversized agent branches and worktrees without overwriting newer target changes. Use before a risky wholesale merge.
In this repository10 other files it gives its agents.
- adversarial-reviewSkill
- checkpoint-walkthroughSkill
- context-prunerSkill
- decision-reconSkill
- deep-planSkill
- evidence-retrospectiveSkill
- idea-forgeSkill
- reasoning-codebase-reviewSkill
- steward-brownfieldSkill
- trace-data-provenanceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. About 0 are common, 26 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈26
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Treat an agent branch as evidence about intended changes, not as a patch that deserves to land whole.
- Distinctive: line 13
Keep inspection read-only.
- Distinctive: line 14
Delete a branch or worktree only when explicitly requested and after establishing durable recovery.
- Distinctive: line 15
Stop for a user decision when it is unclear whether a source feature is still wanted.
- Distinctive: line 19
Read repository instructions, glossary or context files, ADRs, architecture notes, current plans, and available architecture indexes before …
- Distinctive: line 29
every worktree path, branch, HEAD, and dirty state.
- Distinctive: line 33
Use read-only Git evidence such as:
- Distinctive: line 52
Before implementing a slice, classify every path in that slice and its dependency closure individually.
- Distinctive: line 53
Before declaring the whole branch harvested or deleting it, classify every changed path individually.
- Distinctive: line 55
Create a compact ledger:
- Distinctive: line 60
Do not let uninspected paths disappear from the inventory.
- Distinctive: line 62
Treat a target-untouched path as eligible for whole-file or commit transfer only after confirming the source change is coherent and …
- Distinctive: line 64
Treat a source-side deletion as a possible regression.
- Distinctive: line 68
Read the actual diffs, especially deletions.
- Distinctive: line 83
When asked for the first slice, choose the smallest independently valuable or enabling behavior with a complete dependency closure and low …
- Distinctive: line 85
Before splitting or moving modules, search test patch targets and imports.
- Very specific: line 98
Use an isolated worktree pinned to the target SHA unless the current workspace is already a clean, dedicated worktree for this task.
- Distinctive: line 100
Keep slices small enough to review and revert independently.
- Distinctive: line 110
Run compatibility tests against previous persisted shapes for reader changes.
- Distinctive: line 111
Run database-specific checks when SQLite cannot represent locks, JSON operators, defaults, constraints, or cascades.
- Distinctive: line 112
Run platform-specific checks on the real platform for filesystem identity, process, lock, launcher, or path behavior.
- Distinctive: line 113
Run contract, golden, architecture-boundary, and end-to-end tests for cross-cutting owners.
- Distinctive: line 119
Before deleting any source ref:
- Distinctive: line 124
Verify the recovery route resolves to the recorded tip.
- Distinctive: line 125
Delete only the exact authorized ref.
- Distinctive: line 128
Do not remove the isolated worktree until it is clean and every useful artifact is committed, copied to an approved location, or …
- Distinctive: line 142
Do not describe a partial port as a completed branch harvest while unclassified source changes remain.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Harvest Agent Branches
Treat an agent branch as evidence about intended changes, not as a patch that deserves to land whole. Transfer coherent intent onto the current target one reviewable slice at a time.
Bound the authority
- Distinguish inspection, local harvesting, publication, deployment, and cleanup.
- Keep inspection read-only. Treat permission to implement as permission for local branch/worktree changes only; do not infer permission to push, open a PR, deploy, mutate live data, or delete refs.
- Delete a branch or worktree only when explicitly requested and after establishing durable recovery.
- Stop for a user decision when it is unclear whether a source feature is still wanted. Do not rescue work merely because it exists.
Read the target's rules first
Read repository instructions, glossary or context files, ADRs, architecture notes, current plans, and available architecture indexes before classifying changes. Use the repository's vocabulary and preserve its accepted decisions.
Pin the evidence
Resolve and record before editing:
- source ref and full commit SHA;
- target ref and full commit SHA;
- merge-base SHA;
- every worktree path, branch, HEAD, and dirty state;
- relevant remote or PR recovery ref;
- whether either ref moved during the investigation.
Use read-only Git evidence such as:
git rev-parse --verify 'source-ref^{commit}'
git rev-parse --verify 'target-ref^{commit}'
git merge-base source-sha target-sha
git worktree list --porcelain
git log --left-right --cherry-pick --oneline target-sha...source-sha
git diff --name-status -M -C merge-base..source-sha
git diff --name-status -M -C merge-base..target-shaInspect status inside every relevant worktree. Never stash, reset, clean, switch, or overwrite a shared checkout. Preserve unrelated dirty and untracked files. Fetch an exact missing ref when needed; avoid pruning unrelated refs.
Build a path matrix
Inventory the whole branch before choosing a transfer method. Match detail to the request:
- For an initial comparison, cleanup assessment, or request for the first slice, cluster every changed path by concern and inspect the proposed slice path-by-path.
- Before implementing a slice, classify every path in that slice and its dependency closure individually.
- Before declaring the whole branch harvested or deleting it, classify every changed path individually.
Create a compact ledger:
| Path or concern | Source change | Target change since base | Contract role | Decision | Slice |
Do not let uninspected paths disappear from the inventory. Include deletions, renames, migrations, generated files, tests, configuration, and documentation.
- Treat a target-untouched path as eligible for whole-file or commit transfer only after confirming the source change is coherent and adjacent contracts did not change.
- For a path changed on both sides, inspect the base, source, current target, and
git log merge-base..target -- path. Port intent additively onto the target. - Treat a source-side deletion as a possible regression. Prove zero callers or identify the current replacement before carrying it over.
- Trace both sides of a rename; do not let rename detection hide a delete-and-recreate semantic change.
- Regenerate derived files from their current owner inputs instead of copying stale generated output.
Read the actual diffs, especially deletions. File counts and diff statistics orient the investigation but cannot establish safety.
Decompose by behavior
Define each slice as one observable capability or root-cause fix. Include its complete dependency closure:
- implementation and public entrypoint;
- callers, adapters, imports, and compatibility shims;
- tests and hand-built fixtures;
- schema migrations and model changes;
- configuration, examples, generated outputs, and operator documentation;
- terminology or architectural decisions that require glossary or ADR updates.
Mark every source change as harvest, superseded, skip intentionally, or needs user decision. Do not leave unexplained residue.
When asked for the first slice, choose the smallest independently valuable or enabling behavior with a complete dependency closure and low target overlap. "First" means safest useful landing order, not earliest source commit or smallest raw diff.
Before splitting or moving modules, search test patch targets and imports. Preserve intentional monkeypatch seams at their old public location or replace hidden module-global reads with explicit injection. Do not assume a green test exercised a moved patch target.
For persisted data or wire-format readers, include at least one fixture written by hand in the previous format. Never let every compatibility fixture pass through the new writer under test.
Choose the least risky transfer
Prefer, in order:
- Reimplement the source intent against current target abstractions when the target evolved materially.
- Apply a focused patch or use a no-commit cherry-pick for a coherent commit, then review every resulting line.
- Transfer a whole file only when target history proves it remained untouched and the file has no stale coupled assumptions.
- Merge the whole branch only when it is current, cohesive, independently reviewed, and the user explicitly wants that strategy.
Use an isolated worktree pinned to the target SHA unless the current workspace is already a clean, dedicated worktree for this task. Use a fresh codex/ branch by default. Never develop directly in a shared primary checkout.
Keep slices small enough to review and revert independently. Land prerequisites before dependents. Preserve current target behavior unless the slice explicitly changes it.
Prove the harvest
Establish a target baseline before modification, run focused checks while iterating, then run the repository's authoritative gate for a substantive slice.
Make every verification result state what it examined: exact SHA, platform, resolved root, files or tests collected, artifacts or rows sampled, and relevant configuration. Treat zero-input, wrong-root, self-matching process, stale-SHA, or new-writer-only checks as no evidence.
Select additional proof by risk:
- Run compatibility tests against previous persisted shapes for reader changes.
- Run database-specific checks when SQLite cannot represent locks, JSON operators, defaults, constraints, or cascades.
- Run platform-specific checks on the real platform for filesystem identity, process, lock, launcher, or path behavior.
- Run contract, golden, architecture-boundary, and end-to-end tests for cross-cutting owners.
- Inspect integrated-target CI after landing when remote publication is authorized; a green source PR does not prove the combined target.
Preserve recovery before cleanup
Before deleting any source ref:
- Record its full tip SHA and original ref name.
- Confirm which slices landed and which were intentionally skipped.
- Establish a durable recovery route such as a retained branch/tag, an existing PR ref with a documented hosting-retention assumption, or an explicitly authorized bundle. Do not call an unreachable local object durable recovery. If recovery must be indefinite, do not rely on a PR ref alone unless its retention is guaranteed; prefer an authorized tag or archived bundle.
- Verify the recovery route resolves to the recorded tip.
- Delete only the exact authorized ref; never use broad patterns.
- Report what was removed, where the recovery evidence lives, and how long it is expected to remain available.
Do not remove the isolated worktree until it is clean and every useful artifact is committed, copied to an approved location, or intentionally discarded.
Hand off clearly
Lead with what was actually harvested. Include:
- source, target, and merge-base SHAs;
- landed slices and their commits or changed paths;
- superseded and intentionally skipped material with reasons;
- baseline and verification results with scope counts;
- unresolved conflicts, compatibility risks, and decisions still needed;
- exact recovery refs for any retained or deleted branch;
- confirmation that production, deployment, and unrelated worktrees were untouched unless separately authorized.
Do not describe a partial port as a completed branch harvest while unclassified source changes remain.
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
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.

