rehydrate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow Rehydrate Skill

Workflow Rehydrate Skill

Overview

概述

Restore full workflow awareness that survives context auto-summarization without starting a new session.
This skill owns the read/restore side of workflow state — reading current state, reconciling it against git reality, and verifying whether a workflow exists at all. For the write side (init, update, transition, capturing a handoff), see
@skills/checkpoint/SKILL.md
.
恢复完整的工作流感知能力,使其在上下文自动总结后仍能保留,无需启动新会话。
本技能负责工作流状态的读取/恢复侧——读取当前状态、与git实际状态协调,并验证工作流是否存在。至于写入侧(初始化、更新、转换、捕获交接),请参阅
@skills/checkpoint/SKILL.md

Triggers

触发条件

Activate this skill when:
  • Restoring context after summarization (
    rehydrate <featureId>
    )
  • The agent has drifted after context compaction (stopped emitting events or using tools proactively)
  • Returning to a workflow after a break
在以下场景激活本技能:
  • 总结后恢复上下文(
    rehydrate <featureId>
  • Agent在上下文压缩后出现偏离(停止发送事件或主动使用工具)
  • 中断后回到工作流

State Location

状态位置

Workflow state lives in the MCP event store, not the filesystem. Use
exarchos:exarchos_workflow get
to read state and
exarchos_view pipeline
to discover active workflows. Do not scan
~/.claude/workflow-state/*.state.json
— that path is legacy and may be stale or empty.
工作流状态存储在MCP事件存储中,而非文件系统。使用
exarchos:exarchos_workflow get
读取状态,使用
exarchos_view pipeline
发现活跃工作流。请勿扫描
~/.claude/workflow-state/*.state.json
——该路径属于遗留路径,内容可能过时或为空。

Source of Truth — does this workflow exist?

真实性来源——该工作流是否存在?

Workflow state lives in two surfaces, and conflating them causes wrong "untracked" conclusions:
  1. The SQLite event store (
    events
    + projected
    workflow_state
    +
    streams
    ) — the authoritative record of whether a workflow exists. This is what
    rehydrate
    /
    get
    read.
  2. <featureId>.state.json
    files
    (under the state dir) — a secondary "planner's stamp" that carries plan-state facts the event projection cannot derive (review status, declared task list, dimension findings). It may be absent for a tracked workflow (CLI tools, tests, in-flight workflows before the first
    update
    ) and is not an existence signal.
Canonical existence check: use the rehydrate envelope's
_meta.workflowExists
(
true
/
false
), or equivalently a non-empty
data.workflowState.featureId
. A cold probe of a never-
init
'd featureId returns
success: true
with an empty initial document and
_meta.workflowExists: false
— and is side-effect-free (it emits no
workflow.rehydrated
event). Never infer existence from the presence or absence of a
.state.json
file on disk.
工作流状态存在于两个层面,混淆两者会导致错误的“未跟踪”结论:
  1. SQLite事件存储
    events
    + 投影的
    workflow_state
    +
    streams
    )——这是工作流是否存在的权威记录,也是
    rehydrate
    /
    get
    读取的来源。
  2. <featureId>.state.json
    文件
    (位于状态目录下)——这是一个次要的“规划器标记”,承载事件投影无法推导的计划状态信息(评审状态、声明的任务列表、维度发现)。对于已跟踪的工作流,它可能不存在(CLI工具、测试、首次
    update
    前的进行中工作流),因此不能作为存在的信号。
标准存在性检查:使用rehydrate信封中的**
_meta.workflowExists
**(
true
/
false
),或等效的非空
data.workflowState.featureId
。对从未初始化的featureId进行冷探测会返回
success: true
,同时包含空的初始文档和
_meta.workflowExists: false
——且无副作用(不会触发
workflow.rehydrated
事件)。切勿根据磁盘上
.state.json
文件的存在与否推断工作流是否存在。

Rehydrate the Workflow

恢复工作流

Use
exarchos:exarchos_workflow
with
action: "rehydrate"
and
featureId: "<id>"
— it returns an envelope containing the canonical rehydration document (
workflowState
,
taskProgress
,
artifacts
,
blockers
, phase playbook, next actions) in a single call. No multi-step
get fields=[...]
composition is needed.
If the featureId is unknown or the user hasn't named one, fall back to
exarchos_view pipeline
to list active workflows and ask which to rehydrate, then re-invoke
rehydrate
with the selected
featureId
. The pipeline view is repo-scoped by default — it lists only the caller's repo, so a workflow started in another repo won't appear. Every response reports
unscopedTotal
(the pre-scope count); when
unscopedTotal
exceeds
page.total
, the hidden rows live in other repos (or are legacy rows without recorded identity) — re-query with
scope: "all"
(or an explicit
repoRoot
) to reveal them.
使用
exarchos:exarchos_workflow
,设置
action: "rehydrate"
featureId: "<id>"
——它会返回一个信封,其中包含标准的恢复文档(
workflowState
taskProgress
artifacts
blockers
、阶段手册、下一步操作),一次调用即可完成。无需多步
get fields=[...]
组合。
如果featureId未知或用户未指定,可回退使用
exarchos_view pipeline
列出活跃工作流,询问用户要恢复哪个,然后使用选定的
featureId
重新调用
rehydrate
。管线视图默认按仓库范围筛选——仅列出调用者所在仓库的工作流,因此在其他仓库启动的工作流不会显示。每个响应都会报告
unscopedTotal
(未筛选前的总数);当
unscopedTotal
超过
page.total
时,隐藏的条目存在于其他仓库(或属于未记录身份的遗留条目)——使用
scope: "all"
(或显式指定
repoRoot
)重新查询即可显示这些条目。

Read State (targeted)

定向读取状态

For a targeted read rather than a full rehydration, use
exarchos:exarchos_workflow
with
action: "get"
and
featureId
:
  • Full state: Call with just
    featureId
  • Specific field: Add
    query
    for dot-path lookup (e.g.,
    query: "phase"
    ,
    query: "tasks"
    )
  • Multiple fields: Add
    fields
    array for projection (e.g.,
    fields: ["phase", "featureId", "tasks"]
    )
Field projection via
fields
returns only the requested top-level keys, reducing token cost.
若只需定向读取而非完整恢复,可使用
exarchos:exarchos_workflow
,设置
action: "get"
featureId
  • 完整状态:仅传入
    featureId
    调用
  • 特定字段:添加
    query
    进行点路径查找(例如
    query: "phase"
    query: "tasks"
  • 多个字段:添加
    fields
    数组进行投影(例如
    fields: ["phase", "featureId", "tasks"]
通过
fields
进行字段投影仅返回请求的顶级键,可降低token消耗。

Get Summary

获取摘要

For context restoration after summarization, prefer
action: "rehydrate"
(single-call, includes the phase playbook and next actions). For a minimal read,
action: "get"
with
featureId
outputs a summary suitable for rebuilding orchestrator context.
对于总结后的上下文恢复,优先使用
action: "rehydrate"
(单次调用,包含阶段手册和下一步操作)。若只需最小化读取,使用
action: "get"
并传入
featureId
,输出的摘要适用于重建编排器上下文。

Output Format

输出格式

Render the returned document as compact behavioral context (the same shape as post-compaction context) so the agent refreshes its awareness in one pass:
markdown
undefined
将返回的文档渲染为紧凑的行为上下文(与压缩后的上下文格式一致),以便Agent一次性刷新感知:
markdown
undefined

Workflow Rehydrated: <featureId>

工作流已恢复: <featureId>

Phase: <phase> | Type: <workflowType>
阶段: <phase> | 类型: <workflowType>

House Rules (apply every action this turn forward)

规则(本次操作的所有动作均需遵守)

Skill: <phasePlaybook.skillRef or "(no playbook for this phase)"> Tools: <phasePlaybook.tools rendered as bullets> Required model-emitted events: <phasePlaybook.events rendered as bullets — e.g.
task.progressed
,
phase.advanced
> Auto-emitted events (runtime fires these): <phasePlaybook.autoEmittedEvents rendered as bullets> Transition: <phasePlaybook.transitionCriteria> | Guard: <phasePlaybook.guardPrerequisites> Validation scripts: <phasePlaybook.validationScripts joined>
技能: <phasePlaybook.skillRef 或 "(本阶段无手册)"> 工具: <phasePlaybook.tools 以项目符号形式呈现> 模型需触发的事件: <phasePlaybook.events 以项目符号形式呈现 —— 例如
task.progressed
,
phase.advanced
> 自动触发的事件(运行时触发): <phasePlaybook.autoEmittedEvents 以项目符号形式呈现> 转换条件: <phasePlaybook.transitionCriteria> | 前置检查: <phasePlaybook.guardPrerequisites> 验证脚本: <phasePlaybook.validationScripts 拼接显示>

Event Emission Hints

事件触发提示

<_eventHints.missing rendered as bullets, or "(none — phase machinery satisfied)">
<_eventHints.missing 以项目符号形式呈现,或 "(无 —— 阶段机制已满足)">

Task Progress

任务进度

<task table>
<任务表格>

Artifacts

工件

  • Design: <path or "not created">
  • Plan: <path or "not created">
  • PR: <url or "not created">
  • 设计: <路径或 "未创建">
  • 计划: <路径或 "未创建">
  • PR: <链接或 "未创建">

Next Action

下一步操作

<suggested action, from the envelope's
next_actions
>
Discipline reminder: every task transition this turn forward MUST land on the workflow event stream via
exarchos_event.append
or
delegate
subagent emission. Direct
Edit
/
Bash
/
git
actions on task branches without corresponding events will desync the workflow tracker (see RCA
docs/rca/2026-05-08-rehydrate-behavioral-gap.md
).

Keep the output minimal — only essential state and behavioral guidance; full details stay in files, not the conversation.
<建议动作,来自信封中的
next_actions
>
纪律提醒: 本次操作的所有任务转换必须通过
exarchos_event.append
delegate
子Agent触发,写入工作流事件流。若直接对任务分支执行
Edit
/
Bash
/
git
动作而未触发对应事件,会导致工作流跟踪器不同步(请参阅RCA文档
docs/rca/2026-05-08-rehydrate-behavioral-gap.md
)。

保持输出简洁——仅包含必要的状态和行为指导;完整细节保留在文件中,而非对话里。

Reconcile State

协调状态

To verify state matches git reality, run
rehydrate <featureId>
— the rehydration projection folds events newer than the last snapshot and surfaces drift in the returned envelope. For deeper manual verification, run the reconciliation script:
typescript
exarchos_orchestrate({
  action: "reconcile_state",
  stateFile: "<state-file>",
  repoRoot: "<repo-root>"
})
On
passed: true
:
State is consistent. On
passed: false
:
Discrepancies found — review output and resolve via
exarchos:exarchos_workflow
with
action: "update"
(see
@skills/checkpoint/SKILL.md
).
要验证状态与git实际状态匹配,运行
rehydrate <featureId>
——恢复投影会合并最后一次快照之后的事件,并在返回的信封中显示偏差。如需更深入的手动验证,运行协调脚本:
typescript
exarchos_orchestrate({
  action: "reconcile_state",
  stateFile: "<state-file>",
  repoRoot: "<repo-root>"
})
passed: true
:状态一致。
passed: false
:发现差异——查看输出并通过
exarchos:exarchos_workflow
设置
action: "update"
解决(请参阅
@skills/checkpoint/SKILL.md
)。

Best Practices

最佳实践

  1. Reconcile on resume - Always verify state matches git state before acting
  2. Read state, don't remember - After summarization, read from the event store, not memory
  3. Single-call fetch - One
    rehydrate
    call returns the full canonical document; avoid multi-step reads
  4. Existence via
    _meta.workflowExists
    - Never infer existence from a
    .state.json
    file on disk
  1. 恢复时进行协调 - 行动前始终验证状态与git状态匹配
  2. 读取状态,而非依赖记忆 - 总结后从事件存储读取,而非依赖内存
  3. 单次调用获取 - 一次
    rehydrate
    调用即可返回完整的标准文档;避免多步读取
  4. 通过
    _meta.workflowExists
    判断存在性
    - 切勿根据磁盘上
    .state.json
    文件的存在与否推断工作流是否存在

Troubleshooting

故障排除

State Desync

状态不同步

If workflow state doesn't match git reality:
  1. Run
    rehydrate <featureId>
    — the rehydration projection folds in events newer than the last snapshot
  2. If manual check still needed: compare the rehydration document's
    workflowState
    /
    artifacts
    with
    git log
    and branch state
  3. Update state via
    exarchos:exarchos_workflow
    with
    action: "update"
    to match git truth (see
    @skills/checkpoint/SKILL.md
    )
若工作流状态与git实际状态不匹配:
  1. 运行
    rehydrate <featureId>
    ——恢复投影会合并最后一次快照之后的事件
  2. 若仍需手动检查:将恢复文档中的
    workflowState
    /
    artifacts
    git log
    和分支状态对比
  3. 通过
    exarchos:exarchos_workflow
    设置
    action: "update"
    更新状态,使其与git实际状态匹配(请参阅
    @skills/checkpoint/SKILL.md

Resume Finds Stale State

恢复时发现过时状态

If state references branches or worktrees that no longer exist:
  1. Run
    rehydrate <featureId>
    — the rehydration document surfaces stale references
  2. Compare against
    git branch -a
    /
    git worktree list
    to identify drift
  3. Update via
    exarchos_workflow update
    to match git truth
若状态引用的分支或工作树已不存在:
  1. 运行
    rehydrate <featureId>
    ——恢复文档会显示过时的引用
  2. git branch -a
    /
    git worktree list
    对比,识别偏差
  3. 通过
    exarchos_workflow update
    更新状态,使其与git实际状态匹配

Multiple Active Workflows

存在多个活跃工作流

If multiple workflow state files exist:
  1. The system uses the most recently updated active (non-completed) workflow
  2. Use
    exarchos:exarchos_workflow
    with
    action: "cancel"
    and
    dryRun: true
    on stale workflows to preview cleanup
  3. Cancel stale workflows before starting new ones
若存在多个工作流状态文件:
  1. 系统会使用最近更新的活跃(未完成)工作流
  2. 对过时工作流使用
    exarchos:exarchos_workflow
    设置
    action: "cancel"
    dryRun: true
    ,预览清理操作
  3. 启动新工作流前取消过时工作流

Example Workflow

示例工作流

  1. Resume after context loss: Use
    exarchos:exarchos_workflow
    with
    action: "rehydrate"
    and
    featureId: "user-authentication"
    to get context restoration output.
  2. Check state: Use
    exarchos:exarchos_workflow
    with
    action: "get"
    and
    featureId: "user-authentication"
    .
  3. Verify existence: Read
    _meta.workflowExists
    from the rehydrate envelope — if
    false
    , the feature was never started as a workflow, so report that rather than declaring it "untracked" from a filesystem check.
  1. 上下文丢失后恢复:使用
    exarchos:exarchos_workflow
    ,设置
    action: "rehydrate"
    featureId: "user-authentication"
    ,获取上下文恢复输出。
  2. 检查状态:使用
    exarchos:exarchos_workflow
    ,设置
    action: "get"
    featureId: "user-authentication"
  3. 验证存在性:从恢复信封中读取
    _meta.workflowExists
    ——若为
    false
    ,说明该功能从未作为工作流启动,因此应报告此情况,而非通过文件系统检查判定为“未跟踪”。