Workflow State Management Skill
Overview
Manage persistent workflow state that survives context auto-summarization.
State files store: task details, worktree locations, PR URLs, and review status.
Triggers
Activate this skill when:
- Starting a new workflow ()
- Transitioning between workflow phases
- Restoring context after summarization ()
- Saving progress for later continuation ()
Phase Transitions
Valid transitions, guards, and prerequisites for all workflow types are documented in
references/phase-transitions.md
.
CRITICAL: When a transition has a guard, send the prerequisite
and
in a single
call — updates apply before guards evaluate.
Schema Discovery
Use
exarchos_workflow({ action: "describe", actions: ["set", "init", "get"] })
for
parameter schemas and
exarchos_workflow({ action: "describe", playbook: "feature" })
for phase transitions, guards, and playbook guidance. For the lightweight
oneshot variant (with its
implementing → synthesize|completed
choice state
driven by
), call
exarchos_workflow({ action: "describe", playbook: "oneshot" })
— oneshot is a first-class playbook alongside feature/debug/refactor. Use
exarchos_event({ action: "describe", eventTypes: ["workflow.transition", "task.completed"] })
for event data schemas.
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
~/.claude/workflow-state/*.state.json
— that path is legacy and may be stale or empty.
State Operations
For full MCP tool signatures, error handling, and anti-patterns, see
references/mcp-tool-reference.md
.
Initialize State
At the start of
, use
mcp__exarchos__exarchos_workflow
with
with:
- : the workflow identifier (e.g., )
- : one of , , ,
- (optional, oneshot only): one of , , (default ) — silently ignored for non-oneshot types
This creates a new workflow state entry. The initial phase depends on
:
- → starts in
- → starts in
- → starts in
- → starts in (skips ideate entirely)
Workflow Types at a Glance
- — full
ideate → plan → delegate → review → synthesize
for real features with subagent dispatch and two-stage review
- —
triage → investigate → (thorough | hotfix)
for bug workflows with track selection
- —
explore → brief → (polish | overhaul)
for code improvements, polish for small and overhaul for multi-task
- —
plan → implementing → (completed | synthesize)
for trivial changes; direct-commit by default with an opt-in PR path resolved via a choice-state guard driven by and the event
See
@skills/oneshot-workflow/SKILL.md
for the lightweight variant's full prose, including the choice-state mechanics and
trigger.
Read State
Use
mcp__exarchos__exarchos_workflow
with
and
:
- Full state: Call with just
- Specific field: Add for dot-path lookup (e.g., , )
- Multiple fields: Add array for projection (e.g.,
fields: ["phase", "featureId", "tasks"]
)
Field projection via
returns only the requested top-level keys, reducing token cost.
Update State
Use
mcp__exarchos__exarchos_workflow
with
with
and either
,
, or both:
- Update phase:
- Set artifact path:
updates: { "artifacts.design": "docs/designs/2026-01-05-feature.md" }
- Mark task complete (by index):
updates: { "tasks[0].status": "complete", "tasks[0].completedAt": "<timestamp>" }
- Add worktree:
updates: { "worktrees.wt-001": { "branch": "feature/001-types", "taskId": "001", "status": "active" } }
- Phase + updates together: ,
updates: { "artifacts.plan": "docs/plans/plan.md" }
Worktree status values:
'active' | 'merged' | 'removed'
Editing the array
The dot-path parser used by
recognizes only
numeric array brackets (
,
, …). Keyed forms like
are NOT supported and now throw an
error with a clear message — earlier versions silently wrote to a bogus top-level key, returning
while the actual task was untouched. Three patterns are supported:
-
Replace the whole array (use this when the plan is being revised wholesale; matches the issue #1003 contract):
typescript
exarchos_workflow({
action: "set",
featureId: "<id>",
updates: { tasks: [
{ id: "T-001", title: "...", status: "pending" },
{ id: "T-002", title: "...", status: "pending" },
]},
})
-
Edit one task by its array index:
typescript
exarchos_workflow({
action: "set",
featureId: "<id>",
updates: { "tasks[0].status": "complete", "tasks[0].completedAt": "<ts>" },
})
First read
(
action: "get", query: "tasks"
) to find the index of the task you want to edit, then set by that index.
-
Append a new task by writing to the next-free index. If the array currently has length
, write to
:
typescript
// Suppose tasks already contains T-001 and T-002 (length 2). To append:
exarchos_workflow({
action: "set",
featureId: "<id>",
updates: { "tasks[2]": { id: "T-003", title: "Follow-up", status: "pending" } },
})
The parser allows writing one slot past the current length (
); writing further out (
against a length-2 array) throws
. Read the current
length before appending.
Get Summary
For context restoration after summarization, use
mcp__exarchos__exarchos_workflow
with
and
. This outputs a minimal summary suitable for rebuilding orchestrator context.
Reconcile State
To verify state matches git reality, the SessionStart hook automatically reconciles on resume. For manual verification, run the reconciliation script:
typescript
exarchos_orchestrate({
action: "reconcile_state",
stateFile: "<state-file>",
repoRoot: "<repo-root>"
})
On : State is consistent.
On : Discrepancies found — review output and resolve.
Integration Points
When to Update State
| Event | State Update |
|---|
| starts | Create state file |
| Design saved | Set , phase = "plan" |
| Plan saved | Set , populate tasks, phase = "plan-review" |
| Plan-review gaps found | Set , auto-loop to plan |
| Plan-review approved | Set planReview.approved = true
, phase = "delegate" |
| Task dispatched | Set task , |
| Task complete | Set task , |
| Worktree created | Add to object |
| Review complete | Update object |
| PR created | Set , |
| PR feedback | Append to |
Oneshot-specific state updates
Oneshot is a first-class workflow type with a compressed lifecycle and an
opt-in PR path. The rows below mirror the feature-workflow table above.
| Phase | State updates | Events emitted |
|---|
| (oneshot) | , , optional | |
| (oneshot) | , | , optional (via ) |
| (oneshot) | , | , |
| (oneshot) | — | (to ) |
The
implementing → synthesize | completed
fork is a choice state resolved
by
, which reads the
guard
(
+
events). See
@skills/oneshot-workflow/SKILL.md
for the full opt-in mechanics.
Automatic State Updates
Skills should update state at key moments:
brainstorming/SKILL.md:
markdown
After saving design:
1. Update state: `.artifacts.design = "<path>"`
2. Update state: `.phase = "plan"`
implementation-planning/SKILL.md:
markdown
After saving plan:
1. Update state: `.artifacts.plan = "<path>"`
2. Populate `.tasks` from plan
3. Update state: `.phase = "delegate"`
delegation/SKILL.md:
markdown
On task dispatch:
- Update task status to "in_progress"
- Add worktree to state if created
On task complete:
- Update task status to "complete"
- Check if all tasks done, suggest checkpoint
State Schema
See
docs/schemas/workflow-state.schema.json
for full schema.
Key sections:
- : Schema version (currently "1.1")
- : Unique workflow identifier
- : Required. One of "feature", "debug", "refactor", or "oneshot"
- : Current workflow phase
- : Paths to design, plan, PR
- : Task list with status
- : Active git worktrees
- : Plan-review delta analysis results (, )
- : Review results
- : Merge/PR state
Best Practices
- Update often - State should reflect reality at all times
- Use MCP tools - Prefer workflow-state MCP tools over manual JSON editing
- Reconcile on resume - Always verify state matches git state
- Checkpoint at boundaries - Save state before likely context exhaustion
- Read state, don't remember - After summarization, read from state file
Troubleshooting
MCP Tool Call Failed
If an Exarchos MCP tool returns an error:
- Check the error message — it usually contains specific guidance
- Verify the workflow state exists: call
mcp__exarchos__exarchos_workflow
with and the featureId
- If "version mismatch": another process updated state — retry the operation
- If state is corrupted: call
mcp__exarchos__exarchos_workflow
with and
State Desync
If workflow state doesn't match git reality:
- The SessionStart hook runs reconciliation automatically on resume
- If manual check needed: compare state file with and branch state
- Update state via
mcp__exarchos__exarchos_workflow
with to match git truth
Checkpoint File Missing
If the PreCompact hook can't find state to checkpoint:
- Verify a workflow is active: call
mcp__exarchos__exarchos_workflow
with and the featureId
- If no active workflow: the hook will silently skip (expected behavior)
- If workflow exists but checkpoint fails: check disk space and permissions
Resume Finds Stale State
If state references branches or worktrees that no longer exist:
- The SessionStart hook handles reconciliation automatically
- It updates state to reflect current git reality
- Missing branches are flagged in the session-start output
Multiple Active Workflows
If multiple workflow state files exist:
- The system uses the most recently updated active (non-completed) workflow
- Use
mcp__exarchos__exarchos_workflow
with and on stale workflows to preview cleanup
- Cancel stale workflows before starting new ones
Example Workflow
-
Start new workflow: Use
mcp__exarchos__exarchos_workflow
with
with
featureId: "user-authentication"
,
-
After design phase: Use
mcp__exarchos__exarchos_workflow
with
with:
featureId: "user-authentication"
updates: { "artifacts.design": "docs/designs/2026-01-05-user-auth.md" }
-
Check state: Use
mcp__exarchos__exarchos_workflow
with
with
featureId: "user-authentication"
-
Resume after context loss: Use
mcp__exarchos__exarchos_workflow
with
with
featureId: "user-authentication"
to get context restoration output