continue-claude-work

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Continue Claude Work

继续Claude工作

Overview

概述

Recover actionable context from a prior Claude Code session and continue execution in the current conversation. Use local session files as the source of truth, then continue with concrete edits and checks — not just summarizing.
Why this exists instead of
claude --resume
:
claude --resume
replays the full session transcript into the context window. For long sessions this wastes tokens on resolved issues and stale state. This skill selectively reconstructs only actionable context — the latest compact summary, pending work, known errors, and current workspace state — giving a fresh start with prior knowledge.
从之前的Claude Code会话中提取可执行的上下文信息,并在当前对话中继续执行。以本地会话文件为可信来源,随后进行具体的编辑和检查——而非仅做总结。
为何不使用
claude --resume
而选择此方法
claude --resume
会将会话完整记录重新加载到上下文窗口中。对于长会话而言,这会在已解决的问题和过时状态上浪费大量token。本技能选择性重构仅包含可执行的上下文——最新的精简总结、待完成工作、已知错误和当前工作区状态——让你借助已有知识获得全新的开始。

File Structure Reference

文件结构参考

For directory layout, JSONL schemas, and compaction block format, see
references/file_structure.md
.
关于目录布局、JSONL模式和压缩块格式,请参阅
references/file_structure.md

Workflow

工作流程

Step 1: Extract Context (single script call)

步骤1:提取上下文(单次脚本调用)

Run the bundled extraction script. It handles session discovery, compact-boundary parsing, noise filtering, and workspace state in one call:
bash
undefined
运行内置的提取脚本。它可一站式处理会话发现、压缩边界解析、噪声过滤和工作区状态提取:
bash
undefined

Latest session for current project

当前项目的最新会话

python3 scripts/extract_resume_context.py
python3 scripts/extract_resume_context.py

Specific session by ID

指定ID的会话

python3 scripts/extract_resume_context.py --session <SESSION_ID>
python3 scripts/extract_resume_context.py --session <SESSION_ID>

Search by topic

按主题搜索

python3 scripts/extract_resume_context.py --query "auth feature"
python3 scripts/extract_resume_context.py --query "auth feature"

List recent sessions

列出近期会话

python3 scripts/extract_resume_context.py --list

The script outputs a structured Markdown **briefing** containing:
- **Session metadata** from `sessions-index.json`
- **Compact summary** — Claude's own distilled summary from the last compaction boundary (highest-signal context)
- **Last user requests** — the most recent explicit asks
- **Last assistant responses** — what was claimed done
- **Errors encountered** — tool failures and error outputs
- **Unresolved tool calls** — indicates interrupted session
- **Subagent workflow state** — which subagents completed, which were interrupted, their last outputs
- **Session end reason** — clean exit, interrupted (ctrl-c), error cascade, or abandoned
- **Files touched** — files created/edited/read during the session
- **MEMORY.md** — persistent cross-session notes
- **Git state** — current status, branch, recent log

The script automatically skips the currently active session (modified < 60s ago) to avoid self-extraction.
python3 scripts/extract_resume_context.py --list

脚本会输出结构化的Markdown**简报**,包含以下内容:
- 来自`sessions-index.json`的**会话元数据**
- **精简总结**——Claude在最后一个压缩边界生成的自身提炼总结(最高信号量的上下文)
- **最近用户请求**——最新的明确需求
- **最近助手响应**——已完成工作的说明
- **遇到的错误**——工具失败和错误输出
- **未完成的工具调用**——表示会话被中断
- **子代理工作流状态**——哪些子代理已完成、哪些被中断,以及它们的最后输出
- **会话结束原因**——正常退出、中断(ctrl-c)、错误连锁反应或被放弃
- **涉及的文件**——会话期间创建/编辑/读取的文件
- **MEMORY.md**——跨会话的持久化笔记
- **Git状态**——当前状态、分支、近期日志

脚本会自动跳过当前活跃的会话(修改时间小于60秒),以避免自提取。

Step 2: Branch by Session End Reason

步骤2:根据会话结束原因分支处理

The briefing includes a Session end reason. Use it to choose the right continuation strategy:
End ReasonStrategy
Clean exitSession completed normally. Read the last user request that was addressed. Continue from pending work if any.
InterruptedTool calls were dispatched but never got results (likely ctrl-c or timeout). Retry the interrupted tool calls or assess whether they are still needed.
Error cascadeMultiple API errors caused the session to fail. Do not retry blindly — diagnose the root cause first.
AbandonedUser sent a message but got no response. Treat the last user message as the current request.
If the briefing has a Subagent Workflow section with interrupted subagents, check what each was doing and whether to retry or skip.
简报中包含会话结束原因,可据此选择合适的续接策略:
结束原因策略
正常退出会话已正常完成。查看最后一个已处理的用户请求。如有待完成工作,则继续执行。
被中断工具调用已发出但未收到结果(可能是ctrl-c或超时)。重试被中断的工具调用,或者评估是否仍需执行这些调用。
错误连锁反应多次API错误导致会话失败。不要盲目重试——先诊断根本原因。
被放弃用户发送了消息但未收到响应。将最后一条用户消息视为当前请求。
如果简报包含子代理工作流部分且存在被中断的子代理,请检查每个子代理的工作内容,决定是否重试或跳过。

Step 3: Reconcile and Continue

步骤3:协调并继续工作

Before making changes:
  1. Confirm the current directory matches the session's project.
  2. If the git branch has changed from the session's branch, note this and decide whether to switch.
  3. Inspect files related to pending work — verify old claims still hold.
  4. Do not assume old claims are valid without checking.
Then:
  • Implement the next concrete step aligned with the latest user request.
  • Run deterministic verification (tests, type-checks, build).
  • If blocked, state the exact blocker and propose one next action.
在进行更改前:
  1. 确认当前目录与会话对应的项目一致。
  2. 如果Git分支与会话时的分支不同,请记录此情况并决定是否切换分支。
  3. 检查与待完成工作相关的文件——验证之前的说明是否仍然有效。
  4. 不要未经检查就假设之前的说明有效。
随后:
  • 根据最新的用户请求,执行下一个具体步骤。
  • 执行确定性验证(测试、类型检查、构建)。
  • 如果遇到阻塞,请说明具体的阻塞点并提出一个下一步行动建议。

Step 4: Report

步骤4:汇报

Respond concisely:
  • Context recovered: which session, key findings from the briefing
  • Work executed: files changed, commands run, test results
  • Remaining: pending tasks, if any
简洁地回复:
  • 已恢复的上下文:哪个会话,简报中的关键发现
  • 已执行的工作:修改的文件、运行的命令、测试结果
  • 剩余工作:待完成任务(如有)

How the Script Works

脚本工作原理

Compact-Boundary-Aware Extraction

压缩边界感知提取

The script finds the last compact boundary in the session JSONL and extracts its summary. This is the single highest-signal piece of context in any long session -- Claude's own distilled understanding of the entire conversation up to that point. For details on compaction format and JSONL schemas, see
references/file_structure.md
.
脚本会在会话JSONL中找到最后一个压缩边界,并提取其总结。这是任何长会话中信号量最高的单一上下文——Claude对截至该点整个对话的提炼理解。关于压缩格式和JSONL模式的详情,请参阅
references/file_structure.md

Size-Adaptive Strategy

自适应大小策略

Session sizeStrategy
Has compactionsRead last compact summary + all post-compact messages
< 500 KB, no compactionsRead last 60% of messages
500 KB - 5 MBRead last 30% of messages
> 5 MBRead last 15% of messages
会话大小策略
包含压缩内容读取最后一个压缩总结 + 所有压缩后的消息
< 500 KB,无压缩内容读取最后60%的消息
500 KB - 5 MB读取最后30%的消息
> 5 MB读取最后15%的消息

Subagent Context Extraction

子代理上下文提取

When a session has subagent directories (
<session-id>/subagents/
), the script parses each subagent's JSONL to extract agent type, completion status, and last text output. This enables recovery of multi-agent workflows -- e.g., if a 32-subagent evaluation pipeline was interrupted, the briefing shows which agents completed and which need retry.
当会话包含子代理目录(
<session-id>/subagents/
)时,脚本会解析每个子代理的JSONL,提取代理类型、完成状态和最后文本输出。这能够恢复多代理工作流——例如,如果一个包含32个子代理的评估管道被中断,简报会显示哪些代理已完成、哪些需要重试。

Session End Reason Detection

会话结束原因检测

The script classifies how the session ended:
  • completed -- assistant had the last word (clean exit)
  • interrupted -- unresolved tool calls (ctrl-c or timeout)
  • error_cascade -- 3+ API errors
  • abandoned -- user sent a message with no response
脚本会将会话结束类型分类为:
  • completed——助手最后发言(正常退出)
  • interrupted——存在未完成的工具调用(ctrl-c或超时)
  • error_cascade——3次及以上API错误
  • abandoned——用户发送消息但未收到响应

Noise Filtering

噪声过滤

These message types are skipped (37-53% of lines in real sessions):
  • progress
    ,
    queue-operation
    ,
    file-history-snapshot
    -- operational noise
  • api_error
    ,
    turn_duration
    ,
    stop_hook_summary
    -- system subtypes
  • <task-notification>
    ,
    <system-reminder>
    -- filtered from user text extraction
以下消息类型会被跳过(在实际会话中占37-53%的行数):
  • progress
    queue-operation
    file-history-snapshot
    ——操作类噪声
  • api_error
    turn_duration
    stop_hook_summary
    ——系统子类型
  • <task-notification>
    <system-reminder>
    ——从用户文本提取中过滤

Guardrails

防护规则

  • Do not run
    claude --resume
    or
    claude --continue
    — this skill provides context recovery within the current session.
  • Do not treat compact summaries as complete truth — they are lossy. Always verify claims against current workspace.
  • Do not overwrite unrelated working-tree changes.
  • Do not load the full session file into context — always use the script.
  • 不要运行
    claude --resume
    claude --continue
    ——本技能可在当前会话内完成上下文恢复。
  • 不要将精简总结视为完全真实的信息——它们存在信息损耗。请始终对照当前工作区验证相关说明。
  • 不要覆盖无关的工作区更改。
  • 不要将会话完整文件加载到上下文——请始终使用脚本。

Limitations

局限性

  • Cannot recover sessions whose
    .jsonl
    files have been deleted from
    ~/.claude/projects/
    .
  • Cannot access sessions from other machines (files are local only).
  • Edit tool operations show deltas, not full file content — use
    claude-code-history-files-finder
    for full file recovery.
  • Compact summaries are lossy — early conversation details may be missing.
  • sessions-index.json
    can be stale (entries pointing to deleted files). The script falls back to filesystem-based discovery.
  • 无法恢复
    ~/.claude/projects/
    .jsonl
    文件已被删除的会话。
  • 无法访问其他机器上的会话(文件仅存储在本地)。
  • 编辑工具操作仅显示差异,而非完整文件内容——如需恢复完整文件,请使用
    claude-code-history-files-finder
  • 精简总结存在信息损耗——早期对话细节可能丢失。
  • sessions-index.json
    可能过时(条目指向已删除的文件)。脚本会回退到基于文件系统的发现方式。

Example Trigger Phrases

示例触发语句

  • "continue work from session
    abc123-...
    "
  • "don't resume, just read the .claude files and continue"
  • "check what I was working on in the last session and keep going"
  • "search my sessions for the PR review work"
  • "从会话
    abc123-...
    继续工作"
  • "不要恢复,只需读取.claude文件并继续"
  • "查看我在上一个会话中正在处理的内容并继续"
  • "在我的会话中搜索PR评审工作"