sova-after-merge
Skill3 starsChanged 8 days agoApache-2.0View on GitHub
Post-merge cleanup: sync the base branch, delete the branch, clean worktrees, update issue status, capture learnings.
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- dashboard-designSkill
- database-patternsSkill
- design-systemSkill
- design-tasteSkill
- issue-templateSkill
- sova-address-prSkill
- sova-agent-readinessSkill
- sova-audit-instructionsSkill
- sova-debugSkill
- sova-develop-explainSkill
- sova-develop-fullSkill
- sova-developSkill
- sova-extract-knowledgeSkill
- sova-find-taskSkill
- sova-health-auditSkill
- sova-ingest-reviewSkill
- sova-integrate-prSkill
- sova-issueSkill
- sova-new-featureSkill
- sova-optimize-knowledgeSkill
- sova-prSkill
- sova-rearrange-commitsSkill
- sova-researchSkill
- sova-review-fullSkill
- sova-review-prSkill
- sova-reviewSkill
- sova-simplifySkill
- sova-specSkill
- sova-standupSkill
- sova-statusSkill
- sova-testSkill
- sova-update-docsSkill
- testing-patternsSkill
- visual-auditSkill
- dashboard-designSkill
- database-patternsSkill
- design-tasteSkill
- issue-templateSkill
- testing-patternsSkill
- visual-auditSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 10
Run this after a PR has been merged to clean up local state and capture learnings.
- Very specific: line 32
Remove worktrees for the merged ticket.
- Very specific: line 71
Update the PRIMARY checkout's cookbook (cookbook/<domain>.md when split, otherwise cookbook.md under the matching section) before removing …
- Very specific: line 79
Extract broader knowledge: run the sova-extract-knowledge skill if significant patterns emerged
- Very specific: line 80
Ready for next task?: Run the sova-find-task skill or the sova-standup skill
- Very specific: line 84
Never swallow a failed branch or worktree deletion with || true: report what was kept and why
- Distinctive: line 85
NEVER use emojis in any output
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
After Merge Cleanup
The sova-integrate-pr skill is the preferred path (it merges, audits and cleans up in one run); this command is kept for PRs merged outside it.
Run this after a PR has been merged to clean up local state and capture learnings.
Instructions
Each shell block below runs as its own shell invocation, so each one assigns every variable it reads.
- Get the PR from
the arguments provided when this skill is invoked(PR number or branch name). If empty, check for recently merged PRs:gh pr list --author @me --state merged --limit 5 - Switch to the base branch and pull (from the primary checkout, not a worktree):
BASE=$(gh pr view <PR_NUMBER> --json baseRefName --jq .baseRefName) git checkout "$BASE" git pull origin "$BASE" - Clean up worktrees (if any exist for this ticket). Do this before deleting the branch: git refuses to delete a branch that a worktree still has checked out.
Remove worktrees for the merged ticket. Do not passgit worktree list--force: if a worktree has uncommitted changes, leave it in place and report it rather than discarding the work.
Prune dangling worktree references (directories removed but entries remain):git worktree remove .claude/worktrees/<ID>git worktree prune - Delete the merged branch locally:
Ifgit branch -d <branch-name>-drefuses ("not fully merged", expected after a rebase merge), confirmBASE=$(gh pr view <PR_NUMBER> --json baseRefName --jq .baseRefName); git diff "origin/$BASE" <branch-name>prints nothing, thengit branch -D <branch-name>. If the diff is non-empty only because the base branch moved on after the merge, compare against the PR's merge commit instead (gh pr view <PR_NUMBER> --json mergeCommit --jq .mergeCommit.oid); if that is not empty either, keep the branch and report it. Update the linked issues and clean up labels. On a GitHub project, the merged PR's body decides which issues the merge finishes:
sova linked-issues <PR_NUMBER> --applyEach issue a closing keyword names (
Closes #N,Fixes #N,Resolves #Nand their other forms) moves tointegration.post_merge_state("done" closes it). EachPart of #Nissue stays open, gets one comment listing what the PR body says it left undone (itsNot done in this PR:list, or the issue's unchecked acceptance criteria when the body lists none), and loses the workflow labelsagent:in-review,agent:in-progress,sova:reviseandsova:blockit carries, unless another open PR still links the issue (those labels then stay, and the output says so), so a half-finished issue no longer reads as awaiting review. A bare#Nis left alone. Never close an issue by hand instead: aPart ofissue must stay open. A non-zero exit means an issue was not updated (a failed comment or label removal included), so name each such issue from the output in the final report and carry on. On a Jira project, move the ticket the PR title names through its workflow instead.Then, for each issue the command moved (a closing reference, not a
Part ofor bare one), remove the workflow labels that no longer apply after the merge. Only the labels the issue carries are passed, sincegherrors on a label the repository never created (for examplesova:block); name any failure in the final report instead of discarding it:if ! LABELS=$(gh issue view <ISSUE_NUMBER> --json labels --jq '.labels[].name'); then echo "FAILED: could not read the labels of #<ISSUE_NUMBER>" >&2 else ARGS=() for label in agent:in-review agent:in-progress sova:revise sova:block; do if printf '%s\n' "$LABELS" | grep -qxF "$label"; then ARGS+=(--remove-label "$label"); fi done if [ "${#ARGS[@]}" -gt 0 ] && ! gh issue edit <ISSUE_NUMBER> "${ARGS[@]}"; then echo "FAILED: could not remove the workflow labels of #<ISSUE_NUMBER>" >&2 fi fi- Capture learnings from the PR review (run the
sova-ingest-reviewskill):- Fetch PR review data
- Extract lessons: patterns to follow, mistakes to avoid, style preferences, test coverage gaps
- Update the PRIMARY checkout's cookbook (
cookbook/<domain>.mdwhen split, otherwisecookbook.mdunder the matching section) before removing any worktree: a worktree's copy of.claude/agent-memory/may be gitignored and is deleted with it
- Report what was cleaned up, any worktree or branch kept and why, and what was learned.
Cross-References
- Preferred path: the
sova-integrate-prskill merges, runs the post-merge audit, and does this cleanup in one run - Learning from the review: calls the
sova-ingest-reviewskill internally - Extract broader knowledge: run the
sova-extract-knowledgeskill if significant patterns emerged - Ready for next task? Run the
sova-find-taskskill or thesova-standupskill
Rules
- Never swallow a failed branch or worktree deletion with
|| true: report what was kept and why - NEVER use emojis in any output
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.

