handoff — compact the session
Compact the current conversation into a handoff document so a fresh agent can
continue the work. Captures goal, state, decisions, next steps, and pointers to
artifacts — without duplicating content already captured in plan artifacts,
commits, diffs, or ADRs.
OWNERSHIP
Owns: the handoff document (saved to the OS temp dir, NOT the workspace).
Reads: the active plan's artifacts (PRD.md, ARD.md, SPEC.md, PLAN.md,
LESSONS.md, RESEARCH.md), CONTEXT.md, git state.
MUST NOT write plan artifacts. References them by path, never duplicates them.
WHEN (user-invoked)
- Ending a session mid-plan.
- Handing work to another agent.
- User says "handoff", "compact this", "I'm leaving", "pass this to another
agent", "save state for later", "wrap up".
- Before a compaction resets context (if invoked manually rather than by the
adapter).
STEP 0 — CAPTURE THE ARGUMENT
If the user passed an argument, treat it as a description of what the next
session will focus on and tailor the handoff to it. Otherwise, capture the whole
current state.
STEP 1 — GATHER STATE
- Resolve the active plan per §6. Note its path.
- Read the active plan's artifacts. Note their paths + a one-line summary of
each (do NOT duplicate their content).
- Read
CONTEXT.md. Note its path.
- Check git state: current branch, uncommitted changes, recent commits.
- Note any
? items, in-progress tasks (~), and blocking unknowns.
STEP 2 — WRITE THE HANDOFF
Save to the OS temp directory (not the workspace — it is a scratch doc, not a
versioned artifact). Use caveman-light (compressed but readable).
Template:
# HANDOFF — <objective>
> For a fresh agent picking up <objective>. Read this, then open the plan artifacts.
## goal
<one line: what the work is>
## current state
- active plan: docs/plans/<date>-<type>-<slug>/
- branch: <branch>, <clean|uncommitted: N files>
- artifacts: <list paths + one-line summary each, NOT content>
## decisions made
- <decision 1> (in ARD.md §D / ADR 000N)
- <decision 2>
## next steps
1. <next step 1 — e.g. "run build on §T.4">
2. <next step 2>
3. <open question parked as ? — needs research>
## pointers
- plan artifacts: docs/plans/<slug>/
- CONTEXT.md: ./CONTEXT.md
- recent commits: <commit hashes + subjects>
## suggested skills
- <skill 1> — <why>
- <skill 2> — <why>
## redacted
- (any sensitive info redacted — API keys, passwords, PII)
SOURCE DISCIPLINE
- DO NOT duplicate content already captured in artifacts (PRDs, plans, ADRs,
issues, commits, diffs). Reference them by path or URL instead.
- Redact any sensitive information: API keys, passwords, personally identifiable
information. If you must reference that a secret exists, say "secret configured
in env var FOO_KEY" without the value.
SUGGESTED SKILLS
Include a "suggested skills" section that names the skills the next agent should
invoke, with a one-line reason each. Examples:
## suggested skills
- bootstrap — re-enable auto-triggering + artifact-check habit at session start
- build — execute §T.4 next (status ~, blocked by §T.3 which is [x])
- verify — gate §T.4 before flipping to [x]
- lessons — if §T.4's test fails, trace root cause
BOUNDARIES
- MUST save to the OS temp dir, NOT the workspace.
- MUST NOT duplicate content already in artifacts. Reference by path.
- MUST redact sensitive information.
- MUST include a "suggested skills" section.
- MUST use canonical terms from
CONTEXT.md.
- MUST NOT write plan artifacts.
1---2name: handoff3description: Compact the current session into a handoff document so another agent (or a fresh session) can continue the work. Captures goal, state, decisions, next steps, and pointers to artifacts. Does not duplicate content already in artifacts. Use when ending a session mid-plan, or when handing work to another agent, or when the user says "handoff", "compact this", "I'm leaving", "pass this to another agent", "save state for later", "wrap up".4---56# handoff — compact the session78Compact the current conversation into a handoff document so a fresh agent can9continue the work. Captures goal, state, decisions, next steps, and pointers to10artifacts — without duplicating content already captured in plan artifacts,11commits, diffs, or ADRs.1213## OWNERSHIP1415Owns: the handoff document (saved to the OS temp dir, NOT the workspace).16Reads: the active plan's artifacts (`PRD.md`, `ARD.md`, `SPEC.md`, `PLAN.md`,17`LESSONS.md`, `RESEARCH.md`), `CONTEXT.md`, git state.18MUST NOT write plan artifacts. References them by path, never duplicates them.1920## WHEN (user-invoked)2122- Ending a session mid-plan.23- Handing work to another agent.24- User says "handoff", "compact this", "I'm leaving", "pass this to another25 agent", "save state for later", "wrap up".26- Before a compaction resets context (if invoked manually rather than by the27 adapter).2829## STEP 0 — CAPTURE THE ARGUMENT3031If the user passed an argument, treat it as a description of what the next32session will focus on and tailor the handoff to it. Otherwise, capture the whole33current state.3435## STEP 1 — GATHER STATE36371. Resolve the active plan per §6. Note its path.382. Read the active plan's artifacts. Note their paths + a one-line summary of39 each (do NOT duplicate their content).403. Read `CONTEXT.md`. Note its path.414. Check git state: current branch, uncommitted changes, recent commits.425. Note any `?` items, in-progress tasks (`~`), and blocking unknowns.4344## STEP 2 — WRITE THE HANDOFF4546Save to the OS temp directory (not the workspace — it is a scratch doc, not a47versioned artifact). Use `caveman`-light (compressed but readable).4849Template:5051```markdown52# HANDOFF — <objective>5354> For a fresh agent picking up <objective>. Read this, then open the plan artifacts.5556## goal57<one line: what the work is>5859## current state60- active plan: docs/plans/<date>-<type>-<slug>/61- branch: <branch>, <clean|uncommitted: N files>62- artifacts: <list paths + one-line summary each, NOT content>6364## decisions made65- <decision 1> (in ARD.md §D / ADR 000N)66- <decision 2>6768## next steps691. <next step 1 — e.g. "run build on §T.4">702. <next step 2>713. <open question parked as ? — needs research>7273## pointers74- plan artifacts: docs/plans/<slug>/75- CONTEXT.md: ./CONTEXT.md76- recent commits: <commit hashes + subjects>7778## suggested skills79- <skill 1> — <why>80- <skill 2> — <why>8182## redacted83- (any sensitive info redacted — API keys, passwords, PII)84```8586## SOURCE DISCIPLINE8788- DO NOT duplicate content already captured in artifacts (PRDs, plans, ADRs,89 issues, commits, diffs). Reference them by path or URL instead.90- Redact any sensitive information: API keys, passwords, personally identifiable91 information. If you must reference that a secret exists, say "secret configured92 in env var FOO_KEY" without the value.9394## SUGGESTED SKILLS9596Include a "suggested skills" section that names the skills the next agent should97invoke, with a one-line reason each. Examples:9899```100## suggested skills101- bootstrap — re-enable auto-triggering + artifact-check habit at session start102- build — execute §T.4 next (status ~, blocked by §T.3 which is [x])103- verify — gate §T.4 before flipping to [x]104- lessons — if §T.4's test fails, trace root cause105```106107## BOUNDARIES108109- MUST save to the OS temp dir, NOT the workspace.110- MUST NOT duplicate content already in artifacts. Reference by path.111- MUST redact sensitive information.112- MUST include a "suggested skills" section.113- MUST use canonical terms from `CONTEXT.md`.114- MUST NOT write plan artifacts.