memory-handoff Skill
跨 agent CLI 的可移植会话交接。当会话在已知工作上启动时读取项目的交接文件;在会话结束或上下文即将用尽前写入或更新它。每个项目一个纯文本 markdown 文件,让任何 CLI(opencode、claude code、aider)共享记忆,使下次会话从思路中段继续,而不是冷启动。
安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。
技能指令原文(SKILL.md)
When to use
Load this skill when a session touches a project that has a handoff
file, when the user asks to "hand off", "pick up where we left off", or
"save context", or when a session is long enough that losing it would
hurt (roughly: more decisions made than fit in what you can trust
yourself to recall later).
The contract is one markdown file per project at a fixed location. Any
agent that can read and write files can use it. No daemon, no database,
no lock-in: the file is the memory.
The handoff file
Default location: ~/.agent/handoffs/.md, where the slug
is the project directory name (for ~/dev/src/crawlkit, the slug is
crawlkit). $AGENT_HANDOFF_DIR overrides the directory. The path for
a slug prints with scripts/handoff.sh path .
Use scripts/handoff.sh read to locate and print the file, and
write it back with any file-writing mechanism the host agent has.
The file has five fixed sections, in this order:
# handoff: <project-slug>
## Status
One paragraph: what this project is and where it stands. A stranger
should be able to act after reading only this.
## Open threads
Bulleted list of unfinished work, newest first. Each item names the
branch, file, or command needed to resume it.
## Decisions
Dated, one line each, irreversible or expensive-to-reverse choices
only. Rationale lives in the repo, not here.
## Next step
The single most useful thing to do first, as an imperative sentence
with the exact command if there is one.
## Updated
ISO timestamp of the last write and the name of the agent or human
that wrote it.
Steps
- At session start on known work: read the file. Treat
Next stepas
the default first action and Open threads as the agenda. Say out
loud what you picked up, so the human can correct stale context.
- Before doing irreversible work, check
Decisionsfor a dated line
that contradicts what you are about to do.
- On session end, on
save context, or when the session is long:
rewrite the file. Rewrite whole sections rather than appending;
stale handoffs are worse than none. Keep Status under 150 words.
- Every write updates the
Updatedline: timestamp plus which agent
wrote it (for example 2026-10-25T14:00Z by opencode).
- Never put secrets, tokens, or credentials in the file. It is
plaintext in a home directory and often synced by dotfile tooling.
Anti-patterns
- Do not dump session transcripts into the file. Handoff is decisions
and pointers, not history.
- Do not create a second format beside an existing one: if the project
already has NOTES.md or a task tracker the human maintains, ask
before introducing the handoff file.
- Do not write a handoff for throwaway work; the file earns its keep
on multi-session projects only.
See references/handoff-schema.md for a
filled-in example.