workflow-state-machines
Skill27 starsChanged 3 months agoApache-2.0View on GitHub
Use when designing, implementing, or debugging complex agentic workflows using state machine patterns. Keywords: state machine, durable execution, agent orchestration, graph-based agents, workflow checkpoints, C4 protocol.
In this repository163 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-memorySkill
- claukitSkill
- mcp-agent-patternsSkill
- multi-agent-orchestrationSkill
- ai-multimodalSkill
- geo-fundamentalsSkill
- media-processingSkill
- screenshotSkill
- seo-fundamentalsSkill
- soraSkill
- aestheticSkill
- figma-implement-designSkill
- figmaSkill
- frontend-designSkill
- mobile-designSkill
- tailwind-patternsSkill
- ui-stylingSkill
- agentic-ragSkill
- api-patternsSkill
- app-builderSkill
- architectureSkill
- ask-mattSkill
- aspnet-coreSkill
- backend-developmentSkill
- better-authSkill
- clean-codeSkill
- code-agent-patternsSkill
- codebase-designSkill
- code-review-checklistSkill
- code-reviewSkill
- context-engineeringSkill
- context-optimizationSkill
- database-designSkill
- databasesSkill
- diagnoseSkill
- diagnosing-bugsSkill
- docs-seekerSkill
- domain-modelingSkill
- frontend-dev-guidelinesSkill
- graph-ragSkill
- i18n-localizationSkill
- implementSkill
- improve-codebase-architectureSkill
- lint-and-validateSkill
- llm-evalsSkill
- nextjs-best-practicesSkill
- nodejs-best-practicesSkill
- openai-docsSkill
- performance-profilingSkill
- playwright-interactiveSkill
- playwrightSkill
- prompt-engineeringSkill
- prototypeSkill
- python-patternsSkill
- react-patternsSkill
- render-deploySkill
- repomixSkill
- researchSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
When orchestrating multi-step, multi-agent processes that require durability and fault tolerance.
- Distinctive: line 15
When you need to integrate human-in-the-loop (HITL) checkpoints into long-running tasks.
- Distinctive: line 16
When debugging non-deterministic agent behavior through state history inspection.
- Distinctive: line 17
When enforcing KILO-KIT C4 Runtime Protocol stages as formal state transitions.
- Distinctive: line 34
All state changes are logged as events in a durable store.
- Distinctive: line 42
Implement HITL Points: Add explicit breakpoints where the workflow yields control to the user.
- Distinctive: line 45
LangGraph Integration: Use Graph-based definitions for complex stateful loops and branching.
- Distinctive: line 53
Loop Prevention: Every cycle must have an exit condition or max-depth limit defined.
- Distinctive: line 54
Terminal States: Every graph MUST have defined success and failure termination nodes.
- Distinctive: line 55
Shared State Safety: Never share mutable state between parallel branches.
- Distinctive: line 56
Idempotency: All node-level functions must be idempotent to support safe retries.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Workflow State Machines
Overview
This skill provides a structured framework for building resilient, predictable agentic workflows using directed graph-based state machines. It emphasizes durable execution, explicit state transitions, and auditability to ensure complex agent interactions remain stable and debuggable.
When To Use
- When orchestrating multi-step, multi-agent processes that require durability and fault tolerance.
- When you need to integrate human-in-the-loop (HITL) checkpoints into long-running tasks.
- When debugging non-deterministic agent behavior through state history inspection.
- When enforcing KILO-KIT C4 Runtime Protocol stages as formal state transitions.
Core Concepts
Directed Graph Topologies
- Nodes: Represent distinct agent actions, tool executions, or decision points.
- Edges: Define the transition logic based on input, output, or conditions.
- Immutable State: Workflow state is treated as immutable, with transitions resulting in new state snapshots to ensure clean history.
Durable Execution & Checkpointing
- Workflows automatically persist the state after every transition.
- Resumption: Failed workflows can resume precisely from the last successful node (checkpoint) without re-executing completed prior computations.
Human-in-the-Loop (HITL) Interrupts
- Pause States: Workflows can enter a suspended state to await external input, human approval, or parameter adjustments.
- Manual Overrides: Operators can inject or edit state data while the workflow is paused before triggering the next transition.
Time-Travel Debugging
- All state changes are logged as events in a durable store.
- Replay: Developers can isolate a failing branch, modify inputs, and re-execute that specific subgraph to verify fixes without running the entire workflow from scratch.
Workflow
- Define State Schema: Identify all necessary data attributes required for the entire lifecycle.
- Decompose into Nodes: Break down the process into atomic, idempotent functions.
- Map Edges: Implement conditional routing logic (e.g., success paths, failure paths, human-approval branches).
- Configure Persistence: Set up a store for state snapshots and execution history.
- Implement HITL Points: Add explicit breakpoints where the workflow yields control to the user.
Key Patterns
- LangGraph Integration: Use Graph-based definitions for complex stateful loops and branching.
- Temporal/Workflow Separation: Decouple task execution (activities) from orchestration logic (workflow).
- C4 Protocol Mapping:
Brainstorming Gate→ Entry Node (Validation of Intent)Workflow Execution→ Graph TraversalVerification Gate→ Terminal Validation Node (Ensures success criteria)
Quality Gates
- Loop Prevention: Every cycle must have an exit condition or max-depth limit defined.
- Terminal States: Every graph MUST have defined success and failure termination nodes.
- Shared State Safety: Never share mutable state between parallel branches; always rely on state reducers or explicit state merging.
- Idempotency: All node-level functions must be idempotent to support safe retries.
Anti-patterns
- Unchecked Loops: Infinite recursion in agent planning steps.
- Implicit State: Relying on global variables instead of the explicit State Schema.
- Missing Terminal States: Workflows that hang without finishing or erroring out.
- Heavy Side-Effects in Nodes: Side effects that are difficult to rollback or reconcile during state replay.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

