skills/standard/rehydrate/SKILL.md
Restore and read workflow state after a context break — re-inject workflow phase, task progress, and behavioral guidance into the current session, reconcile state against git reality, and verify whether a workflow exists. Use when the user says 'resume', 'rehydrate', 'where were we', or runs /rehydrate, or when the agent has drifted after context compaction. Do NOT use for saving or mutating state (that is /checkpoint).
npx skillsauth add lvlup-sw/exarchos rehydrateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Activate this skill when:
rehydrate <featureId>)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.
Workflow state lives in two surfaces, and conflating them causes wrong "untracked" conclusions:
events + projected workflow_state + streams) — the authoritative record of whether a workflow exists. This is what rehydrate / get read.<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.
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.
For a targeted read rather than a full rehydration, use exarchos:exarchos_workflow with action: "get" and featureId:
featureIdquery for dot-path lookup (e.g., query: "phase", query: "tasks")fields array for projection (e.g., fields: ["phase", "featureId", "tasks"])Field projection via fields returns only the requested top-level keys, reducing token cost.
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.
Render the returned document as compact behavioral context (the same shape as post-compaction context) so the agent refreshes its awareness in one pass:
## Workflow Rehydrated: <featureId>
**Phase:** <phase> | **Type:** <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>
### Event Emission Hints
<_eventHints.missing rendered as bullets, or "(none — phase machinery satisfied)">
### Task Progress
<task table>
### Artifacts
- Design: <path or "not created">
- Plan: <path or "not created">
- PR: <url or "not created">
### 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.
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:
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).
rehydrate call returns the full canonical document; avoid multi-step reads_meta.workflowExists - Never infer existence from a .state.json file on diskIf workflow state doesn't match git reality:
rehydrate <featureId> — the rehydration projection folds in events newer than the last snapshotworkflowState / artifacts with git log and branch stateexarchos:exarchos_workflow with action: "update" to match git truth (see @skills/checkpoint/SKILL.md)If state references branches or worktrees that no longer exist:
rehydrate <featureId> — the rehydration document surfaces stale referencesgit branch -a / git worktree list to identify driftexarchos_workflow update to match git truthIf multiple workflow state files exist:
exarchos:exarchos_workflow with action: "cancel" and dryRun: true on stale workflows to preview cleanupResume after context loss: Use exarchos:exarchos_workflow with action: "rehydrate" and featureId: "user-authentication" to get context restoration output.
Check state: Use exarchos:exarchos_workflow with action: "get" and featureId: "user-authentication".
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.
testing
Create pull request from completed feature branch using GitHub-native stacked PRs. Use when the user says 'create PR', 'submit for review', 'synthesize', or runs /synthesize. Validates branch readiness, creates PR with structured description, and manages merge queue. Do NOT use before review phase completes. Not for draft PRs.
testing
Shepherd PRs through CI and reviews to merge readiness. Operates as an iteration loop within the synthesize phase (not a separate HSM phase). Uses assess_stack to check PR health, fix failures, and request approval. Triggers: 'shepherd', 'tend PRs', 'check CI', or /shepherd.
development
Single adversarial review pass over the integrated branch diff — spec-compliance, code quality, and test adequacy judged together by one fresh-context reviewer. Triggers: /review, 'review the changes', or after delegation completes. Emits one verdict (reviews.review.status). Do NOT use for plan-review (that is its own dispatched gate) or for debugging.
testing
Interactively prune stale non-terminal workflows from the pipeline. Use when the user says 'prune workflows', 'clean stale workflows', 'pipeline cleanup', or runs /prune. Runs a dry-run preview, displays candidates with staleness and safeguard skips, prompts the user to proceed/abort/force, then bulk-cancels approved workflows with a workflow.pruned audit event. Safeguards skip workflows with open PRs or recent commits unless force is set.