
Wrap
End a coding session cleanly by running reflect, pruning merged git worktrees, and warning on unmerged branches before /clear.
Overview
Wrap is an agent skill most often used in Operate (also Build, Ship) that runs reflect then git worktree cleanup before you clear the session.
Install
npx skills add https://github.com/camacho/ai-skills --skill wrapWhat is this skill?
- 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)
- 2-step flow: reflect then session cleanup
- Only deletes worktrees under .worktrees/
Adoption & trust: 556 installs on skills.sh; 1 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You finished a dev cycle but merged worktrees, branch context files, and unreflected session state are still cluttering the repo.
Who is it for?
Solo builders using git worktrees and a reflect skill who want a repeatable end-of-session checklist.
Skip if: Repos without git worktrees or teams that never use session reflect—use ad-hoc git cleanup instead.
When should I use this skill?
Ending a session, wrapping up work, saying goodbye, or transitioning to a new task context after completing a development cycle.
What do I get? / Deliverables
Reflect completes first, merged .worktrees/ paths and branches are removed with a clear report, and you are ready to /clear without losing unmerged work.
- Completed reflect invocation
- Session cleanup report (removed vs kept worktrees)
- Updated repo state ready for /clear
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Operate because wrap is the ritual after work finishes—hygiene and handoff—not the feature build itself. Iterate fits session-close loops: consolidate learnings via reflect, remove stale worktrees, and leave the repo ready for the next cycle.
Where it fits
After merging a feature branch, wrap removes the feat worktree once reflect captured decisions.
Post code-review fixes, wrap ensures reflect ran before you start a new task context.
Weekly maintenance: close session, prune merged .worktrees/, keep in-flight branches visible.
How it compares
Use instead of manually running reflect and git commands in random order at session end.
Common Questions / FAQ
Who is wrap for?
Indie developers and small teams on camacho-style agent workflows who use worktrees and want reflect plus cleanup in one procedure.
When should I use wrap?
When ending a session, wrapping up work, transitioning tasks after a development cycle, or before /clear—in Build after features, Ship after reviews, or Operate during iteration hygiene.
Is wrap safe to install?
It runs git worktree and branch deletion on merged branches only; review the Security Audits panel on this page and verify paths before allowing shell/git on your machine.
Workflow Chain
Requires first: reflect
SKILL.md
READMESKILL.md - Wrap
# 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: ```bash REPO_ROOT="$(git rev-parse --show-toplevel)" git -C "$REPO_ROOT" worktree list ``` For each entry under `.worktrees/` (never the main worktree): ```bash 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 | Mistake | Fix | |---------|-----| | Inlining reflect logic | Invoke `/reflect` via Skill tool | | Removing unmerged worktrees | Warn only — never delete unmerged work | | Invoking /clear directly | Tell user to type it — /clear is a built-in | | Cleaning main worktree | Only clean `.worktrees/*` entries | | Skipping cleanup report | Always report what was cleaned/kept |