handoff
它能做什么
这个工具会生成一个名为 `HANDOFF.md` 的文件。它总结了你想要达成的目标、哪些方法有效、哪些失败了,以及接下来的步骤。它就像一份交接说明,让别人(或者之后的你自己)能从上次停下的地方准确接着做。
适用场景
- ✓当你和 AI 的对话太长、内容已经混乱时。
- ✓当 AI 一直在尝试同一个行不通的方案时。
- ✓当你需要暂停工作、之后再接着做时。
技能链接
https://github.com/thedotmack/claude-mem/blob/main/plugin/skills/handoff/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“创建一个总结文件,方便继续这项工作。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析主要目标、当前项目的状态(哪些部分正常、哪些不正常)、改动过的文件、失败的尝试以及后续步骤,然后把这些内容整理成一份便于接续的文档。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Handoff
Generate a structured HANDOFF.md file that gives a fresh Claude session everything it needs to continue this work without dragging the current degraded context forward.
claude-mem already injects recent observations into every new session, so the fresh agent starts with a timeline of what happened. The handoff adds what that timeline cannot: the goal, the failed attempts and why they failed, the current theory, and exact next steps, plus pointers into memory for deeper recall.
When to Use
- The session is long and Claude feels confused or repetitive
- Claude keeps trying the same failing solution over and over
- The user wants to step away and resume later
/compactran but Claude still lacks clear direction- The user says "handoff", "generate a handoff", "I want to start fresh", or "write a handoff doc"
What to Capture
Think hard about the full arc of this conversation before writing. The handoff must be useful to a Claude instance that has never seen this conversation.
Required Sections
Goal — One paragraph. What is the user actually trying to accomplish? State the end state, not the current sub-task. Be specific enough that a fresh agent can orient immediately.
Current State — What is working right now? What is broken? What is the exact symptom of the problem? Include error messages verbatim if relevant.
Files in Play — List every file that has been read, edited, or created during this session that is relevant to the current task. Use absolute or repo-relative paths. Include a one-line note on why each file matters.
What Has Been Tried (and Why It Failed) — This is the most important section. List every approach attempted that did not work, and explain WHY it failed (not just that it failed). A fresh agent that skips this section will repeat the same mistakes.
Current Best Theory — What do you currently believe is the right path forward, even if you haven't proven it yet? Include any evidence or reasoning that supports it.
Next Steps — Concrete, ordered actions for the fresh agent to take. Be specific: file paths, function names, commands to run. The fresh agent should be able to start on step 1 immediately.
Key Constraints and Context — Any non-obvious constraints: environment specifics, user preferences expressed during this session, things the user explicitly said NOT to do, external dependencies, performance requirements, etc.
Memory Pointers — If claude-mem's search tools are available, run
searchfor this task's key terms and list the few observation IDs that matter most (a decision, the root cause, a failed approach), so the fresh agent can pull full details withget_observations. Also list one or twosearchqueries worth re-running. Skip this section if the tools are not available.
Writing Rules
- Write the handoff for a fresh Claude, not for the user. The user knows what happened; the fresh Claude does not.
- Be ruthlessly specific. Vague next steps are useless. "Fix the auth" is bad. "In
src/auth/middleware.ts:47, the token expiry check usesDate.now()but should usereq.timestamp— change the comparison on line 52" is good. - Include exact error messages, stack traces, or test output that captures the failure mode.
- Do not pad. Every sentence should be load-bearing information for the fresh agent.
- Do not write the handoff from the user's perspective. Write it as a briefing document addressed to the incoming agent.
Output
Write the handoff to HANDOFF.md in the current working directory (the project root).
Use this structure:
# Handoff
> Generated: [timestamp]
> Project: [project name or directory]
> Session summary: [one sentence describing what this session was about]
## Goal
[What the user is trying to accomplish — the actual end state]
## Current State
**Working:**
- [list what is confirmed working]
**Broken:**
- [exact symptom, error message, or failure mode]
## Files in Play
| File | Why It Matters |
|------|---------------|
| `path/to/file.ts` | [one line] |
## What Has Been Tried (and Why It Failed)
### Attempt 1: [short name]
- **What:** [what was done]
- **Why it failed:** [root cause, not just "it didn't work"]
### Attempt 2: [short name]
...
## Current Best Theory
[What you currently believe is the correct approach and why]
## Next Steps
1. [Specific, actionable step with file path or command]
2. [Next step]
3. ...
## Key Constraints
…
常见问题
为什么需要这个文件?
它能确保任何人(包括新开的 AI 会话)都能快速了解工作进展,从而接着做下去,不会丢失重要信息,也不会重复犯同样的错误。
生成 `HANDOFF.md` 文件之后我该做什么?
新开一个与 AI 的会话,让它读取 `HANDOFF.md` 文件,然后接着完成这项工作。
我应该把 `HANDOFF.md` 文件保留在项目里吗?
通常不需要,它只是临时文件。新的 AI 会话读取并接续工作之后,你可以删除它,或者把它加入 `.gitignore`,避免被永久保存。
详情
作者的原始描述
Generate a HANDOFF.md that captures goal, current state, files touched, failed attempts, and next steps — so a fresh Claude session can continue exactly where this one left off. Use when sessions are getting long, Claude keeps retrying the same broken solution, or the user wants to step away and resume later.
repo: thedotmack/claude-mem
热度
- GitHub 星标
- 101k
- 排名
- #1271
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
Agent Cost Report
101k让你的智能体生成其活动的详细成本报告。显示在 token 和服务上花费了多少。
claude-mem-install
101k帮助你的智能体在不同环境中设置 Claude-Mem。你可以选择使用本地或远程工作进程,并配置观察功能。
mem-search
101k让你的智能体搜索过去的记忆。适合回忆之前的解决方案,或旧会话中的工作内容。
host-observer
101k帮助你的智能体响应 Claude-Mem 观察者任务。它只能回复“skip_summary”或完整的 XML 观察记录。