session-handoff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHand-Off Session
会话交接
Response Format
响应格式
Begin the first response to this skill invocation with the line:
Entire Session Handoff:followed by a blank line, then the content. The header applies to the full compaction-summary flow, including the "Unanswered Question" branch (which is still a successful run — the skill summarized the transcript and surfaced the question).
- Apply the header to the first response of the invocation only. Do not re-print it on follow-up turns within the same invocation (e.g. after the user answers the surfaced unanswered question).
- Do not include the header on error or early-exit responses (e.g. no directory, no sessions found after filtering, transcript file missing at the path the session JSON points to). The header's presence should signal that the skill ran and produced real output.
.git/entire-sessions/
调用该技能后的首次响应需以以下内容开头:
Entire Session Handoff:随后空一行,再展示内容。该标题适用于完整的压缩总结流程,包括“未回答问题”分支(这仍属于成功运行——技能已总结对话记录并提出问题)。
- 仅在技能调用的首次响应中添加该标题。在同一次调用的后续交互中(例如用户回答提出的未回答问题后),请勿重复打印该标题。
- 在错误或提前退出的响应中(例如不存在目录、过滤后未找到会话、会话JSON指向的路径中缺少对话记录文件),请勿添加该标题。该标题的存在应表明技能已运行并生成有效输出。
.git/entire-sessions/
STOP — Read these rules before doing ANYTHING
注意——在执行任何操作前请阅读以下规则
- Do NOT ask clarifying questions. Auto-detect the session and read the transcript.
- Do NOT run ,
entire sessions list,entire sessions info,entire explain --session,git log,git status,git branch, or any other exploratory commands. They waste time and don't give you the transcript.ps aux - Do NOT say "Would you like me to continue?" or "Let me know if you want me to pick this up." Just read the transcript and start working. (Exception: if the previous agent asked the user a question that was never answered, you MUST ask the user that question before proceeding.)
- Do NOT summarize the session as having "0 turns" or "no progress" without first reading the actual transcript file. The CLI metadata often undercounts — the transcript is the source of truth.
entire - Skip your own session. Your agent (e.g. Claude Code) also has a session in . Exclude any session whose
.git/entire-sessions/matches your own agent type from the results.agent_type
- 请勿提出澄清问题。自动检测会话并读取对话记录。
- 请勿运行 、
entire sessions list、entire sessions info、entire explain --session、git log、git status、git branch或任何其他探索性命令。这些命令会浪费时间且无法获取对话记录。ps aux - 请勿说“是否需要我继续?”或“如果需要我接手请告知。”直接读取对话记录并开始工作。(例外情况:如果之前的Agent向用户提出了未被回答的问题,你必须先向用户询问该问题,然后再继续。)
- 请勿在未读取实际对话记录文件的情况下总结会话“0轮次”或“无进展”。CLI的元数据经常计数不足——对话记录是唯一的真实来源。
entire - 跳过你自己的会话。你的Agent(例如Claude Code)在中也有会话。从结果中排除任何
.git/entire-sessions/与你自身Agent类型匹配的会话。agent_type
Flow: Active / current session handoff
流程:活跃/当前会话交接
When the user says "current", "active", or just "hand off this session":
当用户说“current”、“active”或仅说“交接此会话”时:
Step 1: Run entire status
entire status步骤1:运行entire status
entire statusentire statusThis returns the active session ID. If the user mentioned an agent name (e.g. "codex"), look for that agent's session in the output.
entire status该命令会返回活跃会话ID。如果用户提到了Agent名称(例如“codex”),请在输出中查找该Agent的会话。
Step 2: Find the transcript path
步骤2:查找对话记录路径
Read the session file at using the Read tool:
.git/entire-sessions/<session-id>.jsonRead: .git/entire-sessions/<session-id>.jsonThe file looks like this:
json
{
"session_id": "019d730f-e099-7910-a946-b5b20e2cfafc",
"agent_type": "Codex",
"phase": "active",
"started_at": "2026-04-09T09:25:21.725231-07:00",
"last_interaction_time": "2026-04-09T09:25:21.725657-07:00",
"transcript_path": "/Users/alisha/.codex/sessions/2026/04/09/rollout-....jsonl",
"last_prompt": "create solitaire game"
}Extract the field. This is the path to the full conversation transcript.
transcript_pathFallback: If doesn't give you a session ID, or the session JSON doesn't exist, use the Glob tool to find all files, read them, and pick the most recent one (by or ). Filter by agent name if the user specified one. Always exclude sessions matching your own agent type.
entire status.git/entire-sessions/*.jsonlast_interaction_timestarted_at使用读取工具读取路径下的会话文件:
.git/entire-sessions/<session-id>.jsonRead: .git/entire-sessions/<session-id>.json文件内容如下:
json
{
"session_id": "019d730f-e099-7910-a946-b5b20e2cfafc",
"agent_type": "Codex",
"phase": "active",
"started_at": "2026-04-09T09:25:21.725231-07:00",
"last_interaction_time": "2026-04-09T09:25:21.725657-07:00",
"transcript_path": "/Users/alisha/.codex/sessions/2026/04/09/rollout-....jsonl",
"last_prompt": "create solitaire game"
}提取字段,这是完整对话记录的路径。
transcript_path备选方案: 如果未返回会话ID,或会话JSON不存在,使用Glob工具查找所有文件,读取这些文件,选择最近的一个(按或排序)。如果用户指定了Agent名称,按名称过滤。始终排除与你自身Agent类型匹配的会话。
entire status.git/entire-sessions/*.jsonlast_interaction_timestarted_atStep 3: Extract and summarize the transcript
步骤3:提取并总结对话记录
Phase A — Extract raw transcript (do NOT show this to the user):
bash
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | cut -c1-2000If the output exceeds ~500 lines, read the last 100 lines (final state) and first 20 lines (original task):
bash
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | tail -100 | cut -c1-2000
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | head -20 | cut -c1-2000Phase B — Produce a compaction summary. Internally process the extracted transcript and produce a structured summary with these sections:
- Task Overview — The user's core request, success criteria, and any stated constraints or clarifications.
- Current State — Completed work: files created/modified, key decisions made, artifacts produced.
- Important Discoveries — Technical constraints uncovered, rationale behind decisions, errors hit and their resolutions, failed approaches and why they failed.
- Next Steps — Specific remaining actions, blockers, and priority ordering.
- Context to Preserve — User preferences, domain-specific details, and commitments made during the session.
- Unanswered Question (only if applicable) — If the previous agent's last message asked the user a question or presented options that were never answered, capture it here exactly as asked.
Be concise but complete — err on the side of including information that would prevent duplicate work or repeated mistakes.
阶段A — 提取原始对话记录(请勿向用户展示此内容):
bash
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | cut -c1-2000如果输出超过约500行,读取最后100行(最终状态)和前20行(原始任务):
bash
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | tail -100 | cut -c1-2000
grep -E '"type":"(message|function_call|user|assistant)"' <transcript_path> | head -20 | cut -c1-2000阶段B — 生成压缩总结。内部处理提取的对话记录,生成包含以下部分的结构化总结:
- 任务概述 — 用户的核心需求、成功标准,以及任何明确的约束或澄清信息。
- 当前状态 — 已完成的工作:创建/修改的文件、关键决策、生成的成果。
- 重要发现 — 发现的技术约束、决策背后的理由、遇到的错误及其解决方案、失败的方法及原因。
- 下一步计划 — 具体的剩余操作、障碍及优先级排序。
- 需保留的上下文 — 用户偏好、领域特定细节,以及会话中做出的承诺。
- 未回答问题(仅在适用时) — 如果之前的Agent最后一条消息向用户提出了未被回答的问题或提供了选项,请在此处准确记录该问题。
内容需简洁但完整——宁可包含能避免重复工作或重复错误的信息。
Step 4: Present summary, then continue
步骤4:展示总结并继续工作
Show the compaction summary from Phase B to the user.
Critical rule — unanswered questions go to the user, not you. If section 6 (Unanswered Question) exists, present that question to the user and wait for their answer. Do NOT answer it yourself or pick a default. The user is the decision-maker.
If there is no unanswered question, immediately pick up the work — start planning, coding, or doing whatever the next step is. Do not ask permission.
向用户展示阶段B生成的压缩总结。
关键规则——未回答问题需提交给用户,而非由你处理。如果存在第6部分(未回答问题),请向用户提出该问题并等待回答。请勿自行回答或选择默认选项。用户是决策者。
如果没有未回答问题,立即接手工作——开始规划、编码或执行下一步操作。无需请求许可。
Flow: Checkpoint handoff (user gives a checkpoint ID)
流程:检查点交接(用户提供检查点ID)
- Run
entire explain --checkpoint <checkpoint-id> --full --no-pager - If fails, fall back to
--fullentire explain --checkpoint <checkpoint-id> --raw-transcript --no-pager - Extract conversation content from ALL session transcripts (do NOT show raw output to the user):
bash
grep -rE '"type":"(message|function_call|user|assistant)"' <transcript_dir_or_files> | cut -c1-2000For large checkpoints with many sessions, focus on the last 100 lines per transcript to understand final state, and the first 20 lines for the original task.
- Produce and present a compaction summary using the same 5-section format from Step 3 Phase B above, then continue.
Resolve checkpoint repos in order: explicit override → local branch → → nearby local clone.
entire/checkpoints/v1.entire/settings.jsoncheckpoint_remote- 运行
entire explain --checkpoint <checkpoint-id> --full --no-pager - 如果失败,改用
--fullentire explain --checkpoint <checkpoint-id> --raw-transcript --no-pager - 从所有会话对话记录中提取对话内容(请勿向用户展示原始输出):
bash
grep -rE '"type":"(message|function_call|user|assistant)"' <transcript_dir_or_files> | cut -c1-2000对于包含多个会话的大型检查点,重点关注每个对话记录的最后100行以了解最终状态,以及前20行以了解原始任务。
- 使用上述步骤3阶段B中的5部分格式生成并展示压缩总结,然后继续工作。
按以下顺序解析检查点仓库:显式覆盖 → 本地分支 → 中的 → 附近的本地克隆。
entire/checkpoints/v1.entire/settings.jsoncheckpoint_remoteFlow: No specific request (bare invocation)
流程:无特定请求(直接调用)
Use the Glob tool to find . Read each file, exclude your own agent type, pick the most recent by . Read the transcript at . Summarize and continue.
.git/entire-sessions/*.jsonlast_interaction_timetranscript_path使用Glob工具查找文件。读取每个文件,排除你自身的Agent类型,选择最新的会话。读取对应的对话记录。总结并继续工作。
.git/entire-sessions/*.jsonlast_interaction_timetranscript_pathAgent name filtering
Agent名称过滤
Words like "codex", "claude", "kiro", "gemini" in the user's request are filters for session selection. Match them case-insensitively against the field (fall back to field). Never invoke another agent's CLI.
agent_typeagent用户请求中的“codex”、“claude”、“kiro”、“gemini”等词汇是会话选择的过滤器。不区分大小写地与字段匹配(如果没有则匹配字段)。请勿调用其他Agent的CLI。
agent_typeagent