session-state

Enforce session-state transitions and log updates for Claude Code workflows.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/lane2077/claude-code-harness-zh --skill session-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-state
Source: https://github.com/lane2077/claude-code-harness-zh/tree/main/codex/.codex/skills/session-state
Command: npx skills add https://github.com/lane2077/claude-code-harness-zh --skill session-state

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automates and enforces internal session-state transitions according to a defined workflow, ensuring consistent progression between phases and safe recovery after errors.

Core Features & Use Cases

  • Enforces the states defined in SESSION_ORCHESTRATION.md (idle, initialized, planning, executing, reviewing, verifying, escalated, completed, failed, stopped).
  • Validates and applies transitions at phase boundaries like /work, supports escalation handling, and enables session resume initialization.
  • Logs state updates and enforces guardrails to prevent invalid transitions.

Quick Start

Trigger a transition by specifying a target state and event to advance the session-state machine.

Frequently Asked Questions about session-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce a state machine for Claude Code workflows?

You can enforce a state machine for Claude Code workflows by validating transitions against allowed states and updating session files at phase boundaries. This prevents invalid progressions and maintains consistent state updates across executing phases.

How does session state validation work during error escalation?

Session state validation during error escalation works by checking the target state against predefined allowed transitions before applying updates. It logs events to session history and ensures the workflow shifts safely to an escalated or failed state without corruption.

What is the best way to automate session resume initialization?

The best way to automate session resume initialization is to trigger a transition specifying the target state and event. This validates the resume path against the state machine and updates the session state files to recover the previous workflow.

Can I define custom phase boundaries for session state transitions?

You can apply transitions at defined phase boundaries like /work, error escalation, and session resume. The state machine enforces specific states such as initialized, planning, executing, and reviewing to ensure consistent progression.

Why does my workflow fail to transition from idle to executing?

Your workflow fails to transition from idle to executing because the state machine validates against allowed states, requiring intermediate phases like initialized and planning. Guardrails block invalid transitions to prevent workflow corruption and ensure safe progression.