返回 CodeWhale
SKILL.md
根目录 / crates / tui / assets / skills / handoff / SKILL.md
1 ---
2 name: handoff
3 description: >-
4 Write a compact, decision-ready handoff so the next session (or the user)
5 can continue without reconstructing the current one. Use when the session
6 is ending, context is running low, the user asks for a handoff / "pass the
7 baton" / "hand off", or a long-running operation needs a durable state
8 checkpoint.
9 invocation: model+user
10 ---
11
12 # Handoff
13
14 > Write a compact, decision-ready handoff so the next session (or the user)
15 > can continue without reconstructing the current one. Use when the session is
16 > ending, context is running low, the user asks for a handoff / "pass the
17 > baton" / "hand off", or a long-running operation needs a durable state
18 > checkpoint. The goal: the durable artifact survives, the context does not
19 > need to.
20
21 Invocation: `model+user`
22
23 ## When to use
24
25 - The user says "handoff", "hand off", "pass the baton", "takeover prompt",
26 "write me a handoff", or the session is about to end / compact.
27 - A long operation (multi-turn, multi-workstream) has state that must survive
28 context loss: commits, branches, PRs, CI, blockers, decisions.
29 - You are switching to a fresh session and want the new session to start from
30 evidence instead of reconstructing the old one.
31
32 ## What to do
33
34 1. **Gather the truth from tools, not memory.** Run/collect:
35 - `git branch --show-current`, `git status --short`, `git log --oneline
36 origin/<default>..HEAD` (what is local-only), `git log --oneline -5`
37 (recent context).
38 - Live remote state where relevant (`gh pr list --state open`,
39 `gh pr checks <n>`, `gh run list`) — only what the user's operation
40 actually depends on; do not pad the handoff with a full GitHub dump.
41 - Any in-flight work: dirty files, uncommitted slices, partial worktrees,
42 running background jobs/workers, queued CI.
43 2. **Write a compact markdown handoff** (aim under ~60 lines; the user may
44 also ask for a "short text-only" variant — then aim under ~15 lines):
45
46 ```markdown
47 # Handoff — <operation/session name> — <date>
48 - **State:** <one-line: what is done vs in-flight vs blocked>
49 - **Landed/committed:** <exact SHAs + one-line what>
50 - **Branches/PRs:** <names + states; which are ours vs community>
51 - **CI:** <what is green, what is waiting, what is broken>
52 - **Blockers:** <exact blocker + what would unblock>
53 - **Decisions made:** <the WHY that a fresh session must not re-litigate>
54 - **Next step:** <the single next action, one line>
55 - **Continuation records:** <pointers to partial work that must be
56 preserved (worktrees, uncommitted files, receipts)>
57 ```
58
59 3. **Persist it.** Always write `.codewhale/handoff.md` in the workspace — that
60 is the only path the runtime reads back. On the next session's first turn it
61 is injected as the "## Previous Session Relay" block
62 (`HANDOFF_RELATIVE_PATH`, `crates/tui/src/prompts.rs:85`; loader at
63 `prompts.rs:301-315`). A handoff written anywhere else is never picked up,
64 so the next session starts cold no matter how good the note is.
65
66 Optionally also write a human-discoverable copy:
67 - If the workspace has an ops/notes convention (e.g. `codewhale-ops/notes/`
68 with a living handoff file), update the living handoff's dated facts and
69 snapshot, or create `<topic>-handoff-<date>.md` next to it.
70 - Otherwise the repo root as `HANDOFF.md` or
71 `docs/handoff/<topic>-<date>.md`. These are for people; nothing in the
72 runtime reads them. Never overwrite someone else's uncommitted handoff
73 without reading it first.
74 4. **Clear the way for the new session ("clears context").** A skill cannot
75 delete the current context, but it can make the context disposable:
76 - Ensure nothing is left only in memory: dirty work is either committed
77 (WIP is fine with a real body), stashed with a note, or recorded in the
78 handoff with its exact location.
79 - Kill or record background work that would outlive the session
80 (background jobs, sub-agents) — record what is still running and its
81 task id.
82 - Close with the one-line "next step" so the fresh session has an
83 unambiguous first action.
84 5. **Deliver.** Give the user the compact handoff text in your reply
85 (the persisted file is the durable copy; the reply is the readable one).
86
87 ## Constraints
88
89 - Facts only from tool output; never invent SHAs, check states, or blockers.
90 - Keep claims narrower than evidence: distinguish landed/committed, verified
91 locally, CI-verified, and pending.
92 - Preserve other people's uncommitted work: read before touching, archive
93 before overwriting.
94 - The handoff is orientation, not law: tell the next session to refresh
95 live state before acting on it.
96 - If the user asks for a "short text-only" handoff, give exactly that in the
97 reply and skip the full markdown file unless asked.
98
98 lines MARKDOWN