Skip to content
Back to skills

Handoff

ASecurity

Save a cold-start resume brief of the current session before /clear, or resume from one. Use when the conversation has grown long on a deep/complex task and you want to reset context without re-explaining. Usage: /handoff [save] | /handoff resume [ticket] | /handoff list

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsgoshellbashgitapi

Works with

  • api
  • mcp

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add Leen15/leen15-claude-marketplace --skill handoff --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Handoff?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Handoff
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leen15-handoff/badge)](https://www.skillsdirectory.com/skills/leen15-handoff)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: handoff
description: Save a cold-start resume brief of the current session before /clear, or resume from one. Use when the conversation has grown long on a deep/complex task and you want to reset context without re-explaining. Usage: /handoff [save] | /handoff resume [ticket] | /handoff list
---

Manage **handoff briefs**: compact, cold-start documents that let a fresh session resume a long/complex task without re-explaining anything. The brief captures the *conversation state* (decisions, dead ends, next steps) and lives **outside the repo**, separate from the user's in-repo task file under `docs/`.

## Storage location (outside any repo)

Briefs are stored per-repo under the user's home, NOT inside the project:

```
${CLAUDE_CONFIG_DIR:-$HOME/.claude}/handoff/<repo>/<ticket>.md
```

- When `CLAUDE_CONFIG_DIR` is set, use it as the Claude home directory.
- Otherwise fall back to `$HOME/.claude`.
- `<repo>` = basename of `git rev-parse --show-toplevel` (fallback: basename of the current working directory).
- `<ticket>` = derived in **Step 0** below.

Never write a brief inside the repo. The in-repo `docs/` task file is the user's own; the skill references it but never overwrites it.

## Step 0 — resolve repo and ticket (every mode)

Run, in one block:

```bash
ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
REPO=$(basename "$ROOT")
BRANCH=$(git -C "$ROOT" rev-parse --abbrev-ref HEAD 2>/dev/null)
CLAUDE_HOME="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
HANDOFF_DIR="$CLAUDE_HOME/handoff/$REPO"
HINDSIGHT_MCP="${HANDOFF_HINDSIGHT_MCP:-hindsight}"
echo "repo=$REPO branch=$BRANCH handoff_dir=$HANDOFF_DIR hindsight_mcp=$HINDSIGHT_MCP"
```

`hindsight_mcp` is the MCP server name used by the optional Hindsight sync (see **Hindsight memory sync** below).

Derive a **proposed** `<ticket>`:
1. If `$ARGUMENTS` contains an explicit ticket after the subcommand, use it.
2. Else extract a ticket code from `$BRANCH` — the first match of `[A-Z]+-[0-9]+` (e.g. `feature/CNTPL-920-expand-opensearch` → `CNTPL-920`).
3. Else use the branch name with `/` replaced by `-` (e.g. `develop` → `develop`).

**Always confirm the reference with the user before using it** — never assume it silently. The ticket from the branch is often NOT the actual task discussed this session (e.g. meta-work on a CNTPL-920 branch). Ask explicitly, e.g.:

> Userei `<proposed-ticket>` come riferimento per il brief (da branch `<branch>`). Va bene, o preferisci un altro nome? Il lavoro di questa sessione mi sembra riguardare: `<short description of what THIS session was actually about>`.

If what the session actually covered differs from the branch ticket, say so and propose a content-based slug instead (e.g. `token-cost-and-handoff-skill`). Use the name the user confirms. In `resume`/`list` modes, if multiple briefs exist and the reference is ambiguous, confirm which one before reading.

The brief path is `$HANDOFF_DIR/<confirmed-ref>.md`.

Before every filesystem operation, resolve the storage directory in the same
shell command. Do not assume shell variables from a previous command persist:

```bash
CLAUDE_HOME="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
HANDOFF_DIR="$CLAUDE_HOME/handoff/$REPO"
```

## Parse `$ARGUMENTS`

First token = subcommand. If empty, default to `save`.
- `save` (or empty) → **Save mode**
- `resume` → **Resume mode**
- `list` → **List mode**

---

## Hindsight memory sync (optional)

When a [Hindsight](https://github.com/vectorize-io/hindsight) MCP server is connected, Save mode also pushes the durable part of the brief into Hindsight, and Resume mode pulls related memories from it. The brief file always stays the source of truth: Hindsight extracts facts with an LLM and may drop details, so it complements the file and never replaces it.

- Server name: `hindsight_mcp` from Step 0 (env `HANDOFF_HINDSIGHT_MCP`, default `hindsight`). `HANDOFF_HINDSIGHT_MCP=off` disables the sync.
- **Active only if** the tools `mcp__<hindsight_mcp>__sync_retain` and `mcp__<hindsight_mcp>__recall` exist in this session. If they are deferred, load them with ToolSearch (`select:mcp__<hindsight_mcp>__sync_retain,mcp__<hindsight_mcp>__retain,mcp__<hindsight_mcp>__recall`). If they do not exist, skip every Hindsight step silently — never mention Hindsight to the user.
- Document ID: `handoff:<repo>:<confirmed-ref>`. Retaining again with the same `document_id` replaces the previous memories of that document, so each brief maps to exactly one up-to-date document.
- Never send credentials, tokens, passwords, API keys, connection strings, or other secrets to Hindsight, even if they appear in the brief.

---

## Save mode

Goal: dump everything needed to resume this task cold into the brief file, so the user can `/clear` and continue with a one-line prompt.

1. Resolve repo/ticket (Step 0), then create the storage directory:

   ```bash
   CLAUDE_HOME="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
   HANDOFF_DIR="$CLAUDE_HOME/handoff/$REPO"
   mkdir -p "$HANDOFF_DIR"
   ```

2. If the brief already exists, read it first and **update** it (preserve still-valid Decisions/Pitfalls, don't lose history) rather than blindly overwriting.
3. Look for the user's in-repo task file (commonly `docs/wip-*.md`, `docs/<ticket>*.md`, or whatever they mentioned this session). If found, reference its path under **Key files** — do NOT duplicate its content into the brief.
4. Write the brief using this exact template, filled from the **current conversation**. Be concrete and specific — this is read by a fresh session with zero memory.

```markdown
# <ticket> — <one-line task title>
_Updated: <output of `date '+%Y-%m-%d %H:%M'`> · repo: <repo> · branch: <branch>_

## Objective
<2-3 lines: what we are ultimately trying to achieve>

## Current state
<where things stand right now: what works, what is in progress, what is broken>

## Decisions + why
<every non-obvious choice made this session and the reason — so it is not re-litigated>

## Next steps
<ordered, actionable list — what to do next, most specific first>

## Key files
<path:line — why it matters. Include the in-repo docs/ task file if present.>

## Pitfalls / dead ends
<approaches already tried and rejected, gotchas, constraints, things that look wrong but are intentional>

## Open questions
<anything unresolved that may need the user's input>
```

5. **Hindsight sync** (only if active, see above). Call `mcp__<hindsight_mcp>__sync_retain` with:
   - `content`: the brief title line plus the **Objective**, **Decisions + why** and **Pitfalls / dead ends** sections, secrets removed. Exclude Current state, Next steps, Key files and Open questions: they go stale quickly and stay only in the file.
   - `document_id`: `handoff:<repo>:<confirmed-ref>`
   - `context`: `handoff`
   - `tags`: `["project:<repo>", "ticket:<confirmed-ref>", "source:handoff"]`
   - `metadata`: `{"brief_path": "<resolved-handoff-dir>/<ticket>.md", "branch": "<branch>", "source": "handoff"}`
   - `timestamp`: current UTC time in ISO format (`date -u '+%Y-%m-%dT%H:%M:%SZ'`)

   The sync succeeded only if the call completes and returns a non-empty `memory_ids` list. A failure never blocks the save: the file is already written.

   **Quota fallback.** If `sync_retain` fails because the LLM provider quota is exhausted (the error mentions `provider quota` or `quota exhausted`), call `mcp__<hindsight_mcp>__retain` once with exactly the same arguments. Hindsight queues it and processes it automatically when the quota resets. This is only a deferral, not a verified sync: report it as queued with its `operation_id`. Do not use this fallback for any other error.

6. After writing, print to the user, verbatim, a ready-to-use resume block:

```
Brief salvato in <resolved-handoff-dir>/<ticket>.md

Ora fai /clear, poi incolla:
  /handoff resume <ticket>
```

If the Hindsight sync is active, add one line after the first one: `Hindsight: <N> memorie (handoff:<repo>:<ref>)` on success, `Hindsight: in coda fino al reset della quota, non ancora verificato (operation <operation_id>)` when the quota fallback was used, or `Hindsight: sync non riuscito — <short reason>` when the call fails or returns zero memories.

Do not run `/clear` yourself — it is the user's action.

## Self-check before finishing Save

Ask yourself: "If I had zero memory of this conversation, could I resume from this file alone?" If any answer would force the user to re-explain something, add it to the relevant section. The **Decisions + why** and **Pitfalls** sections are where hard-to-re-explain context lives — bias toward over-capturing there.

---

## Resume mode

Goal: silently reload the saved context so work can continue. This is a **drop-in replacement for `/compact`**, NOT a status meeting. Restore the context, acknowledge in one line, then stop and wait for the user.

1. Resolve repo/ticket (Step 0).
2. Resolve the handoff path using `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/handoff/$REPO/<ticket>.md` and read it into context. If it does not exist, run List mode and ask which brief to use.
3. Also read the in-repo task file it references under **Key files**, if any.
4. **Hindsight recall** (only if active, see above). Call `mcp__<hindsight_mcp>__recall` with `query` = the brief title plus its Objective, `tags: ["project:<repo>"]`, `tags_match: "any_strict"`, `budget: "low"`, `max_tokens: 2000`. Treat the results as background context only. On conflict the brief file wins, unless a memory is newer than the brief's `_Updated:` date and does not come from this brief's own document (`document_id` different from `handoff:<repo>:<ref>`), e.g. a decision taken later in another assistant. If the recall fails, continue silently.
5. Output **at most one short line** confirming what was reloaded — e.g. `Contesto ripreso da <ticket> (branch <branch>). Dimmi come procedere.` If step 4 found newer memories that contradict the brief, mention them in the same line in a few words (e.g. `… Nota: Hindsight ha una decisione più recente su <topic>.`). Do NOT reproduce the brief: no recap, no decisions list, no next-steps dump, no tables, no question.
6. Do NOT proactively ask the Open questions or propose next steps. The brief now lives in your context — use it to answer the user's next message. Ask a question only if the user's explicit request genuinely cannot be carried out without it.

**For the rest of the conversation after a resume:** behave normally. Do not re-summarize state, re-list next steps, or ask "how do you want to proceed" unless the user explicitly asks for a recap. Resume loads context; it does not report on it.

---

## List mode

```bash
ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
REPO=$(basename "$ROOT")
CLAUDE_HOME="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
HANDOFF_DIR="$CLAUDE_HOME/handoff/$REPO"

if [ -d "$HANDOFF_DIR" ]; then
  ls -lt "$HANDOFF_DIR"
else
  echo "No handoff briefs for $REPO"
fi
```

Print the available briefs for this repo (filename + last-modified). If the directory is empty or missing, say there are no briefs yet for `<repo>`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.