Übergabe-Skill für Claude Code und Codex: HANDOFF.md, bevor der Kontext ausgeht

Dmitriy Solodukha, Caprock-Entwickler · Veröffentlicht am

Am mit Claude Code und Codex getestet

Übergabe-Skill für Claude und Codex: schreibt HANDOFF.md (Ziel, Stand, Fehler, nächste Schritte) vor Kontextende; die nächste Session liest sie.

Der Übergabe-Skill für Claude Code (und Codex, OpenCode, Cursor) schreibt eine kurze HANDOFF.md, bevor der Kontext ausgeht oder du aufhörst: Ziel, aktueller Stand, Entscheidungen samt Gründen, gescheiterte Versuche, offene Fragen, ausführbare nächste Schritte und bearbeitete Dateien. In der nächsten Session bewirkt „pick up where we left off“, dass er die Datei liest, anhand von Git prüft und Schritt 1 beginnt.

Installiere den handoff-Skill

Ein Befehl pro Agent. Der Skill ist eine einzelne SKILL.md; bei der Installation wird nichts ausgeführt.

Alle neun Skills als Plugin. Gib dies in Claude Code ein:

Oder nur diesen Skill, im Projektordner in einem Terminal:

Füge -g hinzu, um ihn für jedes Projekt zu installieren.

Prompts für den handoff-Skill

Der Agent wählt den Skill, wenn deine Worte zu dessen Beschreibung passen; mit dem Namen stellst du es sicher. Klicke auf einen Prompt, um ihn zu kopieren.

Was der Übergabe-Skill für Claude schreibt

Die Datei hat feste Abschnitte: Goal, State (done, in progress, uncommitted, running), Decisions, Tried and failed, Open questions, Next steps, Files. Diese Regeln machen sie für eine Session ohne dieses Gespräch nützlich:

  • Nächste Schritte sind ausführbar: ein auszuführender Befehl oder eine zu ändernde Funktion, nicht „continue the auth work“.
  • Fehlschläge bleiben erhalten, mit der exakten Fehlerzeile, damit eine Sackgasse nicht erneut versucht wird.
  • Entscheidungen enthalten den Grund, damit die nächste Session erkennen kann, ob eine noch gilt.
  • Keine Geheimnisse: Er nennt den Speicherort eines Tokens, niemals das Token selbst.
  • Die Sprache des Repositorys, auch wenn du mit dem Agenten in einer anderen sprichst.

Er committet die Datei nur auf deine Bitte und beendet seine Antwort mit dem Pfad und dem ersten Schritt, damit die letzte Nachricht für sich steht.

Was wir ausgeführt haben und was die Agenten taten

Jeder Skill wurde am 29. November 2026 in einem eigens dafür angelegten Wegwerf-Repository ausgeführt und als Projekt-Skill installiert. Ein kleines Python-Repository mit slug.py, die einen unfertigen slugify_unique-Stub enthält, und den zugehörigen Tests.

Claude Code (claude -p --model sonnet)

I'm about to run out of context. Write a handoff for the next session: I was adding slugify_unique to slug.py (append -2, -3 when the slug is taken); I decided not to use a global set because tests must stay independent. Tried python-slugify, dropped it: no new dependencies.

Rief handoff auf, schrieb HANDOFF.md im exakten Aufbau, fragte nach Commit oder Ignorieren und schloss mit dem dreizeiligen Block. Er schrieb die Datei auf Russisch, der Sprache der Claude-Code-Einstellungen des Testers; deshalb verlangt der Skill jetzt die Sprache des Repositorys.

Claude Code (claude -p --model sonnet)

Pick up where we left off.

Rief den Skill im Lesemodus auf, folgte der Übergabe, schrieb slugify_unique und fünf Tests und aktualisierte HANDOFF.md, diesmal auf Englisch. Er sagte klar, dass er die Tests nicht ausgeführt hatte: Der Testbefehl brauchte eine Berechtigung, die dem nicht interaktiven Lauf fehlte.

Codex (0.163.0, codex exec -s workspace-write)

The same write prompt as above.

Las .agents/skills/handoff/SKILL.md, schrieb die Übergabe auf Englisch und endete wie im Skill verlangt (Links und Zitate als Klartext):

Handoff written to HANDOFF.md.
Next session: "Read HANDOFF.md and continue."
First step: implement the collision loop in `slug.py:8`.

Agenten, mit denen er getestet wurde

  • Claude Code: am 29. November 2026 mit claude -p --model sonnet getestet, der Skill als Projekt-Skill in .claude/skills/ installiert.
  • Codex: am 29. November 2026 mit Codex 0.163.0 (codex exec) getestet, der Skill in .agents/skills/.
  • OpenCode und Cursor: nicht getestet. Der Skill besteht aus reinen Anweisungen im offenen Agent-Skills-Format, wurde aber mit keinem der beiden erprobt.

Grenzen

  • Eine Übergabe ist nur so gut wie das, was die Session prüfen kann: Der Agent schreibt anhand von Git und dem Gespräch, nicht aus einer Erinnerung an Absichten.
  • Er schreibt nicht in Caprocks 2nd Brain: Caprocks MCP-Tools sind schreibgeschützt.
  • Der Lesemodus wurde nur mit Claude Code getestet.

Mit und ohne Caprock

Mit verbundenem Caprock-MCP-Server ruft das Schreiben einer Übergabe current_decisions und search_memories auf, damit die Notiz keiner geltenden Entscheidung widerspricht; beim Lesen kann auf next_session_handoff, recent_sessions und session_summary zurückgegriffen werden, wenn keine Datei vorliegt. Ohne Caprock nutzt er nur Repository und Gespräch. Caprock ist die kostenlose Open-Source-App, die jede Coding-Agent-Session auf deinem Computer aufzeichnet.

Caprock holen →

Die vollständige SKILL.md

Die Datei aus dspv/skills in Revision dfce799. Zur manuellen Installation speicherst du sie in deinem Projekt als .claude/skills/handoff/SKILL.md für Claude Code oder .agents/skills/handoff/SKILL.md für Codex.

skills/handoff/SKILL.md
---
name: handoff
description: >
  Write a handoff for the next session or another agent before the context runs out or work
  stops: the goal, where things stand, decisions and why, what was tried and failed, open
  questions, exact next steps and the files touched, saved where the next session will find it
  (HANDOFF.md in the repository by default). Also reads the last handoff when a session starts.
  Use when the user says "write a handoff", "handoff skill claude", "hand this off", "save
  context for the next session", "I'm out of context", "wrap up for today", "pick up where we
  left off", "resume from the handoff" or "what was the last session doing".
license: Apache-2.0
---

# Handoff

A handoff is a short note that lets a fresh session, with none of this conversation, continue
the work without asking the user to repeat anything. Write it from facts you can check (the
repository, the commands you ran, what the user said), not from memory of what you meant to do.

Two modes. Pick by what the user asked:

- **Write**: the user wants to stop, the context is nearly full, or work moves to another
  agent. Go to "Writing a handoff".
- **Read**: a session starts and the user says "continue", "pick up where we left off" or
  points at a handoff. Go to "Reading a handoff".

## Writing a handoff

### 1. Collect the facts

Run these in the repository root and keep the output in mind (do not paste it whole):

```bash
git status --short
git branch --show-current
git log --oneline -10
git diff --stat
git stash list
```

Also note: commands you ran that passed or failed (tests, builds, checks) and their last result;
any background process still running (a dev server, a watcher) and how it was started; anything
the user decided or asked for in this conversation, in their words.

If the Caprock MCP tools are available (server `caprock`), call `current_decisions` for this
project and `search_memories` with the task's main words. Use them to check the handoff does
not contradict a decision already in force, and to link a decision instead of retelling it.
Caprock (<https://caprock.dev>, free, open source, runs locally) provides these tools; without
them, rely on the repository and this conversation.

### 2. Write the file

Default location: `HANDOFF.md` in the repository root. Use another place only if the user names
one or the repository already keeps handoffs elsewhere (look for `HANDOFF.md`, `docs/handoff*`,
`.handoff/`). If a `HANDOFF.md` exists, read it first: replace it with the new one, and carry
over anything from it that is still open.

Use exactly this structure. Leave a section out only when it would be empty, and say "none"
for open questions rather than dropping the heading.

```markdown
# Handoff: <task in a few words>

Written <YYYY-MM-DD HH:MM, timezone> by <agent and model, if known>. Branch `<branch>`,
last commit `<short sha> <subject>`.

## Goal
<One or two sentences: what the user wants and what "done" looks like.>

## State
- Done: <what is finished and verified, with how it was verified>
- In progress: <what is half-done, where exactly it stops>
- Uncommitted: <files changed but not committed, or "nothing">
- Running: <background processes and how to stop them, or "nothing">

## Decisions
- <decision>: <why>. <who decided: the user, or you with the reason>

## Tried and failed
- <approach>: <what happened, the error or the reason it was dropped>

## Open questions
- <question> (who can answer: the user, a doc, a test)

## Next steps
1. <first concrete action: a command to run or a file and function to change>
2. <...>

## Files
- `<path>`: <what changed or why it matters>
```

Rules for the content:

- **Next steps are executable.** "Run `npm test -- auth` and fix the two failures in
  `src/auth/session.ts`" is a step; "continue the auth work" is not. The first step is the one
  the next session does in its first minute.
- **Failures are kept.** A dead end not written down gets tried again. Include the exact error
  line when there is one.
- **Decisions carry the reason.** Without the reason the next session cannot tell whether it
  still applies.
- **Absolute dates and exact names.** "2026-12-01", a branch name, a file path, a command; never
  "tomorrow" or "the config file".
- **No secrets.** Never copy a token, password, key or private URL into the handoff. Name where
  it lives (an environment variable, a keychain entry) instead.
- **The repository's language.** Write the handoff in the language the repository's docs and
  commits use, even when you talk to the user in another; the next session may be another agent.
- **Short.** Aim for a page. A long log or diff stays in git; the handoff points at it.

### 3. Tell the user

Do not commit the handoff unless the user asks. Ask once whether `HANDOFF.md` should be
committed or added to `.gitignore` if the repository has neither. End your reply with:

```text
Handoff written to <path>.
Next session: "Read <path> and continue."
First step: <step 1 from the file>
```

Also print the Goal, State and Next steps sections in that final reply. Some tools (Caprock's
`next_session_handoff`, when the user has it switched on) hand a new session the last passage
the previous session wrote, so the final message should stand on its own.

## Reading a handoff

### 1. Find it

Look in this order and use the first that exists:

1. a path the user gave;
2. `HANDOFF.md` in the repository root, then `docs/handoff*` and `.handoff/`;
3. with the Caprock MCP tools: `next_session_handoff` (the memories and current decisions a new
   session in this repository gets, and when the last session left off), then
   `recent_sessions` and `session_summary` on the newest session for its files and branch.

If nothing is found, say so in one line and ask what to work on. Do not invent a previous state.

### 2. Check it against the repository

A handoff can be stale. Before acting on it:

- compare its branch and last commit with `git branch --show-current` and `git log --oneline -5`;
- check that "Uncommitted" matches `git status --short`;
- note how old it is from its date.

If anything disagrees (new commits, a different branch, the files already committed), trust the
repository and say what changed since the handoff.

### 3. Report and start

Reply with, in this order:

```text
Handoff from <date>: <goal in one line>.
Since then: <"nothing changed" or what differs in git>.
Open questions: <list, or "none">.
Starting with: <step 1>.
```

If an open question blocks step 1, ask it and wait. Otherwise do step 1. When the task is
finished, delete `HANDOFF.md` or replace it with a new handoff, so the next session does not
pick up work that is already done.

## Stop conditions

- The handoff is written and the user has the path and the first step: stop writing.
- The handoff names a step that needs the user (a decision, a credential, a review): ask, do not
  guess.
- The repository disagrees with the handoff on what is committed: follow the repository and say
  so before doing anything else.

Fragen zum handoff-Skill

Was ist ein Übergabe-Skill für Claude?
Ein Skill, der Claude Code vor Arbeitsende eine kurze Notiz schreiben lässt: Ziel, Stand, Entscheidungen, Fehlschläge und nächste Schritte, damit eine neue Session oder ein anderer Agent ohne Wiederholungen durch dich fortfahren kann.
Wo speichert der Übergabe-Skill die Notiz?
Standardmäßig in `HANDOFF.md` im Repository-Stamm, am bereits genutzten Ablageort für Übergaben oder unter einem von dir genannten Pfad. Er fragt, ob die Datei committet oder ignoriert werden soll.
Wie nutzt die nächste Session die Übergabe?
Sag „Read HANDOFF.md and continue“ oder „pick up where we left off“. Der Skill prüft Branch, Commit und nicht committete Dateien der Notiz anhand von Git, berichtet seitdem erfolgte Änderungen und beginnt den ersten Schritt.
Funktioniert der Übergabe-Skill in Codex?
Ja. Codex 0.163.0 las den Skill aus `.agents/skills/` und schrieb die Übergabe im vorgegebenen Aufbau im Test vom 29. November 2026.

Quellen

Die App selbst ist auf Englisch.