AGENT SKILL

wrap

Wrap up a session at a natural seam — land in-flight work, square the TaskList honestly, write a copy-paste continuation prompt, then hand off to a directed /compact. Use when the user says "wrap up", "wrap this up", "let's wrap", "end of session", "checkpoint and compact", "hand off", or invokes /wrap.

License 许可
AGPL-3.0
所属仓库
aaronsb/agent-ways
最近更新
2026-11-14
Stars
★ 26
Forks
13

01 前言 Front Matter

name
wrap
description
Wrap up a session at a natural seam — land in-flight work, square the TaskList honestly, write a copy-paste continuation prompt, then hand off to a directed /compact. Use when the user says "wrap up", "wrap this up", "let's wrap", "end of session", "checkpoint and compact", "hand off", or invokes /wrap.
allowed-tools
Bash, Read, Grep, Glob, TaskList, TaskCreate, TaskUpdate, TaskGet, AskUserQuestion, Agent

03 SKILL.md 正文

Wrap

Close out a session at its end. This is the on-demand sibling of the meta/compaction-checkpoint way — the way fires automatically near the context limit; /wrap runs the same muscle whenever you decide the session is done.

Wrap is not merge. Landing is iterative — many merges happen across a session as each piece of work lands. Wrap is terminal — it runs once, at the end. By the time you wrap, the session's work should already be merged. So /wrap does not land work; it confirms nothing got stranded, then produces the artifacts that outlive the session.

The deliverable is two things that survive a reset: a TaskList that honestly mirrors reality, and a copy-paste continuation prompt. The skill ends by handing you a ready-to-run /compact line — it cannot run it for you (see Step 4).

Arguments

  • /wrap — full flow: land work (offer), square the TaskList, write the handoff, hand off to /compact.
  • /wrap stay — wrapping mid-work on purpose: skip the land/merge step. Don't land anything; just capture state accurately and produce the handoff. Use when the seam is "I'm pausing", not "I'm done".

Step 0 — Read the context gauge first

Before anything else, check where the session sits. Same source as context-status:

ways context --json   # used / total tokens, pct filled; total auto-detected from model

The fill level calibrates the entire wrap, and is worth saying out loud — the user may be wrapping early on purpose, and that's valid. Locate it against the ways trigger curves (the todos way fires ~75%, compaction-checkpoint ~85%):

  • Early (well below the curves — e.g. 300k/1M, 30%): lots of headroom. Say so plainly ("we'd be wrapping early — 300k of 1M used"), but don't talk the user out of it — end-of-day, task-switching, or banking a clean state are all good reasons. When early, /compact reclaims little and costs you the live thread, so in Step 4 offer the lighter paths: checkpoint-and-continue (no compact), or /clear+paste later. The handoff can be leaner — less accumulated context means less to reconstruct.
  • Late (near or past the curves): compaction is imminent or already mandatory. This is the urgent case — be thorough and quick. A lot is about to be summarized away, so the continuation prompt and TaskList carry more weight; get them down before auto-compact fires on its own.

Let this scale Steps 2–3: how much detail the handoff needs is proportional to how much context is about to be lost. A near-full window deserves a dense, complete prompt; an early wrap can be crisp. Knowing the total window (1M vs 200k) is what makes that call.

Step 1 — Loose-ends check (not a merge step)

Wrap assumes the session's work already merged. This step only confirms that and catches anything stranded — it is not the place to run a full delivery. Assess in parallel:

git status --short              # uncommitted changes?
git branch --show-current
git log --oneline main..HEAD    # unmerged commits?
  • Clean / already merged → the expected state. Move on.
  • Something stranded (uncommitted changes, or commits never PR'd) → this is a guard, not wrap's job. Surface it and let the user decide: invoke merge to land it, or leave it parked.
  • Parked on purpose (/wrap stay, or user chooses to leave it) → do not merge. Record exactly what's uncommitted, on which branch, and why it's parked — verbatim into Step 3 so post-reset-you can resume the partial work cold.

The rule: wrap never silently drops stranded work, and never lands it behind your back. Either the user lands it (via merge), or it's described in the handoff.

Step 2 — TaskList honesty pass (load-bearing)

This is the point of the skill, not a footnote. Post-compaction-you (or a fresh session) inherits the TaskList with zero memory of this conversation — so the list must be true, not optimistic. Use TaskList to read current state, then reconcile it:

Close the books (TaskUpdate):

  • Mark genuinely-finished tasks completed.
  • Retire stale, obsolete, abandoned, or aspirational tasks — don't carry cruft forward. A task that no longer reflects the plan is noise that will mislead the next session.

Write what's real (TaskCreate):

  • One task per piece of actual remaining work.
  • Each description must be resumable cold: file paths, decisions already made (so they aren't re-litigated), what was tried, and the next concrete step. The subject is imperative; activeForm is present-continuous.
  • Mark the genuine next task in_progress.

Open findings are work, not backlog. A review or test finding that the session's work owns and that is still unfixed gets a task to fix it, under the project convention it falls under (ADR-614). Do not turn it into an issue to close the books. If something merged with an owned finding open, the task says so and names the PR. When the project's instruction file or its review briefs send findings to a follow-up by default, note the line in the continuation as something to change.

The bar is honesty. Before moving on, sanity-check: does any "pending" task describe work that's actually done? Does any real remaining thread have no task? A dishonest list is worse than none — it hands the next session a confident lie.

Then print the list. Reconciling silently gives the user nothing to check against. Enumerate every task — finished, in progress, and backlog — with its full description:

#1 [IN PROGRESS] <subject>
  <description verbatim: paths, decisions already made, what was tried, next concrete step>

#2 [OPEN] <subject>
  <description>

#3 [OPEN, blocked by #2] <subject>
  <description>

#4 [DONE] <subject>

Number in the order the next session should work them, not creation order. Mark blocking relationships inline ([OPEN, blocked by #2]). Finished tasks get subject only — enough to confirm they were closed deliberately, not enough to crowd the live work.

Do not compress the descriptions here. This block and Step 3's prompt carry different weight: the prompt is the cold-start narrative, this is the per-thread detail, and a summarized description is exactly the content post-reset-you cannot reconstruct.

Step 3 — Write the continuation prompt

Produce a single copy-pastable block. Compaction keeps the session alive; this prompt is the harder guarantee — it survives even a /clear or a brand-new window. Also save it to .claude/handoff.wrap.md at the repository root (git rev-parse --show-toplevel), where start and a successor session look for it, with the date and the HEAD commit on its first line. When .gitignore does not cover it, list it in .git/info/exclude so the working tree stays clean. Tailor sections to the work, but cover:

Continue work on <project> (<path>) — <one-line what it is and its purpose>.
<build/test status: how to build, what's green>.

LANDED — <what shipped this session, with PR #s / commit refs; "merged to main, green">.

STATE — IN FLIGHT — <anything parked: branch, uncommitted files, why; from Step 1>.

INVARIANTS / GOTCHAS — <things NOT recoverable from git: crash-safety rules, ordering
constraints, "X is noise, trust Y", env quirks. Skip if none.>

TASKS — recreate these with the task list tool before starting; they are the working set.
<the Step 2 enumeration verbatim — number, status, subject, full description>.

WORKING MODE — <for complex work only: steer from the main session, delegate the heavy
work to subagents, one worktree per branch. See "Working mode" below. Skip for simple work.>

DO NEXT — <the immediate next step, then 1-3 alternatives, each specific enough to start>.

DECISIONS: <each choice left to the operator, numbered, one line each, so the answer
can be "1 and 3">. Skip if none.

CONVENTIONS — <project-specific workflow worth repeating: branch→PR→review→merge, lint
quirks, verification patterns>.

KEY FILES / BRANCHES — <the handful that matter, with paths>.

If a /goal is active, restate the goal condition at the top — it's the anchor the post-compaction turns steer by, and it survives compaction.

The TASKS section carries the Step 2 enumeration in full and tells the next session to rehydrate it with TaskCreate. Pasting this prompt into a /cleared or brand-new window arrives with an empty task list, so spell the instruction out — "recreate these as tasks before starting" — rather than assuming the list travels with the prompt.

Keep it dense and concrete. The gold standard is a prompt a stranger could resume from. Test that before moving on. A stranger holding only the repository and this prompt can: run the project, run the verification gates, find the current plan, and name the next step. Fix the prompt for any of the four that fails.

Number every decision left to the operator, in the prompt and in the chat, so the reply can be "1 and 3". A decision buried in a paragraph gets paraphrased back or missed.

Working mode

Write the WORKING MODE section when the remaining work has complexity: several open tasks, a change across many files, or review-and-fix rounds still to run. It tells the next session to spend its own context on steering and to delegate the rest, so the session lasts across the whole task list:

  • The main session steers. It reads reports, makes the calls, writes briefs, talks with the operator, and merges. It does not read large diffs or run long test suites itself.
  • Implementation, review, and fan-out reads go to subagents. Each brief names the files, the gates with their pass condition, and the shape of the report to return.
  • Each branch of implementation gets its own git worktree, in the location the project uses for worktrees, so parallel agents and the main checkout never share a working tree. List the existing worktrees and what each holds.
  • A fix round after the second goes to a freshly briefed agent. A worker resumed through many rounds can run out of context partway through its gates.
  • Small edits, single-file fixes, and anything the operator is watching live stay in the main session.

Name the subagent types and the worktree location this project uses, so the next session does not have to rediscover them. Work that is one task in one file gets no WORKING MODE section.

Close-out: what the session taught

Walk four categories. Each item lands in an issue, a design note, or a way edit, or gets the line "nothing of interest, because <reason>":

  • A sharp edge that bit, and the tell that would spot it next time.
  • A corrected assumption: the session started believing X and the work proved it false.
  • A trigger that should have fired and did not (a way, a skill description, a hook).
  • A reusable tool the session built: a script, a query, or a check worth running again.

Step 4 — Hand off (compaction is gauge-dependent)

First, let Step 0 decide whether compaction even applies:

  • Early wrap → /compact is optional; it reclaims little and ends the live thread. Lead with the lighter paths: checkpoint-and-continue (keep working in the same session — the TaskList and handoff are already saved), or /clear+paste later for a clean switch. Mention /compact as available, not as the default.
  • Late wrap → compaction is the point. Make the directed /compact the headline action.

A skill cannot trigger /compact — Claude Code forbids hooks/skills from invoking / commands. So when compaction is the move, end by handing the user a one-keystroke directed compaction, and explain why directed beats generic:

The synthesis above is now the freshest content in context. Run /compact with these focus instructions and it'll preserve the synthesis as the anchor instead of the system keeping whatever it guesses:

Then output the exact line, with focus instructions tailored to what should survive:

/compact keep the continuation prompt and TaskList state; <project>'s next step is <X>; drop the exploratory back-and-forth

Offer the alternative explicitly: for a hard reset (switching tasks entirely), /clear then paste the Step 3 prompt into a fresh session — the old one stays in /resume.

Make the /compact ... line the last thing in your response so it's immediately copyable. Do not claim the session is compacted — you've prepared it; the user pulls the trigger.

Key Principles

  • The TaskList must be honest — done is done, stale is gone, real work is captured with resume-detail. That's the load-bearing deliverable.
  • Print the list you squared — an unenumerated honesty pass is unreviewable; the user should see every task and description without asking.
  • Prepare, don't pretend — the skill can't self-compact; it hands off a ready /compact. Never report compaction as done.
  • Directed > generic — a synthesis-anchored /compact keeps what matters; an unanchored one keeps what the system guesses.
  • On-demand, not automatic — that's the whole reason this exists alongside the compaction-checkpoint way. You choose the seam.
  • Two survival layers — TaskList + continuation prompt survive even a hard reset; /compact is the lighter same-session path on top. The prompt carries the tasks and the instruction to rehydrate them, because a fresh window starts with an empty list.

Not for

  • Authoring the code being wrapped — /wrap closes out work, it doesn't write it.
  • Replacing the compaction-checkpoint way — that fires passively near the limit; this is the on-demand version. They share DNA on purpose.
  • Actually performing compaction — it can't. It prepares everything and hands you /compact.

See Also

  • merge — Step 1 delegates here to land work.
  • compaction-checkpoint (meta way) — the automatic sibling that fires near the context limit.
  • todos (meta way) — the TaskList-at-compaction discipline this enforces on demand.
  • context-status — check how much room is left before you decide to wrap.

04 同仓库更多 Skills

aaronsb
aaronsb/agent-ways

my-skill

A hand-built skill the user keeps in ~/.claude/skills. The fixture asserts it survives the install.

Skill与智能体开发
★ 26
aaronsb
aaronsb/agent-ways

work-skill

A skill in a second Claude Code config directory. The fixture asserts the directory is untouched.

Skill与智能体开发
★ 26
aaronsb
aaronsb/agent-ways

ways-update

Update the agent-ways installation to the latest version — preview the update with `ways manage update --what-if` (versions, release notes, the commits, local changes, the actions, dev links), read it back to the user, then apply it with `ways manage update --commit`, which pulls the app source in $XDG_DATA, refreshes the binaries and corpus, and reprojects ~/.claude. Use when the user wants to update agent-ways, pull the latest ways/hooks, or refresh their ways framework install. Not for editing or authoring individual ways (that is the ways skill) or upgrading project dependencies.

Skill与智能体开发
★ 26
aaronsb
aaronsb/agent-ways

ways-tests

Score way matching via embedding similarity, analyze vocabulary, and validate frontmatter. Use when testing how well a way matches prompts, checking cosine similarity scores, inspecting the embedding engine status, or validating way files.

★ 26
aaronsb
aaronsb/agent-ways

ways-localize

Localize agent-ways into the operator's language — translate every way's matching metadata against the English root, tune it clean, and switch ways (and Claude Code) into that language. Use when the operator asks to run ways in their language ("set up ways in Spanish", "localiza ways al español", "ways auf Deutsch"). Not for authoring or editing individual ways (that is the ways skill), not for English installs (already built), and not for changing Claude Code's language alone (that is a settings.json edit).

★ 26
aaronsb
aaronsb/agent-ways

think

Structured reasoning strategies (tree-of-thoughts, trilemma, self-consistency, step-back, ReAct). Use when facing complex decisions, weighing trade-offs, comparing multiple approaches, balancing competing objectives, or stuck. `/think <mode>` runs one strategy; `/think` alone shows the menu.

前端开发
★ 26