CLI Reference
FlowState provides three main commands: run, list, and resume.
fs run
Section titled “fs run”Execute a workflow, creating a new instance or resuming an existing one.
Synopsis
Section titled “Synopsis”fs run <workflow> [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
workflow | Name of the workflow to run |
Options
Section titled “Options”| Option | Short | Description |
|---|---|---|
--name <name> | -n | Create a new instance with this name |
--resume <name> | -r | Resume an existing instance |
--clean-on-end | Delete instance on successful completion |
Behavior
Section titled “Behavior”Interactive mode (no options):
- If instances exist, prompt to select one or create new
- If no instances, prompt for new instance name
- Run the workflow
With --name:
- Create new instance with specified name
- Fail if instance already exists
- Run from start
With --resume:
- Load existing instance
- Fail if instance doesn’t exist
- Continue from saved state
Non-interactive mode (stdin redirected):
Requires either --name or --resume. Fails otherwise.
Examples
Section titled “Examples”# Interactive - choose or create instancefs run my-workflow
# Create named instancefs run my-workflow --name feature-123
# Resume existing instancefs run my-workflow --resume feature-123
# CI mode - clean up on successfs run my-workflow --name build-$(date +%s) --clean-on-endExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Workflow completed successfully |
1 | Workflow error or validation failure |
130 | User cancelled |
| Other | Propagated from failed tool |
fs list
Section titled “fs list”List available workflows or paused instances.
Synopsis
Section titled “Synopsis”fs list [options]Options
Section titled “Options”| Option | Description |
|---|---|
--paused | List paused instances instead of workflows |
Listing Workflows
Section titled “Listing Workflows”fs listOutput:
Workflows: code-review (extends new-feature) hello-world new-featureShows:
- Workflow names (sorted alphabetically)
- Inheritance relationships
- Warning if parent workflow not found
Listing Paused Instances
Section titled “Listing Paused Instances”fs list --pausedOutput:
Paused Instances:┌───────────────┬─────────────┬───────────────┬───────────┬─────────────────────┐│ Instance │ Workflow │ State │ Paused At │ Reason │├───────────────┼─────────────┼───────────────┼───────────┼─────────────────────┤│ feature-123 │ code-review │ await-review │ 2h ago │ Waiting for review ││ deploy-prod │ deploy │ approval-gate │ 5m ago │ Needs manager sign… │└───────────────┴─────────────┴───────────────┴───────────┴─────────────────────┘fs resume
Section titled “fs resume”Resume paused workflow instances.
Synopsis
Section titled “Synopsis”fs resume [instance] [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
instance | Name of instance to resume (optional in interactive mode) |
Options
Section titled “Options”| Option | Description |
|---|---|
--all | Resume all paused instances |
--workflow <name> | Resume all paused instances for a workflow |
--force | Skip condition check and force resume |
Behavior
Section titled “Behavior”Interactive mode (no arguments):
- Show menu of paused instances
- User selects which to resume
- Check pause condition if present
- Continue workflow execution
With instance name:
- Load specified instance
- Verify it’s paused
- Check condition, resume if met
With --all:
Resume every paused instance. Each is processed independently.
With --workflow:
Resume all paused instances belonging to that workflow.
With --force:
Skip condition checking. The workflow advances to its next state regardless.
Condition Checking
Section titled “Condition Checking”When resuming an instance with a pause condition:
- Execute the condition command
- If exit code 0, condition is met - resume
- If non-zero, condition not met - stay paused
# Normal resume - checks conditionfs resume my-instance
# Force resume - skips conditionfs resume my-instance --forceExamples
Section titled “Examples”# Interactive selectionfs resume
# Resume specific instancefs resume feature-123
# Resume all pausedfs resume --all
# Resume workflow's paused instancesfs resume --workflow code-review
# Force resume (skip condition)fs resume feature-123 --forceExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | All instances resumed successfully |
1 | One or more instances failed to resume |
Instance Management
Section titled “Instance Management”Instances are stored in .flowstate/instances/<name>/.
Instance Directory Structure
Section titled “Instance Directory Structure”.flowstate/instances/feature-123/├── workflow/│ ├── index.yaml # Workflow definition│ └── helper-workflow.yaml # Referenced sub-flows└── context.json # Execution statecontext.json
Section titled “context.json”{ "workflowName": "code-review", "currentState": "await-approval", "status": "Paused", "createdAt": "2024-01-15T10:30:00Z", "lastRunAt": "2024-01-15T10:35:00Z", "pausedAt": "2024-01-15T10:35:00Z", "pauseReason": "Waiting for approval", "variables": { "branch": "feature-123", "reviewer": "alice" }}Status Values
Section titled “Status Values”| Status | Description |
|---|---|
Running | Currently executing |
Paused | Awaiting resume |
Halted | Stopped due to error |
Completed | Finished successfully |
Manual Instance Cleanup
Section titled “Manual Instance Cleanup”Delete an instance directory to remove it:
rm -rf .flowstate/instances/old-instanceOr let FlowState prompt on completion, or use --clean-on-end.
Environment
Section titled “Environment”FlowState respects these environment variables:
| Variable | Description |
|---|---|
HOME | User home directory for ~/.flowstate/ |
Tool-specific variables (e.g., GEMINI_API_KEY) are passed through to tool execution.