Handing Off
Compaction keeps a summary the model writes under pressure. The handoff
is the part chosen deliberately: what is open, why, and what continues.
Steps
- Collect open state from the session itself, never by
re-derivation: unmerged changes and what gates them, open tickets
touched, rulings and standing rules the principal stated, gotchas
that cost time. Order items as a work ledger orders threads —
urgency, then importance, a blocker before what waits on it — with
low-hanging fruit carrying the most value for the work ahead
surfaced early. Where the
thread-ledger skill's tooling is
available, render its view as a mechanically generated second
opinion — never the primary source, so work not yet recorded there
is not overlooked. Completion: every item carries a next action.
- Write the handoff to a file: what happened since the previous
handoff; an open-state table (item | state | next); standing rules;
gotchas. Link the previous handoff. Table rows are single-line and
stand in step 1's priority order — verify.sh lifts them verbatim
into the post-compaction context, so the table IS the priority
list and the extractor stays dumb. Completion: a reader with none
of this session's context can pick any table row and continue it.
- Publish the file wherever the installing project keeps session
artifacts, and update the tickets and progress records the session
touched. Completion: the handoff has a URL.
- Mark freshness: run
./mark.sh <handoff-file> [url]. It records
the live transcript's current size into $HANDOFF_STATE (default
~/.claude/handoff-state.json) so hooks can tell a fresh handoff
from a stale one. Completion: mark.sh prints the marker path.
- Propose focus: from what continues next, print one to three
candidate
/compact <focus line> commands, first one recommended,
each in its own individual fenced code box — one command per box,
nothing else in it, so a terminal client renders every proposal as
a single copyable unit. Running /compact stays the user's step —
end the run on the proposals.
- Run
./check.sh — machine-verifies the marker, the handoff file,
and that the skill's hooks are registered (installing the
registration where nothing else manages settings.json), then
prints the residue to verify by hand. Relay any warning it prints
about registration timing: registration is captured at CLI
startup, so a fresh install protects the next session, not the
compaction this handoff prepares.
The skill ships its own compaction hooks: verify.sh runs on
SessionStart (matcher compact) and injects the handoff pointer
plus the open-state table verbatim into the fresh context, with the
instruction to restate it; guard.sh runs on PreCompact and blocks
compaction (exit 2) while no fresh marker exists — growth-based
freshness, PRECOMPACT_GUARD=off overrides. The installing project
contributes only registration: where a manager owns settings.json
(a managedBy marker), its template must carry the two entries and
check.sh prints exactly what to add; everywhere else check.sh
installs them itself. HANDOFF_STATE and HANDOFF_TRANSCRIPT
(transcript path override; unset = newest transcript under
~/.claude/projects) remain the data contract all three scripts
share.
1---2name: handing-off3description: Prepare a session for compaction: write the handoff, mark it fresh, propose /compact focus lines. Use before a manual /compact, when a reminder or hook warns that compaction is near, or when asked to wrap up or hand off session context.4---5
6# Handing Off
7
8Compaction keeps a summary the model writes under pressure. The handoff
9is the part chosen deliberately: what is open, why, and what continues.
10
11## Steps
12
131. **Collect open state** from the session itself, never by
14 re-derivation: unmerged changes and what gates them, open tickets
15 touched, rulings and standing rules the principal stated, gotchas
16 that cost time. Order items as a work ledger orders threads —
17 urgency, then importance, a blocker before what waits on it — with
18 low-hanging fruit carrying the most value for the work ahead
19 surfaced early. Where the `thread-ledger` skill's tooling is
20 available, render its view as a mechanically generated second
21 opinion — never the primary source, so work not yet recorded there
22 is not overlooked. Completion: every item carries a next action.
232. **Write the handoff** to a file: what happened since the previous
24 handoff; an open-state table (item | state | next); standing rules;
25 gotchas. Link the previous handoff. Table rows are single-line and
26 stand in step 1's priority order — verify.sh lifts them verbatim
27 into the post-compaction context, so the table IS the priority
28 list and the extractor stays dumb. Completion: a reader with none
29 of this session's context can pick any table row and continue it.
303. **Publish** the file wherever the installing project keeps session
31 artifacts, and update the tickets and progress records the session
32 touched. Completion: the handoff has a URL.
334. **Mark freshness**: run `./mark.sh <handoff-file> [url]`. It records
34 the live transcript's current size into `$HANDOFF_STATE` (default
35 `~/.claude/handoff-state.json`) so hooks can tell a fresh handoff
36 from a stale one. Completion: mark.sh prints the marker path.
375. **Propose focus**: from what continues next, print one to three
38 candidate `/compact <focus line>` commands, first one recommended,
39 each in its own individual fenced code box — one command per box,
40 nothing else in it, so a terminal client renders every proposal as
41 a single copyable unit. Running `/compact` stays the user's step —
42 end the run on the proposals.
436. Run `./check.sh` — machine-verifies the marker, the handoff file,
44 and that the skill's hooks are registered (installing the
45 registration where nothing else manages `settings.json`), then
46 prints the residue to verify by hand. Relay any warning it prints
47 about registration timing: registration is captured at CLI
48 startup, so a fresh install protects the next session, not the
49 compaction this handoff prepares.
50
51The skill ships its own compaction hooks: `verify.sh` runs on
52`SessionStart` (matcher `compact`) and injects the handoff pointer
53plus the open-state table verbatim into the fresh context, with the
54instruction to restate it; `guard.sh` runs on `PreCompact` and blocks
55compaction (exit 2) while no fresh marker exists — growth-based
56freshness, `PRECOMPACT_GUARD=off` overrides. The installing project
57contributes only registration: where a manager owns `settings.json`
58(a `managedBy` marker), its template must carry the two entries and
59`check.sh` prints exactly what to add; everywhere else `check.sh`
60installs them itself. `HANDOFF_STATE` and `HANDOFF_TRANSCRIPT`
61(transcript path override; unset = newest transcript under
62`~/.claude/projects`) remain the data contract all three scripts
63share.