Claude Code와 Codex용 핸드오프 스킬: 컨텍스트가 소진되기 전에 HANDOFF.md 작성

Dmitriy Solodukha, Caprock 개발자 · 게시일

Claude Code와 Codex에서 테스트

Claude와 Codex용 핸드오프 스킬입니다. 컨텍스트가 소진되기 전에 HANDOFF.md에 목표, 상태, 실패한 시도, 다음 단계를 기록하고, 다음 세션이 이를 읽습니다.

Claude Code(및 Codex, OpenCode, Cursor)용 핸드오프 스킬은 컨텍스트가 소진되거나 작업을 멈추기 전에 짧은 HANDOFF.md를 작성합니다. 목표, 현재 상태, 결정과 그 이유, 시도했지만 실패한 내용, 미해결 질문, 실행 가능한 다음 단계, 건드린 파일을 기록합니다. 다음 세션에서 “pick up where we left off”라고 하면 파일을 읽고 git과 대조한 다음 1단계를 시작합니다.

handoff 스킬 설치

에이전트마다 명령어 하나로 설치합니다. 스킬은 SKILL.md 파일 하나이며, 설치 시 실행되는 것은 없습니다.

스킬 아홉 가지 전체를 플러그인으로 설치합니다. Claude Code 안에서 다음을 입력합니다:

이 스킬만 설치하려면 터미널에서 프로젝트 폴더로 이동한 뒤 다음을 실행합니다:

추가 옵션: -g 모든 프로젝트에 설치하려면 앞의 옵션을 추가합니다.

handoff 스킬을 사용하는 프롬프트

요청이 스킬 설명과 일치하면 에이전트가 해당 스킬을 선택합니다. 이름을 명시하면 확실하게 선택할 수 있습니다. 프롬프트를 클릭하면 복사됩니다.

handoff 스킬이 Claude를 위해 작성하는 내용

파일은 Goal, State(done, in progress, uncommitted, running), Decisions, Tried and failed, Open questions, Next steps, Files라는 고정 섹션으로 구성됩니다. 이 대화 내용이 전혀 없는 세션에서도 유용하게 만드는 규칙은 다음과 같습니다.

  • 실행 가능한 다음 단계: “continue the auth work”가 아니라 실행할 명령어나 변경할 함수를 제시합니다.
  • 실패 기록 보존: 막힌 접근법을 다시 시도하지 않도록 정확한 오류 줄을 함께 기록합니다.
  • 이유를 함께 기록한 결정. 다음 세션에서 여전히 적용되는지 판단할 수 있도록 합니다.
  • 비밀 정보 제외: 토큰 자체는 절대 기록하지 않고 토큰이 저장된 위치만 명시합니다.
  • 다른 곳에서 에이전트와 대화하더라도 저장소의 언어.

요청하지 않으면 파일을 커밋하지 않습니다. 마지막 메시지만으로도 내용을 파악할 수 있도록 응답 끝에 경로와 첫 단계를 제시합니다.

실행한 내용과 에이전트의 수행 결과

각 스킬은 2026년 11월 29일에 전용 임시 저장소에 프로젝트 스킬로 설치하여 실행했습니다. slug.py에 미완성 slugify_unique 스텁과 해당 테스트가 있는 작은 Python 저장소입니다.

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.

handoff를 호출하고, 정확한 구조로 HANDOFF.md를 작성하고, 커밋할지 무시할지 물은 뒤 세 줄 블록으로 마무리했습니다. 파일은 테스트한 사람의 Claude Code 설정 언어인 러시아어로 작성했습니다. 이 실행 결과 때문에 현재 스킬에는 저장소의 언어로 작성하라는 지침이 들어 있습니다.

Claude Code (claude -p --model sonnet)

Pick up where we left off.

읽기 모드로 스킬을 호출하고 핸드오프를 따라 slugify_unique와 테스트 다섯 개를 작성한 뒤 HANDOFF.md를 업데이트했습니다. 이번에는 영어로 작성했습니다. 테스트를 실행하지 않았다고 분명히 밝혔습니다. 테스트 명령에 비대화형 실행에서 갖고 있지 않은 권한이 필요했기 때문입니다.

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

The same write prompt as above.

.agents/skills/handoff/SKILL.md를 읽고 핸드오프를 영어로 작성한 뒤 스킬의 지시대로 마무리했습니다(링크와 인용문은 일반 텍스트로 표시):

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

테스트한 에이전트

  • Claude Code: .claude/skills/에 프로젝트 스킬로 설치한 상태에서 2026년 11월 29일에 claude -p --model sonnet으로 테스트했습니다.
  • Codex: 2026년 11월 29일에 Codex 0.163.0(codex exec)로 테스트했으며, 스킬은 .agents/skills/에 설치했습니다.
  • OpenCode와 Cursor: 테스트하지 않았습니다. 스킬은 공개 Agent Skills 형식의 일반 지침이지만, 어느 쪽에서도 실행하여 확인하지 않았습니다.

한도

  • 핸드오프의 품질은 세션에서 확인할 수 있는 내용에 달려 있습니다. 에이전트는 의도를 기억해 쓰는 대신 Git과 대화를 바탕으로 작성합니다.
  • Caprock의 2nd Brain에 쓰지 않습니다. Caprock의 MCP 도구는 읽기 전용입니다.
  • 읽기 모드는 Claude Code에서만 테스트했습니다.

Caprock을 사용할 때와 사용하지 않을 때

Caprock MCP 서버가 연결되어 있으면 핸드오프를 작성할 때 current_decisions와 search_memories를 호출하여 메모가 이미 적용 중인 결정과 모순되지 않게 합니다. 핸드오프를 읽을 때 파일이 없으면 next_session_handoff, recent_sessions, session_summary를 대신 사용할 수 있습니다. Caprock이 없으면 저장소와 대화만 사용합니다. Caprock은 컴퓨터의 모든 코딩 에이전트 세션을 기록하는 무료 오픈 소스 앱입니다.

Caprock 다운로드 →

SKILL.md 전문

dspv/skills의 리비전 dfce799에 있는 파일 그대로입니다. 수동으로 설치하려면 프로젝트 안에 Claude Code용은 .claude/skills/handoff/SKILL.md, Codex용은 .agents/skills/handoff/SKILL.md로 저장합니다.

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.

handoff 스킬 관련 질문

Claude용 handoff 스킬이란 무엇인가요?
Claude Code가 작업을 멈추기 전에 목표, 상태, 결정, 실패, 다음 단계를 짧은 노트로 남기게 하는 스킬입니다. 새 세션이나 다른 에이전트가 설명을 다시 듣지 않고도 이어서 작업할 수 있습니다.
handoff 스킬은 메모를 어디에 저장하나요?
기본적으로 저장소 루트의 `HANDOFF.md`에 저장하거나, 저장소에서 기존에 핸드오프를 보관하는 위치 또는 지정한 경로에 저장합니다. 파일을 커밋할지 무시할지 묻습니다.
다음 세션은 핸드오프를 어떻게 활용하나요?
“Read HANDOFF.md and continue” 또는 “pick up where we left off”라고 말합니다. 스킬은 메모의 브랜치, 커밋, 커밋하지 않은 파일을 Git과 대조하고, 그 이후 달라진 점을 보고한 뒤 첫 단계를 시작합니다.
handoff 스킬이 Codex에서도 작동하나요?
네. Codex 0.163.0은 2026년 11월 29일 테스트에서 `.agents/skills/`의 스킬을 읽고 해당 구조에 맞춰 핸드오프를 작성했습니다.

출처

앱 자체는 영어로 되어 있습니다.