rehydrate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorkflow 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.mdTriggers
触发条件
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 to read state and to discover active workflows. Do not scan — that path is legacy and may be stale or empty.
exarchos:exarchos_workflow getexarchos_view pipeline~/.claude/workflow-state/*.state.json工作流状态存储在MCP事件存储中,而非文件系统。使用读取状态,使用发现活跃工作流。请勿扫描——该路径属于遗留路径,内容可能过时或为空。
exarchos:exarchos_workflow getexarchos_view pipeline~/.claude/workflow-state/*.state.jsonSource of Truth — does this workflow exist?
真实性来源——该工作流是否存在?
Workflow state lives in two surfaces, and conflating them causes wrong "untracked" conclusions:
- The SQLite event store (+ projected
events+workflow_state) — the authoritative record of whether a workflow exists. This is whatstreams/rehydrateread.get - 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
<featureId>.state.json) and is not an existence signal.update
Canonical existence check: use the rehydrate envelope's (/), or equivalently a non-empty . A cold probe of a never-'d featureId returns with an empty initial document and — and is side-effect-free (it emits no event). Never infer existence from the presence or absence of a file on disk.
_meta.workflowExiststruefalsedata.workflowState.featureIdinitsuccess: true_meta.workflowExists: falseworkflow.rehydrated.state.json工作流状态存在于两个层面,混淆两者会导致错误的“未跟踪”结论:
- SQLite事件存储(+ 投影的
events+workflow_state)——这是工作流是否存在的权威记录,也是streams/rehydrate读取的来源。get - 文件(位于状态目录下)——这是一个次要的“规划器标记”,承载事件投影无法推导的计划状态信息(评审状态、声明的任务列表、维度发现)。对于已跟踪的工作流,它可能不存在(CLI工具、测试、首次
<featureId>.state.json前的进行中工作流),因此不能作为存在的信号。update
标准存在性检查:使用rehydrate信封中的****(/),或等效的非空。对从未初始化的featureId进行冷探测会返回,同时包含空的初始文档和——且无副作用(不会触发事件)。切勿根据磁盘上文件的存在与否推断工作流是否存在。
_meta.workflowExiststruefalsedata.workflowState.featureIdsuccess: true_meta.workflowExists: falseworkflow.rehydrated.state.jsonRehydrate the Workflow
恢复工作流
Use with and — it returns an envelope containing the canonical rehydration document (, , , , phase playbook, next actions) in a single call. No multi-step composition is needed.
exarchos:exarchos_workflowaction: "rehydrate"featureId: "<id>"workflowStatetaskProgressartifactsblockersget fields=[...]If the featureId is unknown or the user hasn't named one, fall back to to list active workflows and ask which to rehydrate, then re-invoke with the selected . 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 (the pre-scope count); when exceeds , the hidden rows live in other repos (or are legacy rows without recorded identity) — re-query with (or an explicit ) to reveal them.
exarchos_view pipelinerehydratefeatureIdunscopedTotalunscopedTotalpage.totalscope: "all"repoRoot使用,设置和——它会返回一个信封,其中包含标准的恢复文档(、、、、阶段手册、下一步操作),一次调用即可完成。无需多步组合。
exarchos:exarchos_workflowaction: "rehydrate"featureId: "<id>"workflowStatetaskProgressartifactsblockersget fields=[...]如果featureId未知或用户未指定,可回退使用列出活跃工作流,询问用户要恢复哪个,然后使用选定的重新调用。管线视图默认按仓库范围筛选——仅列出调用者所在仓库的工作流,因此在其他仓库启动的工作流不会显示。每个响应都会报告(未筛选前的总数);当超过时,隐藏的条目存在于其他仓库(或属于未记录身份的遗留条目)——使用(或显式指定)重新查询即可显示这些条目。
exarchos_view pipelinefeatureIdrehydrateunscopedTotalunscopedTotalpage.totalscope: "all"repoRootRead State (targeted)
定向读取状态
For a targeted read rather than a full rehydration, use with and :
exarchos:exarchos_workflowaction: "get"featureId- Full state: Call with just
featureId - Specific field: Add for dot-path lookup (e.g.,
query,query: "phase")query: "tasks" - Multiple fields: Add array for projection (e.g.,
fields)fields: ["phase", "featureId", "tasks"]
Field projection via returns only the requested top-level keys, reducing token cost.
fields若只需定向读取而非完整恢复,可使用,设置和:
exarchos:exarchos_workflowaction: "get"featureId- 完整状态:仅传入调用
featureId - 特定字段:添加进行点路径查找(例如
query、query: "phase")query: "tasks" - 多个字段:添加数组进行投影(例如
fields)fields: ["phase", "featureId", "tasks"]
通过进行字段投影仅返回请求的顶级键,可降低token消耗。
fieldsGet Summary
获取摘要
For context restoration after summarization, prefer (single-call, includes the phase playbook and next actions). For a minimal read, with outputs a summary suitable for rebuilding orchestrator context.
action: "rehydrate"action: "get"featureId对于总结后的上下文恢复,优先使用(单次调用,包含阶段手册和下一步操作)。若只需最小化读取,使用并传入,输出的摘要适用于重建编排器上下文。
action: "rehydrate"action: "get"featureIdOutput 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
undefinedWorkflow 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. , >
Auto-emitted events (runtime fires these): <phasePlaybook.autoEmittedEvents rendered as bullets>
Transition: <phasePlaybook.transitionCriteria> | Guard: <phasePlaybook.guardPrerequisites>
Validation scripts: <phasePlaybook.validationScripts joined>
task.progressedphase.advanced技能: <phasePlaybook.skillRef 或 "(本阶段无手册)">
工具: <phasePlaybook.tools 以项目符号形式呈现>
模型需触发的事件: <phasePlaybook.events 以项目符号形式呈现 —— 例如 , >
自动触发的事件(运行时触发): <phasePlaybook.autoEmittedEvents 以项目符号形式呈现>
转换条件: <phasePlaybook.transitionCriteria> | 前置检查: <phasePlaybook.guardPrerequisites>
验证脚本: <phasePlaybook.validationScripts 拼接显示>
task.progressedphase.advancedEvent 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_actionsDiscipline reminder: every task transition this turn forward MUST land on the workflow event stream viaorexarchos_event.appendsubagent emission. Directdelegate/Edit/Bashactions on task branches without corresponding events will desync the workflow tracker (see RCAgit).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子Agent触发,写入工作流事件流。若直接对任务分支执行delegate/Edit/Bash动作而未触发对应事件,会导致工作流跟踪器不同步(请参阅RCA文档git)。docs/rca/2026-05-08-rehydrate-behavioral-gap.md
保持输出简洁——仅包含必要的状态和行为指导;完整细节保留在文件中,而非对话里。Reconcile State
协调状态
To verify state matches git reality, run — 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:
rehydrate <featureId>typescript
exarchos_orchestrate({
action: "reconcile_state",
stateFile: "<state-file>",
repoRoot: "<repo-root>"
})On : State is consistent.
On : Discrepancies found — review output and resolve via with (see ).
passed: truepassed: falseexarchos:exarchos_workflowaction: "update"@skills/checkpoint/SKILL.md要验证状态与git实际状态匹配,运行——恢复投影会合并最后一次快照之后的事件,并在返回的信封中显示偏差。如需更深入的手动验证,运行协调脚本:
rehydrate <featureId>typescript
exarchos_orchestrate({
action: "reconcile_state",
stateFile: "<state-file>",
repoRoot: "<repo-root>"
})当时:状态一致。
当时:发现差异——查看输出并通过设置解决(请参阅)。
passed: truepassed: falseexarchos:exarchos_workflowaction: "update"@skills/checkpoint/SKILL.mdBest Practices
最佳实践
- Reconcile on resume - Always verify state matches git state before acting
- Read state, don't remember - After summarization, read from the event store, not memory
- Single-call fetch - One call returns the full canonical document; avoid multi-step reads
rehydrate - Existence via - Never infer existence from a
_meta.workflowExistsfile on disk.state.json
- 恢复时进行协调 - 行动前始终验证状态与git状态匹配
- 读取状态,而非依赖记忆 - 总结后从事件存储读取,而非依赖内存
- 单次调用获取 - 一次调用即可返回完整的标准文档;避免多步读取
rehydrate - 通过判断存在性 - 切勿根据磁盘上
_meta.workflowExists文件的存在与否推断工作流是否存在.state.json
Troubleshooting
故障排除
State Desync
状态不同步
If workflow state doesn't match git reality:
- Run — the rehydration projection folds in events newer than the last snapshot
rehydrate <featureId> - If manual check still needed: compare the rehydration document's /
workflowStatewithartifactsand branch stategit log - Update state via with
exarchos:exarchos_workflowto match git truth (seeaction: "update")@skills/checkpoint/SKILL.md
若工作流状态与git实际状态不匹配:
- 运行——恢复投影会合并最后一次快照之后的事件
rehydrate <featureId> - 若仍需手动检查:将恢复文档中的/
workflowState与artifacts和分支状态对比git log - 通过设置
exarchos:exarchos_workflow更新状态,使其与git实际状态匹配(请参阅action: "update")@skills/checkpoint/SKILL.md
Resume Finds Stale State
恢复时发现过时状态
If state references branches or worktrees that no longer exist:
- Run — the rehydration document surfaces stale references
rehydrate <featureId> - Compare against /
git branch -ato identify driftgit worktree list - Update via to match git truth
exarchos_workflow update
若状态引用的分支或工作树已不存在:
- 运行——恢复文档会显示过时的引用
rehydrate <featureId> - 与/
git branch -a对比,识别偏差git worktree list - 通过更新状态,使其与git实际状态匹配
exarchos_workflow update
Multiple Active Workflows
存在多个活跃工作流
If multiple workflow state files exist:
- The system uses the most recently updated active (non-completed) workflow
- Use with
exarchos:exarchos_workflowandaction: "cancel"on stale workflows to preview cleanupdryRun: true - Cancel stale workflows before starting new ones
若存在多个工作流状态文件:
- 系统会使用最近更新的活跃(未完成)工作流
- 对过时工作流使用设置
exarchos:exarchos_workflow和action: "cancel",预览清理操作dryRun: true - 启动新工作流前取消过时工作流
Example Workflow
示例工作流
-
Resume after context loss: Usewith
exarchos:exarchos_workflowandaction: "rehydrate"to get context restoration output.featureId: "user-authentication" -
Check state: Usewith
exarchos:exarchos_workflowandaction: "get".featureId: "user-authentication" -
Verify existence: Readfrom the rehydrate envelope — if
_meta.workflowExists, the feature was never started as a workflow, so report that rather than declaring it "untracked" from a filesystem check.false
-
上下文丢失后恢复:使用,设置
exarchos:exarchos_workflow和action: "rehydrate",获取上下文恢复输出。featureId: "user-authentication" -
检查状态:使用,设置
exarchos:exarchos_workflow和action: "get"。featureId: "user-authentication" -
验证存在性:从恢复信封中读取——若为
_meta.workflowExists,说明该功能从未作为工作流启动,因此应报告此情况,而非通过文件系统检查判定为“未跟踪”。false