create-handoff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Handoff
创建工作交接文档
You are tasked with writing a handoff document to hand off your work to another agent in a new session. You will create a handoff document that is thorough, but also concise. The goal is to compact and summarize your context without losing any of the key details of what you're working on.
你的任务是编写一份工作交接文档,将你的工作移交给新会话中的另一个Agent。你需要创建一份既全面又简洁的交接文档。目标是在不丢失当前工作关键细节的前提下,精简并汇总相关上下文。
Process
流程
1. Filepath & Metadata
1. 文件路径与元数据
Use the following information to understand how to create your document:
First, determine the session name from existing handoffs:
bash
ls -td thoughts/shared/handoffs/*/ 2>/dev/null | head -1 | xargs basenameThis returns the most recently modified handoff folder name (e.g., ). Use this as the handoff folder name.
open-source-releaseIf no handoffs exist, use as the folder name.
generalCreate your file under: , where:
thoughts/shared/handoffs/{session-name}/YYYY-MM-DD_HH-MM_description.yaml- is from existing handoffs (e.g.,
{session-name}) oropen-source-releaseif none existgeneral - is today's date
YYYY-MM-DD - is the current time in 24-hour format (no seconds needed)
HH-MM - is a brief kebab-case description
description
Examples:
thoughts/shared/handoffs/open-source-release/2026-01-08_16-30_memory-system-fix.yamlthoughts/shared/handoffs/general/2026-01-08_16-30_bug-investigation.yaml
使用以下信息了解如何创建文档:
首先,从现有交接文档中确定会话名称:
bash
ls -td thoughts/shared/handoffs/*/ 2>/dev/null | head -1 | xargs basename该命令会返回最近修改的交接文件夹名称(例如:),将其用作交接文件夹名称。
open-source-release如果没有现有交接文档,使用作为文件夹名称。
general在以下路径下创建文件: ,其中:
thoughts/shared/handoffs/{session-name}/YYYY-MM-DD_HH-MM_description.yaml- 来自现有交接文档(例如:
{session-name}),若无则使用open-source-releasegeneral - 为当前日期
YYYY-MM-DD - 为24小时制的当前时间(无需秒数)
HH-MM - 为简短的短横线分隔式描述
description
示例:
thoughts/shared/handoffs/open-source-release/2026-01-08_16-30_memory-system-fix.yamlthoughts/shared/handoffs/general/2026-01-08_16-30_bug-investigation.yaml
2. Write YAML handoff (~400 tokens vs ~2000 for markdown)
2. 编写YAML格式的交接文档(约400个token,相比Markdown的约2000个token更精简)
CRITICAL: Use EXACTLY this YAML format. Do NOT deviate or use alternative field names.
The and fields are shown in the statusline - they MUST be named exactly this.
goal:now:yaml
---
session: {session-name from ledger}
date: YYYY-MM-DD
status: complete|partial|blocked
outcome: SUCCEEDED|PARTIAL_PLUS|PARTIAL_MINUS|FAILED
---
goal: {What this session accomplished - shown in statusline}
now: {What next session should do first - shown in statusline}
test: {Command to verify this work, e.g., pytest tests/test_foo.py}
done_this_session:
- task: {First completed task}
files: [{file1.py}, {file2.py}]
- task: {Second completed task}
files: [{file3.py}]
blockers: [{any blocking issues}]
questions: [{unresolved questions for next session}]
decisions:
- {decision_name}: {rationale}
findings:
- {key_finding}: {details}
worked: [{approaches that worked}]
failed: [{approaches that failed and why}]
next:
- {First next step}
- {Second next step}
files:
created: [{new files}]
modified: [{changed files}]Field guide:
- +
goal:- REQUIRED, shown in statuslinenow: - - What was accomplished with file references
done_this_session: - - Important choices and rationale
decisions: - - Key learnings
findings: - /
worked:- What to repeat vs avoidfailed: - - Action items for next session
next:
DO NOT use alternative field names like session_goal
, objective
, focus
, current
, etc.
The statusline parser looks for EXACTLY goal:
and now:
- nothing else works.
session_goalobjectivefocuscurrentgoal:now:重要提示:必须严格使用此YAML格式,不得偏离或使用其他字段名称。
goal:now:yaml
---
session: {来自记录的会话名称}
date: YYYY-MM-DD
status: complete|partial|blocked
outcome: SUCCEEDED|PARTIAL_PLUS|PARTIAL_MINUS|FAILED
---
goal: {本次会话完成的内容 - 显示在状态栏}
now: {下一次会话应首先执行的操作 - 显示在状态栏}
test: {验证工作的命令,例如:pytest tests/test_foo.py}
done_this_session:
- task: {第一项已完成任务}
files: [{file1.py}, {file2.py}]
- task: {第二项已完成任务}
files: [{file3.py}]
blockers: [{任何阻塞问题}]
questions: [{留给下一次会话的未解决问题}]
decisions:
- {决策_name}: {理由}
findings:
- {关键发现}: {详情}
worked: [{有效的方法}]
failed: [{失败的方法及原因}]
next:
- {第一个下一步操作}
- {第二个下一步操作}
files:
created: [{新建文件}]
modified: [{修改的文件}]字段说明:
- +
goal:- 必填,显示在状态栏中now: - - 已完成的工作及相关文件引用
done_this_session: - - 重要决策及其理由
decisions: - - 关键收获
findings: - /
worked:- 可复用的方法与需避免的方法failed: - - 下一次会话的行动项
next:
请勿使用session_goal
、objective
、focus
、current
等替代字段名称。
状态栏解析器只会识别完全匹配的goal:
和now:
——其他名称均无效。
session_goalobjectivefocuscurrentgoal:now:3. Mark Session Outcome (REQUIRED)
3. 标记会话结果(必填)
IMPORTANT: Before responding to the user, you MUST ask about the session outcome.
Use the AskUserQuestion tool with these exact options:
Question: "How did this session go?"
Options:
- SUCCEEDED: Task completed successfully
- PARTIAL_PLUS: Mostly done, minor issues remain
- PARTIAL_MINUS: Some progress, major issues remain
- FAILED: Task abandoned or blockedAfter the user responds, index and mark the outcome:
bash
undefined重要提示:在回复用户之前,你必须询问会话结果。
使用AskUserQuestion工具,提供以下确切选项:
Question: "本次会话进展如何?"
Options:
- SUCCEEDED: 任务成功完成
- PARTIAL_PLUS: 基本完成,仅存在少量问题
- PARTIAL_MINUS: 取得部分进展,但存在重大问题
- FAILED: 任务已放弃或被阻塞用户回复后,索引并标记结果:
bash
undefinedMark the most recent handoff (works with PostgreSQL or SQLite)
标记最新的交接文档(支持PostgreSQL或SQLite)
Use git root to find project, then opc/scripts/core/
使用git根目录查找项目,然后进入opc/scripts/core/
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "${CLAUDE_PROJECT_DIR:-.}")
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "${CLAUDE_PROJECT_DIR:-.}")
First, index the handoff into the database
首先,将交接文档索引到数据库中
cd "$PROJECT_ROOT/opc" && uv run python scripts/core/artifact_index.py --file thoughts/shared/handoffs/{session_name}/{filename}.yaml
cd "$PROJECT_ROOT/opc" && uv run python scripts/core/artifact_index.py --file thoughts/shared/handoffs/{session_name}/{filename}.yaml
Then mark the outcome
然后标记结果
cd "$PROJECT_ROOT/opc" && uv run python scripts/core/artifact_mark.py --latest --outcome <USER_CHOICE>
**IMPORTANT:** Replace `{session_name}` and `{filename}` with the actual values from step 1.
These commands auto-detect the database (PostgreSQL if configured, SQLite fallback).
**Note:** If indexing fails, the marking step will show "Database marking was not available" - this is acceptable for the first handoff but indicates the indexing step was skipped.cd "$PROJECT_ROOT/opc" && uv run python scripts/core/artifact_mark.py --latest --outcome <USER_CHOICE>
**重要提示:将`{session_name}`和`{filename}`替换为步骤1中的实际值。**
这些命令会自动检测数据库(已配置则使用PostgreSQL,否则回退到SQLite)。
**注意:如果索引失败,标记步骤会显示“Database marking was not available”——对于首次交接文档,这是可接受的,但表示索引步骤已被跳过。**4. Confirm completion
4. 确认完成
After marking the outcome, respond to the user:
Handoff created! Outcome marked as [OUTCOME].
Resume in a new session with:
/resume_handoff path/to/handoff.yaml##. Additional Notes & Instructions
- more information, not less. This is a guideline that defines the minimum of what a handoff should be. Always feel free to include more information if necessary.
- be thorough and precise. include both top-level objectives, and lower-level details as necessary.
- avoid excessive code snippets. While a brief snippet to describe some key change is important, avoid large code blocks or diffs; do not include one unless it's necessary (e.g. pertains to an error you're debugging). Prefer using references that an agent can follow later when it's ready, e.g.
/path/to/file.ext:linepackages/dashboard/src/app/dashboard/page.tsx:12-24
标记结果后,回复用户:
交接文档已创建!结果标记为[OUTCOME]。
在新会话中恢复工作请使用:
/resume_handoff path/to/handoff.yaml—
补充说明与指引
—
- 宁多勿少:这是交接文档的最低要求指南。如有必要,随时可以添加更多信息。
- 全面且精准:既包含顶层目标,也按需包含底层细节。
- 避免过多代码片段:虽然简短的片段有助于描述关键变更,但应避免大段代码块或差异对比;除非必要(例如与你正在调试的错误相关),否则不要包含。优先使用Agent后续可以跟进的引用,例如
/path/to/file.ext:linepackages/dashboard/src/app/dashboard/page.tsx:12-24