run_lightflows
Executes, inspects, and resumes existing Lightflow DAG workflows via CLI (`lightflow`, or the equivalent `python3 -m lightflow`) or MCP (`lightflow-mcp`). Use when asked to run, dry-run, check status, visualize, resolve an `operator_action` human-in-the-loop checkpoint (`EXIT_CODE=2`), or recover a failed Lightflow run without authoring a new workflow. Run `start` directly without pre-reading the manifest or `actions.py`.
Warnings for the author
- "name" should use lowercase letters, digits and single hyphens only
Running & Resuming Lightflow Workflows (run_lightflows)
Authoring new workflows? Read
create_lightflowsinstead.
Fast-Path Rules
- Read only
SKILL.md, then runstartdirectly: Do not readlightflow.yaml,actions.py, orREADME.mdbeforestart. The CLI compiles the manifest and prints any gateInstructions,Payload Schema, and exactresumecommand.--lightflow=<dir>accepts a workflow directory (or manifest file path). - Skip redundant
statuscalls & chain cleanup: Whenstartorresumeexits0(Lightflow completed successfully!), do not runstatus. When asked to clean up on completion (or inspect an output file), chainstart ... && cleanup ...orresume ... && cleanup ...in a single shell command (&&naturally stops ifstartsuspends at anEXIT_CODE=2gate).
1. Commands
(python3 -m lightflow is equivalent to lightflow whenever the console script
is not on PATH.)
# Start a run (add --payload='{...}' for initial args, or --dry_run only if asked to preview)
lightflow start --lightflow=<dir> --log_id=<run_id>
# Approve a paused operator_action gate (sets approved=true automatically)
lightflow resume --lightflow=<dir> --log_id=<id> \
--stage=<gate_stage> --resolution=APPROVE --payload='{...}'
# Reject a paused gate (runs any rollback_action; blocks ALL_SUCCESS, allows ALL_DONE)
lightflow resume --lightflow=<dir> --log_id=<id> \
--stage=<gate_stage> --resolution=REJECT --comment="Rejected by operator"
# Recover from a failed stage (re-arms only failed stages; preserves completed work; optional --payload overrides)
lightflow resume --lightflow=<dir> --log_id=<id> [--payload='{...}']
# Re-run a completed or skipped stage and its downstream dependents without wiping upstream work
lightflow resume --lightflow=<dir> --log_id=<id> --rerun=<stage> [--cascade=true]
# Inspect state (one line per stage + any paused gate's Instructions, Payload
# Schema, and resume command; --verbose adds payload + stamp log), generate
# HTML visualizer, or delete state directory
lightflow status --lightflow=<dir> --log_id=<id>
lightflow visualize --lightflow=<dir> --log_id=<id> --out=/tmp/viz.html
lightflow cleanup --log_id=<id>
MCP (lightflow-mcp): If connected, prefer the structured tools
run_lightflow, resume_lightflow, get_lightflow_status,
dry_run_lightflow, and visualize_lightflow over the CLI; the same rules
below apply to their status / exit_code fields (pass fields=[...] for
targeted passport reads or verbose=true for the full passport and Mermaid
diagram).
2. Exit Codes & Governance
- Exit
0(COMPLETED): Done. Report the stage outputs printed tostdout. - Exit
2(SUSPENDEDatoperator_action): Follow the printedInstructions. If they ask for a person's decision, present theInstructionsandPayload Schemato that person and wait for their answer — never decide or self-approve for them. Then runresumewith a payload matching thePayload Schema. - Exit
1(FAILED): Fix the root cause and runresume(neverstart --force, which wipes completed upstream stages). - Gate payload validation:
resume --resolution=APPROVEvalidates--payloadagainst the gate'sjson_schema(required keys, types,enumvalues). On a validation error the gate staysPAUSED; fix the payload and re-runresume. If the gate'sPayload Schemais no longer in context (e.g. a new conversation), runstatus, which reprints it. statusexits like the run:0completed,1failed, rejected, or interrupted,2paused at a gate,3no saved state for the log ID,4still running in another process (wait; don'tresume). Add--verboseonly when you need the full payload, stamp log, or Mermaid diagram.
Files of this skill
This skill has no supporting files.