mcpField
C
create-handoff

create-handoff

github.com/parcadeiAgent 工作流3.9k510 次安装39 周前更新
代码仓库

关于 create-handoff

create-handoff 是用于编写 YAML 交接文档的 Agent 技能,帮助新会话中的 Agent 接续工作。它还说明了如何索引文档并记录会话结果。

主要功能

  1. 01查找当前交接目录
  2. 02创建带日期的 YAML 交接文档
  3. 03记录目标、发现和后续步骤
  4. 04索引文档并标记结果

适用场景

  1. 01将工作交给新会话中的 Agent
  2. 02在结束会话前记录项目状态

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/parcadei/continuous-claude-v3 --skill create-handoff

安装后在 Claude Code 中输入/create-handoff确认已加载。

附带文件SKILL.v6.md

详细介绍

创建交接文档

你的任务是编写一份交接文档,将你的工作交接给新会话中的另一位 Agent。你要创建一份详尽但也简洁的交接文档。目标是在不丢失当前工作关键细节的前提下,压缩并总结你的上下文。

流程

1. 文件路径和元数据

使用以下信息了解如何创建文档:

首先,从现有交接文档中确定会话名称:

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-release);如果不存在,则使用 general
  • YYYY-MM-DD 是今天的日期
  • HH-MM 是当前时间,使用 24 小时制(无需精确到秒)
  • description 是简短的 kebab-case 描述

示例:

  • thoughts/shared/handoffs/open-source-release/2026-01-08_16-30_memory-system-fix.yaml
  • thoughts/shared/handoffs/general/2026-01-08_16-30_bug-investigation.yaml
2. 编写 YAML 交接文档(约 400 个 token,而 Markdown 约 2000 个 token)

重要:必须严格使用以下 YAML 格式。不得偏离或使用其他字段名称。

goal: 和 now: 字段会显示在状态栏中——字段名称必须完全一致。

---
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}]

字段说明:

  • goal: + now: - 必填,会显示在状态栏中
  • done_this_session: - 已完成的工作,并附上文件引用
  • decisions: - 重要决策及其理由
  • findings: - 关键发现
  • worked: / failed: - 建议复用的方法与应避免的方法
  • next: - 下一会话的待办事项

不得使用 session_goal、objective、focus、current 等替代字段名称。 状态栏解析器只会查找 goal: 和 now:——其他名称均无效。

3. 标记会话结果(必需)

重要:回复用户前,必须询问会话结果。

使用 AskUserQuestion 工具,并严格使用以下选项:

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 blocked

用户回复后,为结果编制索引并进行标记:

# Mark the most recent handoff (works with PostgreSQL or SQLite)
# Use git root to find project, then opc/scripts/core/
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

# Then mark the outcome
cd "$PROJECT_ROOT/opc" && uv run python scripts/core/artifact_mark.py --latest --outcome <USER_CHOICE>

重要:将 {session_name} 和 {filename} 替换为第 1 步中的实际值。

这些命令会自动检测数据库(如果已配置 PostgreSQL,则使用 PostgreSQL;否则回退到 SQLite)。

注意: 如果索引失败,标记步骤会显示“Database marking was not available”。首次创建交接文档时出现这种情况可以接受,但这表示跳过了索引步骤。

4. 确认完成

标记结果后,向用户回复:

Handoff created! Outcome marked as [OUTCOME].

Resume in a new session with:
/resume_handoff path/to/handoff.yaml

##. 其他注意事项和说明

  • 信息宁多勿少。这是交接文档的最低要求。必要时可随时补充更多信息。
  • 务必详尽准确。既要涵盖顶层目标,也要按需包含更细节的内容。
  • 避免包含过多代码片段。用简短片段说明关键改动很重要,但应避免大型代码块或差异;除非确有必要(例如正在排查错误),否则不要添加。优先使用 /path/to/file.ext:line 这样的引用,方便 Agent 后续查找,例如 packages/dashboard/src/app/dashboard/page.tsx:12-24。

评论

支持 Markdown