skill: Wrap up, then clear

I clear my agent sessions a lot now. Long sessions get slow and expensive, and after a while the agent is mostly rereading old tool output. The thing that kept me from clearing was the worry that something useful would go with it: a gotcha we hit, a decision and the reason for it, a half-finished branch.

So I wrote a small skill called wrap-up. Before I clear, I say "wrap up" and the agent goes through the session and reports back. It changes nothing until I choose.

  • Lessons not yet written down. Corrections I made, gotchas we found, decisions and why. It checks the repo docs, AGENTS.md, skills and memory first, and leaves out anything already there or obvious from the code.
  • Where each one should go, with the exact wording. An AGENTS.md rule, a repo doc, a skill, or personal memory, plus one line on why.
  • What it would skip, and why. I can overrule it, and it stops the notes from slowly piling up.
  • Unfinished work. Running agents, open worktrees, uncommitted or unpushed changes, questions I never answered.

I pick the ones I want, it writes them, and I clear. Sometimes the answer is "none of these". The agent can work them out again quickly, and a note that is never needed is just more to read next time.

What I get out of it: clearing becomes a habit instead of a gamble. Sessions stay short and cheap, and the next agent starts from what was actually learned, not from 200k tokens of scrollback.

		
  1. ---
  2. name: wrap-up
  3. description: Before the user clears the session, report what is worth saving and what is unfinished; after the clear, resume from the handoff. Use when the user says they will clear, reset or end the session, or says 收工 / 要清 session 了; or, after a clear, says "cleared, resume please", "cleared resume" or 清完了,继续.
  4. ---
  5. Change nothing until the user picks.
  6. - **Number the choices:** separate completed work worth recording, unfinished work that could continue, and live state that needs attention (background jobs, agents, worktrees, uncommitted or unpushed changes). Ask the user to choose what to save, continue or drop by number. Unselected old work stays pending, never resumes automatically.
  7. - **Lessons not yet recorded:** user corrections, gotchas found, workflows explained only in chat, decisions and their reasons. Check repo docs, AGENTS.md, skills and memory first; drop what is already there or readable from the code. Also drop anything you got right on your own or caught yourself this session; keep only what would likely go wrong again without a note.
  8. - **For each, propose a home and the wording:** an AGENTS.md rule, a repo doc, a skill, or memory (personal preference or setup), with one line of why.
  9. - **List what you would skip,** with the reason, so the user can overrule.
  10. - **After the choice:** save approved lessons to their agreed homes. Write information needed across a clear to the project-root `HANDOFF.md`: goal, roles and member names, relevant branches and worktree paths, live state, and the user's explicit choices, then a fixed "Resume steps" section: the commands the next session runs first (project-specific; none if nothing applies). Work not explicitly chosen to continue is listed only as pending selection.
  11. - **Local handoff only:** before creating or updating `HANDOFF.md`, verify it is untracked and add `/HANDOFF.md` to the repository's local Git exclude file (`git rev-parse --git-path info/exclude`), not shared ignore rules. Never commit it. If already tracked, report the conflict before writing. Read any existing file first and preserve other chains' and the user's content.
  12. - **Clear entries when resolved:** remove an entry only when completed, explicitly dropped, or transferred to a persistent record the user approved. Delete the file when every entry is resolved; reading it alone is not grounds for deletion. Leave unresolved entries for the next session.
  13. - **Resume:** after a clear, read `HANDOFF.md`, run its Resume steps, then report the next actions to the user. Do not re-brief other agents or restore roles unless the user asks.