Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
camacho avatar

Wrap

  • 578 installs
  • 1 repo stars
  • Updated May 26, 2026
  • camacho/ai-skills

wrap is a session wrap-up skill that runs reflect, prunes merged git worktrees, and warns on unmerged branches for developers ending a coding agent session before /clear.

About

wrap is a session-ending agent skill that closes development cycles cleanly by invoking the reflect skill, pruning merged git worktrees, and surfacing warnings for unmerged branches before the developer runs /clear. The reflect step handles MEMORY.md updates, Basic Memory vault writes, GitHub issues, plan finalization, and .last-reflect-ts tracking—wrap delegates to reflect rather than inlining that logic. After reflect completes, wrap lists worktrees under the repository root and removes entries in .worktrees/ that are already merged, while flagging branches that still need attention. Developers reach for wrap when finishing a task, saying goodbye, transitioning contexts, or preparing a fresh agent session without leaving stale worktrees behind.

  • Invokes the reflect skill via Skill tool—no inlined reflect logic
  • Lists git worktrees and removes only paths under .worktrees/ when branch is merged to main
  • Warns and keeps unmerged worktrees with branch name in the report
  • Conditional delete of .branch-context.md when reflect confirmed learnings consolidated
  • Structured session cleanup report (Removed vs Kept entries)

Wrap by the numbers

  • 578 all-time installs (skills.sh)
  • Ranked #690 of 3,282 Productivity & Planning skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/camacho/ai-skills --skill wrap

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs578
repo stars1
Security audit3 / 3 scanners passed
Last updatedMay 26, 2026
Repositorycamacho/ai-skills

How do you clean git worktrees after agent sessions?

End a coding session cleanly by running reflect, pruning merged git worktrees, and warning on unmerged branches before /clear.

Who is it for?

Developers using git worktrees with coding agents who want clean session handoffs before /clear.

Skip if: Repositories without git worktrees or sessions that do not use reflect-based memory workflows.

When should I use this skill?

A developer ends a session, wraps up work, transitions tasks, or prepares for /clear after completing a development cycle.

What you get

Completed reflect artifacts, pruned merged worktrees, and warnings for unmerged branches.

  • reflect artifacts
  • pruned worktree list
  • unmerged branch warnings

Files

SKILL.mdMarkdownGitHub ↗

Wrap

Session wrap-up: reflect, clean worktrees, prepare for /clear.

1. Reflect

Invoke /reflect via the Skill tool. Wait for it to complete before proceeding.

Do NOT inline reflect logic — invoke the skill. It handles MEMORY.md, Basic Memory vault, GitHub issues, plan finalization, and .last-reflect-ts.

2. Session Cleanup

After reflect completes, clean up session worktrees:

REPO_ROOT="$(git rev-parse --show-toplevel)"
git -C "$REPO_ROOT" worktree list

For each entry under .worktrees/ (never the main worktree):

REPO_ROOT="$(git rev-parse --show-toplevel)"
BRANCH=$(git -C <worktree-path> rev-parse --abbrev-ref HEAD)
git -C "$REPO_ROOT" branch --merged main | grep -q "$BRANCH" && MERGED=true || MERGED=false
  • Merged: git -C "$REPO_ROOT" worktree remove <path> + git -C "$REPO_ROOT" branch -d "$BRANCH"
  • Not merged: warn with branch name, do not delete

`.branch-context.md`: If it exists at "$REPO_ROOT/.branch-context.md" and reflect confirmed learnings were consolidated, delete it. If reflect skipped it or reported no learnings, leave it and warn: ".branch-context.md may contain unreflected learnings."

Report:

Session cleanup:
  Removed: .worktrees/feat-foo (branch feat/foo, merged)
  Kept:    .worktrees/feat-baz (branch feat/baz, NOT merged)
  Cleaned: .branch-context.md (learnings consolidated)

3. Prompt /clear

Session wrapped. Type /clear when ready.

Do NOT invoke /clear — it is a built-in command only the user can type. After /clear, the SessionStart hook injects catchup instructions automatically.

Common Mistakes

MistakeFix
Inlining reflect logicInvoke /reflect via Skill tool
Removing unmerged worktreesWarn only — never delete unmerged work
Invoking /clear directlyTell user to type it — /clear is a built-in
Cleaning main worktreeOnly clean .worktrees/* entries
Skipping cleanup reportAlways report what was cleaned/kept

Related skills

How it compares

Pick wrap over manual git commands when the session uses reflect, worktrees, and /clear as a combined end-of-cycle ritual.

FAQ

What does wrap do before /clear?

wrap invokes the reflect skill first, then lists git worktrees, prunes merged .worktrees/ entries, and warns about unmerged branches so the next session starts clean.

Does wrap handle memory updates itself?

wrap delegates memory and plan finalization to the reflect skill, which updates MEMORY.md, Basic Memory vault, GitHub issues, and .last-reflect-ts before cleanup runs.

Is Wrap safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.