pgflow is an AI harness and orchestrator for running workflows built using deterministic scripts and AI prompts within a pgflow project folder taking actions within a target working directory.
- Loads a workflow from
flow.ymlin a pgflow project folder - Resolves workflow assets like prompt files and scripts from that project folder
- Executes actions against a target working directory chosen at run time
- Runs
scriptactions withbashorpwsh - Runs
githubCopilotactions through the internal Copilot adapter - Executes actions sequentially by default
- Uses
nextonly when a workflow needs to override the default next action - Writes per-run logs under the pgflow project folder
- .NET SDK 10.0 or newer
bashon macOS/Linux orpwshfor PowerShell-based workflows- GitHub Copilot access for workflows that use
githubCopilot - optionally
GITHUB_TOKENif token-based auth is preferred
From the repository root:
dotnet build Powergentic.Flow.slnx
dotnet test Powergentic.Flow.slnx
dotnet run --project src/Powergentic.Flow.Cli -- run samples/basic-scriptThe last command uses samples/basic-script as both the pgflow project folder and the target working directory because the current shell directory is used by default when --workdir is not supplied.
pgflow <command> [project-folder] [options]
pgflow run <project-folder> [target-working-directory] [options]
pgflow [project-folder] [target-working-directory] [workflow-file]
Defaults:
project-folderdefaults to the current directorytarget-working-directorydefaults to the current shell directory forrunworkflow-filedefaults toflow.yml
pgflow run [project-folder] [target-working-directory]- validate and execute a workflowpgflow validate [project-folder]- load and validate a workflowpgflow init [project-folder]- scaffold a workflow projectpgflow logs [project-folder]- show the latest run summary or a selected runpgflow help- show help informationpgflow version- show the current version
-h,--help- show help information--workflow <file>- override the default workflow file name--workdir <path>- override the target working directory forrun--input key=value- override a workflow input--var key=value- override a workflow variable--env key=value- inject or override an environment value--dry-run- validate without executing actions--template <name>- template forinit--run-id <id>- select a specific run forlogs--latest- show the latest run summary--force- allowinitin a non-empty folder--display-enhanced- show a live execution dashboard in interactive terminals while logs continue to stream--verbose- enable verbose console logging--json- emit JSON output
Validate a workflow:
pgflow validate samples/basic-scriptRun a workflow against the current shell directory:
pgflow run samples/basic-scriptRun a workflow against another repository:
pgflow run samples/script-and-copilot-loop ../my-projectRun the same workflow with an explicit option instead:
pgflow run samples/script-and-copilot-loop --workdir ../my-projectRun with input, variable, and environment overrides:
pgflow run samples/basic-script --input audience=Developers --var greeting=Hello --env NAME=ChrisRun with the enhanced live dashboard in an interactive terminal:
pgflow run samples/basic-script --display-enhancedWhen --display-enhanced is enabled, pgflow keeps a pinned dashboard at the bottom of the terminal while normal console output continues to scroll above it.
The dashboard includes:
- current action name and action type
- action start time
- total flow elapsed time
- current action elapsed time
- current visit count for the action
- transition progress
- action result totals
- last status message
The enhanced display is only used for interactive terminals. Redirected output and --json mode stay non-interactive.
A pgflow project folder contains the reusable automation harness:
flow.yml- prompt templates
- helper scripts
- logs
The target working directory is the actual project or content folder the workflow should operate on.
Resolution rules:
- workflow asset paths such as
promptFile,path, andfileresolve from the pgflow project folder scriptandgithubCopilotactions run in the target working directory by default- a relative
workingDirectoryoverride resolves from the target working directory - logs always go under
<project-folder>/logs/<run-id>/ githubCopilot.with.writeResponseToresolves from the target working directory
Top-level fields:
namedescriptionversioninputsvariablesenvexecutionactions
Common action fields:
idnameusesifwithoutputspublishnext
Execution rules:
- actions run in file order by default
- if an action's
ifcondition is false, that action is skipped and execution continues to the next action in file order - use
next.whento branch conditionally - use
next.gotoonly when the next action should not be the next action defined in the file
Example:
- id: hello
uses: script
with:
shell: bash
path: scripts/hello.sh
environment:
GREETING: HelloSupported with fields:
shell:bashorpwshrun: inline script contentfileorpath: script file path in the pgflow project folderworkingDirectory: optional override, resolved from the target working directory if relativeenvironment: extra environment variablesfailOnNonZeroExit: defaults totrue
Runtime environment variables exposed to scripts:
ORCHESTRATOR_OUTPUTORCHESTRATOR_PROJECT_FOLDERORCHESTRATOR_TARGET_WORKING_DIRECTORYORCHESTRATOR_RUN_ID
Scripts can emit outputs by appending key=value lines to $ORCHESTRATOR_OUTPUT.
Example:
- id: review
uses: githubCopilot
with:
promptFile: prompts/review.prompt.md
inputs:
statusFile: ${ actions.prepare.outputs.statusFile }
targetPath: ${ runtime.targetWorkingDirectory }
writeResponseTo: output/review.txtSupported with fields:
promptorpromptFileinputswriteResponseToworkingDirectorymodelsystemPromptstreaminggitHubTokenrequestHeaders
Prompt placeholders support both {{name}} and ${name} forms.
If an action does not define publish, pgflow will automatically publish actions.<id>.outputs.response to both:
consolerunSummary
If publish is defined, that explicit configuration overrides the default behavior.
Example:
- id: analyze
uses: githubCopilot
with:
promptFile: prompts/final-analysis.prompt.md
publish:
- title: Final analysis
from: ${ actions.analyze.outputs.response }
to:
- console
- runSummarySupported publish fields:
titlefromtoifmaxLength
Useful runtime values include:
${ inputs.name }${ variables.name }${ runtime.projectFolder }${ runtime.targetWorkingDirectory }${ runtime.runId }${ runtime.logFolder }${ runtime.currentActionId }
Workflow-level inputs are intended for caller-provided values, typically passed with --input key=value. Existing variables remain available for workflow-owned state and defaults.
Each run writes under <project-folder>/logs/<run-id>/.
Typical files include:
workflow-resolved.jsonrun.jsonconsole.logactions/*.json- script stdout/stderr files when applicable
console.log is a human-readable transcript of the run. It captures the operator-facing console activity, published console entries, and mirrored diagnostic logging for that run.
run.json now includes the consoleLogFile path, and pgflow logs prints that path as Console Log when it is available.
Inspect the latest run with:
pgflow logs <project-folder> --latestsamples/basic-script- minimal script-only workflowsamples/script-and-copilot-loop- script + Copilot example that relies on sequential flow by default
src/Powergentic.Flow.Cli- CLI entrypointsrc/Powergentic.Flow.Core- workflow models, validation, execution, loggingsrc/Powergentic.Flow.Actions.Script- local script runnersrc/Powergentic.Flow.Actions.GitHubCopilot- Copilot action runner and adaptertests/Powergentic.Flow.Core.Tests- unit tests

