---
name: wrapup
description: End-of-session ritual for any project. Sync the project docs (PROJECT_PLAN.md gets the session narrative, CLAUDE.md gets only standing-reference deltas), archive completed material to PROJECT_PLAN_ARCHIVE.md, run the build check, commit, push (only with explicit confirmation, since push-to-main deploys on most projects). Use when the user says things like "wrap up", "that's enough for today/this week", "update the docs and commit and push", or otherwise signals the session is ending. Invoke as /wrapup.
---

# Session wrap-up

Close out the current work session properly: docs synced and routed to the right files, sizes checked,
build verified, work committed, push confirmed.

**The three-file model this skill enforces:**
`CLAUDE.md` is the operating manual (auto-loaded, no session logs, ever). `PROJECT_PLAN.md` is the plan
plus one dated update entry per working day. `PROJECT_PLAN_ARCHIVE.md` holds completed sections and old
entries, moved verbatim.

**Hard rules (they always win):**
- **Never push without an explicit yes in the current session.** If your host deploys on push to main,
  pushing IS deploying.
- Scan for secrets before any commit. Never commit `.env` files or anything else holding credentials.
- Only touch docs/files related to this session's work: no drive-by tidying.
- End with the standard four-part report.

## Step 1: Orient

1. Confirm the project root (the nearest ancestor with `CLAUDE.md` or `.git`). If run outside a project,
   ask which project to wrap up.
2. Note whether it's a git repo, and its deploy model (check the project CLAUDE.md: push-to-main
   auto-deploy vs manual vs none).
3. `git status` first. If there are staged files or changes you don't recognise from this session
   (another terminal may be working in the same project), STOP and list them. Ask before sweeping
   anything up. Commit only what this session touched.

## Step 2: Sync the docs (route content to the RIGHT file)

Update **only what this session made stale**, in this order:

1. **`PROJECT_PLAN.md` first.** Add or extend **today's dated update entry**: one entry per working day,
   never a second for the same day. Shape: **Goal, Scope, Files touched, Verification** (what was proven
   and how). Then reconcile the roadmap: mark completed tasks with `~~strikethrough~~` (and tick the
   checkbox if the plan uses them). Strike ONLY what is verified done against the code and the live
   system; half-done work stays plain with a note on what remains.
2. **`CLAUDE.md` second, deltas only.** New gotchas discovered this session, state blocks rewritten in
   place (one current version, superseded text moves to the archive), new commands, env vars or key
   files, people/comms changes. **Never session narrative, never a log entry, never "Recent Updates".**
   If this project's CLAUDE.md still contains a session-log section, that is the legacy shape: offer to
   convert it now (move the logs into PROJECT_PLAN.md dated entries or the archive), and do so on a yes.
3. **A master CLAUDE.md, if you keep one above your projects**: only if this session found something
   that applies to every project.

Show a one-line-per-file summary of the doc edits made. Keep edits in the project's existing voice and
structure: additive where content is new, surgical rewrites where state changed.

## Step 2b: Measure and archive (EVERY wrap-up, not when someone notices)

`CLAUDE.md` is auto-loaded at the start of every session, so its size is a cost paid on every future
session. **Wrap-up is the only step that subtracts; without it the files only ever grow.** (One project
reached about 215 KB, was pruned to 110 KB, and was back near 200 KB two days later, because the rules
lived in the file and nothing performed them.)

1. **Measure first:** `wc -c CLAUDE.md PROJECT_PLAN.md`. Budgets: **CLAUDE.md under 100 KB, investigate at 90;
   PROJECT_PLAN.md under 500 KB.** If both are under their trigger, report the sizes and skip to
   Step 3.
2. **CLAUDE.md over budget** means it is carrying history or dead reference. Move session narrative to
   PROJECT_PLAN.md (recent) or PROJECT_PLAN_ARCHIVE.md (old). Collapse resolved defects to a one-line
   epitaph plus the lesson only where the lesson outlived the fix. Rewrite corrected entries in place.
3. **PROJECT_PLAN.md over budget** (or at any wrap-up where it helps): move update entries older than
   about a month, and roadmap sections that are fully struck and verified, to `PROJECT_PLAN_ARCHIVE.md`.
   Create the archive if absent (newest-first, with a one-line pointer left in the plan).
4. **Archive before you cut, verbatim.** Never summarise-then-delete. Nothing is deleted; it moves, and
   git holds every version regardless. Report what moved and the before/after sizes.
5. **Legacy `SESSION_ARCHIVE.md`:** if the project has one, leave it exactly as it is. Never append to
   it; new archive material goes to PROJECT_PLAN_ARCHIVE.md only.
6. ⚠️ **A prune is a significant content change**, so describe what you
   are about to move and why, and get confirmation, before doing it.

## Step 3: Build check

If `package.json` has a `build` script: run `npm run build` (a hosted build can be stricter than local; a
red build must not be committed as "done"). Fix trivial breakage caused by this session's work; report anything
bigger and stop before committing.
No build script (Python/static/scripts project): skip, say so.

## Step 4: Secret scan + commit

1. Quick scan of the staged diff for anything key-shaped (`sk-`, `key=`, `token`, `secret`, base64
   blobs, `eyJ`) and for files that should be gitignored (`.env*`, `.claude/`, `scratch/`). Anything suspicious: stop and show it. (Never echo a secret's
   value; reference it by name and location.)
2. Stage this session's files, commit with a concise message describing the session's work (match the
   repo's existing commit style).
3. Not a git repo? Skip 1 and 2 and say so.

## Step 5: Push (gated)

Ask explicitly, including the consequence: e.g. **"Push to main? This project auto-deploys, so pushing
publishes it live."** (or "no auto-deploy configured" if true).
- Yes → push, then report the result (and the deploy URL if relevant).
- No/park it → leave committed locally and say so.
Never push on momentum, prior approvals, or "you mentioned it earlier".

## Step 6: Close-out report

End with this report:
- **Files changed** (every file touched, docs included)
- **What was modified** (one line per file)
- **Files intentionally not touched**
- **Follow-up needed** (uncommitted work, parked pushes, pending deploys, things to verify tomorrow)

## Guidelines

- **Honesty over tidiness:** if the build failed, tests are pending, or something is half-done, the docs
  and the report must say so. Never write "done" into any doc for work that isn't.
- **Speed:** this should feel like one command, not an interrogation. The only questions asked are the
  push gate (Step 5), the legacy-conversion offer and archive confirmation
  (Steps 2 and 2b), and anything genuinely blocking (unrecognised changes, secrets found).
- **Parallel sessions:** if another Claude session is active in the same project, coordinate; don't
  commit its half-finished work.
